help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debug grub scripts without rebooting into grub shell.


From: Glenn Washburn
Subject: Re: Debug grub scripts without rebooting into grub shell.
Date: Tue, 11 Jul 2023 16:08:49 -0500

On Sun, 9 Jul 2023 08:13:40 +0300
Andrei Borzenkov <arvidjaar@gmail.com> wrote:

> On 09.07.2023 03:21, Hongyi Zhao wrote:
> > 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:
> > 
> 
> If you want to debug grubx64.efi, then you of course need to load it 
> either on real hardware or in VM. But you can debug scripts used by 
> grubx64.efi using grub-emu by setting up suitable simulated environment. 
> There are clear limitations (scripts cannot load and start any kernel).

Point of clarification. If I'm not mistaken, grub emu can now indirectly
load and start a kernel via kexec.

Glenn

> > $ 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
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]