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/
This commit is contained in:
Michael Marineau 2014-05-16 20:55:38 -07:00
parent 54f774d931
commit b24df04465
3 changed files with 42 additions and 2 deletions

View File

@ -32,7 +32,7 @@ DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \
"Default all bootloaders to use kernel-based root fs integrity checking." "Default all bootloaders to use kernel-based root fs integrity checking."
DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \
"Directory in which to place image result directories (named by version)" "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." "The disk layout type to use for this image."
DEFINE_string group "${DEFAULT_GROUP}" \ DEFINE_string group "${DEFAULT_GROUP}" \
"The update 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 This script is used to build a CoreOS image. CoreOS comes in many
different forms. This scripts can be used to build the following: 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. prod - Production image for CoreOS. This image is for booting.
dev - Developer image. Like base but with additional developer packages. dev - Developer image. Like base but with additional developer packages.
container - Developer image with single filesystem, bootable by nspawn.
Examples: Examples:
@ -93,10 +93,12 @@ check_gsutil_opts
PROD_IMAGE=0 PROD_IMAGE=0
DEV_IMAGE=0 DEV_IMAGE=0
CONTAINER=0
for arg in "$@"; do for arg in "$@"; do
case "${arg}" in case "${arg}" in
prod) PROD_IMAGE=1 ;; prod) PROD_IMAGE=1 ;;
dev) DEV_IMAGE=1 ;; dev) DEV_IMAGE=1 ;;
container) CONTAINER=1 ;;
*) die_notrace "Unknown image type ${arg}" ;; *) die_notrace "Unknown image type ${arg}" ;;
esac esac
done done
@ -130,12 +132,18 @@ fi
mkdir -p "${BUILD_DIR}" mkdir -p "${BUILD_DIR}"
DISK_LAYOUT="${FLAGS_disk_layout:-base}" DISK_LAYOUT="${FLAGS_disk_layout:-base}"
CONTAINER_LAYOUT="${FLAGS_disk_layout:-container}"
if [[ "${DEV_IMAGE}" -eq 1 ]]; then if [[ "${DEV_IMAGE}" -eq 1 ]]; then
create_dev_image ${COREOS_DEVELOPER_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group} create_dev_image ${COREOS_DEVELOPER_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group}
upload_image "${BUILD_DIR}/${COREOS_DEVELOPER_IMAGE_NAME}" upload_image "${BUILD_DIR}/${COREOS_DEVELOPER_IMAGE_NAME}"
fi 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 if [[ "${PROD_IMAGE}" -eq 1 ]]; then
create_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group} create_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group}
upload_image "${BUILD_DIR}/${COREOS_PRODUCTION_IMAGE_NAME}" upload_image "${BUILD_DIR}/${COREOS_PRODUCTION_IMAGE_NAME}"

View File

@ -79,6 +79,37 @@
"label":"ROOT", "label":"ROOT",
"blocks":"33587200" "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"
}
} }
} }
} }

View File

@ -405,6 +405,7 @@ BUILD_DIR=
# Standard filenames # Standard filenames
COREOS_DEVELOPER_IMAGE_NAME="coreos_developer_image.bin" COREOS_DEVELOPER_IMAGE_NAME="coreos_developer_image.bin"
COREOS_DEVELOPER_CONTAINER_NAME="coreos_developer_container.bin"
COREOS_PRODUCTION_IMAGE_NAME="coreos_production_image.bin" COREOS_PRODUCTION_IMAGE_NAME="coreos_production_image.bin"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------