All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv)
@ 2021-12-03 23:17 Yann E. MORIN
  2021-12-03 23:17 ` [Buildroot] [PATCH 1/3] boot/grub2/Config.in: add symbols to represent legacy and EFI boot Yann E. MORIN
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Yann E. MORIN @ 2021-12-03 23:17 UTC (permalink / raw)
  To: buildroot; +Cc: Köry Maincent, Yann E . MORIN, Adam Duskett

Hello All!

The grub2 rework to support multi platforms in a single build, broke
mender-grubenv.

This small series, a joint work kick-started by Adam and slightly
reworked by me, is a proposal to eventually fix that mess.

Regards,
Yann E. MORIN.


----------------------------------------------------------------
Adam Duskett (2):
      boot/grub2/Config.in: add symbols to represent legacy and EFI boot
      package/mender-grubenv: fix grub module checks

Yann E. MORIN (1):
      package/mender-grubenv: fix modules list help and variable

 boot/grub2/Config.in                     | 22 +++++++++---
 package/mender-grubenv/Config.in         |  7 +++-
 package/mender-grubenv/mender-grubenv.mk | 57 ++++++++++++++++++++------------
 3 files changed, 59 insertions(+), 27 deletions(-)

-- 
.-----------------.--------------------.------------------.--------------------.
|  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

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

* [Buildroot] [PATCH 1/3] boot/grub2/Config.in: add symbols to represent legacy and EFI boot
  2021-12-03 23:17 [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN
@ 2021-12-03 23:17 ` Yann E. MORIN
  2021-12-03 23:17 ` [Buildroot] [PATCH 2/3] package/mender-grubenv: fix modules list help and variable Yann E. MORIN
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2021-12-03 23:17 UTC (permalink / raw)
  To: buildroot; +Cc: Köry Maincent, Yann E . MORIN, Adam Duskett

From: Adam Duskett <aduskett@gmail.com>

There are cases to want a synthetic information whether the legacy BIOS
or U-Boot boot scheme, or the EFI boot scheme, are enabled, without
resorting to testing all and each platforms.

This is already the cae in grub2 itself, for the configuration of the
BIOS/U-Boot boot partition, and builtin modules and configuration on one
hand, and the EFI builtin modules and configuraiton on the other hand.

It is also the case for mender-grubenv, which will want to know if
either or both are enabled, but without having to resort to testing all
the cases.

Add two new symbols, that each represent those conditions:
  * BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
  * BR2_TARGET_GRUB2_HAS_EFI_BOOT

Each target selects the appropriate bool, which makes it much more
simple for other packages such as mender-grubenv to check if grub legacy
or EFI is selected.

And of course, we also make use of those symbols in grub2 itself, to
simplify the conditions for showing.hiding legacy and EFI options.

Additionally (but that does not merit being in its own patch), add a
comment on the closing 'endif' for the EFI part.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Köry Maincent <kory.maincent@bootlin.com>

---
Changes v5 -> v6 (Adam):
  - new patch

Changes v6 -> v7: (Yann):
  - s/BR2_TARGET_GRUB_/BR2_TARGET_GRUB2_/
  - rename variables anyway
  - use variables in grub2 itself
---
 boot/grub2/Config.in | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
index 7bbe697932..92b5dd501b 100644
--- a/boot/grub2/Config.in
+++ b/boot/grub2/Config.in
@@ -34,12 +34,19 @@ config BR2_TARGET_GRUB2
 
 if BR2_TARGET_GRUB2
 
+config BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
+	bool
+
+config BR2_TARGET_GRUB2_HAS_EFI_BOOT
+	bool
+
 config BR2_TARGET_GRUB2_HAS_PTF
 	bool
 
 config BR2_TARGET_GRUB2_I386_PC
 	bool "i386-pc"
 	depends on BR2_i386 || BR2_x86_64
+	select BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
 	help
 	  Select this option if the platform you're targetting is a
 	  x86 or x86-64 legacy BIOS based platform.
@@ -48,6 +55,7 @@ config BR2_TARGET_GRUB2_I386_EFI
 	bool "i386-efi"
 	depends on BR2_i386 || BR2_x86_64
 	select BR2_TARGET_GRUB2_HAS_PTF
+	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
 	help
 	  Select this option if the platform you're targetting has a
 	  32 bits EFI BIOS. Note that some x86-64 platforms use a 32
@@ -57,6 +65,7 @@ config BR2_TARGET_GRUB2_X86_64_EFI
 	bool "x86-64-efi"
 	depends on BR2_x86_64
 	select BR2_TARGET_GRUB2_HAS_PTF
+	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
 	help
 	  Select this option if the platform you're targetting has a
 	  64 bits EFI BIOS.
@@ -64,6 +73,7 @@ config BR2_TARGET_GRUB2_X86_64_EFI
 config BR2_TARGET_GRUB2_ARM_UBOOT
 	bool "arm-uboot"
 	depends on BR2_arm
+	select BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
 	help
 	  Select this option if the platform you're targetting is an
 	  ARM u-boot platform, and you want to boot Grub 2 as an u-boot
@@ -73,6 +83,7 @@ config BR2_TARGET_GRUB2_ARM_EFI
 	bool "arm-efi"
 	depends on BR2_arm
 	select BR2_TARGET_GRUB2_HAS_PTF
+	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
 	help
 	  Select this option if the platform you're targetting is an
 	  ARM platform and you want to boot Grub 2 as an EFI
@@ -81,12 +92,13 @@ config BR2_TARGET_GRUB2_ARM_EFI
 config BR2_TARGET_GRUB2_ARM64_EFI
 	bool "arm64-efi"
 	depends on BR2_aarch64
+	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
 	help
 	  Select this option if the platform you're targetting is an
 	  Aarch64 platform and you want to boot Grub 2 as an EFI
 	  application.
 
-if BR2_TARGET_GRUB2_I386_PC || BR2_TARGET_GRUB2_ARM_UBOOT
+if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
 
 comment "Options for the x86 legacy BIOS or ARM U-Boot support"
 
@@ -114,10 +126,9 @@ config BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC
 	  device and other configuration parameters, but however menu
 	  entries cannot be described in this embedded configuration.
 
-endif # BR2_TARGET_GRUB2_I386_PC || BR2_TARGET_GRUB2_ARM_UBOOT
+endif # BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
 
-if BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI || \
-	BR2_TARGET_GRUB2_ARM_EFI  || BR2_TARGET_GRUB2_ARM64_EFI
+if BR2_TARGET_GRUB2_HAS_EFI_BOOT
 
 comment "Options for the EFI BIOS or ARM EFI support"
 
@@ -135,7 +146,8 @@ config BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI
 	  device and other configuration parameters, but however menu
 	  entries cannot be described in this embedded configuration.
 
-endif
+endif # BR2_TARGET_GRUB2_HAS_EFI_BOOT
+
 config BR2_TARGET_GRUB2_INSTALL_TOOLS
 	bool "install tools"
 	help
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 2/3] package/mender-grubenv: fix modules list help and variable
  2021-12-03 23:17 [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN
  2021-12-03 23:17 ` [Buildroot] [PATCH 1/3] boot/grub2/Config.in: add symbols to represent legacy and EFI boot Yann E. MORIN
