@@ -11,13 +11,19 @@ printfiles="n"
1111printinitrd=" n"
1212while getopts " b:e:r:a:o:fi" arg; do
1313 case $arg in
14- b) bootdir=" $OPTARG " ;;
15- e) entry=" $OPTARG " ;;
16- r) cmdremove=" $OPTARG " ;;
17- a) cmdadd=" $OPTARG " ;;
18- o) override_initrd=" $OPTARG " ;;
19- f) dryrun=" y" ; printfiles=" y" ;;
20- i) dryrun=" y" ; printinitrd=" y" ;;
14+ b) bootdir=" $OPTARG " ;;
15+ e) entry=" $OPTARG " ;;
16+ r) cmdremove=" $OPTARG " ;;
17+ a) cmdadd=" $OPTARG " ;;
18+ o) override_initrd=" $OPTARG " ;;
19+ f)
20+ dryrun=" y"
21+ printfiles=" y"
22+ ;;
23+ i)
24+ dryrun=" y"
25+ printinitrd=" y"
26+ ;;
2127 esac
2228done
2329
2733
2834bootdir=" ${bootdir%%/ } "
2935
30- kexectype=` echo $entry | cut -d\| -f2`
31- kexecparams=` echo $entry | cut -d\| -f3- | tr ' |' ' \n' `
36+ kexectype=$( echo $entry | cut -d\| -f2)
37+ kexecparams=$( echo $entry | cut -d\| -f3- | tr ' |' ' \n' )
3238kexeccmd=" kexec"
3339
40+ DEBUG " kexec-boot.sh: entry='$entry '"
41+ DEBUG " kexec-boot.sh: kexectype='$kexectype '"
42+ DEBUG " kexec-boot.sh: kexecparams='$kexecparams '"
43+ DEBUG " kexec-boot.sh: cmdadd='$cmdadd '"
44+
3445cmdadd=" $CONFIG_BOOT_KERNEL_ADD $cmdadd "
3546cmdremove=" $CONFIG_BOOT_KERNEL_REMOVE $cmdremove "
3647
@@ -53,29 +64,31 @@ fix_file_path() {
5364
5465adjusted_cmd_line=" n"
5566adjust_cmd_line () {
67+ DEBUG " adjust_cmd_line: original cmdline='$cmdline '"
5668 if [ -n " $cmdremove " ]; then
5769 for i in $cmdremove ; do
5870 cmdline=$( echo $cmdline | sed " s/\b$i \b//g" )
5971 done
6072 fi
6173
6274 if [ -n " $cmdadd " ]; then
75+ DEBUG " adjust_cmd_line: cmdadd='$cmdadd '"
6376 cmdline=" $cmdline $cmdadd "
77+ DEBUG " adjust_cmd_line: final cmdline='$cmdline '"
6478 fi
6579 adjusted_cmd_line=" y"
6680}
6781
68- if [ " $CONFIG_DEBUG_OUTPUT " = " y" ]; then
82+ if [ " $CONFIG_DEBUG_OUTPUT " = " y" ]; then
6983 # If expecting debug output, have kexec load (-l) output debug info
7084 kexeccmd=" $kexeccmd -d"
7185fi
7286
7387module_number=" 1"
74- while read line
75- do
76- key=` echo $line | cut -d\ -f1`
77- firstval=` echo $line | cut -d\ -f2`
78- restval=` echo $line | cut -d\ -f3-`
88+ while read line; do
89+ key=$( echo $line | cut -d\ -f1)
90+ firstval=$( echo $line | cut -d\ -f2)
91+ restval=$( echo $line | cut -d\ -f3-)
7992 if [ " $key " = " kernel" ]; then
8093 fix_file_path
8194 if [ " $kexectype " = " xen" ]; then
112125 fi
113126 fi
114127 fi
115- module_number=` expr $module_number + 1`
128+ module_number=$( expr $module_number + 1)
116129 kexeccmd=" $kexeccmd --module \" $filepath $cmdline \" "
117130 fi
118131 if [ " $key " = " initrd" ]; then
135148 adjust_cmd_line
136149 kexeccmd=" $kexeccmd --append=\" $cmdline \" "
137150 fi
138- done << EOF
151+ done << EOF
139152$kexecparams
140153EOF
141154
@@ -153,10 +166,10 @@ STATUS "Loading the new kernel"
153166DEBUG " kexec command: $kexeccmd "
154167# DO_WITH_DEBUG captures the debug output from stderr to the log, we don't need
155168# it on the console as well
156- DO_WITH_DEBUG eval " $kexeccmd " 2> /dev/null \
157- || DIE " Failed to load the new kernel"
169+ DO_WITH_DEBUG eval " $kexeccmd " 2> /dev/null ||
170+ DIE " Failed to load the new kernel"
158171
159- if [ " $CONFIG_DEBUG_OUTPUT " = " y" ]; then
172+ if [ " $CONFIG_DEBUG_OUTPUT " = " y" ]; then
160173 # Ask user if they want to continue booting without echoing back the input (-s)
161174 INPUT " [DEBUG] Continue booting? [Y/n]:" -s -n 1 debug_boot_confirm
162175 if [ " ${debug_boot_confirm^^} " = N ]; then
0 commit comments