mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 06:26:57 +02:00
Check kernel image size when building image
Kernel and ramdisk image together are copied into a 16MB partition. This CL logs their size when building image. If they are larger than 14MB, warning message is emitted. If they reached 16MB, building fails. BUG=chromium-os:27739 TEST=Build success on x86 and arm. Check log and see kernel image size logged. Lower the size limit to 6MB and build x86 factory install shim and see build fail. Change-Id: I4c4895c2989b302aa0c3624127518468566d1148 Reviewed-on: https://gerrit.chromium.org/gerrit/22543 Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Ready: Vic Yang <victoryang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org>
This commit is contained in:
parent
6b1abb2a6f
commit
d0694f5ac9
@ -228,6 +228,16 @@ make_image_bootable() {
|
||||
--keys_dir="${FLAGS_keys_dir}" \
|
||||
${use_dev_keys}
|
||||
|
||||
# Check the size of kernel image and issue warning when image size is
|
||||
# near the limit.
|
||||
local kernel_image_size=$(stat -c '%s' ${FLAGS_output_dir}/vmlinuz.image)
|
||||
info "Kernel image size is ${kernel_image_size} bytes."
|
||||
if [[ ${kernel_image_size} -gt $((16 * 1024 * 1024)) ]]; then
|
||||
die "Kernel image is larger than 16 MB."
|
||||
elif [[ ${kernel_image_size} -gt $((14 * 1024 * 1024)) ]]; then
|
||||
warn "Kernel image is larger than 14 MB. Limit is 16 MB."
|
||||
fi
|
||||
|
||||
local rootfs_hash_size=$(stat -c '%s' ${FLAGS_rootfs_hash})
|
||||
info "Appending rootfs.hash (${rootfs_hash_size} bytes) to the root fs"
|
||||
if [[ ${rootfs_hash_size} -gt $((FLAGS_rootfs_hash_pad * 1024 * 1024)) ]]
|
||||
|
Loading…
Reference in New Issue
Block a user