diff options
author | Hsin-Yi Wang <hsinyi@chromium.org> | 2020-09-22 16:38:06 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-09 12:55:13 +0000 |
commit | ca64d646cedcdf664015e070e3a2f0c475f449c3 (patch) | |
tree | 9106fc697d9a7b57c390460dd8905d5631408873 | |
parent | eba5595b348e4ff252cf2a64ea0105ee8014d2ed (diff) | |
download | vboot-ca64d646cedcdf664015e070e3a2f0c475f449c3.tar.gz |
vboot_reference: shortcut for enable earlycon and serial console
Add a shortcut to enable and disable earlycon and serial console.
Earlycon requires to setup the correct parameter in stdout-path for
ARM/ARM64 or SPCR table for x86.
BRANCH=none
BUG=b:168171144
TEST=./make_dev_ssd.sh -i $image --enable_earlycon (--disable_console)
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Change-Id: Ifc39c825bf0830bca9d72668b8451aff64708071
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2423643
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
-rwxr-xr-x | scripts/image_signing/make_dev_ssd.sh | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/scripts/image_signing/make_dev_ssd.sh b/scripts/image_signing/make_dev_ssd.sh index ed102a6b..992d89c9 100755 --- a/scripts/image_signing/make_dev_ssd.sh +++ b/scripts/image_signing/make_dev_ssd.sh @@ -35,7 +35,15 @@ ROOTDEV_KERNEL="$((ROOTDEV_PARTITION - 1))" DEFINE_string image "$ROOTDEV_DISK" "Path to device or image file" "i" DEFINE_string keys "$DEFAULT_KEYS_FOLDER" "Path to folder of dev keys" "k" DEFINE_boolean remove_rootfs_verification \ - $FLAGS_FALSE "Modify kernel boot config to disable rootfs verification" "" + "${FLAGS_FALSE}" "Modify kernel boot config to disable rootfs verification" "" +DEFINE_boolean enable_earlycon "${FLAGS_FALSE}" \ + "Enable earlycon from stdout-path (ARM/ARM64) or SPCR (x86)." "" +DEFINE_boolean disable_earlycon "${FLAGS_FALSE}" \ + "Disable earlycon." "" +DEFINE_boolean enable_console "${FLAGS_FALSE}" \ + "Enable serial console." "" +DEFINE_boolean disable_console "${FLAGS_FALSE}" \ + "Disable serial console." "" DEFINE_string backup_dir \ "$DEFAULT_BACKUP_FOLDER" "Path of directory to store kernel backups" "" DEFINE_string save_config "" \ @@ -106,6 +114,28 @@ remove_legacy_boot_rootfs_verification() { sudo umount "$mount_point" } +# Enable/Disable earlycon or serial console +insert_parameter() { + local cmdline="$1" + local param="$2" + + if [ -n "${cmdline##*${param}*}" ]; then + cmdline="${param} ${cmdline}" + fi + + echo "${cmdline}" +} + +remove_parameter() { + local cmdline="$1" + local param="$2" + + cmdline=$(echo "${cmdline}" | sed ' + s/'"${param} "'//g') + + echo "${cmdline}" +} + # Wrapped version of dd mydd() { # oflag=sync is safer, but since we need bs=512, syncing every block would be @@ -244,6 +274,26 @@ resign_ssd_kernel() { remove_legacy_boot_rootfs_verification "$ssd_device" fi + if [ "${FLAGS_enable_earlycon}" = "${FLAGS_TRUE}" ]; then + debug_msg "Enabling earlycon" + kernel_config="$(insert_parameter "${kernel_config}" "earlycon")" + debug_msg "New kernel config: ${kernel_config}" + elif [ "${FLAGS_disable_earlycon}" = "${FLAGS_TRUE}" ]; then + debug_msg "Disabling earlycon" + kernel_config="$(remove_parameter "${kernel_config}" "earlycon")" + debug_msg "New kernel config: ${kernel_config}" + fi + + if [ "${FLAGS_enable_console}" = "${FLAGS_TRUE}" ]; then + debug_msg "Enabling serial console" + kernel_config="$(remove_parameter "${kernel_config}" "console=")" + debug_msg "New kernel config: ${kernel_config}" + elif [ "${FLAGS_disable_console}" = "${FLAGS_TRUE}" ]; then + debug_msg "Disabling serial console" + kernel_config="$(insert_parameter "${kernel_config}" "console=")" + debug_msg "New kernel config: ${kernel_config}" + fi + local new_kernel_config_file="$(make_temp_file)" echo -n "$kernel_config" >"$new_kernel_config_file" |