From 90e3b259143ce463a2a5ac61d72d31ee657a849d Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Wed, 9 Jan 2013 18:34:35 +0800 Subject: [PATCH] Move ARM factory install shim to initramfs As USB/SD install shim might be used for ARM devices now, it is reasonable to move ARM factory install shim to initramfs like on x86. This converges the code path and build process for ARM and x86. BUG=chrome-os-partner:15884 TEST=Install with install shim and netboot on Spring. Change-Id: Ic8d7328502181ca909be3d7542be34f2a904523f Signed-off-by: Vic Yang Reviewed-on: https://gerrit.chromium.org/gerrit/40931 Reviewed-by: Hung-Te Lin --- build_image | 14 ++++--------- make_netboot.sh | 54 +++++++++++++++++++++++-------------------------- 2 files changed, 29 insertions(+), 39 deletions(-) diff --git a/build_image b/build_image index f155bf9413..d55ef34bae 100755 --- a/build_image +++ b/build_image @@ -125,17 +125,11 @@ if should_build_image ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}; then BASE_PACKAGE="chromeos-base/chromeos-installshim" - # On x86/amd64, we boot the factory install shim from an SD card using - # initramfs for our root. On ARM, we boot the factory install shim over the - # network, so we don't require initramfs, but we do require fbconsole to fix - # a display driver bug. - if [ "${ARCH}" = "x86" -o "${ARCH}" = "amd64" ] ; then - export USE="${USE} initramfs vfat" - fi - # CONFIG_BLK_DEV_RAM is disabled by default. - # But tftp install needs it to mount rootfs in ram + export USE="${USE} initramfs vfat" + + # On ARM, fbconsole is required to fix a display driver bug. if [ "${ARCH}" = "arm" ] ; then - export USE="${USE} fbconsole blkdevram" + export USE="${USE} fbconsole" fi fi diff --git a/make_netboot.sh b/make_netboot.sh index d7a0fd15b0..08416943d1 100755 --- a/make_netboot.sh +++ b/make_netboot.sh @@ -94,44 +94,40 @@ else fi # Get netboot kernel. +echo "Building kernel" + +# Create temporary emerge root +temp_build_path="$(mktemp -d bk_XXXXXXXX)" +if ! [ -d "${temp_build_path}" ]; then + echo "Failed to create temporary directory." + exit 1 +fi + +# Emerge network boot kernel +# We don't want to build whole install shim everytime we run this script, +# and thus we only build kernel here. If this script is run against install +# shim with different kernel version, this might not work. But as we don't +# upgrade kernel so often, this is probably fine. +export USE='vfat blkdevram fbconsole' +export EMERGE_BOARD_CMD="emerge-${FLAGS_board}" +emerge_custom_kernel ${temp_build_path} + +# Generate kernel uImage +echo "Generating netboot kernel vmlinux.uimg" + if [ "${ARCH}" = "arm" ]; then - # Currently we don't use initramfs for ARM. Someday we would probably want - # initramfs for USB factory installation. - # TODO: Converge build processes of ARM and x86. - echo "Generating netboot kernel vmlinux.uimg" - cp "r/boot/vmlinux.uimg" "netboot" + cp "${temp_build_path}"/boot/vmlinux.uimg netboot/ else - echo "Building kernel" - - # Create temporary emerge root - temp_build_path="$(mktemp -d bk_XXXXXXXX)" - if ! [ -d "${temp_build_path}" ]; then - echo "Failed to create temporary directory." - exit 1 - fi - - # Emerge network boot kernel - # We don't want to build whole install shim everytime we run this script, - # and thus we only build kernel here. If this script is run against install - # shim with different kernel version, this might not work. But as we don't - # upgrade kernel so often, this is probably fine. - export USE='vfat blkdevram fbconsole' - export EMERGE_BOARD_CMD="emerge-${FLAGS_board}" - emerge_custom_kernel ${temp_build_path} - - # Generate kernel uImage - echo "Generating netboot kernel vmlinux.uimg" - # U-boot put kernel image at 0x100000. We load it at 0x3000000 because # 0x3000000 is safe enough not to overlap with image at 0x100000. mkimage -A "${MKIMAGE_ARCH}" -O linux -T kernel -n "Linux kernel" -C none \ -d "${temp_build_path}"/boot/vmlinuz \ -a 0x03000000 -e 0x03000000 netboot/vmlinux.uimg - - # Clean up temporary emerge root - sudo rm -rf "${temp_build_path}" fi +# Clean up temporary emerge root +sudo rm -rf "${temp_build_path}" + echo "Add lsb-factory" # Copy factory config file. # TODO(nsanders): switch this to u-boot env var config.