diff mbox

grub2: Specify boot partition

Message ID 1404204289-8303-1-git-send-email-jezz@sysmic.org
State Superseded
Headers show

Commit Message

Jérôme Pouiller July 1, 2014, 8:44 a.m. UTC
Since boot partition was not specified, grub tools try to detect it
automatically. This patch add an option to force it.

Notice I am not sure -p option is usefull when -c option is used.

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
---
 boot/grub2/Config.in | 5 +++++
 boot/grub2/grub2.mk  | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni July 1, 2014, 9:14 a.m. UTC | #1
Dear Jérôme Pouiller,

On Tue,  1 Jul 2014 10:44:49 +0200, Jérôme Pouiller wrote:
> Since boot partition was not specified, grub tools try to detect it
> automatically. This patch add an option to force it.
> 
> Notice I am not sure -p option is usefull when -c option is used.

This should not be part of the commit log. If you want to express such
comments, they should go...

> 
> Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
> ---

... here.

Indeed, when the configuration is built into the image, I don't think
the prefix is very useful. But I believe that's OK.

> +config BR2_TARGET_GRUB2_BOOT_PARTITION
> +	string "boot partition"
> +	default "(hd0,msdos1)"

	depends on BR2_TARGET_GRUB2_I386_PC

since there is no need to specify a boot partition for the EFI boot
cases.

> +	  Specifiy partition where /boot/grub/grub.cfg will be located.

Fix that with:

	Specify the partition where the /boot/grub/grub.cfg is located.
	Use (hd0,msdos1) for the first partition of the first disk if
	using a legacy partition table, or (hd0,gpt1) if using GPT
	partition table.

Other than that, looks OK. Can you quickly resend a v2 ?

Thanks a lot for looking into this problem!

Thomas
diff mbox

Patch

diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
index b37e024..0ebb3a0 100644
--- a/boot/grub2/Config.in
+++ b/boot/grub2/Config.in
@@ -111,6 +111,11 @@  config BR2_TARGET_GRUB2_X86_64_EFI
 
 endchoice
 
+config BR2_TARGET_GRUB2_BOOT_PARTITION
+	string "boot partition"
+	default "(hd0,msdos1)"
+	  Specifiy partition where /boot/grub/grub.cfg will be located.
+
 config BR2_TARGET_GRUB2_BUILTIN_MODULES
 	string "builtin modules"
 	default "boot linux ext2 fat part_msdos part_gpt normal biosdisk" if BR2_TARGET_GRUB2_I386_PC
diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
index 50f93ee..ab2b122 100644
--- a/boot/grub2/grub2.mk
+++ b/boot/grub2/grub2.mk
@@ -14,6 +14,7 @@  GRUB2_DEPENDENCIES = host-bison host-flex
 ifeq ($(BR2_TARGET_GRUB2_I386_PC),y)
 GRUB2_IMAGE = $(BINARIES_DIR)/grub.img
 GRUB2_CFG = $(TARGET_DIR)/boot/grub/grub.cfg
+GRUB2_PREFIX = /boot/grub
 GRUB2_TUPLE = i386-pc
 GRUB2_TARGET = i386
 GRUB2_PLATFORM = pc
@@ -35,6 +36,7 @@  endif
 
 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 is kind of special: it considers CC, LD and so on to be the
 # tools to build the native tools (i.e to be executed on the build
@@ -71,7 +73,7 @@  define GRUB2_IMAGE_INSTALLATION
 		-d $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE) \
 		-O $(GRUB2_TUPLE) \
 		-o $(GRUB2_IMAGE) \
-		$(if $(GRUB2_PREFIX),-p $(GRUB2_PREFIX)) \
+		-p $(GRUB2_BOOT_PARTITION)$(GRUB2_PREFIX) \
 		$(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
 		$(GRUB2_BUILTIN_MODULES)
 	mkdir -p $(dir $(GRUB2_CFG))