reset_uki_cmdline: have non-empty cmdline for unsigned images We want to disallow overriding the compiled in command line for UKI images. However, we currently depend on this behavior for unsigned images, because the command line isn't finalized yet at that time. Instead of using an empty builtin cmdline for unsigned images, use whatever the partition A cmdline is. This should allow the unsigned image to function well enough for testing, and the signing process will still update it to the correct final cmdline. BUG=None TEST=presubmit RELEASE_NOTE=None Change-Id: I0c478ff203d95de73c0d709b6d719067f0ce9975 Reviewed-on: https://cos-review.googlesource.com/c/third_party/platform/crosutils/+/229466 Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com> Reviewed-by: Dom Huh <domhuh@google.com>
diff --git a/reset_uki_cmdline.sh b/reset_uki_cmdline.sh index e5fe01e..334c160 100755 --- a/reset_uki_cmdline.sh +++ b/reset_uki_cmdline.sh
@@ -57,6 +57,9 @@ local stateful_fs_dir="${tmpdir}/stateful" local esp_fs_dir="${tmpdir}/esp" local vmlinux="/build/${BOARD}/usr/src/linux/build/vmlinux" + local cmdline + cmdline="$(PATH=$PATH:/sbin cos_kernel_args \ + --vmlinux "${vmlinux}" show "${image}")" trap "check_full_disk ; unmount_image ; rm -r ${tmpdir}" EXIT mount_image "${image}" "${root_fs_dir}" "${stateful_fs_dir}" \ @@ -68,7 +71,7 @@ trap - EXIT PATH=$PATH:/sbin cos_kernel_args --vmlinux "${vmlinux}" \ - sed --command "s|.*||g" "${image}" + sed --command "s|.*|${cmdline}|g" "${image}" trap "check_full_disk ; unmount_image ; rm -r ${tmpdir}" EXIT mount_image "${image}" "${root_fs_dir}" "${stateful_fs_dir}" \