On Sat, Jul 8, 2023 at 9:53 PM Andrei Borzenkov <arvidjaar@gmail.com> wrote:
On 08.07.2023 14:58, Hongyi Zhao wrote:
Hi here,
Are there some convenient methods to debug grub scripts without
rebooting into grub shell?
You may try grub-emu which emulates grub.
I tried, but it seems that grub-emu doesn't meet my requirement as
described below.
I want to debug the grubx64.efi created by the following command:
$ grub-mkstandalone -O x86_64-efi -o grubx64.efi --modules='lvm fat
ntfs part_msdos part_gpt ext2 btrfs probe regexp search configfile'
boot/grub/grub.cfg=./grub.cfg
The content of the ./grub.cfg is as follows:
$ egrep -v '^[ ]*(#|$)' grub.cfg
regexp -s __cmdpath_efi '^\(([^,]+)' "$cmdpath"
export __cmdpath_efi
for file in ($__cmdpath_efi,*)/multibootusb.git/grub.cfg; do
if regexp -s __root '^(\([^*]+\))' "$file"; then
set __prefix=$__root/multibootusb.git
export __root
export __prefix
configfile $__prefix/grub.cfg
break
fi
done
The files' layout is as follows:
$ tree .
.
├── grub.cfg
├── grub-mkstandalone.sh
├── grubx64.efi
└── iso
├── deepin-desktop-community-23-Beta-amd64.iso
├── rescatux-0.74.iso
├── supergrub2-2.06s1-beta2-multiarch-CD.iso
├── systemrescue-10.01-amd64.iso
├── ubuntu-23.04-desktop-amd64.iso
└── ubuntukylin-23.04-desktop-amd64.iso
1 directory, 9 files
Regards,
Zhao