diff mbox series

boot/grub2/grub2.mk: Fix the installation of target tools

Message ID 20211021160612.475456-1-kory.maincent@bootlin.com
State Changes Requested
Headers show
Series boot/grub2/grub2.mk: Fix the installation of target tools | expand

Commit Message

Kory Maincent Oct. 21, 2021, 4:06 p.m. UTC
The tools was not installed anymore since we move from autotools to
generic-package. This patch fixes their installation.

We have decided to implement the install tool process by running the "make
install" command for each tuples. This allows to have all different
platforms Grub modules installed in the target. The drawback is the
overwrite of Grub2 binaries tools during each "make install" command. This
drawback is not really important as it happens in the same package. This is
the best option to avoid unnecessary and more complexity to this package.

Yann adds also mixes fixes, like no semi-colons but separate lines, or
using && not sime-colon, and the calls to MESSAGE to explicit the different
step of the parallel build.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Tested-by: Adam Duskett <aduskett@gmail.com>
---
 boot/grub2/grub2.mk | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

Comments

Thomas Petazzoni Oct. 21, 2021, 4:08 p.m. UTC | #1
On Thu, 21 Oct 2021 18:06:12 +0200
Kory Maincent <kory.maincent@bootlin.com> wrote:

> The tools was not installed anymore since we move from autotools to
> generic-package. This patch fixes their installation.
> 
> We have decided to implement the install tool process by running the "make
> install" command for each tuples. This allows to have all different
> platforms Grub modules installed in the target. The drawback is the
> overwrite of Grub2 binaries tools during each "make install" command. This
> drawback is not really important as it happens in the same package. This is
> the best option to avoid unnecessary and more complexity to this package.
> 
> Yann adds also mixes fixes, like no semi-colons but separate lines, or
> using && not sime-colon, and the calls to MESSAGE to explicit the different
> step of the parallel build.

Yann will ask to have these in a separate patch, I'm pretty sure (as I
would request the same).

Thanks!

Thomas
Yann E. MORIN Oct. 21, 2021, 6:09 p.m. UTC | #2
On 2021-10-21 18:06 +0200, Kory Maincent spake thusly:
> The tools was not installed anymore since we move from autotools to
            were
> generic-package. This patch fixes their installation.
> 
> We have decided to implement the install tool process by running the "make
> install" command for each tuples. This allows to have all different
                            tuple ('each' is a singular)

> platforms Grub modules installed in the target. The drawback is the
> overwrite of Grub2 binaries tools during each "make install" command. This
> drawback is not really important as it happens in the same package. This is
s/not really/absolutely not/  ;-)

> the best option to avoid unnecessary and more complexity to this package.

Yes, agreed.

> Yann adds also mixes fixes, like no semi-colons but separate lines, or
                 misc
> using && not sime-colon, and the calls to MESSAGE to explicit the different
               semi

Yeah, another guy doing typoes like I do! I like that! :-)

> step of the parallel build.
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Tested-by: Adam Duskett <aduskett@gmail.com>

As Thomas already replied, this should be done in separate patches:
  - fix the tools installation
  - remove the unnecessary \-continuations
  - adding the MESSAGES calls

Regards,
Yann E. MORIN.

> ---
>  boot/grub2/grub2.mk | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
> index e01ebb2edb..19047d02f7 100644
> --- a/boot/grub2/grub2.mk
> +++ b/boot/grub2/grub2.mk
> @@ -149,8 +149,9 @@ HOST_GRUB2_CONF_OPTS = \
>  
>  define GRUB2_CONFIGURE_CMDS
>  	$(foreach tuple, $(GRUB2_TUPLES-y), \
> -		mkdir -p $(@D)/build-$(tuple) ; \
> -		cd $(@D)/build-$(tuple) ; \
> +		@$(call MESSAGE,Configuring $(tuple))
> +		mkdir -p $(@D)/build-$(tuple)
> +		cd $(@D)/build-$(tuple) && \
>  		$(TARGET_CONFIGURE_OPTS) \
>  		$(TARGET_CONFIGURE_ARGS) \
>  		$(GRUB2_CONF_ENV) \
> @@ -172,13 +173,15 @@ endef
>  
>  define GRUB2_BUILD_CMDS
>  	$(foreach tuple, $(GRUB2_TUPLES-y), \
> +		@$(call MESSAGE,Building $(tuple))
>  		$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build-$(tuple)
>  	)
>  endef
>  
>  define GRUB2_INSTALL_IMAGES_CMDS
>  	$(foreach tuple, $(GRUB2_TUPLES-y), \
> -		mkdir -p $(dir $(GRUB2_IMAGE_$(tuple))) ; \
> +		@$(call MESSAGE,Installing $(tuple) to images directory)
> +		mkdir -p $(dir $(GRUB2_IMAGE_$(tuple)))
>  		$(HOST_DIR)/usr/bin/grub-mkimage \
>  			-d $(@D)/build-$(tuple)/grub-core/ \
>  			-O $(tuple) \
> @@ -186,14 +189,23 @@ define GRUB2_INSTALL_IMAGES_CMDS
>  			-p "$(GRUB2_PREFIX_$(tuple))" \
>  			$(if $(GRUB2_BUILTIN_CONFIG_$(tuple)), \
>  				-c $(GRUB2_BUILTIN_CONFIG_$(tuple))) \
> -			$(GRUB2_BUILTIN_MODULES_$(tuple)) ; \
> -		$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG_$(tuple)) ; \
> +			$(GRUB2_BUILTIN_MODULES_$(tuple))
> +		$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG_$(tuple))
>  		$(if $(findstring $(GRUB2_PLATFORM_$(tuple)), pc), \
>  			cat $(HOST_DIR)/lib/grub/$(tuple)/cdboot.img $(GRUB2_IMAGE_$(tuple)) > \
> -				$(BINARIES_DIR)/grub-eltorito.img ; \
> +				$(BINARIES_DIR)/grub-eltorito.img
>  		) \
>  	)
>  endef
>  
> +ifeq ($(BR2_TARGET_GRUB2_INSTALL_TOOLS),y)
> +define GRUB2_INSTALL_TARGET_CMDS
> +	$(foreach tuple, $(GRUB2_TUPLES-y), \
> +		@$(call MESSAGE,Installing $(tuple) to target directory)
> +		$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build-$(tuple) DESTDIR=$(TARGET_DIR) install
> +	)
> +endef
> +endif
> +
>  $(eval $(generic-package))
>  $(eval $(host-autotools-package))
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
index e01ebb2edb..19047d02f7 100644
--- a/boot/grub2/grub2.mk
+++ b/boot/grub2/grub2.mk
@@ -149,8 +149,9 @@  HOST_GRUB2_CONF_OPTS = \
 
 define GRUB2_CONFIGURE_CMDS
 	$(foreach tuple, $(GRUB2_TUPLES-y), \
-		mkdir -p $(@D)/build-$(tuple) ; \
-		cd $(@D)/build-$(tuple) ; \
+		@$(call MESSAGE,Configuring $(tuple))
+		mkdir -p $(@D)/build-$(tuple)
+		cd $(@D)/build-$(tuple) && \
 		$(TARGET_CONFIGURE_OPTS) \
 		$(TARGET_CONFIGURE_ARGS) \
 		$(GRUB2_CONF_ENV) \
@@ -172,13 +173,15 @@  endef
 
 define GRUB2_BUILD_CMDS
 	$(foreach tuple, $(GRUB2_TUPLES-y), \
+		@$(call MESSAGE,Building $(tuple))
 		$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build-$(tuple)
 	)
 endef
 
 define GRUB2_INSTALL_IMAGES_CMDS
 	$(foreach tuple, $(GRUB2_TUPLES-y), \
-		mkdir -p $(dir $(GRUB2_IMAGE_$(tuple))) ; \
+		@$(call MESSAGE,Installing $(tuple) to images directory)
+		mkdir -p $(dir $(GRUB2_IMAGE_$(tuple)))
 		$(HOST_DIR)/usr/bin/grub-mkimage \
 			-d $(@D)/build-$(tuple)/grub-core/ \
 			-O $(tuple) \
@@ -186,14 +189,23 @@  define GRUB2_INSTALL_IMAGES_CMDS
 			-p "$(GRUB2_PREFIX_$(tuple))" \
 			$(if $(GRUB2_BUILTIN_CONFIG_$(tuple)), \
 				-c $(GRUB2_BUILTIN_CONFIG_$(tuple))) \
-			$(GRUB2_BUILTIN_MODULES_$(tuple)) ; \
-		$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG_$(tuple)) ; \
+			$(GRUB2_BUILTIN_MODULES_$(tuple))
+		$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG_$(tuple))
 		$(if $(findstring $(GRUB2_PLATFORM_$(tuple)), pc), \
 			cat $(HOST_DIR)/lib/grub/$(tuple)/cdboot.img $(GRUB2_IMAGE_$(tuple)) > \
-				$(BINARIES_DIR)/grub-eltorito.img ; \
+				$(BINARIES_DIR)/grub-eltorito.img
 		) \
 	)
 endef
 
+ifeq ($(BR2_TARGET_GRUB2_INSTALL_TOOLS),y)
+define GRUB2_INSTALL_TARGET_CMDS
+	$(foreach tuple, $(GRUB2_TUPLES-y), \
+		@$(call MESSAGE,Installing $(tuple) to target directory)
+		$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build-$(tuple) DESTDIR=$(TARGET_DIR) install
+	)
+endef
+endif
+
 $(eval $(generic-package))
 $(eval $(host-autotools-package))