Skip to contentSkip to conversation

Various GRUB build fixes

PATCH In review Daniel Kiper 2 participants 8 messages Mar 19, 2019 – Mar 20, 2019

lore
Share & tools
lore
#0 lore raw

cover Various GRUB build fixes

Hey,

As in subject... I am CC-ing folks who were somehow involved in doing/reviewing patches touching broken files. If I missed somebody then sorry about that. Anyway, please take a look.

There are still broken builds which I am going to fix soon. However, fortunately most of our targets build without any issue right now.

Daniel

 grub-core/kern/compiler-rt.c              | 5 +++--
 grub-core/loader/ia64/efi/linux.c         | 3 +--
 grub-core/loader/mips/linux.c             | 2 +-
 grub-core/loader/powerpc/ieee1275/linux.c | 4 ++--
 include/grub/compiler-rt.h                | 4 +++-
 5 files changed, 10 insertions(+), 8 deletions(-)

Daniel Kiper (5):
verifiers: IA-64 fallout cleanup
verifiers: PowerPC fallout cleanup
verifiers: MIPS fallout cleanup
mips: Enable __clzsi2()
sparc: Enable __clzsi2() and __clzdi2()

#1 lore raw

PATCH 1/5 verifiers: IA-64 fallout cleanup

IA-64 fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility to verify kernel and modules command lines).

---
 grub-core/loader/ia64/efi/linux.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
grub-core/loader/ia64/efi/linux.c +1 -2
index 639a1f379..7987fd1ba 100644
@@ -505,8 +505,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   *p = '\0';
 
-  err = grub_verify_string (cmdline, GRUB_VERIFY_KERNEL_CMDLINE);
-  if (err)
+  if (grub_verify_string (cmdline, GRUB_VERIFY_KERNEL_CMDLINE))
     goto fail;
   
   boot_param->command_line = (grub_uint64_t) cmdline;
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/5 verifiers: PowerPC fallout cleanup

In reply to Daniel Kiper

PowerPC fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility to verify kernel and modules command lines) and ca0a4f689 (verifiers: File type for fine-grained signature-verification controlling).

---
 grub-core/loader/powerpc/ieee1275/linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
grub-core/loader/powerpc/ieee1275/linux.c +2 -2
index c114e7df4..818b2a86d 100644
@@ -270,7 +270,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
       goto out;
     }
 
-  elf = grub_elf_open (argv[0]);
+  elf = grub_elf_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
   if (! elf)
     goto out;
 
@@ -303,7 +303,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   /* Create kernel command line.  */
   grub_memcpy (linux_args, LINUX_IMAGE, sizeof (LINUX_IMAGE));
   if (grub_create_loader_cmdline (argc, argv, linux_args + sizeof (LINUX_IMAGE) - 1,
-				  size))
+				  size, GRUB_VERIFY_KERNEL_CMDLINE))
     goto out;
 
 out:
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/5 verifiers: MIPS fallout cleanup

In reply to Daniel Kiper

MIPS fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility to verify kernel and modules command lines).

---
 grub-core/loader/mips/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/loader/mips/linux.c +1 -1
index e256c440f..7b723bf18 100644
@@ -314,7 +314,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   grub_memcpy (params, LINUX_IMAGE, sizeof (LINUX_IMAGE));
   grub_create_loader_cmdline (argc, argv, params + sizeof (LINUX_IMAGE) - 1,
-			      size);
+			      size, GRUB_VERIFY_KERNEL_CMDLINE);
 #else
   linux_argv = extra;
   argv_off = (grub_uint8_t *) linux_argv - (grub_uint8_t *) playground;
Signature · 1 line
2.11.0
#4 lore raw

PATCH 4/5 mips: Enable __clzsi2()

In reply to Daniel Kiper

This patch is similiar to commit e795b9011 (RISC-V: Add libgcc helpers for clz) but for MIPS target.

---
 grub-core/kern/compiler-rt.c | 5 +++--
 include/grub/compiler-rt.h   | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)
grub-core/kern/compiler-rt.c +3 -2
index e10b6668c..33e08fe06 100644
@@ -420,8 +420,7 @@ __aeabi_llsl (grub_uint64_t u, int b)
 
 #endif
 
-#ifdef __riscv
-
+#if defined(__mips__) || defined(__riscv)
 /* Based on libgcc from gcc suite. */
 int
 __clzsi2 (grub_uint32_t val)
@@ -447,7 +446,9 @@ __clzsi2 (grub_uint32_t val)
     }
   return (i - val);
 }
+#endif
 
