Skip to content

Commit bdcc556

Browse files
authored
Merge pull request #1377 from tlaurion/iso_boot_debugging_and_fixes
2 parents a7777a7 + 40872d8 commit bdcc556

File tree

6 files changed

+38
-10
lines changed

6 files changed

+38
-10
lines changed

initrd/bin/kexec-boot

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ adjust_cmd_line() {
6161
adjusted_cmd_line="y"
6262
}
6363

64+
if [ "$CONFIG_DEBUG_OUTPUT" = "y" ];then
65+
#If expecting debug output, have kexec load (-l) output debug info
66+
kexeccmd="$kexeccmd -d"
67+
fi
68+
6469
module_number="1"
6570
while read line
6671
do
@@ -76,7 +81,14 @@ do
7681
elif [ "$kexectype" = "multiboot" ]; then
7782
kexeccmd="$kexeccmd -l $filepath"
7883
kexeccmd="$kexeccmd --command-line \"$restval\""
84+
elif [ "$kexectype" = "elf" ]; then
85+
DEBUG "kexectype= $kexectype"
86+
DEBUG "restval= $restval"
87+
DEBUG "filepath= $filepath"
88+
kexeccmd="$kexeccmd -l $filepath"
89+
DEBUG "kexeccmd= $kexeccmd"
7990
else
91+
DEBUG "unknown kexectype!!!!"
8092
kexeccmd="$kexeccmd -l $filepath"
8193
fi
8294
fi

initrd/bin/kexec-iso-init

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mount -t iso9660 -o loop $MOUNTED_ISO_PATH /boot \
2727
|| die '$MOUNTED_ISO_PATH: Unable to mount /boot'
2828

2929
DEV_UUID=`blkid $DEV | tail -1 | tr " " "\n" | grep UUID | cut -d\" -f2`
30-
ADD="fromiso=/dev/disk/by-uuid/$DEV_UUID/$ISO_PATH img_dev=/dev/disk/by-uuid/$DEV_UUID iso-scan/filename=/${ISO_PATH} img_loop=$ISO_PATH"
30+
ADD="fromiso=/dev/disk/by-uuid/$DEV_UUID/$ISO_PATH img_dev=/dev/disk/by-uuid/$DEV_UUID iso-scan/filename=/${ISO_PATH} img_loop=$ISO_PATH iso=$DEV_UUID/$ISO_PATH"
3131
REMOVE=""
3232

3333
paramsdir="/media/kexec_iso/$ISO_PATH"
@@ -47,7 +47,7 @@ if [ -r $REMOVE_FILE ]; then
4747
fi
4848

4949
# Call kexec and indicate that hashes have been verified
50-
kexec-select-boot -b /boot -d /media -p "$paramsdir" \
50+
DO_WITH_DEBUG kexec-select-boot -b /boot -d /media -p "$paramsdir" \
5151
-a "$ADD" -r "$REMOVE" -c "*.cfg" -u -i
5252

5353
die "Something failed in selecting boot"

initrd/bin/kexec-parse-boot

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@ reset_entry() {
2121
}
2222

2323
filedir=`dirname $file`
24+
DEBUG "filedir= $filedir"
2425
bootdir="${bootdir%%/}"
26+
DEBUG "bootdir= $bootdir"
2527
bootlen="${#bootdir}"
28+
DEBUG "bootlen= $bootlen"
2629
appenddir="${filedir:$bootlen}"
30+
DEBUG "appenddir= $appenddir"
2731

2832
fix_path() {
2933
path="$@"
3034
if [ "${path:0:1}" != "/" ]; then
35+
DEBUG "fix_path: path was $@"
3136
path="$appenddir/$path"
37+
DEBUG "fix_path: path is now $path"
3238
fi
3339
}
3440

@@ -38,7 +44,10 @@ check_path() {
3844
local checkpath firstval
3945
checkpath="$1"
4046
firstval="$(echo "$checkpath" | cut -d\ -f1)"
41-
if ! [ -r "$bootdir$firstval" ]; then return 1; fi
47+
if ! [ -r "$bootdir$firstval" ]; then
48+
DEBUG "$bootdir$firstval doesn't exist"
49+
return 1;
50+
fi
4251
return 0
4352
}
4453

