Skip to contentSkip to conversation

How to test the git clone without "make install" ?

DISCUSSION Thomas Schmitt via Grub-devel 3 participants 6 messages Jun 14, 2024

lore
Share & tools
lore
#0 lore raw

Hi,

on occasion of
https://savannah.gnu.org/bugs/index.php?65880
"heap-buffer-overflow in grub-mkrescue.c"
i try to get grub-mkrescue running from git.

My problem is that grub_util_get_pkglibdir() returns
/usr/local/lib/grub
and grub_util_get_pkgdatadir() returns
/usr/local/share/grub
which of course do not come with a Debian installation.
So grub-mkrescue produces only a very small ISO with no boot lures or boot programs. Quite unrealistic for testing.

I was able to overcome this obstacle by
ln -s /usr/lib/grub /usr/local/lib/grub
ln -s /usr/share/grub /usr/local/share/grub
but i understand that now my grub-mkrescue actually copies the ISO content from the Debian installation and not from the git clone.

The manual
https://www.gnu.org/software/grub/manual/grub-dev/grub-dev.html
does not give me a clue how i would get the /usr/local/*/grub directories populated with the files made from the git clone. I guess "make install" would do it for me, but i fear that this does too many other things to the GRUB installation of my vanilla Debian. In general i would prefer to keep the git files away from any system directory.

So what can i do to make the files built from git available to ./grub-mkrescue built from git, without frankensteining my Debian 12 ?

Have a nice day :)

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#1 lore raw

Hi Thomas,

to keep the host installation clean, I would probably use a container. So if you are familiar with Podman or Docker, take a look at this:
https://github.com/stendler/grub-fde/blob/main/Containerfile

You could then use a volume mount for any input files from your host and to retrieve the output files.

Hope this helps in your case, otherwise someone more knowledgeable than me could chime in. :)

Cheers
Max

Quoted 36 lines · Thomas Schmitt via Grub-devel

Hi,

on occasion of
https://savannah.gnu.org/bugs/index.php?65880
"heap-buffer-overflow in grub-mkrescue.c"
i try to get grub-mkrescue running from git.

My problem is that grub_util_get_pkglibdir() returns
/usr/local/lib/grub
and grub_util_get_pkgdatadir() returns
/usr/local/share/grub
which of course do not come with a Debian installation.
So grub-mkrescue produces only a very small ISO with no boot lures or boot programs. Quite unrealistic for testing.

I was able to overcome this obstacle by
ln -s /usr/lib/grub /usr/local/lib/grub
ln -s /usr/share/grub /usr/local/share/grub
but i understand that now my grub-mkrescue actually copies the ISO content from the Debian installation and not from the git clone.

The manual
https://www.gnu.org/software/grub/manual/grub-dev/grub-dev.html
does not give me a clue how i would get the /usr/local/*/grub directories populated with the files made from the git clone. I guess "make install" would do it for me, but i fear that this does too many other things to the GRUB installation of my vanilla Debian. In general i would prefer to keep the git files away from any system directory.

So what can i do to make the files built from git available to ./grub-mkrescue built from git, without frankensteining my Debian 12 ?

Have a nice day :)

Quoted 7 lines

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw
In reply to Thomas Schmitt via Grub-devel

Set pkgdatadir environment variable

Quoted 36 lines · Thomas Schmitt via Grub-devel

Hi,

on occasion of
https://savannah.gnu.org/bugs/index.php?65880
"heap-buffer-overflow in grub-mkrescue.c"
i try to get grub-mkrescue running from git.

My problem is that grub_util_get_pkglibdir() returns
/usr/local/lib/grub
and grub_util_get_pkgdatadir() returns
/usr/local/share/grub
which of course do not come with a Debian installation.
So grub-mkrescue produces only a very small ISO with no boot lures or boot programs. Quite unrealistic for testing.

I was able to overcome this obstacle by
ln -s /usr/lib/grub /usr/local/lib/grub
ln -s /usr/share/grub /usr/local/share/grub
but i understand that now my grub-mkrescue actually copies the ISO content from the Debian installation and not from the git clone.

