From b24df04465918c76b876823afe1546bd219b76e1 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Fri, 16 May 2014 20:55:38 -0700 Subject: [PATCH] feat(build_image): Add 'container' image type. This image type is the same as the developer image except that it is a single root filesystem and is bootable via systemd-nspawn. This may become obsolete eventually when it becomes possible to boot the normal disk images under nspawn but it is useful for testing until then. The partition type is defined by the Discoverable Partitions Spec. http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ --- build_image | 12 ++++++++++-- build_library/disk_layout.json | 31 +++++++++++++++++++++++++++++++ common.sh | 1 + 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/build_image b/build_image index 39ed8446b5..1dc23e870d 100755 --- a/build_image +++ b/build_image @@ -32,7 +32,7 @@ DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \ "Default all bootloaders to use kernel-based root fs integrity checking." DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ "Directory in which to place image result directories (named by version)" -DEFINE_string disk_layout "base" \ +DEFINE_string disk_layout "" \ "The disk layout type to use for this image." DEFINE_string group "${DEFAULT_GROUP}" \ "The update group." @@ -46,9 +46,9 @@ FLAGS_HELP="USAGE: build_image [flags] [list of images to build]. This script is used to build a CoreOS image. CoreOS comes in many different forms. This scripts can be used to build the following: -base - Pristine CoreOS image for generating update payloads or a dev/prod image. prod - Production image for CoreOS. This image is for booting. dev - Developer image. Like base but with additional developer packages. +container - Developer image with single filesystem, bootable by nspawn. Examples: @@ -93,10 +93,12 @@ check_gsutil_opts PROD_IMAGE=0 DEV_IMAGE=0 +CONTAINER=0 for arg in "$@"; do case "${arg}" in prod) PROD_IMAGE=1 ;; dev) DEV_IMAGE=1 ;; + container) CONTAINER=1 ;; *) die_notrace "Unknown image type ${arg}" ;; esac done @@ -130,12 +132,18 @@ fi mkdir -p "${BUILD_DIR}" DISK_LAYOUT="${FLAGS_disk_layout:-base}" +CONTAINER_LAYOUT="${FLAGS_disk_layout:-container}" if [[ "${DEV_IMAGE}" -eq 1 ]]; then create_dev_image ${COREOS_DEVELOPER_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group} upload_image "${BUILD_DIR}/${COREOS_DEVELOPER_IMAGE_NAME}" fi +if [[ "${CONTAINER}" -eq 1 ]]; then + create_dev_image "${COREOS_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" + upload_image "${BUILD_DIR}/${OREOS_DEVELOPER_CONTAINER_NAME}" +fi + if [[ "${PROD_IMAGE}" -eq 1 ]]; then create_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group} upload_image "${BUILD_DIR}/${COREOS_PRODUCTION_IMAGE_NAME}" diff --git a/build_library/disk_layout.json b/build_library/disk_layout.json index a1004966ac..d10d60a638 100644 --- a/build_library/disk_layout.json +++ b/build_library/disk_layout.json @@ -79,6 +79,37 @@ "label":"ROOT", "blocks":"33587200" } + }, + "container":{ + "1":{ + "type":"blank" + }, + "2":{ + "type":"blank" + }, + "3":{ + "type":"blank" + }, + "4":{ + "type":"blank" + }, + "5":{ + "type":"blank" + }, + "6":{ + "type":"blank" + }, + "7":{ + "type":"blank" + }, + "8":{ + "type":"blank" + }, + "9":{ + "label":"ROOT", + "type":"4f68bce3-e8cd-4db1-96e7-fbcaf984b709", + "blocks":"6291456" + } } } } diff --git a/common.sh b/common.sh index f036e18f9b..3a175d22aa 100644 --- a/common.sh +++ b/common.sh @@ -405,6 +405,7 @@ BUILD_DIR= # Standard filenames COREOS_DEVELOPER_IMAGE_NAME="coreos_developer_image.bin" +COREOS_DEVELOPER_CONTAINER_NAME="coreos_developer_container.bin" COREOS_PRODUCTION_IMAGE_NAME="coreos_production_image.bin" # -----------------------------------------------------------------------------