Skip to contentSkip to conversation

powerpc_ieee1275: Excluding the PKS for grub-emu on 32-bit PowerPC

PATCH In review Sudhakar Kuppusamy 3 participants 6 messages Feb 27 – Mar 3

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc_ieee1275: Excluding the PKS for grub-emu on 32-bit PowerPC

Configuring the build with --with-platform=emu fails on 32-bit PowerPC with:

/usr/bin/ld: appendedsig.module: in function `grub_mod_init':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1615:(.text+0x2ab4): undefined reference to grub_pks_get_keystore' /usr/bin/ld: appendedsig.module: in function create_dbs_from_pks':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1400:(.text+0x2c3c): undefined reference to `grub_pks_free_data'
collect2: error: ld returned 1 exit status

Fixing this by excluding the Platform Keystore (PKS) for grub-emu on 32-bit PowerPC.

---
 include/grub/powerpc/ieee1275/platform_keystore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/grub/powerpc/ieee1275/platform_keystore.h +1 -1
index 931ada224..3bfb594a3 100644
@@ -96,7 +96,7 @@ struct grub_pks
 };
 typedef struct grub_pks grub_pks_t;
 
-#if defined(__powerpc__)
+#if defined(__powerpc__) && !(GRUB_MACHINE_EMU)
 /* Initialization of the Platform Keystore. */
 extern void
 grub_pks_keystore_init (void);
Signature · 7 lines
2.50.1 (Apple Git-155)


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Tested-by on v1 1/1
#1 lore raw

Hi Sudhakar,

Quoted 21 lines · Sudhakar Kuppusamy

Configuring the build with --with-platform=emu fails on 32-bit PowerPC with:

/usr/bin/ld: appendedsig.module: in function `grub_mod_init':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1615:(.text+0x2ab4): undefined reference to grub_pks_get_keystore' /usr/bin/ld: appendedsig.module: in function create_dbs_from_pks':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1400:(.text+0x2c3c): undefined reference to `grub_pks_free_data'
collect2: error: ld returned 1 exit status

Fixing this by excluding the Platform Keystore (PKS) for grub-emu on 32-bit PowerPC.

---
 include/grub/powerpc/ieee1275/platform_keystore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/grub/powerpc/ieee1275/platform_keystore.h +0 -0
index 931ada224..3bfb594a3 100644

include/grub/powerpc/ieee1275/platform_keystore.h struct grub_pks · line 102

Quoted 8 lines
include/grub/powerpc/ieee1275/platform_keystore.h +1 -1
@@ -96,7 +96,7 @@ struct grub_pks
 };
 typedef struct grub_pks grub_pks_t;
 
-#if defined(__powerpc__)
+#if defined(__powerpc__) && !(GRUB_MACHINE_EMU)
 /* Initialization of the Platform Keystore. */
 extern void
 grub_pks_keystore_init (void);

I can confirm that this patch fixes the problem, so:

However, I'm wondering whether the commit message is correct as __powerpc__ is also defined on 64-bit PowerPC:

glaubitz@perotto:~$ echo | gcc -E -dM - |grep -i powerpc
#define __powerpc__ 1
#define __powerpc64__ 1
glaubitz@perotto:~$

Shouldn't the correct commit message be:

powerpc_ieee1275: Exclude PKS support for grub-emu on PowerPC

?

Or am I missing something here?

Adrian

Signature · 9 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

Hi Sudhakar,

Quoted 43 lines · John Paul Adrian Glaubitz
Quoted 21 lines · Sudhakar Kuppusamy

Configuring the build with --with-platform=emu fails on 32-bit PowerPC with:

/usr/bin/ld: appendedsig.module: in function `grub_mod_init':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1615:(.text+0x2ab4): undefined reference to grub_pks_get_keystore' /usr/bin/ld: appendedsig.module: in function create_dbs_from_pks':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1400:(.text+0x2c3c): undefined reference to `grub_pks_free_data'
collect2: error: ld returned 1 exit status

Fixing this by excluding the Platform Keystore (PKS) for grub-emu on 32-bit PowerPC.

---
 include/grub/powerpc/ieee1275/platform_keystore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/grub/powerpc/ieee1275/platform_keystore.h +0 -0
index 931ada224..3bfb594a3 100644

include/grub/powerpc/ieee1275/platform_keystore.h struct grub_pks · line 102

Quoted 8 lines
include/grub/powerpc/ieee1275/platform_keystore.h +1 -1
@@ -96,7 +96,7 @@ struct grub_pks
 };
 typedef struct grub_pks grub_pks_t;
 
-#if defined(__powerpc__)
+#if defined(__powerpc__) && !(GRUB_MACHINE_EMU)
 /* Initialization of the Platform Keystore. */
 extern void
 grub_pks_keystore_init (void);

I can confirm that this patch fixes the problem, so:

