make_netboot: Copy unibuild netboot firmwares
Unified build netboot firmware might have suffix in the names, e.g.
image*.net.bin. We should also copy those files.
BUG=b:137073209
TEST=run make_netboot.sh and check that netboot firmwares are copied
Change-Id: Ifc737a9d115f096843b759de086e2820e0aacf18
Reviewed-on: https://chromium-review.googlesource.com/1695387
Tested-by: Cheng-Han Yang <chenghan@chromium.org>
Commit-Ready: Cheng-Han Yang <chenghan@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
diff --git a/make_netboot.sh b/make_netboot.sh
index c7734fe..1145d3b 100755
--- a/make_netboot.sh
+++ b/make_netboot.sh
@@ -43,12 +43,18 @@
mkdir -p netboot
# Get netboot firmware.
-FIRMWARE_PATH="/firmware/image.net.bin"
-if [ -f "${SYSROOT}${FIRMWARE_PATH}" ]; then
- echo "Copying netboot firmware ${FIRMWARE_PATH}..."
- cp -v "${SYSROOT}${FIRMWARE_PATH}" netboot/
+FIRMWARE_PATTERN="firmware/image*.net.bin"
+FIRMWARE_PATHS=("${SYSROOT}"/${FIRMWARE_PATTERN})
+# When there is no netboot firmware found, filename expansion fails and the
+# array still contains the original pattern string, so we need to check if the
+# first file in the array actually exists to know if we find any firmware.
+if [ -e "${FIRMWARE_PATHS[0]}" ]; then
+ for firmware_path in "${FIRMWARE_PATHS[@]}"; do
+ echo "Copying netboot firmware ${firmware_path}..."
+ cp -v "${firmware_path}" netboot/
+ done
else
- echo "Skipping netboot firmware: ${SYSROOT}${FIRMWARE_PATH} not present?"
+ echo "Skipping netboot firmware: ${SYSROOT}/${FIRMWARE_PATTERN} not present?"
fi
# Create temporary emerge root