[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Debug grub scripts without rebooting into grub shell.
From: |
Hongyi Zhao |
Subject: |
Re: Debug grub scripts without rebooting into grub shell. |
Date: |
Wed, 12 Jul 2023 09:27:59 +0800 |
On Wed, Jul 12, 2023 at 5:08 AM Glenn Washburn
<development@efficientek.com> wrote:
>
> 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.
What's the concrete steps?
> Glenn
Zhao
> > > $ 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
> >
- Re: Debug grub scripts without rebooting into grub shell., (continued)
- Re: Debug grub scripts without rebooting into grub shell., Andrei Borzenkov, 2023/07/09
- Re: Debug grub scripts without rebooting into grub shell., Hongyi Zhao, 2023/07/09
- Re: Debug grub scripts without rebooting into grub shell., Andrei Borzenkov, 2023/07/09
- Re: Debug grub scripts without rebooting into grub shell., Hongyi Zhao, 2023/07/09
- Re: Debug grub scripts without rebooting into grub shell., Andrei Borzenkov, 2023/07/09
- Re: Debug grub scripts without rebooting into grub shell., Hongyi Zhao, 2023/07/09
- Re: Debug grub scripts without rebooting into grub shell., Hongyi Zhao, 2023/07/09
- Re: Debug grub scripts without rebooting into grub shell., Glenn Washburn, 2023/07/11
- Re: Debug grub scripts without rebooting into grub shell.,
Hongyi Zhao <=
- Re: Debug grub scripts without rebooting into grub shell., Glenn Washburn, 2023/07/12
- Re: Debug grub scripts without rebooting into grub shell., Hongyi Zhao, 2023/07/12
- Re: Debug grub scripts without rebooting into grub shell., Glenn Washburn, 2023/07/12
Re: Debug grub scripts without rebooting into grub shell., Hongyi Zhao, 2023/07/09
Re: Debug grub scripts without rebooting into grub shell., Glenn Washburn, 2023/07/11