However, I'm wondering whether the commit message is correct as __powerpc__ is also defined on 64-bit PowerPC:

glaubitz@perotto:~$ echo | gcc -E -dM - |grep -i powerpc
#define __powerpc__ 1
#define __powerpc64__ 1
glaubitz@perotto:~$
Quoted 7 lines

Shouldn't the correct commit message be:

powerpc_ieee1275: Exclude PKS support for grub-emu on PowerPC

?

Or am I missing something here?

I just tried to build --with-platform=ieee1275 which fails:

cc -DHAVE_CONFIG_H -I. -I../../../grub-core -I.. -Wno-unused-but-set-variable -Wall -W -DGRUB_MACHINE_IEEE1275=1 -DGRUB_MACHINE=POWERPC_IEEE1275 -m32 -mbig-endian -nostdinc -isystem /usr/lib/gcc/powerpc-linux-gnu/15/include -I../../../include -I../include -DGRUB_FILE=\"kern/rescue_parser.c\" -I. -I../../../grub-core -I.. -I../../.. -I../../../include -I../include -I../../../grub-
core/lib/libgcrypt-grub/src/ -DGRUB_KERNEL=1 -D_FILE_OFFSET_BITS=64 -std=gnu99 -fno-common -Os -m32 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -
Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing- format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter - Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -mbig-endian -freg-struct-return -msoft-float -fno-omit-frame-pointer -fno-dwarf2-cfi-asm -fno-asynchronous-unwind-tables
-fno-unwind-tables -fno-ident -fno-PIE -fno-pie -fno-stack-protector -Wtrampolines -Werror -mcpu=powerpc -ffreestanding -c -o kern/kernel_exec-rescue_parser.o `test -f 'kern/rescue_parser.c' ||
echo '../../../grub-core/'`kern/rescue_parser.c
In file included from ../../../grub-core/kern/powerpc/ieee1275/platform_keystore.c:26:
../../../include/grub/powerpc/ieee1275/platform_keystore.h:99:31: error: 'GRUB_MACHINE_EMU' is not defined, evaluates to '0' [-Werror=undef]
99 | #if defined(__powerpc__) && !(GRUB_MACHINE_EMU)

      |                               ^~~~~~~~~~~~~~~~

Using "&& !defined(GRUB_MACHINE_EMU)" instead works.

Can you change that?

Adrian

Signature · 9 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#4 lore raw
In reply to Sudhakar Kuppusamy

The header is under powerpc/ieee1275. How does it get included in the first place? The problem is with it's including in emu, not its contents

Regards

Le ven. 27 févr. 2026, 16:42, Sudhakar Kuppusamy <[email protected]> a écrit :

Quoted 35 lines

Configuring the build with --with-platform=emu fails on 32-bit PowerPC with:

/usr/bin/ld: appendedsig.module: in function `grub_mod_init':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1615:(.text+0x2ab4):
undefined reference to `grub_pks_get_keystore'
/usr/bin/ld: appendedsig.module: in function `create_dbs_from_pks':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1400:(.text+0x2c3c):
undefined reference to `grub_pks_free_data'
collect2: error: ld returned 1 exit status

Fixing this by excluding the Platform Keystore (PKS) for grub-emu on 32-bit PowerPC.

---
 include/grub/powerpc/ieee1275/platform_keystore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/grub/powerpc/ieee1275/platform_keystore.h +1 -2
index 931ada224..3bfb594a3 100644
@@ -96,7 +96,7 @@ struct grub_pks
 };
 typedef struct grub_pks grub_pks_t;
 
-#if defined(__powerpc__)
+#if defined(__powerpc__) && !(GRUB_MACHINE_EMU)
 /* Initialization of the Platform Keystore. */
 extern void
 grub_pks_keystore_init (void);
--
Quoted 3 lines

2.50.1 (Apple Git-155)

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

#3 lore raw
In reply to John Paul Adrian Glaubitz
Quoted 73 lines · John Paul Adrian Glaubitz

Hi Sudhakar,

Quoted 43 lines · John Paul Adrian Glaubitz
Quoted 27 lines · Sudhakar Kuppusamy

Configuring the build with --with-platform=emu fails on 32-bit PowerPC with:

/usr/bin/ld: appendedsig.module: in function `grub_mod_init':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1615:(.text+0x2ab4): undefined reference to grub_pks_get_keystore' /usr/bin/ld: appendedsig.module: in function create_dbs_from_pks':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1400:(.text+0x2c3c): undefined reference to `grub_pks_free_data'
collect2: error: ld returned 1 exit status

Fixing this by excluding the Platform Keystore (PKS) for grub-emu on 32-bit PowerPC.

---
include/grub/powerpc/ieee1275/platform_keystore.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
include/grub/powerpc/ieee1275/platform_keystore.h +1 -1
index 931ada224..3bfb594a3 100644
@@ -96,7 +96,7 @@ struct grub_pks
 };
 typedef struct grub_pks grub_pks_t;
 
