From bfe47817e496efa07895a522cce84330cf0dc3a6 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sun, 5 Jan 2014 14:38:33 -0800 Subject: [PATCH] fix(build_image): Add support for COREOS_DISK_LAYOUT_SUFFIX Append COREOS_DISK_LAYOUT_SUFFIX from the portage profile to disk layout names. Allows switching from "base" to "base-usr" and similar. --- build_image | 10 +++++++--- build_library/base_image_util.sh | 3 +-- build_library/dev_image_util.sh | 2 +- build_library/prod_image_util.sh | 6 +++--- build_library/vm_image_util.sh | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/build_image b/build_image index e033414df0..521fdd6c0b 100755 --- a/build_image +++ b/build_image @@ -119,8 +119,11 @@ fi # Create the output directory and temporary mount points. mkdir -p "${BUILD_DIR}" +DISK_LAYOUT_SUFFIX=$(portageq-$BOARD envvar COREOS_DISK_LAYOUT_SUFFIX) +DISK_LAYOUT="${FLAGS_disk_layout:-base}${DISK_LAYOUT_SUFFIX}" + # Create the base image. -create_base_image ${PRISTINE_IMAGE_NAME} +create_base_image ${PRISTINE_IMAGE_NAME} ${DISK_LAYOUT} if should_build_image ${PRISTINE_IMAGE_NAME}; then upload_image "${BUILD_DIR}/${PRISTINE_IMAGE_NAME}" fi @@ -138,14 +141,15 @@ if should_build_image ${CHROMEOS_DEVELOPER_IMAGE_NAME}; then else copy_image ${PRISTINE_IMAGE_NAME} ${CHROMEOS_DEVELOPER_IMAGE_NAME} fi - install_dev_packages ${CHROMEOS_DEVELOPER_IMAGE_NAME} + install_dev_packages ${CHROMEOS_DEVELOPER_IMAGE_NAME} ${DISK_LAYOUT} upload_image "${BUILD_DIR}/${CHROMEOS_DEVELOPER_IMAGE_NAME}" fi if should_build_image ${COREOS_PRODUCTION_IMAGE_NAME}; then copy_image ${CHROMEOS_BASE_IMAGE_NAME} ${COREOS_PRODUCTION_IMAGE_NAME} - setup_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} "dev-channel" \ + setup_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} \ + "dev-channel" \ ${SRC_ROOT}/third_party/coreos-overlay/coreos-base/coreos-au-key/files/update-payload-key.pub.pem upload_image "${BUILD_DIR}/${COREOS_PRODUCTION_IMAGE_NAME}" diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh index 27e7f47986..726ec5c7cf 100755 --- a/build_library/base_image_util.sh +++ b/build_library/base_image_util.sh @@ -6,9 +6,8 @@ create_base_image() { local image_name=$1 - local rootfs_verification_enabled=$2 + local disk_layout=$2 - local disk_layout="${FLAGS_disk_layout:-base}" local disk_img="${BUILD_DIR}/${image_name}" local mbr_img="/usr/share/syslinux/gptmbr.bin" local root_fs_dir="${BUILD_DIR}/rootfs" diff --git a/build_library/dev_image_util.sh b/build_library/dev_image_util.sh index ea624f2f59..50d6ed491f 100755 --- a/build_library/dev_image_util.sh +++ b/build_library/dev_image_util.sh @@ -11,9 +11,9 @@ # Takes as an arg the name of the image to be created. install_dev_packages() { local image_name=$1 + local disk_layout=$2 info "Adding developer packages to ${image_name}" - local disk_layout="${FLAGS_disk_layout:-base}" local root_fs_dir="${BUILD_DIR}/rootfs" "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \ diff --git a/build_library/prod_image_util.sh b/build_library/prod_image_util.sh index 8129c4309b..7bf2929107 100755 --- a/build_library/prod_image_util.sh +++ b/build_library/prod_image_util.sh @@ -5,11 +5,11 @@ setup_prod_image() { local image_name="$1" - local update_track="$2" - local au_key="$3" + local disk_layout="$2" + local update_track="$3" + local au_key="$4" info "Configuring production image ${image_name}" - local disk_layout="${FLAGS_disk_layout:-base}" local root_fs_dir="${BUILD_DIR}/rootfs" local enable_rootfs_verification_flag=--noenable_rootfs_verification if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index b4b5eb1299..2a67635f1e 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -198,7 +198,8 @@ _disk_ext() { } setup_disk_image() { - local disk_layout="${1:-$(_get_vm_opt DISK_LAYOUT)}" + local suffix=$(portageq-$BOARD envvar COREOS_DISK_LAYOUT_SUFFIX) + local disk_layout="${1:-$(_get_vm_opt DISK_LAYOUT)}${suffix}" rm -rf "${VM_TMP_DIR}" mkdir -p "${VM_TMP_DIR}" "${VM_TMP_ROOT}"