All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Hybrid UEFI-Only CD-ROM image with systemd-boot
@ 2024-11-06 11:26 Thomas Kindler
  2024-11-07  7:09 ` Thomas Schmitt via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Kindler @ 2024-11-06 11:26 UTC (permalink / raw)
  To: buildroot

Hi!

I'm using Buildroot 2024.05.2 to build a PREEMPT-RT system for an
UEFI-Only x86-64 industrial server PC.

I'm using systemd as the init system with systemd-boot as the bootloader.
The root file system is compiled into the linux kernel by using
BR2_TARGET_ROOTFS_INITRAMFS.

I generate an UEFI-Bootable usbstick.img containing a single efi-part.vfat
partition with the following contents:

$ tree efi-part --charset X
efi-part
|-- bzImage -> /home/myuser/os74000/output/images/bzImage
|-- EFI
|   |-- BOOT
|   |   |-- bootx64.efi
|   |   `-- memtest.efi -> /home/myuser/os74000/output/images/memtest.efi
|   |-- Linux
|   `-- systemd
|       `-- systemd-bootx64.efi ->
/home/myuser/os74000/output/target/usr/lib/systemd/boot/efi/systemd-bootx64.efi
|-- loader
|   |-- entries
|   |   |-- memtest.conf
|   |   `-- usbstick.conf
|   `-- loader.conf
`-- shellx64.efi ->
/home/myuser/os74000/buildroot-external/board/pc/shellx64.efi

7 directories, 8 files


This usbstick.img works great.


Unfortunately, one of our server-BMCs only supports virtual CD-ROM images.

Buildroot does not seem to have an official option to build those when
using systemd-boot. BR2_TARGET_ROOTFS_ISO9660 is only available when
isolinux is used.

So I do my own image generation following instructions from

https://wiki.syslinux.org/wiki/index.php?title=Isohybrid#UEFI

My post-image.sh contains these lines:


rm -f $BINARIES_DIR/*-cdrom.iso
mkdir -p $BINARIES_DIR/cdrom

cp $BINARIES_DIR/efi-part.vfat $BINARIES_DIR/cdrom
cp $BINARIES_DIR/syslinux/isolinux.bin $BINARIES_DIR/cdrom

xorriso -as mkisofs \
  -o $BINARIES_DIR/cdrom.iso \
  -isohybrid-mbr $HOST_DIR/usr/share/syslinux/isohdpfx.bin \
  -eltorito-catalog boot.cat \
  -eltorito-boot isolinux.bin -no-emul-boot -boot-load-size 4
-boot-info-table \
  -eltorito-alt-boot -e efi-part.vfat -no-emul-boot \
  -isohybrid-gpt-basdat \
  $BINARIES_DIR/cdrom


The resulting cdrom.iso image works fine when mounted as a (virtual) CD-ROM.

But it does not work correctly when dd-copied to an USB stick!

The partition table looks like this:

$ fdisk -l cdrom.iso
Disk cdrom.iso: 129 MiB, 135266304 bytes, 264192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3a388812

Device     Boot Start    End Sectors  Size Id Type
cdrom.iso1 *        0 264191  264192  129M  0 Empty
cdrom.iso2        136 262207  262072  128M ef EFI (FAT-12/16/32)


The UEFI-BIOS will actually load systemd-boot from such an USB stick.
And systemd-boot will load the bzImage.

BUT: systemd-boot does not set 
LoaderDevicePartUUID-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f, as it does when
booting from my normal usbstick.img.

This trips up my /sbin/init script, which has to decide if /boot has to be
mounted from /dev/sr0 + loop back mount of efi-part.vfat, or from the
given EFI var.


When inserting the dd-copied stick, it will show up as:

  /dev/sda1 - containing the useless CD-ROM contents as an ISO9660 file
system
  /dev/sda2 - what i actually need -- my EFI FAT partition contents!


So my questions are:

1) How can I get xorriso to generate an image with only the EFI partition?

- I can not use fdisk to remove partition 1, because it will "remove the
iso9660 signature" on write.

2) Shouldn't xorriso generate a GPT table? fdisk says "Disklabel type: dos"

3) Why do I need isohdpfx.bin and isolinux.bin at all?!
I only want to support UEFI systems, and this seems to be legacy BIOS
related?


best regards,
-- 
Thomas Kindler <mail_buildroot@t-kindler.de>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-08  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 11:26 [Buildroot] Hybrid UEFI-Only CD-ROM image with systemd-boot Thomas Kindler
2024-11-07  7:09 ` Thomas Schmitt via buildroot
2024-11-08  7:53   ` Thomas Kindler
2024-11-08  9:28     ` Thomas Schmitt via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.