-#if defined(__powerpc__)
+#if defined(__powerpc__) && !(GRUB_MACHINE_EMU)
 /* Initialization of the Platform Keystore. */
Quoted 2 lines

extern void
grub_pks_keystore_init (void);

I can confirm that this patch fixes the problem, so:

However, I'm wondering whether the commit message is correct as __powerpc__ is also defined on 64-bit PowerPC:

glaubitz@perotto:~$ echo | gcc -E -dM - |grep -i powerpc
#define __powerpc__ 1
#define __powerpc64__ 1
glaubitz@perotto:~$
Quoted 7 lines

Shouldn't the correct commit message be:

powerpc_ieee1275: Exclude PKS support for grub-emu on PowerPC

?

Or am I missing something here?

I just tried to build --with-platform=ieee1275 which fails:

cc -DHAVE_CONFIG_H -I. -I../../../grub-core -I.. -Wno-unused-but-set-variable -Wall -W -DGRUB_MACHINE_IEEE1275=1 -DGRUB_MACHINE=POWERPC_IEEE1275 -m32 -mbig-endian -nostdinc -isystem /usr/lib/gcc/powerpc-linux-gnu/15/include -I../../../include -I../include -DGRUB_FILE=\"kern/rescue_parser.c\" -I. -I../../../grub-core -I.. -I../../.. -I../../../include -I../include -I../../../grub-
core/lib/libgcrypt-grub/src/ -DGRUB_KERNEL=1 -D_FILE_OFFSET_BITS=64 -std=gnu99 -fno-common -Os -m32 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -
Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing- format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter - Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations -Wcast-align -Wextra -Wattributes -Wendif-labels

(quoted diff) +0 -3
-Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign
-Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -mbig-endian -freg-struct-return -msoft-float -fno-omit-frame-pointer -fno-dwarf2-cfi-asm -fno-asynchronous-unwind-tables
-fno-unwind-tables -fno-ident -fno-PIE -fno-pie -fno-stack-protector -Wtrampolines -Werror  -mcpu=powerpc  -ffreestanding   -c -o kern/kernel_exec-rescue_parser.o `test -f 'kern/rescue_parser.c' ||

echo '../../../grub-core/'`kern/rescue_parser.c
In file included from ../../../grub-core/kern/powerpc/ieee1275/platform_keystore.c:26:
../../../include/grub/powerpc/ieee1275/platform_keystore.h:99:31: error: 'GRUB_MACHINE_EMU' is not defined, evaluates to '0' [-Werror=undef]
99 | #if defined(__powerpc__) && !(GRUB_MACHINE_EMU)

Quoted 5 lines
     |                               ^~~~~~~~~~~~~~~~

Using "&& !defined(GRUB_MACHINE_EMU)" instead works.

Can you change that?

Thank you Adrian for the testing and suggestion. I'll make changes in v2.

Thanks,
Sudhakar

Quoted 8 lines

Adrian

Signature · 4 lines
.''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
 `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

#5 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 8 lines · Vladimir 'phcoder' Serbinenko

This Message Is From an External Sender
This message came from outside your organization.
Report Suspicious
The header is under powerpc/ieee1275. How does it get included in the first place? The problem is with it's including in emu, not its contents

Thank you for your review, Vladimir.

Yes. You are right. I'll fix it in v2.

Thanks,
Sudhakar

Quoted 35 lines

Regards

Le ven. 27 févr. 2026, 16:42, Sudhakar Kuppusamy <[email protected]> a écrit :
Configuring the build with --with-platform=emu fails on 32-bit PowerPC with:

/usr/bin/ld: appendedsig.module: in function `grub_mod_init':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1615:(.text+0x2ab4): undefined reference to grub_pks_get_keystore' /usr/bin/ld: appendedsig.module: in function create_dbs_from_pks':
/home/glaubitz/grub/grub-core/commands/appendedsig/appendedsig.c:1400:(.text+0x2c3c): undefined reference to `grub_pks_free_data'
collect2: error: ld returned 1 exit status

Fixing this by excluding the Platform Keystore (PKS) for grub-emu on 32-bit PowerPC.

---
 include/grub/powerpc/ieee1275/platform_keystore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/grub/powerpc/ieee1275/platform_keystore.h +1 -1
index 931ada224..3bfb594a3 100644
@@ -96,7 +96,7 @@ struct grub_pks
 };
 typedef struct grub_pks grub_pks_t;
 
-#if defined(__powerpc__)
+#if defined(__powerpc__) && !(GRUB_MACHINE_EMU)
 /* Initialization of the Platform Keystore. */
 extern void
 grub_pks_keystore_init (void);
Signature · 1 line
2.50.1 (Apple Git-155)

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