Skip to contentSkip to conversation

sparc64: Fix BIOS Boot Partition support

PATCH In review James Clarke 4 participants 6 messages Jul 14, 2019 – Jul 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc64: Fix BIOS Boot Partition support

Currently, gpt_offset is uninitialised when using a BIOS Boot Partition but is used unconditionally inside save_blocklists. Instead, ensure it is always initialised to 0 (note that there is already separate code to do the equivalent adjustment after we call save_blocklists on this code path).

This patch has been tested on a T5-2 LDOM.

---
 util/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/setup.c +3 -1
index 6f88f3cc4..3be88aae1 100644
@@ -270,6 +270,9 @@ SETUP (const char *dir,
 #ifdef GRUB_SETUP_BIOS
   bl.current_segment =
     GRUB_BOOT_I386_PC_KERNEL_SEG + (GRUB_DISK_SECTOR_SIZE >> 4);
+#endif
+#ifdef GRUB_SETUP_SPARC64
+  bl.gpt_offset = 0;
 #endif
   bl.last_length = 0;
 
@@ -730,7 +733,6 @@ unable_to_embed:
 #ifdef GRUB_SETUP_SPARC64
   {
     grub_partition_t container = root_dev->disk->partition;
-    bl.gpt_offset = 0;
 
     if (grub_strstr (container->partmap->name, "gpt"))
       bl.gpt_offset = grub_partition_get_start (container);
Signature · 1 line
2.20.1
Tested-by on v1 1/1
#1 lore raw
Quoted 29 lines · James Clarke

Currently, gpt_offset is uninitialised when using a BIOS Boot Partition but is used unconditionally inside save_blocklists. Instead, ensure it is always initialised to 0 (note that there is already separate code to do the equivalent adjustment after we call save_blocklists on this code path).

This patch has been tested on a T5-2 LDOM.

---
 util/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/setup.c +3 -0
index 6f88f3cc4..3be88aae1 100644
@@ -270,6 +270,9 @@ SETUP (const char *dir,
 #ifdef GRUB_SETUP_BIOS
   bl.current_segment =
     GRUB_BOOT_I386_PC_KERNEL_SEG + (GRUB_DISK_SECTOR_SIZE >> 4);
+#endif
+#ifdef GRUB_SETUP_SPARC64
+  bl.gpt_offset = 0;
 #endif
   bl.last_length = 0;
 

util/setup.c unable_to_embed: · line 738

Quoted 7 lines
util/setup.c +0 -1
@@ -730,7 +733,6 @@ unable_to_embed:
 #ifdef GRUB_SETUP_SPARC64
   {
     grub_partition_t container = root_dev->disk->partition;
-    bl.gpt_offset = 0;
 
     if (grub_strstr (container->partmap->name, "gpt"))
       bl.gpt_offset = grub_partition_get_start (container);

Works as expected and fixes the problem I reported earlier [1].

@Eric: Any comments?

Adrian

Quoted 1 line

[1] https://lists.gnu.org/archive/html/grub-devel/2019-07/msg00017.html

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Reviewed-by
#2 lore raw
Quoted 43 lines · John Paul Adrian Glaubitz
Quoted 29 lines · James Clarke

Currently, gpt_offset is uninitialised when using a BIOS Boot Partition but is used unconditionally inside save_blocklists. Instead, ensure it is always initialised to 0 (note that there is already separate code to do the equivalent adjustment after we call save_blocklists on this code path).

This patch has been tested on a T5-2 LDOM.

---
util/setup.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
util/setup.c +3 -0
index 6f88f3cc4..3be88aae1 100644
@@ -270,6 +270,9 @@ SETUP (const char *dir,
 #ifdef GRUB_SETUP_BIOS
  bl.current_segment =
    GRUB_BOOT_I386_PC_KERNEL_SEG + (GRUB_DISK_SECTOR_SIZE >> 4);
+#endif
+#ifdef GRUB_SETUP_SPARC64
+  bl.gpt_offset = 0;
 #endif
  bl.last_length = 0;
 

util/setup.c unable_to_embed: · line 738

Quoted 7 lines
util/setup.c +0 -1
@@ -730,7 +733,6 @@ unable_to_embed:
 #ifdef GRUB_SETUP_SPARC64
  {
    grub_partition_t container = root_dev->disk->partition;
-    bl.gpt_offset = 0;
 
    if (grub_strstr (container->partmap->name, "gpt"))
      bl.gpt_offset = grub_partition_get_start (container);

Works as expected and fixes the problem I reported earlier [1].

Quoted 4 lines

@Eric: Any comments?

#3 lore raw
In reply to James Clarke

LGTM. Let's give it another day on ML, then I'll commit it

Quoted 44 lines · James Clarke

Currently, gpt_offset is uninitialised when using a BIOS Boot Partition but is used unconditionally inside save_blocklists. Instead, ensure it is always initialised to 0 (note that there is already separate code to do the equivalent adjustment after we call save_blocklists on this code path).

This patch has been tested on a T5-2 LDOM.

---
 util/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/setup.c +3 -2
index 6f88f3cc4..3be88aae1 100644
@@ -270,6 +270,9 @@ SETUP (const char *dir,
 #ifdef GRUB_SETUP_BIOS
   bl.current_segment =
     GRUB_BOOT_I386_PC_KERNEL_SEG + (GRUB_DISK_SECTOR_SIZE >> 4);
+#endif
+#ifdef GRUB_SETUP_SPARC64
+  bl.gpt_offset = 0;
 #endif
   bl.last_length = 0;
 
@@ -730,7 +733,6 @@ unable_to_embed:
 #ifdef GRUB_SETUP_SPARC64
   {
     grub_partition_t container = root_dev->disk->partition;
-    bl.gpt_offset = 0;
 
     if (grub_strstr (container->partmap->name, "gpt"))
       bl.gpt_offset = grub_partition_get_start (container);
--

2.20.1

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#4 lore raw
Quoted 1 line · Vladimir 'phcoder' Serbinenko

LGTM. Let's give it another day on ML, then I'll commit it

Friendly reminder ;-).

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#5 lore raw

Committed

Quoted 12 lines · John Paul Adrian Glaubitz
Quoted 1 line · Vladimir 'phcoder' Serbinenko

LGTM. Let's give it another day on ML, then I'll commit it

Friendly reminder ;-).

Adrian

--

 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko