boot/grub2: memdisk option
PATCH 1/1 boot/grub2: memdisk option
Allows to create grub2 memdisk from specified directory
--- boot/grub2/Config.in | 5 +++++ boot/grub2/grub2.mk | 14 ++++++++++++++ 2 files changed, 19 insertions(+)
boot/grub2/Config.in +5 -0
@@ -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 + endif # BR2_TARGET_GRUB2 comment "grub2 needs a toolchain w/ wchar"
boot/grub2/grub2.mk +14 -0
@@ -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 + rm -rf $(HOST_DIR)/grub2_memdisk + # clean artefacs from previos build + rm -rf $(HOST_DIR)/memdisk.tar + mkdir -p $(HOST_DIR)/grub2_memdisk + cp -r $(BR2_TARGET_GRUB2_MEMDISK_DIR)/* $(HOST_DIR)/grub2_memdisk/ + 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))
Signature · 1 line
2.20.1
PATCH 1/1 boot/grub2: memdisk option
Alexey, All,
On 2019-05-19 14:35 +0300, Alexey Lukyanchuk spake thusly:
Quoted 1 line
Allows to create grub2 memdisk from specified directory
Can you expand a bit on what you're trying to achieve with this?
Quoted 11 lines
Signed-off-by Alexey Lukyanchuk <[email protected]>--- boot/grub2/Config.in | 5 +++++ boot/grub2/grub2.mk | 14 ++++++++++++++ 2 files changed, 19 insertions(+)boot/grub2/Config.in +0
-0
boot/grub2/Config.in config BR2_TARGET_GRUB2_INSTALL_TOOLS · line 122
Quoted 7 lines
boot/grub2/Config.in +4
-0@@ -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.
Quoted 8 lines
boot/grub2/Config.in +0
-0endif # BR2_TARGET_GRUB2 comment "grub2 needs a toolchain w/ wchar"boot/grub2/grub2.mk +0
-0
boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALL_ELTORITO · line 120
Quoted 7 lines
boot/grub2/grub2.mk +4
-0@@ -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/
boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALL_ELTORITO · line 121
Quoted 1 line
boot/grub2/grub2.mk +1
-0+ 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.
boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALL_ELTORITO · line 122
Quoted 1 line
boot/grub2/grub2.mk +1
-0+ # clean artefacs from previos build
No need to repeat.
boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALL_ELTORITO · line 123
Quoted 1 line
boot/grub2/grub2.mk +1
-0+ 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.
boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALL_ELTORITO · line 125
Quoted 2 lines
boot/grub2/grub2.mk +2
-0+ 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.
Quoted 22 lines
boot/grub2/grub2.mk +5
-0+ 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))Signature · 6 lines
2.20.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 boot/grub2: memdisk option
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190519/f436aba3/attachment.html>
PATCH 1/1 boot/grub2: memdisk option
In reply to Yann E. MORINAn HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190519/afd2f20a/attachment.html>