grub2: add option to specify grub.cfg file.
PATCH 1/1 grub2: add option to specify grub.cfg file.
Currently the menu file for grub is copied from boot/grub2/grub.cfg with no way for a user to change the preset settings. This is a small patch but being able to specify a menu file allows for much more flexibility that is desired.
--- boot/grub2/Config.in | 6 ++++++ boot/grub2/grub2.mk | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-)
boot/grub2/Config.in +6 -0
@@ -166,4 +166,10 @@ config BR2_TARGET_GRUB2_BUILTIN_CONFIG device and other configuration parameters, but however menu entries cannot be described in this embedded configuration. +config BR2_TARGET_GRUB2_MENU_CONFIG + string "Menu config file" + default "boot/grub2/grub.cfg" + help + Path to a grub.cfg file that will be installed at /boot/grub/grub.cfg + endif # BR2_TARGET_GRUB2
boot/grub2/grub2.mk +2 -1
@@ -14,6 +14,7 @@ GRUB2_DEPENDENCIES = host-bison host-flex GRUB2_BUILTIN_MODULES = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES)) GRUB2_BUILTIN_CONFIG = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_CONFIG)) GRUB2_BOOT_PARTITION = $(call qstrip,$(BR2_TARGET_GRUB2_BOOT_PARTITION)) +GRUB2_MENU_CONFIG = $(call qstrip,$(BR2_TARGET_GRUB2_MENU_CONFIG)) ifeq ($(BR2_TARGET_GRUB2_I386_PC),y) GRUB2_IMAGE = $(BINARIES_DIR)/grub.img
@@ -94,7 +95,7 @@ define GRUB2_IMAGE_INSTALLATION $(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \ $(GRUB2_BUILTIN_MODULES) mkdir -p $(dir $(GRUB2_CFG)) - $(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG) + $(INSTALL) -D -m 0644 $(GRUB2_MENU_CONFIG) $(GRUB2_CFG) $(GRUB2_IMAGE_INSTALL_ELTORITO) endef GRUB2_POST_INSTALL_TARGET_HOOKS += GRUB2_IMAGE_INSTALLATION
Signature · 1 line
2.9.3
PATCH 1/1 grub2: add option to specify grub.cfg file.
Hello,
Quoted 6 lines · Adam Duskett
Currently the menu file for grub is copied from boot/grub2/grub.cfg with no way for a user to change the preset settings. This is a small patch but being able to specify a menu file allows for much more flexibility that is desired.
Signed-off-by Adam Duskett <[email protected]>
I'm really not sure this is needed. You can just have a post-build script or a rootfs overlay that adds your custom grub.cfg file in /boot/grub2 at the end of the build. The one installed by the package is merely an initial example that works for some basic situations. But there is no need for an additional option to override this file, just use a rootfs overlay or a post-build script.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
A message that is not in the archive (sent off-list or not yet received): CAFSsvmqtxvxDK--NU-kZHGYed9wqp4XbqdGUTufEJpnc-PTCKQ@mail.gmail.com
PATCH 1/1 grub2: add option to specify grub.cfg file.
Hello,
Please keep the mailing list in Cc. Thanks!
Quoted 2 lines · Adam Duskett
It's not technically "needed" I guess, but I am usually not a fan of hard coded things such as this.
There are full of hardcoded things all over the place. Each package installs its own init script or systemd unit file, and the one we install is hardcoded. If you want some customization, just overwrite with your own in a rootfs overlay or post-build script.
Quoted 3 lines
Sure I could create a extra folder and then change the menuconfig to add a new overlay, but why would they have to instead of just putting it in a board file or any other folder they choose?
What's the difference? In all situations you have to put your own custom file somewhere. Specifying the location of this file through a grub2 specific option like you propose or through the generic rootfs overlay option is *exactly* the same.
Except that the latter can be used to override *any* file in the filesystem, and therefore avoids the need to add gazillions of options in each and every package. With you reasoning, we should have an option in the openssh package to install a custom ssh_config file, another one to install a custom sshd_config file, and then dbus should also have its own options to install custom dbus policy files, etc, etc. This is definitely not the direction we want to take.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com