+#ifdef __riscv
 int
 __clzdi2 (grub_uint64_t val)
 {
include/grub/compiler-rt.h +3 -1
index e6a25c6ea..31c0fd750 100644
@@ -110,10 +110,12 @@ EXPORT_FUNC (__aeabi_llsr) (grub_uint64_t u, int b);
 
 #endif
 
-#ifdef __riscv
+#if defined(__mips__) || defined(__riscv)
 int
 EXPORT_FUNC (__clzsi2) (grub_uint32_t val);
+#endif
 
+#ifdef __riscv
 int
 EXPORT_FUNC (__clzdi2) (grub_uint64_t val);
 #endif
Signature · 1 line
2.11.0
#5 lore raw

PATCH 5/5 sparc: Enable __clzsi2() and __clzdi2()

In reply to Daniel Kiper

This patch is similiar to commit e795b9011 (RISC-V: Add libgcc helpers for clz) but for SPARC target.

---
 grub-core/kern/compiler-rt.c | 4 ++--
 include/grub/compiler-rt.h   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
grub-core/kern/compiler-rt.c +2 -2
index 33e08fe06..a464200c6 100644
@@ -420,7 +420,7 @@ __aeabi_llsl (grub_uint64_t u, int b)
 
 #endif
 
-#if defined(__mips__) || defined(__riscv)
+#if defined(__mips__) || defined(__riscv) || defined(__sparc__)
 /* Based on libgcc from gcc suite. */
 int
 __clzsi2 (grub_uint32_t val)
@@ -448,7 +448,7 @@ __clzsi2 (grub_uint32_t val)
 }
 #endif
 
-#ifdef __riscv
+#if defined(__riscv) || defined(__sparc__)
 int
 __clzdi2 (grub_uint64_t val)
 {
include/grub/compiler-rt.h +2 -2
index 31c0fd750..7591980b4 100644
@@ -110,12 +110,12 @@ EXPORT_FUNC (__aeabi_llsr) (grub_uint64_t u, int b);
 
 #endif
 
-#if defined(__mips__) || defined(__riscv)
+#if defined(__mips__) || defined(__riscv) || defined(__sparc__)
 int
 EXPORT_FUNC (__clzsi2) (grub_uint32_t val);
 #endif
 
-#ifdef __riscv
+#if defined(__riscv) || defined(__sparc__)
 int
 EXPORT_FUNC (__clzdi2) (grub_uint64_t val);
 #endif
Signature · 1 line
2.11.0
Reviewed-by on the v1 series
#6 lore raw
In reply to Daniel Kiper
Quoted 18 lines · Daniel Kiper

Hey,

As in subject... I am CC-ing folks who were somehow involved in doing/reviewing patches touching broken files. If I missed somebody then sorry about that. Anyway, please take a look.

There are still broken builds which I am going to fix soon. However, fortunately most of our targets build without any issue right now.

Daniel

 grub-core/kern/compiler-rt.c              | 5 +++--
 grub-core/loader/ia64/efi/linux.c         | 3 +--
 grub-core/loader/mips/linux.c             | 2 +-
 grub-core/loader/powerpc/ieee1275/linux.c | 4 ++--
 include/grub/compiler-rt.h                | 4 +++-
 5 files changed, 10 insertions(+), 8 deletions(-)
Quoted 2 lines

Daniel Kiper (5):
verifiers: IA-64 fallout cleanup

It seems like the things fixed in these two would have prevented compiling. I guess it was not tried on these platforms?

Quoted 4 lines

verifiers: PowerPC fallout cleanup
verifiers: MIPS fallout cleanup> mips: Enable __clzsi2()
sparc: Enable __clzsi2() and __clzdi2()

Anyway, LGTM

#7 lore raw
Quoted 19 lines · Ross Philipson
Quoted 18 lines · Daniel Kiper

Hey,

As in subject... I am CC-ing folks who were somehow involved in doing/reviewing patches touching broken files. If I missed somebody then sorry about that. Anyway, please take a look.

There are still broken builds which I am going to fix soon. However, fortunately most of our targets build without any issue right now.

Daniel

 grub-core/kern/compiler-rt.c              | 5 +++--
 grub-core/loader/ia64/efi/linux.c         | 3 +--
 grub-core/loader/mips/linux.c             | 2 +-
 grub-core/loader/powerpc/ieee1275/linux.c | 4 ++--
 include/grub/compiler-rt.h                | 4 +++-
 5 files changed, 10 insertions(+), 8 deletions(-)
Quoted 5 lines
Quoted 2 lines

Daniel Kiper (5):
verifiers: IA-64 fallout cleanup

It seems like the things fixed in these two would have prevented compiling. I guess it was not tried on these platforms?

Nope.

Quoted 8 lines
Quoted 4 lines

verifiers: PowerPC fallout cleanup
verifiers: MIPS fallout cleanup> mips: Enable __clzsi2()
sparc: Enable __clzsi2() and __clzdi2()

Anyway, LGTM

Thanks a lot! Patches have been pushed.

Daniel