On Sun, Jul 9, 2023 at 2:49 PM Andrei Borzenkov <arvidjaar@gmail.com> wrote:
On 09.07.2023 09:33, Hongyi Zhao wrote:
On Sun, Jul 9, 2023 at 1:13 PM 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).
Then, how to access the real hard disk devices and partitions? I can
only see the following devices via grub-emu:
You create device.map and give names hd0, hd1, ... to your devices.
See below:
werner@X10DAi:~$ sudo grub-mkdevicemap -n
werner@X10DAi:~$ cat /boot/grub/device.map
(hd0) /dev/disk/by-id/nvme-SAMSUNG_MZVL22T0HBLB-00B00_S677NF0R503706
(hd1) /dev/disk/by-id/ata-WDC_WDS100T2B0A-00SM50_191533467906
Now, I see the following devices in grub-emu:
grub> ls
(proc) (hd0) (hd1) (host)
But how to access the corresponding partitions on these devices?