All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: "Köry Maincent" <kory.maincent@bootlin.com>
Cc: Adam Duskett <aduskett@gmail.com>,
	thomas.petazzoni@bootlin.com, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v3 2/7] boot/grub2: add support to build multiple Grub2 configurations in the same build
Date: Thu, 14 Oct 2021 22:02:07 +0200	[thread overview]
Message-ID: <20211014200207.GC368016@scaer> (raw)
In-Reply-To: <20211011122736.3b0df127@kmaincent-XPS-13-7390>

Köry, All,

Sorry for my late reply, I've been pretty busy here...

On 2021-10-11 12:27 +0200, Köry Maincent spake thusly:
> On Thu, 7 Oct 2021 18:29:31 +0200
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > On 2021-10-07 14:43 +0200, Köry Maincent spake thusly:
> > > On Thu, 7 Oct 2021 11:53:26 +0200
> > > "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:  
> > [--SNIP--]
> 
> > In this case, this should not be too complex either; we just need a
> > post-image hook that copies all modules into TARGET_DIR, like:
> 
> Is something like the following code seems okay for you.
> I use temporary install-$(tuple) folder for the different platforms.
> We need to do the CONFIGURE_CMD_PTF as a PRE_CONFIGURE_HOOK because the
> CONFIGURE_CMDS from autotools is configuring inside the GRUB2_SRCDIR folder.
> Then if the ./configure has been run in the GRUB2_SRCDIR I can not run other
> configure command without receive this error message:
>   configure: error: source directory already configured; run "make distclean"
>   there first

Arg, I hadn't thought about this...

> To follow the logic I move all the *_CMDS_PTF as PRE_*_HOOK.
> I have tested it and it seems functioning.

But I'm afraid it is going to fail if you try to reconfigure the thing,
like:

    $ make grub2-reconfigure

So, in the end, your original proposal, to install each and every tuples
into target/, is probably the best option we have, and it can be as
simple as something like:

    diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
    index e01ebb2edb..a18696b6cc 100644
    --- a/boot/grub2/grub2.mk
    +++ b/boot/grub2/grub2.mk
    @@ -195,5 +195,13 @@ define GRUB2_INSTALL_IMAGES_CMDS
        )
     endef
     
    +ifeq ($(BR2_TARGET_GRUB2_INSTALL_TOOLS),y)
    +define GRUB2_INSTALL_TARGET_CMDS
    +	$(foreach tuple, $(GRUB2_TUPLES-y), \
    +		$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build-$(tuple) DESTDIR=$(TARGET_DIR) install
    +	)
    +endef
    +endif
    +
     $(eval $(generic-package))
     $(eval $(host-autotools-package))

Yes, this will indeed install the same tools more than once, but this is
not a problem: it is _not_ a case of a package overwriting files from
another package, but overwriting its own files, so we don't care.

Test-built with:

    BR2_x86_pentium4=y
    BR2_TOOLCHAIN_EXTERNAL=y
    BR2_TARGET_GRUB2=y
    BR2_TARGET_GRUB2_I386_PC=y
    BR2_TARGET_GRUB2_I386_EFI=y
    BR2_TARGET_GRUB2_INSTALL_TOOLS=y

Side note, unrelated to this issue: we have a parallel build issue with
grub2:

    2021-10-14 21:45:52 cd . && /bin/sh ./config.status config-util.h
    2021-10-14 21:45:52 config.status: creating config-util.h
    2021-10-14 21:45:52 bison -d -p grub_script_yy -b grub_script ../grub-core/script/parser.y
    2021-10-14 21:45:52 ../grub-core/script/parser.y:92.1-12: warning: deprecated directive: ‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated]
    2021-10-14 21:45:52    92 | %pure-parser
    2021-10-14 21:45:52       | ^~~~~~~~~~~~
    2021-10-14 21:45:52       | %define api.pure
    2021-10-14 21:45:52 ../grub-core/script/parser.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
    2021-10-14 21:45:52 /home/ymorin/dev/buildroot/O/host/bin/i686-linux-gcc -E -DHAVE_CONFIG_H -I. -I..  -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE="util/grub-fstest.c" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/gnulib -I../grub-core/lib/gnulib  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fno-stack-protector -D_FILE_OFFSET_BITS=64   -D'GRUB_MOD_INIT(x)=@MARKER@x@' ../util/grub-fstest.c ../grub-core/kern/emu/hostfs.c ../ grub-core/disk/host.c ../grub-core/osdep/init.c > grub_fstest.pp || (rm -f grub_fstest.pp; exit 1)
    2021-10-14 21:45:52 ../grub-core/kern/emu/hostfs.c:20:10: fatal error: config-util.h: No such file or directory
    2021-10-14 21:45:52    20 | #include <config-util.h>
    2021-10-14 21:45:52       |          ^~~~~~~~~~~~~~~
    2021-10-14 21:45:52 compilation terminated.
    2021-10-14 21:45:52 make[2]: *** [Makefile:13107: grub_fstest.pp] Error 1
    2021-10-14 21:45:52 make[2]: *** Waiting for unfinished jobs....

And re-starting the build succeeds.

But just looking at how config-util.h is actually created (in Makefile.in)
makes me cry:

   3389 config-util.h: stamp-h1
   3390     @test -f $@ || rm -f stamp-h1
   3391     @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
   3392
   3393 stamp-h1: $(srcdir)/config-util.h.in $(top_builddir)/config.status
   3394     @rm -f stamp-h1
   3395     cd $(top_builddir) && $(SHELL) ./config.status config-util.h

Whaaa?

But fortunately, it looks liek it is fixed with upstream commit
42f4054faf3c (Makefile: Make libgrub.pp depend on config-util.h).

Could you look into both the tools and the backport of the commit?

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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-10-14 20:02 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 [this message]
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
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=20211014200207.GC368016@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=aduskett@gmail.com \
    --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.