@@ -111,26 +120,30 @@ grub_entry() {
111120
# TODO: differentiate between Xen and other multiboot kernels
112121
kexectype="xen"
113122
kernel="$val"
123+
DEBUG " grub_entry multiboot kernel= $kernel"
114124
;;
115125
module*)
116126
case $val in
117127
--nounzip*) val=`echo $val | cut -d\ -f2-` ;;
118128
esac
119129
fix_path $val
120130
modules="$modules|module $path"
131+
DEBUG " grub_entry linux modules= $modules"
121132
;;
122133
linux*)
123134
# Some configs have a device specification in the kernel
124135
# or initrd path. Assume this would be /boot and remove
125136
# it. Keep the '/' following the device, since this
126137
# path is relative to the device root, not the config
127138
# location.
139+
DEBUG " grub_entry : linux trimcmd prior of kernel/append parsing: $trimcmd"
128140
kernel=`echo $trimcmd | sed "s/([^)]*)//g" | cut -d\ -f2`
129141
append=`echo $trimcmd | cut -d\ -f3-`
130142
;;
131143
initrd*)
132144
# Trim off device specification as above
133145
initrd="$(echo "$val" | sed "s/([^)]*)//g")"
146+
DEBUG " grub_entry: linux initrd= $initrd"
134147
;;
135148
esac
136149
}
@@ -205,17 +218,20 @@ syslinux_entry() {
205218
state="search"
206219
;;
207220
*)
208-
kernel="${val#"$bootdir"}"
221+
kernel="$val"
222+
DEBUG "kernel= $kernel"
209223
esac
210224
;;
211225
initrd* | INITRD* )
212-
initrd="${val#"$bootdir"}"
226+
initrd="$val"
227+
DEBUG "initrd= $initrd"
213228
;;
214229
append* | APPEND* )
215230
if [ "$kexectype" = "multiboot" -o "$kexectype" = "xen" ]; then
216231
syslinux_multiboot_append
217232
else
218233
append="$val"
234+
DEBUG "append= $append"
219235
fi
220236
;;
221237
esac

initrd/bin/kexec-select-boot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ scan_options() {
182182
option_file="/tmp/kexec_options.txt"
183183
if [ -r $option_file ]; then rm $option_file; fi
184184
for i in `find $bootdir -name "$config"`; do
185-
kexec-parse-boot "$bootdir" "$i" >> $option_file
185+
DO_WITH_DEBUG kexec-parse-boot "$bootdir" "$i" >> $option_file
186186
done
187187
# FC29/30+ may use BLS format grub config files
188188
# https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault

initrd/bin/media-scan

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ if [ `cat /tmp/iso_menu.txt | wc -l` -gt 0 ]; then
8686
if [ -n "$option" ]; then
8787
MOUNTED_ISO=$option
8888
ISO=${option:7} # remove /media/ to get device relative path
89-
kexec-iso-init $MOUNTED_ISO $ISO $USB_BOOT_DEV
89+
DO_WITH_DEBUG kexec-iso-init $MOUNTED_ISO $ISO $USB_BOOT_DEV
9090

9191
die "Something failed in iso init"
9292
fi
@@ -95,9 +95,9 @@ fi
9595
echo "!!! Could not find any ISO, trying bootable USB"
9696
# Attempt to pull verified config from device
9797
if [ -x /bin/whiptail ]; then
98-
kexec-select-boot -b /media -c "*.cfg" -u -g -s
98+
DO_WITH_DEBUG kexec-select-boot -b /media -c "*.cfg" -u -g -s
9999
else
100-
kexec-select-boot -b /media -c "*.cfg" -u -s
100+
DO_WITH_DEBUG kexec-select-boot -b /media -c "*.cfg" -u -s
101101
fi
102102

103103
die "Something failed in selecting boot"

initrd/bin/usb-init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ if [ "$CONFIG_TPM" = "y" ]; then
1111
tpmr extend -ix 4 -ic usb
1212
fi
1313

14-
media-scan usb
14+
DO_WITH_DEBUG media-scan usb
1515
recovery "Something failed during USB boot"

0 commit comments

Comments
 (0)