mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 19:56:32 +02:00
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 <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/40931 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
parent
5d75098098
commit
90e3b25914
14
build_image
14
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
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user