mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 05:51:43 +01:00
feat(build*): add CoreOS production image building
This will create a CoreOS production image and support it with the tools like image_to_vm.sh and build_image.
This commit is contained in:
parent
195d052495
commit
a45c529549
43
build_image
43
build_image
@ -35,10 +35,11 @@ DEFINE_string enable_serial "" \
|
||||
"Enable serial port for printks. Example values: ttyS0"
|
||||
|
||||
FLAGS_HELP="USAGE: build_image [flags] [list of images to build].
|
||||
This script is used to build a Chromium OS image. Chromium OS 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:
|
||||
|
||||
base - Pristine Chromium OS image. As similar to Chrome OS as possible.
|
||||
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.
|
||||
test - Like dev, but with additional test specific packages and can be easily
|
||||
used for automated testing using scripts like run_remote_tests, etc.
|
||||
@ -158,6 +159,12 @@ if should_build_image ${CHROMEOS_DEVELOPER_IMAGE_NAME} \
|
||||
install_dev_packages ${CHROMEOS_DEVELOPER_IMAGE_NAME}
|
||||
fi
|
||||
|
||||
if should_build_image ${COREOS_PRODUCTION_IMAGE_NAME}; then
|
||||
copy_image ${CHROMEOS_BASE_IMAGE_NAME} ${COREOS_PRODUCTION_IMAGE_NAME}
|
||||
${SCRIPTS_DIR}/bin/cros_make_image_bootable "${BUILD_DIR}" \
|
||||
${COREOS_PRODUCTION_IMAGE_NAME}
|
||||
fi
|
||||
|
||||
# From a developer image create a test|factory_test image.
|
||||
if should_build_image ${CHROMEOS_TEST_IMAGE_NAME}; then
|
||||
copy_image ${CHROMEOS_DEVELOPER_IMAGE_NAME} ${CHROMEOS_TEST_IMAGE_NAME}
|
||||
@ -173,28 +180,34 @@ ln -sfT $(basename ${BUILD_DIR}) ${LINK_NAME}
|
||||
|
||||
echo "Done. Image(s) created in ${BUILD_DIR}"
|
||||
|
||||
print_image_to_vm() {
|
||||
flags=
|
||||
if [ $# = 1 ]; then
|
||||
flags="--${1}_image"
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
To convert it to a VMWare image, use:
|
||||
./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD} ${flags}
|
||||
EOF
|
||||
}
|
||||
|
||||
# Print out the images we generated.
|
||||
if should_build_image ${CHROMEOS_BASE_IMAGE_NAME}; then
|
||||
echo "Non-developer Chromium OS image created as ${PRISTINE_IMAGE_NAME}"
|
||||
if should_build_image ${COREOS_PRODUCTION_IMAGE_NAME}; then
|
||||
echo "CoreOS Production image created as ${COREOS_PRODUCTION_IMAGE_NAME}"
|
||||
print_image_to_vm "prod"
|
||||
fi
|
||||
if should_build_image ${CHROMEOS_FACTORY_SHIM_NAME}; then
|
||||
echo "Chromium OS Factory install shim created as ${PRISTINE_IMAGE_NAME}"
|
||||
if should_build_image ${CHROMEOS_BASE_IMAGE_NAME}; then
|
||||
echo "Non-developer CoreOS image created as ${PRISTINE_IMAGE_NAME}"
|
||||
fi
|
||||
if should_build_image ${CHROMEOS_DEVELOPER_IMAGE_NAME}; then
|
||||
echo "Developer image created as ${CHROMEOS_DEVELOPER_IMAGE_NAME}"
|
||||
fi
|
||||
if should_build_image ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}; then
|
||||
echo "Factory test image created as ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"
|
||||
fi
|
||||
if should_build_image ${CHROMEOS_TEST_IMAGE_NAME}; then
|
||||
echo "Test image created as ${CHROMEOS_TEST_IMAGE_NAME}"
|
||||
print_image_to_vm "test"
|
||||
fi
|
||||
|
||||
command_completed
|
||||
|
||||
cat << EOF
|
||||
To copy the image to a USB key, use:
|
||||
./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR}
|
||||
To convert it to a VMWare image, use:
|
||||
./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}
|
||||
EOF
|
||||
|
||||
|
||||
@ -36,6 +36,9 @@ get_images_to_build() {
|
||||
for image_to_build in $*; do
|
||||
# Shflags leaves "'"s around ARGV.
|
||||
case ${image_to_build} in
|
||||
\'prod\' )
|
||||
IMAGES_TO_BUILD="${IMAGES_TO_BUILD} ${COREOS_PRODUCTION_IMAGE_NAME}"
|
||||
;;
|
||||
\'base\' )
|
||||
IMAGES_TO_BUILD="${IMAGES_TO_BUILD} ${CHROMEOS_BASE_IMAGE_NAME}"
|
||||
;;
|
||||
|
||||
@ -404,6 +404,7 @@ CHROMEOS_TEST_IMAGE_NAME="chromiumos_test_image.bin"
|
||||
COREOS_BASE_IMAGE_NAME=${CHROMEOS_BASE_IMAGE_NAME}
|
||||
COREOS_IMAGE_NAME=${CHROMEOS_IMAGE_NAME}
|
||||
COREOS_DEVELOPER_IMAGE_NAME=${CHROMEOS_DEVELOPER_IMAGE_NAME}
|
||||
COREOS_PRODUCTION_IMAGE_NAME="coreos_production_image.bin"
|
||||
COREOS_RECOVERY_IMAGE_NAME=${CHROMEOS_RECOVERY_IMAGE_NAME}
|
||||
COREOS_TEST_IMAGE_NAME=${CHROMEOS_TEST_IMAGE_NAME}
|
||||
|
||||
|
||||
@ -25,10 +25,8 @@ DEFINE_string adjust_part "" \
|
||||
"Adjustments to apply to the partition table"
|
||||
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||
"Board for which the image was built"
|
||||
DEFINE_boolean factory $FLAGS_FALSE \
|
||||
"Modify the image for manufacturing testing"
|
||||
DEFINE_boolean factory_install $FLAGS_FALSE \
|
||||
"Modify the image for factory install shim"
|
||||
DEFINE_boolean prod $FLAGS_FALSE \
|
||||
"Build prod image"
|
||||
|
||||
# We default to TRUE so the buildbot gets its image. Note this is different
|
||||
# behavior from image_to_usb.sh
|
||||
@ -47,6 +45,8 @@ DEFINE_string state_image "" \
|
||||
"Stateful partition image (defaults to creating new statful partition)"
|
||||
DEFINE_boolean test_image "${FLAGS_FALSE}" \
|
||||
"Copies normal image to ${CHROMEOS_TEST_IMAGE_NAME}, modifies it for test."
|
||||
DEFINE_boolean prod_image "${FLAGS_FALSE}" \
|
||||
"Copies normal image to ${COREOS_OFFICIAL_IMAGE_NAME}, modifies it for test."
|
||||
DEFINE_string to "" \
|
||||
"Destination folder for VM output file(s)"
|
||||
DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \
|
||||
@ -91,8 +91,8 @@ if [ -z "${FLAGS_to}" ] ; then
|
||||
FLAGS_to="${FLAGS_from}"
|
||||
fi
|
||||
|
||||
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
|
||||
SRC_IMAGE="${FLAGS_from}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"
|
||||
if [ ${FLAGS_prod_image} -eq ${FLAGS_TRUE} ]; then
|
||||
SRC_IMAGE="${FLAGS_from}/${COREOS_PRODUCTION_IMAGE_NAME}"
|
||||
elif [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ]; then
|
||||
SRC_IMAGE="${FLAGS_from}/${CHROMEOS_TEST_IMAGE_NAME}"
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user