Skip to content

Commit

Permalink
x86_efi: fixes
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
rizlik authored and danielinux committed May 20, 2024
1 parent 0ddde6f commit bf55ac1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ test-lib: include/target.h $(OBJS)

wolfboot.efi: wolfboot.elf
@echo "\t[BIN] $@"
$(Q)$(OBJCOPY) -j .text -j .sdata -j .data \
$(Q)$(OBJCOPY) -j .rodata -j .text -j .sdata -j .data \
-j .dynamic -j .dynsym -j .rel \
-j .rela -j .reloc -j .eh_frame \
--target=efi-app-x86_64 --subsystem=10 $^ $@
Expand Down
2 changes: 2 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ ifeq ($(TARGET),x86_64_efi)
-fshort-wchar -mno-red-zone -maccumulate-outgoing-args
CFLAGS += -I/usr/include/efi -I/usr/include/efi/x86_64 \
-DPLATFORM_X86_64_EFI -DWOLFBOOT_DUALBOOT
# avoid using of fixed LOAD_ADDRESS, uefi target uses dynamic location
CFLAGS += -DNO_WOLFBOOT_LOAD_ADDRESS
LDFLAGS = -shared -Bsymbolic -L/usr/lib -T$(GNU_EFI_LSCRIPT)
LD_START_GROUP = $(GNU_EFI_CRT0)
LD_END_GROUP = -lgnuefi -lefi
Expand Down
2 changes: 1 addition & 1 deletion config/examples/x86_64_efi.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ SPMATH=0
# required for keytools
WOLFBOOT_SECTOR_SIZE?=0x1000
WOLFBOOT_NO_PARTITIONS=1
WOLFBOOT_LOAD_ADDRESS=0

2 changes: 2 additions & 0 deletions include/target.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@

#endif /* WOLFBOOT_FIXED_PARTITIONS */

#if !defined(NO_WOLFBOOT_LOAD_ADDRESS)
/* Load address in RAM for staged OS (update_ram only) */
#define WOLFBOOT_LOAD_ADDRESS @WOLFBOOT_LOAD_ADDRESS@
#endif
#define WOLFBOOT_LOAD_DTS_ADDRESS @WOLFBOOT_LOAD_DTS_ADDRESS@


Expand Down
2 changes: 1 addition & 1 deletion tools/efi/compile_efi_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [ -f "./tools/keytools/sign" ]; then
SIGN_TOOL="./tools/keytools/sign"
fi

$SIGN_TOOL --ed25519 $IMAGE_DIR/images/bzImage wolfBoot_signing_private_key.der 1
$SIGN_TOOL --ed25519 $IMAGE_DIR/images/bzImage wolfboot_signing_private_key.der 1
$SIGN_TOOL --ed25519 $IMAGE_DIR/images/bzImage wolfboot_signing_private_key.der 2

mkdir -p /tmp/efi
Expand Down
2 changes: 2 additions & 0 deletions tools/keytools/keygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ const char Store_hdr[] = "\n"
"#define KEYSTORE_SECTION __attribute__((section (\"__KEYSTORE,__keystore\")))\n"
"#elif defined(__CCRX__)\n"
"#define KEYSTORE_SECTION\n"
"#elif defined(TARGET_x86_64_efi)\n"
"#define KEYSTORE_SECTION\n"
"#else\n"
"#define KEYSTORE_SECTION __attribute__((section (\".keystore\")))\n"
"#endif\n\n"
Expand Down

0 comments on commit bf55ac1

Please sign in to comment.