Skip to content

Commit bf55ac1

Browse files
rizlikdanielinux
authored andcommitted
x86_efi: fixes
- do not use a custom section for the keystore as it will not be loaded in the UEFI env - remove and disable WOLFBOOT_LOAD_ADDRESS - copy .rodata from .elf to .efi as the new version of gnu-efi ld scripts do not merge .rodata into .data anymore - fix typo in compile_efi_linux.sh
1 parent 0ddde6f commit bf55ac1

File tree

6 files changed

+9
-3
lines changed

6 files changed

+9
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ test-lib: include/target.h $(OBJS)
138138

139139
wolfboot.efi: wolfboot.elf
140140
@echo "\t[BIN] $@"
141-
$(Q)$(OBJCOPY) -j .text -j .sdata -j .data \
141+
$(Q)$(OBJCOPY) -j .rodata -j .text -j .sdata -j .data \
142142
-j .dynamic -j .dynsym -j .rel \
143143
-j .rela -j .reloc -j .eh_frame \
144144
--target=efi-app-x86_64 --subsystem=10 $^ $@

arch.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,8 @@ ifeq ($(TARGET),x86_64_efi)
788788
-fshort-wchar -mno-red-zone -maccumulate-outgoing-args
789789
CFLAGS += -I/usr/include/efi -I/usr/include/efi/x86_64 \
790790
-DPLATFORM_X86_64_EFI -DWOLFBOOT_DUALBOOT
791+
# avoid using of fixed LOAD_ADDRESS, uefi target uses dynamic location
792+
CFLAGS += -DNO_WOLFBOOT_LOAD_ADDRESS
791793
LDFLAGS = -shared -Bsymbolic -L/usr/lib -T$(GNU_EFI_LSCRIPT)
792794
LD_START_GROUP = $(GNU_EFI_CRT0)
793795
LD_END_GROUP = -lgnuefi -lefi

config/examples/x86_64_efi.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ SPMATH=0
88
# required for keytools
99
WOLFBOOT_SECTOR_SIZE?=0x1000
1010
WOLFBOOT_NO_PARTITIONS=1
11-
WOLFBOOT_LOAD_ADDRESS=0
11+

include/target.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@
9292

9393
#endif /* WOLFBOOT_FIXED_PARTITIONS */
9494

95+
#if !defined(NO_WOLFBOOT_LOAD_ADDRESS)
9596
/* Load address in RAM for staged OS (update_ram only) */
9697
#define WOLFBOOT_LOAD_ADDRESS @WOLFBOOT_LOAD_ADDRESS@
98+
#endif
9799
#define WOLFBOOT_LOAD_DTS_ADDRESS @WOLFBOOT_LOAD_DTS_ADDRESS@
98100

99101

tools/efi/compile_efi_linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if [ -f "./tools/keytools/sign" ]; then
2222
SIGN_TOOL="./tools/keytools/sign"
2323
fi
2424

25-
$SIGN_TOOL --ed25519 $IMAGE_DIR/images/bzImage wolfBoot_signing_private_key.der 1
25+
$SIGN_TOOL --ed25519 $IMAGE_DIR/images/bzImage wolfboot_signing_private_key.der 1
2626
$SIGN_TOOL --ed25519 $IMAGE_DIR/images/bzImage wolfboot_signing_private_key.der 2
2727

2828
mkdir -p /tmp/efi

tools/keytools/keygen.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ const char Store_hdr[] = "\n"
145145
"#define KEYSTORE_SECTION __attribute__((section (\"__KEYSTORE,__keystore\")))\n"
146146
"#elif defined(__CCRX__)\n"
147147
"#define KEYSTORE_SECTION\n"
148+
"#elif defined(TARGET_x86_64_efi)\n"
149+
"#define KEYSTORE_SECTION\n"
148150
"#else\n"
149151
"#define KEYSTORE_SECTION __attribute__((section (\".keystore\")))\n"
150152
"#endif\n\n"

0 commit comments

Comments
 (0)