mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 07:01:13 +02:00
build_image: make sure the factory_image size is propagated
Verified rootfs-based factory installers fail because the ROOT_SIZE_BYTES is updated, but the information is not propagated to the boot.desc which cros_make_image_bootable uses. The result is that mod_image_for_test incorrectly appends the rootfs hash even though it is correctly computed. Random note: build_kernel_image uses dumpe2fs to compute the size, but cros_make_image_bootable uses the supplied size. These shouldn't diverge though the partition size should accomodate the addition of the hashes. TODO(wad) Add checking of sizes in cros_make_image_bootable TEST=x86-generic build image with --enable_rootfs_verification and --factory_install; then put in a machine and it no longer spewed dm-verity hash errors and the root hash checked successfully! BUG=chromium-os:5100 Review URL: http://codereview.chromium.org/3155025 Change-Id: I174e3661b80d83b25f3af95ff1eb77f634a7e797
This commit is contained in:
parent
843b70acf4
commit
d253badb6c
28
build_image
28
build_image
@ -50,14 +50,14 @@ DEFINE_boolean dev_install ${FLAGS_FALSE} \
|
|||||||
DEFINE_string arm_extra_bootargs "" \
|
DEFINE_string arm_extra_bootargs "" \
|
||||||
"Additional command line options to pass to the ARM kernel."
|
"Additional command line options to pass to the ARM kernel."
|
||||||
DEFINE_integer rootfs_partition_size 1024 \
|
DEFINE_integer rootfs_partition_size 1024 \
|
||||||
"rootfs parition size in MBs."
|
"rootfs partition size in MiBs."
|
||||||
DEFINE_integer rootfs_size 720 \
|
DEFINE_integer rootfs_size 720 \
|
||||||
"rootfs filesystem size in MBs."
|
"rootfs filesystem size in MiBs."
|
||||||
# ceil(0.1 * rootfs_size) is a good minimum.
|
# ceil(0.1 * rootfs_size) is a good minimum.
|
||||||
DEFINE_integer rootfs_hash_pad 8 \
|
DEFINE_integer rootfs_hash_pad 8 \
|
||||||
"MBs reserved at the end of the rootfs image."
|
"MiBs reserved at the end of the rootfs image."
|
||||||
DEFINE_integer statefulfs_size 1024 \
|
DEFINE_integer statefulfs_size 1024 \
|
||||||
"stateful filesystem size in MBs."
|
"stateful filesystem size in MiBs."
|
||||||
DEFINE_boolean preserve ${FLAGS_FALSE} \
|
DEFINE_boolean preserve ${FLAGS_FALSE} \
|
||||||
"Attempt to preserve the previous build image if one can be found (unstable, \
|
"Attempt to preserve the previous build image if one can be found (unstable, \
|
||||||
kernel/firmware not updated)"
|
kernel/firmware not updated)"
|
||||||
@ -97,8 +97,8 @@ fi
|
|||||||
|
|
||||||
if [ "$((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad))" -gt \
|
if [ "$((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad))" -gt \
|
||||||
"${FLAGS_rootfs_partition_size}" ] ; then
|
"${FLAGS_rootfs_partition_size}" ] ; then
|
||||||
error "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MB) is \
|
error "rootfs ($((FLAGS_rootfs_size + FLAGS_rootfs_hash_pad)) MiB) is \
|
||||||
bigger than partition (${FLAGS_rootfs_partition_size} MB)."
|
bigger than partition (${FLAGS_rootfs_partition_size} MiB)."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -453,15 +453,8 @@ create_base_image() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create root file system disk image to fit on a 1GB memory stick.
|
# Create root file system disk image.
|
||||||
# 1 GB in hard-drive-manufacturer-speak is 10^9, not 2^30. 950MB < 10^9 bytes.
|
|
||||||
# Minimize rootfs size for dev install shim and factory installer
|
|
||||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ||
|
|
||||||
[ ${FLAGS_dev_install} -eq ${FLAGS_TRUE} ] ; then
|
|
||||||
ROOT_SIZE_BYTES=$((1024 * 1024 * 300))
|
|
||||||
else
|
|
||||||
ROOT_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_rootfs_size}))
|
ROOT_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_rootfs_size}))
|
||||||
fi
|
|
||||||
|
|
||||||
# Pad out for the hash tree.
|
# Pad out for the hash tree.
|
||||||
ROOT_HASH_PAD=$((FLAGS_rootfs_hash_pad * 1024 * 1024))
|
ROOT_HASH_PAD=$((FLAGS_rootfs_hash_pad * 1024 * 1024))
|
||||||
@ -655,6 +648,13 @@ if [[ $FLAGS_preserve -eq ${FLAGS_TRUE} ]] ; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Minimize rootfs size for dev install shim and factory installer
|
||||||
|
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} -o \
|
||||||
|
${FLAGS_dev_install} -eq ${FLAGS_TRUE} ] ; then
|
||||||
|
info "Fixing the rootfs size at 300 MiB for the factory installer"
|
||||||
|
FLAGS_rootfs_size=300
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the boot.desc file which stores the build-time configuration
|
# Create the boot.desc file which stores the build-time configuration
|
||||||
# information needed for making the image bootable after creation with
|
# information needed for making the image bootable after creation with
|
||||||
# cros_make_image_bootable.
|
# cros_make_image_bootable.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user