All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Kory Maincent <kory.maincent@bootlin.com>
Cc: thomas.petazzoni@bootlin.com, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v3 3/7] fs/iso9660: add support to Grub EFI bootloader in the image
Date: Mon, 27 Sep 2021 22:43:55 +0200	[thread overview]
Message-ID: <20210927204355.GE1504958@scaer> (raw)
In-Reply-To: <20210923155726.87851-4-kory.maincent@bootlin.com>

Köry, All,

On 2021-09-23 17:57 +0200, Kory Maincent spake thusly:
> Add support to boot the Grub bootloader from an EFI BIOS in the ISO9660
> image.
> For that we need to create EFI System Partition (ESP). The ESP is a vfat
> partition which contain the Grub2 binary at the /EFI/BOOT/ location.
> xorriso command will generate the iso image including the ESP.
> 
> We notice Grub can not read and mount the ESP, therefore we place the Grub
> configuration file in the ISO9660 partition. A Grub2 builtin configuration
> need to be used to tell Grub2 to search automatically its configuration
> file in the ISO9660 partition. Use 'set root=(cd0)' in the configuration
> file passed to BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI.
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
[--SNIP--]
> diff --git a/fs/iso9660/iso9660.mk b/fs/iso9660/iso9660.mk
> index 23421a9a5c..921efa1b02 100644
> --- a/fs/iso9660/iso9660.mk
> +++ b/fs/iso9660/iso9660.mk
> @@ -57,7 +57,12 @@ else
>  ROOTFS_ISO9660_TMP_TARGET_DIR = $(TARGET_DIR)
>  endif
>  
> -ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2),y)
> +ifeq ($(BR2_REPRODUCIBLE),y)
> +ROOTFS_ISO9660_VFAT_OPTS = --invariant
> +ROOTFS_ISO9660_FIX_TIME = touch $(SOURCE_DATE_EPOCH)

I think you may have missed something about SOURCE_DATE_EPOCH: it is a
UNIX timestamp, as a number of seconds elapsed since 1970-01-01T00:00:00+0000.
Right now, it's around 1632775187.

So, what you wrote would create a file named '1632775187' in the
Buildroot top-level directory... Probably not what is expected...

So I've changed to:

    ifeq ($(BR2_REPRODUCIBLE),y)
    ROOTFS_ISO9660_VFAT_OPTS = --invariant
    ROOTFS_ISO9660_FIX_TIME = touch -d @$(SOURCE_DATE_EPOCH)
    else
    ROOTFS_ISO9660_FIX_TIME = @:
    endif

... and then...

> +ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2)$(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER),yy)
>  ROOTFS_ISO9660_DEPENDENCIES += grub2
>  ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
>  	$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
> @@ -66,6 +71,22 @@ define ROOTFS_ISO9660_INSTALL_BOOTLOADER
>  	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/grub-eltorito.img \
>  		$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub-eltorito.img
>  endef
> +else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2)$(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),yy)
> +ROOTFS_ISO9660_DEPENDENCIES += grub2 host-dosfstools host-mtools
> +ROOTFS_ISO9660_EFI_PARTITION = boot/fat.efi
> +ROOTFS_ISO9660_EFI_PARTITION_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_EFI_PARTITION)
> +ROOTFS_ISO9660_EFI_PARTITION_CONTENT = $(BINARIES_DIR)/efi-part
> +ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
> +	$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
> +define ROOTFS_ISO9660_INSTALL_BOOTLOADER
> +	rm -rf $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
> +	mkdir -p $(dir $(ROOTFS_ISO9660_EFI_PARTITION_PATH))
> +	dd if=/dev/zero of=$(ROOTFS_ISO9660_EFI_PARTITION_PATH) bs=1M count=1
> +	$(ROOTFS_ISO9660_FIX_TIME)
> +	$(HOST_DIR)/sbin/mkfs.vfat $(ROOTFS_ISO9660_VFAT_OPTS) $(ROOTFS_ISO9660_EFI_PARTITION_PATH)

... here:

    $(ROOTFS_ISO9660_FIX_TIME) $(ROOTFS_ISO9660_EFI_PARTITION_CONTENT)/*

... and...

> +	$(HOST_DIR)/bin/mcopy -p -m -i $(ROOTFS_ISO9660_EFI_PARTITION_PATH) -s \
> +		$(ROOTFS_ISO9660_EFI_PARTITION_CONTENT)/* ::/

... here:

    $(ROOTFS_ISO9660_FIX_TIME) $(ROOTFS_ISO9660_EFI_PARTITION_PATH)

Applied to master with the above changes, thanks.

Regards,
Yann E. MORIN.

> +endef
>  else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_ISOLINUX),y)
>  ROOTFS_ISO9660_DEPENDENCIES += syslinux
>  ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
> @@ -128,9 +149,25 @@ ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
>  
>  endif # ROOTFS_ISO9660_USE_INITRD
>  
> +ROOTFS_ISO9660_OPTS += \
> +	-J \
> +	-R \
> +	-no-emul-boot
> +
> +ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER),y)
> +ROOTFS_ISO9660_OPTS += \
> +	-boot-load-size 4 \
> +	-boot-info-table \
> +	-b $(ROOTFS_ISO9660_BOOT_IMAGE)
> +endif
> +
> +ifeq ($(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),y)
> +ROOTFS_ISO9660_OPTS += \
> +	--efi-boot $(ROOTFS_ISO9660_EFI_PARTITION)
> +endif
> +
>  define ROOTFS_ISO9660_CMD
> -	$(HOST_DIR)/bin/xorriso -as mkisofs -J -R -b $(ROOTFS_ISO9660_BOOT_IMAGE) \
> -		-no-emul-boot -boot-load-size 4 -boot-info-table \
> +	$(HOST_DIR)/bin/xorriso -as mkisofs \
>  		$(ROOTFS_ISO9660_OPTS) \
>  		-o $@ $(ROOTFS_ISO9660_TMP_TARGET_DIR)
>  endef
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@lists.buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2021-09-27 20:44 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 15:57 [Buildroot] [PATCH v3 0/7] Add support for ISO9660 image compatible with Legacy and EFI BIOS Kory Maincent
2021-09-23 15:57 ` [Buildroot] [PATCH v3 1/7] board, boot, package: remove usage of startup.nsh in EFI partition Kory Maincent
2021-09-23 20:06   ` Yann E. MORIN
2021-09-24 20:28     ` Erico Nunes
2021-09-27 19:28       ` Yann E. MORIN
2021-09-27 19:27   ` Yann E. MORIN
2021-09-23 15:57 ` [Buildroot] [PATCH v3 2/7] boot/grub2: add support to build multiple Grub2 configurations in the same build Kory Maincent
2021-09-27 19:42   ` Yann E. MORIN
2021-10-06 18:11   ` Yann E. MORIN
2021-10-07  8:23     ` Köry Maincent
2021-10-07  9:53       ` Yann E. MORIN
2021-10-07 12:43         ` Köry Maincent
2021-10-07 16:29           ` Yann E. MORIN
2021-10-08  8:20             ` Köry Maincent
2021-10-11 10:27             ` Köry Maincent
2021-10-14 20:02               ` Yann E. MORIN
2021-10-14 20:27                 ` Yann E. MORIN
2021-10-14 20:48                 ` Adam Duskett
2021-10-14 21:02                 ` Yann E. MORIN
2021-10-15  9:19                 ` Köry Maincent
2021-10-15  9:28                   ` Thomas Petazzoni
2021-10-15 20:50                 ` Yann E. MORIN
2021-10-19 16:30                   ` Adam Duskett
2021-10-20 15:58                     ` Köry Maincent
2021-09-23 15:57 ` [Buildroot] [PATCH v3 3/7] fs/iso9660: add support to Grub EFI bootloader in the image Kory Maincent
2021-09-27 20:43   ` Yann E. MORIN [this message]
2021-09-28  5:35     ` Yann E. MORIN
2021-09-23 15:57 ` [Buildroot] [PATCH v3 4/7] fs/iso9660: add support for hybrid image using Grub bootloader on BIOS and EFI Kory Maincent
2021-09-27 21:05   ` Yann E. MORIN
2021-09-29  8:23     ` Köry Maincent
2021-09-29 21:26   ` Yann E. MORIN
2021-09-30  9:12     ` Köry Maincent
2021-09-23 15:57 ` [Buildroot] [PATCH v3 5/7] support/testing/infra/emulator.py: update encoding when calling qemu Kory Maincent
2021-09-30 20:28   ` Yann E. MORIN
2021-10-02 20:28     ` Yann E. MORIN
2021-10-03  9:09       ` Thomas Petazzoni
2021-10-03 12:47   ` Yann E. MORIN
2021-10-04  7:47     ` Köry Maincent
2021-10-06 14:59     ` Peter Korsgaard
2021-09-23 15:57 ` [Buildroot] [PATCH v3 6/7] boot/edk2: add support to i386 architecture Kory Maincent
2021-09-30 19:51   ` Yann E. MORIN
2021-10-03 12:49   ` Yann E. MORIN
2021-10-04 10:22     ` Köry Maincent
2021-09-23 15:57 ` [Buildroot] [PATCH v3 7/7] support/testing/tests/fs/test_iso9660.py: add support to test using EFI BIOS Kory Maincent
2021-10-03 12:50   ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210927204355.GE1504958@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=kory.maincent@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.