mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 23:21:17 +02:00
Fix build_image --factory_install to work again.
There were two bugs: 1) The test [ ${ARCH} -eq "arm" ] was wrong because -eq is a numeric comparison operator, not legal on strings. 2) Variable ${ARCH} was used before set. The code change includes comment changes to clarify the reasons for the code, and a future-proofing logic change. Change-Id: I63f502cc33cf8a9a441b4b305fc49ed57d0a55b1 BUG=None TEST=build_image --factory_install, and boot the resulting image Review URL: http://codereview.chromium.org/6905119
This commit is contained in:
parent
237b686be8
commit
b290366b6e
58
build_image
58
build_image
@ -187,19 +187,43 @@ OVERLAY_CHROMEOS_DIR="${SRC_ROOT}/third_party/chromiumos-overlay/chromeos/"
|
||||
# Determine build version.
|
||||
. "${OVERLAY_CHROMEOS_DIR}/config/chromeos_version.sh"
|
||||
|
||||
BOARD="${FLAGS_board}"
|
||||
BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
|
||||
|
||||
# What cross-build are we targeting?
|
||||
. "${BOARD_ROOT}/etc/make.conf.board_setup"
|
||||
LIBC_VERSION=${LIBC_VERSION}
|
||||
|
||||
# Figure out ARCH from the given toolchain.
|
||||
# TODO: Move to common.sh as a function after scripts are switched over.
|
||||
TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }')
|
||||
case "${TC_ARCH}" in
|
||||
arm*)
|
||||
ARCH="arm"
|
||||
;;
|
||||
*86)
|
||||
ARCH="x86"
|
||||
;;
|
||||
*)
|
||||
error "Unable to determine ARCH from toolchain: ${CHOST}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# Configure extra USE or packages for this type of build.
|
||||
EXTRA_PACKAGES=""
|
||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
|
||||
# Factory install needs to have the factory installer added.
|
||||
EXTRA_PACKAGES="${EXTRA_PACKAGES} chromeos-base/chromeos-factoryinstall"
|
||||
# On x86, booting factory install shim on SD card needs to have the kernel
|
||||
# initrmafs enabled. On ARM, booting factory install image on network does
|
||||
# not needs initramfs. Force to enable fbconsole to fix a display driver bug.
|
||||
if [ ${ARCH} -eq "arm" ] ; then
|
||||
export USE="${USE} fbconsole"
|
||||
else
|
||||
# On x86, 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" ] ; then
|
||||
export USE="${USE} initramfs"
|
||||
fi
|
||||
if [ "${ARCH}" = "arm" ] ; then
|
||||
export USE="${USE} fbconsole"
|
||||
fi
|
||||
fi
|
||||
|
||||
emerge_to_image() {
|
||||
@ -236,9 +260,6 @@ fi
|
||||
PRISTINE_IMG="${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}"
|
||||
DEVELOPER_IMG="${OUTPUT_DIR}/${DEVELOPER_IMAGE_NAME}"
|
||||
|
||||
BOARD="${FLAGS_board}"
|
||||
BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
|
||||
|
||||
ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
|
||||
ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
|
||||
ROOT_FS_HASH="${OUTPUT_DIR}/rootfs.hash"
|
||||
@ -260,29 +281,10 @@ ESP_LOOP_DEV=
|
||||
# translate to /usr/local.
|
||||
DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image"
|
||||
|
||||
# What cross-build are we targeting?
|
||||
. "${BOARD_ROOT}/etc/make.conf.board_setup"
|
||||
LIBC_VERSION=${LIBC_VERSION}
|
||||
|
||||
if [ ${FLAGS_jobs} -ne -1 ]; then
|
||||
EMERGE_JOBS="--jobs=${FLAGS_jobs}"
|
||||
fi
|
||||
|
||||
# Figure out ARCH from the given toolchain.
|
||||
# TODO: Move to common.sh as a function after scripts are switched over.
|
||||
TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }')
|
||||
case "${TC_ARCH}" in
|
||||
arm*)
|
||||
ARCH="arm"
|
||||
;;
|
||||
*86)
|
||||
ARCH="x86"
|
||||
;;
|
||||
*)
|
||||
error "Unable to determine ARCH from toolchain: ${CHOST}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
if [[ ${FLAGS_crosbug12352_arm_kernel_signing} -eq ${FLAGS_TRUE} ]]; then
|
||||
crosbug12352_flag="--crosbug12352_arm_kernel_signing"
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user