help-grub
[Top][All Lists]
Advanced

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

Re: Extracting config file from GRUB EFI image


From: SevenBits
Subject: Re: Extracting config file from GRUB EFI image
Date: Fri, 6 May 2016 10:39:07 -0400

Ah, okay. I'm familiar with disk images, I just didn't know if I needed something specific to QEMU. Thanks.

On Friday, May 6, 2016, hoan <address@hidden> wrote:
hi,
the Fat partition diskfile is pure "nix",independent of qemu. As root do
0 simply get a plain new usb stick (it's fat formatted by default)
create directory /EFI/BOOT/  on your stick then cp boot.efi to it.
Just boot it with your pc_uefi .(no need of qemu.)

or do either
1        dd if=/dev/zero of=efi.img bs=1024 count=2880
or
1bis    mkdiskimage -M efi.img 3 8 8
then
2    mkfs.fat efi.img

    mount efi.img /mnt ; mkdir -p /mnt/EFI/BOOT ; cp boot.efi /mnt/EFI/BOOT ;umount /mnt

final step qemu-system-x86_64 -bios OVMF.fd efi.img
get into grub console by typing c
then
grub>cat (memdisk)/boot/grub/grub.cfg

for more info:
https://sourceforge.net/projects/toysbox/files/practice_on_bootx64.efi/
https://sites.google.com/site/grubefikiss/play-with-efi-platform
hope it helps
have a nice day.
On 05/05/2016 11:02 PM, SevenBits wrote:
On 05/05/2016 06:33 AM, hoan wrote:
an alternative way to recover the embedded grub.cfg inside your boot.efi
is to put onto a fat partition efi.img with /EFI/BOOT/boot.efi
then boot the efi.img
for ex qemu-system-x86_64 -bios OVMF.fd efi.img
the embedded grub.cfg is inside memdisk ! Just

cat (memdisk)/boot/grub/grub.cfg
Hi! This sounds very interesting... I'll try it. How would I create this
FAT partition? I'm not familiar with QEMU.
hope it helps.
On 05/04/2016 10:20 PM, SevenBits wrote:
On 05/03/2016 11:56 PM, Andrei Borzenkov wrote:
04.05.2016 06:49, SevenBits пишет:
On Tuesday, May 3, 2016, Andrei Borzenkov <address@hidden> wrote:

04.05.2016 06:34, SevenBits пишет:
On Tuesday, May 3, 2016, Andrei Borzenkov <address@hidden
<_javascript_:;>> wrote:
04.05.2016 03:57, SevenBits пишет:
I used this command to create a bootable GRUB UEFI image:

../grub-mkstandalone -d . -o ~/Desktop/boot.efi --format=x86_64-efi
--grub-mkimage=../grub-mkimage --install-modules="boot linux ext2
normal
configfile lspci ls help echo fat exfat hfs hfsplus part_msdos
part_gpt
part_apple terminal sleep loopback normal fixvideo iso9660 loadbios
setvariable applesetos"
/boot/grub/fonts/myfont.pf2='/boot/grub/fonts/unicode.pf2'
/boot/grub/grub.cfg='/home/user/Desktop/grub.cfg'

Unfortunately, I have accidentally erased the grub.cfg file
referenced
in this command and I (stupidly) did not include it in source
code with
my rest of my project.

Is there a way to extract this GRUB configuration file from a built
image? In other words, if I have an image that was built with
the above
command, can I extract the configuration file from it?

You can take https://github.com/arvidjaar/bootinfoscript as
example and
extract GRUB modules parsing. Modules are in "mods" section of
GRUB efi
image. I actually started with standalone script to do it, but
never had
enough incentive to finish.
How exactly does this script work? Do I call it on my GRUB image?

Did you try to read README before asking?
I can't access GitHub right now, which is why I asked. I'll check
out the
script tomorrow.

BIS scans system for known bootloaders and bootloader related files. It
is intended x86 systems with legacy boot (or, better - nobody tried it
somewhere else). For supported bootloader it tries to parse binaries and
display some more information.

It has rudimentary support for EFI, but here the problem starts with
simple fact that we have no way to even detect GRUB image - it may be
stored under any name and located practically anywhere.
So, I've taken a look at the script, and while it appears to work, it
doesn't quite do what I need. The script scans my MBR, but I don't want
it to scan my MBR; I need to scan only *one* file that I have. Ideally,
I'd like to be able to pass the path of this file to the script.

In other words: I don't want to look at the system GRUB (which is using
legacy), but rather a specific GRUB EFI image on my hard drive.

Calling ./bootinfoscript -h gives the list of commands, but there isn't
any to specify the file to look at. Is there any way to accomplish this?

Can it actually extract files, or just list what files are
included in
the
image?

It does extract them during processing.

Fantastic.

_______________________________________________
Help-grub mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-grub


_______________________________________________
Help-grub mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-grub


      

_______________________________________________
Help-grub mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-grub


reply via email to

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