From 05d5a6f9170639ea6b034eee9cfbe7c6e3bf7168 Mon Sep 17 00:00:00 2001 From: Kyle MacLeod <kyle.macleod@windriver.com> Date: Fri, 9 Jun 2023 10:29:58 -0400 Subject: [PATCH] Add extra_boot_params boot parameters into miniboot parms When the --param extra_boot_params argument is given, we need to parse the given boot parameters and include them in the miniboot boot options by adding them into the BOOT_ARGS_COMMON variable Example: For '--param extra_boot_params=arg1=1,arg2=two' The following is added to the miniboot kernel options: extra_boot_params=arg1=1,arg2=two arg1=1 arg2=two Where 'extra_boot_params=arg1=1,arg2=two' is required for parsing by miniboot.cfg and 'arg1=1 arg2=two' are the actual boot parameters applied during boot of the miniboot bootimage.iso. Test Plan PASS: - Verify that extra_boot_params is parsed both the 'extra_boot_params=' as well as separate miniboot kernel options (see above example) - Verify that the miniboot comes up with the kernel options in its /proc/cmdline (i.e., the initial miniboot ISO boots with the configured extra options) - Tested with the follow input: --param extra_boot_params=arg1=1,arg2=2 --param extra_boot_params=arg1=1 --param extra_boot_params=arg1 Closes-Bug: 2023407 Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/885758 Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com> Change-Id: Iae094d9f7746e8d2963e137ab809376d75ad1bca --- .../scripts/gen-bootloader-iso.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/utilities/platform-util/scripts/gen-bootloader-iso.sh b/utilities/platform-util/scripts/gen-bootloader-iso.sh index 2524921d..70503ad0 100755 --- a/utilities/platform-util/scripts/gen-bootloader-iso.sh +++ b/utilities/platform-util/scripts/gen-bootloader-iso.sh @@ -490,6 +490,27 @@ function generate_boot_cfg { BOOT_ARGS_COMMON="${BOOT_ARGS_COMMON} debug_kickstart" fi BOOT_ARGS_COMMON="${BOOT_ARGS_COMMON} ${PARAM_LIST}" + + # Search the install kernel command line for the 'extra_boot_params=' + # option. If present, propagate the value into our BOOT_ARGS_COMMON, so + # that any extra boot parameters are also provided during the boot from + # miniboot ISO. + # Multiple parameters can be separated by ',' here; we want to + # split them out to be space-separated when adding to kernel arguments. + # e.g.: for extra_boot_params=arg1=1,arg2=2, set kernel params: arg1=1 arg2=2 + local option + for option in ${PARAM_LIST}; do + if [ "${option%%=*}" = "extra_boot_params" ]; then + # Do not include the 'extra_boot_params' string. + # Strip out any commas and replace with space. + extra_boot_params=${option#*=} # remove 'extra_boot_params=' + extra_boot_params=${extra_boot_params//,/ } # replace all ',' with ' ' + ilog "Adding extra_boot_params to BOOT_ARGS_COMMON: ${extra_boot_params}" + BOOT_ARGS_COMMON="${BOOT_ARGS_COMMON} ${extra_boot_params}" + break + fi + done + # Uncomment for debugging: #BOOT_ARGS_COMMON="${BOOT_ARGS_COMMON} instsh=2 instpost=shell" log_verbose "BOOT_ARGS_COMMON: $BOOT_ARGS_COMMON"