@ 2021-12-03 23:17 ` Yann E. MORIN
  2021-12-03 23:17 ` [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks Yann E. MORIN
  2021-12-04 17:25 ` [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN
  3 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2021-12-03 23:17 UTC (permalink / raw)
  To: buildroot; +Cc: Köry Maincent, Yann E. MORIN, Adam Duskett

The help was missing the regexp module.

The variable assignment was missing spaces around the equal sign.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
[yann.morin.1998@free.fr:
  - split to its own patch
  - fix assignment too
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Köry Maincent <kory.maincent@bootlin.com>
---
 package/mender-grubenv/Config.in         | 2 +-
 package/mender-grubenv/mender-grubenv.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/mender-grubenv/Config.in b/package/mender-grubenv/Config.in
index 97f785ad3f..38da5b84fe 100644
--- a/package/mender-grubenv/Config.in
+++ b/package/mender-grubenv/Config.in
@@ -8,7 +8,7 @@ config BR2_PACKAGE_MENDER_GRUBENV
 	  integrate with the GRUB bootloader.
 
 	  The following Grub modules must be selected for this package:
-	  loadenv hashsum echo halt gcry_sha256 test
+	  loadenv hashsum echo halt gcry_sha256 test regexp
 
 	  https://github.com/mendersoftware/grub-mender-grubenv
 
diff --git a/package/mender-grubenv/mender-grubenv.mk b/package/mender-grubenv/mender-grubenv.mk
index 07df25512c..d7bdcc99eb 100644
--- a/package/mender-grubenv/mender-grubenv.mk
+++ b/package/mender-grubenv/mender-grubenv.mk
@@ -30,7 +30,7 @@ MENDER_GRUBENV_DEFINES = \
 
 # These grub modules must be built in for the grub scripts to work properly.
 # Without them, the system will not boot.
-MENDER_GRUBENV_MANDATORY_MODULES=loadenv hashsum echo halt gcry_sha256 test regexp
+MENDER_GRUBENV_MANDATORY_MODULES = loadenv hashsum echo halt gcry_sha256 test regexp
 MENDER_GRUBENV_MODULES_MISSING = \
 	$(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES)),\
 		$(MENDER_GRUBENV_MANDATORY_MODULES))
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks
  2021-12-03 23:17 [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN
  2021-12-03 23:17 ` [Buildroot] [PATCH 1/3] boot/grub2/Config.in: add symbols to represent legacy and EFI boot Yann E. MORIN
  2021-12-03 23:17 ` [Buildroot] [PATCH 2/3] package/mender-grubenv: fix modules list help and variable Yann E. MORIN
@ 2021-12-03 23:17 ` Yann E. MORIN
  2021-12-04  9:17   ` Yann E. MORIN
  2021-12-04 22:36   ` Peter Korsgaard
  2021-12-04 17:25 ` [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN
  3 siblings, 2 replies; 9+ messages in thread
From: Yann E. MORIN @ 2021-12-03 23:17 UTC (permalink / raw)
  To: buildroot; +Cc: Köry Maincent, Yann E . MORIN, Adam Duskett

From: Adam Duskett <aduskett@gmail.com>

Commit b68810e70cbd (boot/grub2: add support to build multiple Grub2
configurations in the same build) broke mender-grubenv by splititng up
BR2_TARGET_GRUB2_BUILTIN_MODULES into two separate symbols, one for
legacy boot and one for EFI boot.

This change causes a systematic build failure now, as the legacy variable
BR2_TARGET_GRUB2_BUILTIN_MODULES is now always empty (during build).

We fix that by supplicating the missing modules to check: one for EFI and
one for legacy boot.

The EFI check is tricky: Indeed, there can be more than one EFI platform
enabled simultaneously; indeed, on x86_64, we can have both the 32-bit
and 64-bit EFI platforms enabled. So the check is inverted, and we check
that no platform is not enabled (yeah, double negation). For consistency,
we do the same for the legacy boot, even though in that case, there can
only ever be only one enabled at once at most.

Furthermore, mender-grubenv does not support multiple installations of
grub concurrently; it can only be installed for either legacy or EFI,
not both at the same time: /etc/mender-grubenv.cfg, its configuration
file, can only contain settings for one or the other, not both.

So we add a new check to Config.in to support only one grub installation
type at a time.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Köry Maincent <kory.maincent@bootlin.com>

---
changes v1 -> v2:
  - Change ifeq ($(BR2_TARGET_GRUB2_X86_64_EFI),y) to
    ifneq ($(BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI),) to cover all grub2
efi
    scenarios. (Thomas)

  - Change BR2_TARGET_GRUB2_BUILTIN_MODULES to
    BR2_TARGET_GRUB2_BUILTIN_MODULES_PC (thomas)

Changes v2 -> v3:
  - Check for both MODULES_EFI and MODULES_PC (Thomas)

Changes v3 -> v4:
  - Add qstrips to needed variables (Thomas)
  - Check for empty module lists (Thomas)
  - Split up MENDER_GRUBENV_INSTALL_IMAGES_CMDS to work with pc and efi
    at the
    same time.

Changes v4 -> v5 (Yann):
  - drop superfluous check on empty modules lists
  - move EFI and legacy commands under same condition as checks

Changes v5 -> v6 (Adam):
  - Add a check in Config.in to ensure only one grub target is selected
  - Clean up the commit grammar.

Changes v6 -> v7:
  - variables were renamed
  - misc eye-candy
---
 package/mender-grubenv/Config.in         |  5 +++
 package/mender-grubenv/mender-grubenv.mk | 55 +++++++++++++++---------
 2 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/package/mender-grubenv/Config.in b/package/mender-grubenv/Config.in
index 38da5b84fe..33d63fbfa3 100644
--- a/package/mender-grubenv/Config.in
+++ b/package/mender-grubenv/Config.in
@@ -3,6 +3,8 @@ config BR2_PACKAGE_MENDER_GRUBENV
 	depends on BR2_TARGET_GRUB2_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_MENDER # runtime
 	depends on BR2_TARGET_GRUB2
+	depends on (BR2_TARGET_GRUB2_HAS_LEGACY_BOOT && !BR2_TARGET_GRUB2_HAS_EFI_BOOT) || \
+		(BR2_TARGET_GRUB2_HAS_LEGACY_BOOT && !BR2_TARGET_GRUB2_HAS_EFI_BOOT)
 	help
 	  Contains the boot scripts and tools used by Mender to
 	  integrate with the GRUB bootloader.
@@ -34,3 +36,6 @@ comment "mender-grubenv needs a grub2 bootloader"
 	depends on BR2_TARGET_GRUB2_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_MENDER
 	depends on !BR2_TARGET_GRUB2
+
+comment "mender-grubenv does not support both legacy and EFI grub2 bootloaders at the same time"
+	depends on BR2_TARGET_GRUB2_HAS_LEGACY_BOOT && BR2_TARGET_GRUB2_HAS_EFI_BOOT
diff --git a/package/mender-grubenv/mender-grubenv.mk b/package/mender-grubenv/mender-grubenv.mk
index d7bdcc99eb..dd0cf7e4f9 100644
--- a/package/mender-grubenv/mender-grubenv.mk
+++ b/package/mender-grubenv/mender-grubenv.mk
@@ -13,7 +13,7 @@ MENDER_GRUBENV_LICENSE_FILES = LICENSE
 MENDER_GRUBENV_DEPENDENCIES = grub2
 MENDER_GRUBENV_INSTALL_IMAGES = YES
 
-ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
+ifeq ($(BR2_TARGET_GRUB_LEGACY)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
 MENDER_GRUBENV_ENV_DIR = /boot/grub
 else
 MENDER_GRUBENV_ENV_DIR = /boot/EFI/BOOT
@@ -31,14 +31,41 @@ MENDER_GRUBENV_DEFINES = \
 # These grub modules must be built in for the grub scripts to work properly.
 # Without them, the system will not boot.
 MENDER_GRUBENV_MANDATORY_MODULES = loadenv hashsum echo halt gcry_sha256 test regexp
-MENDER_GRUBENV_MODULES_MISSING = \
-	$(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES)),\
+
+ifeq ($(BR2_TARGET_GRUB2_HAS_LEGACY_BOOT),y)
+MENDER_GRUBENV_MODULES_MISSING_PC = \
+	$(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES_PC)),\
 		$(MENDER_GRUBENV_MANDATORY_MODULES))
 
+define MENDER_GRUBENV_INSTALL_I386_CFG
+	mkdir -p $(BINARIES_DIR)/boot-part/grub
+	cp -dpfr $(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/grub.cfg \
+		$(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/mender_grubenv* \
+		$(BINARIES_DIR)/boot-part/grub
+endef
+endif # BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
+
+ifeq ($(BR2_TARGET_GRUB2_HAS_EFI_BOOT),y)
+MENDER_GRUBENV_MODULES_MISSING_EFI = \
+	$(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI)),\
+		$(MENDER_GRUBENV_MANDATORY_MODULES))
+
+define MENDER_GRUBENV_INSTALL_EFI_CFG
+	mkdir -p $(BINARIES_DIR)/efi-part/EFI/BOOT
+	cp -dpfr $(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/grub.cfg \
+		$(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/mender_grubenv* \
+		$(BINARIES_DIR)/efi-part/EFI/BOOT
+endef
+endif # BR2_TARGET_GRUB2_HAS_EFI_BOOT
+
 ifeq ($(BR2_PACKAGE_MENDER_GRUBENV)$(BR_BUILDING),yy)
-ifneq ($(MENDER_GRUBENV_MODULES_MISSING),)
-$(error The following missing grub2 modules must be enabled for mender-grubenv \
-	to work: $(MENDER_GRUBENV_MODULES_MISSING))
+ifneq ($(MENDER_GRUBENV_MODULES_MISSING_EFI),)
+$(error The following missing grub2 efi modules must be enabled for mender-grubenv \
+	to work: $(MENDER_GRUBENV_MODULES_MISSING_EFI))
+endif
+ifneq ($(MENDER_GRUBENV_MODULES_MISSING_PC),)
+$(error The following missing grub2 pc modules must be enabled for mender-grubenv \
+	to work: $(MENDER_GRUBENV_MODULES_MISSING_PC))
 endif
 endif
 
@@ -54,21 +81,9 @@ define MENDER_GRUBENV_INSTALL_TARGET_CMDS
 	$(MENDER_GRUBENV_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install
 endef
 
-# Overwrite the default grub2 config files with the ones in this package.
-ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
 define MENDER_GRUBENV_INSTALL_IMAGES_CMDS
-	mkdir -p $(BINARIES_DIR)/boot-part/grub
-	cp -dpfr $(TARGET_DIR)/boot/grub/grub.cfg \
-		$(TARGET_DIR)/boot/grub/mender_grubenv* \
-		$(BINARIES_DIR)/boot-part/grub
+	$(MENDER_GRUBENV_INSTALL_I386_CFG)
+	$(MENDER_GRUBENV_INSTALL_EFI_CFG)
 endef
-else
-define MENDER_GRUBENV_INSTALL_IMAGES_CMDS
-	mkdir -p $(BINARIES_DIR)/efi-part/EFI/BOOT
-	cp -dpfr $(TARGET_DIR)/boot/EFI/BOOT/grub.cfg \
-		$(TARGET_DIR)/boot/EFI/BOOT/mender_grubenv* \
-		$(BINARIES_DIR)/efi-part/EFI/BOOT
-endef
-endif
 
 $(eval $(generic-package))
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks
  2021-12-03 23:17 ` [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks Yann E. MORIN
@ 2021-12-04  9:17   ` Yann E. MORIN
  2021-12-04 22:36   ` Peter Korsgaard
  1 sibling, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2021-12-04  9:17 UTC (permalink / raw)
  To: buildroot; +Cc: Köry Maincent, Adam Duskett

Me, All,

On 2021-12-04 00:17 +0100, Yann E. MORIN spake thusly:
> From: Adam Duskett <aduskett@gmail.com>
> Commit b68810e70cbd (boot/grub2: add support to build multiple Grub2
> configurations in the same build) broke mender-grubenv by splititng up
> BR2_TARGET_GRUB2_BUILTIN_MODULES into two separate symbols, one for
> legacy boot and one for EFI boot.
> 
> This change causes a systematic build failure now, as the legacy variable
> BR2_TARGET_GRUB2_BUILTIN_MODULES is now always empty (during build).
> 
> We fix that by supplicating the missing modules to check: one for EFI and
> one for legacy boot.
> 
> The EFI check is tricky: Indeed, there can be more than one EFI platform
> enabled simultaneously; indeed, on x86_64, we can have both the 32-bit
> and 64-bit EFI platforms enabled. So the check is inverted, and we check
> that no platform is not enabled (yeah, double negation). For consistency,
> we do the same for the legacy boot, even though in that case, there can
> only ever be only one enabled at once at most.
> 
> Furthermore, mender-grubenv does not support multiple installations of
> grub concurrently; it can only be installed for either legacy or EFI,
> not both at the same time: /etc/mender-grubenv.cfg, its configuration
> file, can only contain settings for one or the other, not both.
> 
> So we add a new check to Config.in to support only one grub installation
> type at a time.
> 
> Signed-off-by: Adam Duskett <aduskett@gmail.com>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Köry Maincent <kory.maincent@bootlin.com>
[--SNIP--]
> diff --git a/package/mender-grubenv/Config.in b/package/mender-grubenv/Config.in
> index 38da5b84fe..33d63fbfa3 100644
> --- a/package/mender-grubenv/Config.in
> +++ b/package/mender-grubenv/Config.in
[--SNIP--]
> @@ -34,3 +36,6 @@ comment "mender-grubenv needs a grub2 bootloader"
>  	depends on BR2_TARGET_GRUB2_ARCH_SUPPORTS
>  	depends on BR2_PACKAGE_MENDER
>  	depends on !BR2_TARGET_GRUB2
> +
> +comment "mender-grubenv does not support both legacy and EFI grub2 bootloaders at the same time"
> +	depends on BR2_TARGET_GRUB2_HAS_LEGACY_BOOT && BR2_TARGET_GRUB2_HAS_EFI_BOOT

Missing dependency on BR2_PACKAGE_MENDER

> diff --git a/package/mender-grubenv/mender-grubenv.mk b/package/mender-grubenv/mender-grubenv.mk
> index d7bdcc99eb..dd0cf7e4f9 100644
> --- a/package/mender-grubenv/mender-grubenv.mk
> +++ b/package/mender-grubenv/mender-grubenv.mk
> @@ -13,7 +13,7 @@ MENDER_GRUBENV_LICENSE_FILES = LICENSE
>  MENDER_GRUBENV_DEPENDENCIES = grub2
>  MENDER_GRUBENV_INSTALL_IMAGES = YES
>  
> -ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
> +ifeq ($(BR2_TARGET_GRUB_LEGACY)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)

The ARM U-Boot part is superfluous, now.

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

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

* Re: [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv)
  2021-12-03 23:17 [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN
                   ` (2 preceding siblings ...)
  2021-12-03 23:17 ` [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks Yann E. MORIN
@ 2021-12-04 17:25 ` Yann E. MORIN
  3 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2021-12-04 17:25 UTC (permalink / raw)
  To: buildroot; +Cc: Köry Maincent, Adam Duskett

Adam, All,

On 2021-12-04 00:17 +0100, Yann E. MORIN spake thusly:
> The grub2 rework to support multi platforms in a single build, broke
> mender-grubenv.
> 
> This small series, a joint work kick-started by Adam and slightly
> reworked by me, is a proposal to eventually fix that mess.
> 
> ----------------------------------------------------------------
> Adam Duskett (2):
>       boot/grub2/Config.in: add symbols to represent legacy and EFI boot
>       package/mender-grubenv: fix grub module checks
> 
> Yann E. MORIN (1):
>       package/mender-grubenv: fix modules list help and variable

Series finally Applied to master, thanks,

Regards,
Yann E. MORIN.

>  boot/grub2/Config.in                     | 22 +++++++++---
>  package/mender-grubenv/Config.in         |  7 +++-
>  package/mender-grubenv/mender-grubenv.mk | 57 ++++++++++++++++++++------------
>  3 files changed, 59 insertions(+), 27 deletions(-)
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  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.  |
> '------------------------------^-------^------------------^--------------------'

-- 
.-----------------.--------------------.------------------.--------------------.
|  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

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

* Re: [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks
  2021-12-03 23:17 ` [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks Yann E. MORIN
  2021-12-04  9:17   ` Yann E. MORIN
@ 2021-12-04 22:36   ` Peter Korsgaard
  2021-12-04 22:38     ` Peter Korsgaard
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2021-12-04 22:36 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Köry Maincent, Adam Duskett, buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

Hi,

 > From: Adam Duskett <aduskett@gmail.com>
 > Commit b68810e70cbd (boot/grub2: add support to build multiple Grub2
 > configurations in the same build) broke mender-grubenv by splititng up
 > BR2_TARGET_GRUB2_BUILTIN_MODULES into two separate symbols, one for
 > legacy boot and one for EFI boot.

..

 > +++ b/package/mender-grubenv/mender-grubenv.mk
 > @@ -13,7 +13,7 @@ MENDER_GRUBENV_LICENSE_FILES = LICENSE
 >  MENDER_GRUBENV_DEPENDENCIES = grub2
 >  MENDER_GRUBENV_INSTALL_IMAGES = YES
 
 > -ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
 > +ifeq ($(BR2_TARGET_GRUB_LEGACY)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
 >  MENDER_GRUBENV_ENV_DIR = /boot/grub

Should this not be BR2_TARGET_GRUB2_HAS_LEGACY_BOOT?

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks
  2021-12-04 22:36   ` Peter Korsgaard
@ 2021-12-04 22:38     ` Peter Korsgaard
  2021-12-04 22:55       ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2021-12-04 22:38 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Köry Maincent, Adam Duskett, buildroot

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
 > Hi,

 >> From: Adam Duskett <aduskett@gmail.com>
 >> Commit b68810e70cbd (boot/grub2: add support to build multiple Grub2
 >> configurations in the same build) broke mender-grubenv by splititng up
 >> BR2_TARGET_GRUB2_BUILTIN_MODULES into two separate symbols, one for
 >> legacy boot and one for EFI boot.

 > ..

 >> +++ b/package/mender-grubenv/mender-grubenv.mk
 >> @@ -13,7 +13,7 @@ MENDER_GRUBENV_LICENSE_FILES = LICENSE
 >> MENDER_GRUBENV_DEPENDENCIES = grub2
 >> MENDER_GRUBENV_INSTALL_IMAGES = YES
 
 >> -ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
 >> +ifeq ($(BR2_TARGET_GRUB_LEGACY)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
 >> MENDER_GRUBENV_ENV_DIR = /boot/grub

 > Should this not be BR2_TARGET_GRUB2_HAS_LEGACY_BOOT?

In fact, what seems to have been committed is:

ifeq ($(BR2_TARGET_GRUB_LEGACY),y)

What happened to the _ARM_UBOOT part?

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks
  2021-12-04 22:38     ` Peter Korsgaard
@ 2021-12-04 22:55       ` Yann E. MORIN
  0 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2021-12-04 22:55 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Köry Maincent, Adam Duskett, buildroot

Peter, All,

On 2021-12-04 23:38 +0100, Peter Korsgaard spake thusly:
> >>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>  >> From: Adam Duskett <aduskett@gmail.com>
>  >> Commit b68810e70cbd (boot/grub2: add support to build multiple Grub2
>  >> configurations in the same build) broke mender-grubenv by splititng up
>  >> BR2_TARGET_GRUB2_BUILTIN_MODULES into two separate symbols, one for
>  >> legacy boot and one for EFI boot.
> 
>  >> +++ b/package/mender-grubenv/mender-grubenv.mk
>  >> @@ -13,7 +13,7 @@ MENDER_GRUBENV_LICENSE_FILES = LICENSE
>  >> MENDER_GRUBENV_DEPENDENCIES = grub2
>  >> MENDER_GRUBENV_INSTALL_IMAGES = YES
>  
>  >> -ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
>  >> +ifeq ($(BR2_TARGET_GRUB_LEGACY)$(BR2_TARGET_GRUB2_ARM_UBOOT),y)
>  >> MENDER_GRUBENV_ENV_DIR = /boot/grub
> 
>  > Should this not be BR2_TARGET_GRUB2_HAS_LEGACY_BOOT?

Gah. This is a place I forgot to fix after I renamed the variables.

> In fact, what seems to have been committed is:
> ifeq ($(BR2_TARGET_GRUB_LEGACY),y)
> What happened to the _ARM_UBOOT part?

The _ARM_UBOOT is implied because it selects _HAS_LEGACY_BOOT:

    https://git.buildroot.org/buildroot/tree/boot/grub2/Config.in#n73

    config BR2_TARGET_GRUB2_ARM_UBOOT
        bool "arm-uboot"
        depends on BR2_arm
        select BR2_TARGET_GRUB2_HAS_LEGACY_BOOT

I'll apply a fixup commit, sorry for the mess... :-/

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

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

end of thread, other threads:[~2021-12-04 22:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 23:17 [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN
2021-12-03 23:17 ` [Buildroot] [PATCH 1/3] boot/grub2/Config.in: add symbols to represent legacy and EFI boot Yann E. MORIN
2021-12-03 23:17 ` [Buildroot] [PATCH 2/3] package/mender-grubenv: fix modules list help and variable Yann E. MORIN
2021-12-03 23:17 ` [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks Yann E. MORIN
2021-12-04  9:17   ` Yann E. MORIN
2021-12-04 22:36   ` Peter Korsgaard
2021-12-04 22:38     ` Peter Korsgaard
2021-12-04 22:55       ` Yann E. MORIN
2021-12-04 17:25 ` [Buildroot] [PATCH 0/3] package/mender-grubenv: fix breakage after grub2 rework (branch yem/mender-grubenv) Yann E. MORIN

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.