The manual
https://www.gnu.org/software/grub/manual/grub-dev/grub-dev.html
does not give me a clue how i would get the /usr/local/*/grub directories populated with the files made from the git clone. I guess "make install" would do it for me, but i fear that this does too many other things to the GRUB installation of my vanilla Debian. In general i would prefer to keep the git files away from any system directory.

So what can i do to make the files built from git available to ./grub-mkrescue built from git, without frankensteining my Debian 12 ?

Have a nice day :)

Quoted 8 lines

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#3 lore raw

Hi,

Quoted 1 line · Maximilian Stendler

to keep the host installation clean, I would probably use a container.

Yes, a virtual machine came to my mind. Easy to clone and to dispose. But there must be some better way to test a utility built from git independenly of systemwide directories.

Quoted 1 line · Vladimir 'phcoder' Serbinenko

Set pkgdatadir environment variable

Ahum ...
rm /usr/local/share/grub
pkgdatadir=. ./grub-mkrescue -o /dvdbuffer/test.iso
yields indeed an ISO with EFI boot equipment.

But what to do about /usr/local/lib/grub ?
I found option -d meanwhile. After some forth and back i came to

pkgdatadir=. ./grub-mkrescue -o /dvdbuffer/test.iso -d ./grub-core

which to my surprise creates an ISO with boot equipment for legacy BIOS:

  $ xorriso -indev /dvdbuffer/test.iso -report_el_torito plain -report_system_area plain
  ...
  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4        1397
  El Torito img path :   1  /boot/grub/i386-pc/eltorito.img
  El Torito img opts :   1  boot-info-table grub2-boot-info
  ...
  System area summary: MBR protective-msdos-label grub2-mbr cyl-align-off
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0xcd            1        13783

While i used the Debian system directories it was EFI:

  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  UEFI  y   none  0x0000  0x00   5760          52
  El Torito img path :   1  /efi.img
  ...
  System area summary: MBR protective-msdos-label cyl-align-off GPT APM
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x00  0xee            1        18015

... and a GPT and an Apple Partition Map for HFS+ ...

So i will start a new thread with the question:
How do i convince the git clone to produce programs and ISO for 64 bit EFI.

Have a nice day :)

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#4 lore raw
Quoted 50 lines · Thomas Schmitt via Grub-devel

Hi,

Quoted 1 line · Maximilian Stendler

to keep the host installation clean, I would probably use a container.

Yes, a virtual machine came to my mind. Easy to clone and to dispose. But there must be some better way to test a utility built from git independenly of systemwide directories.

Quoted 1 line · Vladimir 'phcoder' Serbinenko

Set pkgdatadir environment variable

Ahum ...
rm /usr/local/share/grub
pkgdatadir=. ./grub-mkrescue -o /dvdbuffer/test.iso
yields indeed an ISO with EFI boot equipment.

But what to do about /usr/local/lib/grub ?
I found option -d meanwhile. After some forth and back i came to

pkgdatadir=. ./grub-mkrescue -o /dvdbuffer/test.iso -d ./grub-core

which to my surprise creates an ISO with boot equipment for legacy BIOS:

  $ xorriso -indev /dvdbuffer/test.iso -report_el_torito plain
-report_system_area plain
  ...
  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4        1397
  El Torito img path :   1  /boot/grub/i386-pc/eltorito.img
  El Torito img opts :   1  boot-info-table grub2-boot-info
  ...
  System area summary: MBR protective-msdos-label grub2-mbr cyl-align-off
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0xcd            1        13783

While i used the Debian system directories it was EFI:

  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  UEFI  y   none  0x0000  0x00   5760          52
  El Torito img path :   1  /efi.img
  ...
  System area summary: MBR protective-msdos-label cyl-align-off GPT APM
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x00  0xee            1        18015
Quoted 7 lines

... and a GPT and an Apple Partition Map for HFS+ ...

So i will start a new thread with the question:
How do i convince the git clone to produce programs and ISO for 64 bit EFI.

./configure --with-platform=efi --target=x86_64

Quoted 5 lines

Have a nice day :)

Quoted 8 lines

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw

Hi,

Quoted 3 lines · i wrote:
Quoted 3 lines

So i will start a new thread with the question:
How do i convince the git clone to produce programs and ISO for 64 bit EFI.

Quoted 1 line · Vladimir 'phcoder' Serbinenko

./configure --with-platform=efi --target=x86_64

Fast and concise as ever. :))
Thanks, Vladimir.

It works if i do beforehand
make clean

Without "make clean" i get from the subsequent "make":

symlist.h:30:10: fatal error: ../include/grub/machine/pxe.h: No such file or directory

     30 | #include <../include/grub/machine/pxe.h>

Trying to revoke the change by
./configure && make
yields:

symlist.c: In function ‘grub_register_exported_symbols’:
symlist.c:66:31: error: ‘grub_acpi_find_fadt’ undeclared (first use in this function)

     66 |       {"grub_acpi_find_fadt", grub_acpi_find_fadt, 1},

-----------------------------------------------------------------------

Well, now that i know the magic words, i find them in the manual under "8 Porting".
Possibly it would be worthwhile to put some of this into a new chapter
"1.1 Building from the git clone"
together with a warning about re-configuring without clean-making.

Have a nice day :)

Thomas

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel