All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] boot/grub2: memdisk option
Date: Sun, 19 May 2019 19:00:21 +0200	[thread overview]
Message-ID: <20190519170021.GA5097@scaer> (raw)
In-Reply-To: <20190519113526.25633-1-skif@skif-web.ru>

Alexey, All,

On 2019-05-19 14:35 +0300, Alexey Lukyanchuk spake thusly:
> Allows to create grub2 memdisk from specified directory

Can you expand a bit on what you're trying to achieve with this?

> Signed-off-by: Alexey Lukyanchuk <skif@skif-web.ru>
> ---
>  boot/grub2/Config.in |  5 +++++
>  boot/grub2/grub2.mk  | 14 ++++++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
> index e45133999e..15c2db1a06 100644
> --- a/boot/grub2/Config.in
> +++ b/boot/grub2/Config.in
> @@ -116,6 +116,11 @@ config BR2_TARGET_GRUB2_INSTALL_TOOLS
>  	  This will also install the Grub 2 loadable modules to the
>  	  target.
>  
> +config BR2_ROOTFS_ISO9660_ADDITIONAL_FILES
> +	string "Add additional files to iso"
> +	help
> +	  Use this option to add any additional files to iso

This patch is about grub2, so the option is incorrectly mnamed, its
prompt is incorrect, and the help text is incorrect too, as they refer
to iso, not grub2.

>  endif # BR2_TARGET_GRUB2
>  
>  comment "grub2 needs a toolchain w/ wchar"
> diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
> index 65371f0170..04166ddec9 100644
> --- a/boot/grub2/grub2.mk
> +++ b/boot/grub2/grub2.mk
> @@ -114,6 +114,19 @@ define GRUB2_IMAGE_INSTALL_ELTORITO
>  endef
>  endif
>  
> +ifneq ($(BR2_TARGET_GRUB2_MEMDISK_DIR),)
> +GRUB2_POST_BUILD_HOOKS += GRUB2_MAKE_MEMDISK
> +define GRUB2_MAKE_MEMDISK
> +	# clean artefacs from previos build

s/previos/previous/

> +	rm -rf $(HOST_DIR)/grub2_memdisk

Why did you put that in $(HOST_DIR) ? Why can't you put that in $(@D)
instead?

Note: you may even use $(GRUB2_BUILD_DIR) instead of $(@D), this is more
future-proof.

> +	# clean artefacs from previos build

No need to repeat.

> +	rm -rf $(HOST_DIR)/memdisk.tar

You can use a single command to remove both the dir and file. Although
there should be no need to remove the file, as tar will overwrite it
anyway.

> +	mkdir -p $(HOST_DIR)/grub2_memdisk
> +	cp -r $(BR2_TARGET_GRUB2_MEMDISK_DIR)/* $(HOST_DIR)/grub2_memdisk/

cp -r does not preserve all attributes of files, so you should use cp -a
instead.

But before you fix and respin, please explain what you are trying to
achieve eith this patch (and the next one too).

Regards,
Yann E. MORIN.

> +	tar -cvf $(HOST_DIR)/memdisk.tar -C $(HOST_DIR)/grub2_memdisk/ .
> +endef
> +endif
> +
>  define GRUB2_INSTALL_IMAGES_CMDS
>  	mkdir -p $(dir $(GRUB2_IMAGE))
>  	$(HOST_DIR)/usr/bin/grub-mkimage \
> @@ -121,6 +134,7 @@ define GRUB2_INSTALL_IMAGES_CMDS
>  		-O $(GRUB2_TUPLE) \
>  		-o $(GRUB2_IMAGE) \
>  		-p "$(GRUB2_PREFIX)" \
> +		$(if $(BR2_TARGET_GRUB2_MEMDISK_DIR),-m $(HOST_DIR)/memdisk.tar) \
>  		$(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
>  		$(GRUB2_BUILTIN_MODULES)
>  	mkdir -p $(dir $(GRUB2_CFG))
> -- 
> 2.20.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/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.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2019-05-19 17:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-19 11:35 [Buildroot] [PATCH 1/1] boot/grub2: memdisk option Alexey Lukyanchuk
2019-05-19 17:00 ` Yann E. MORIN [this message]
2019-05-19 17:19   ` Лукьянчук Алексей
2019-05-19 17:39   ` Лукьянчук Алексей

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=20190519170021.GA5097@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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.