Skip to contentSkip to conversation

boot/syslinux: fix build of efi part with gnu-efi 3.0.10

PATCH New Thomas Petazzoni 2 participants 4 messages Mar 24, 2020 – Apr 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 boot/syslinux: fix build of efi part with gnu-efi 3.0.10

The following defconfig:

BR2_x86_i686=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.bootlin.com/downloads/releases/toolchains/x86-i686/tarballs/x86-i686--glibc--bleeding-edge-2018.11-1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_TARGET_SYSLINUX=y
BR2_TARGET_SYSLINUX_EFI=y

fails to build due to missing setjmp/longjmp definitions, which is a consequence of a change introduced between gnu-efi 3.0.9 and 3.0.10.

This build failure is fixed by adding another syslinux paytch, which has been submitted upstream.

---
 .../0015-efi-main.c-include-efisetjmp.h.patch | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 boot/syslinux/0015-efi-main.c-include-efisetjmp.h.patch
boot/syslinux/0015-efi-main.c-include-efisetjmp.h.patch new file +60 -0
new file mode 100644
index 0000000000..2fd61ecbc8
@@ -0,0 +1,60 @@
+From 7d68fa68cd9f2987bd85339f3391913a8b0e58c7 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Tue, 24 Mar 2020 10:21:27 +0100
+Subject: [PATCH] efi/main.c: include <efisetjmp.h>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Building syslinux against gnu-efi 3.0.10 currently fails with:
+
+syslinux/efi/main.c:33:8: error: unknown type name ?jmp_buf?
+   33 | static jmp_buf load_error_buf;
+      |        ^~~~~~~
+syslinux/efi/main.c: In function ?local_boot?:
+syslinux/efi/main.c:189:5: warning: implicit declaration of function ?longjmp? [-Wimplicit-function-declaration]
+  189 |     longjmp(&load_error_buf, 1);
+      |     ^~~~~~~
+syslinux/efi/main.c: In function ?build_gdt?:
+syslinux/efi/main.c:907:75: warning: taking address of packed member of ?struct dt_desc? may result in an unaligned pointer value [-Waddress-of-packed-member]
+  907 |  status = emalloc(gdt.limit, __SIZEOF_POINTER__ , (EFI_PHYSICAL_ADDRESS *)&gdt.base);
+      |                                                                           ^~~~~~~~~
+syslinux/efi/main.c: In function ?efi_main?:
+syslinux/efi/main.c:1390:7: warning: implicit declaration of function ?setjmp? [-Wimplicit-function-declaration]
+ 1390 |  if (!setjmp(&load_error_buf))
+      |       ^~~~~~
+make[3]: *** [syslinux/mk/efi.mk:63: main.o] Error 1
+
+This is due to gnu-efi commit 486ba3c3bdd147b7d98159b9e650be60bce0f027
+("Do not include efisetjmp.h on efi.h"), in which they state:
+
+    Do not include efisetjmp.h on efi.h
+
+    People than really want to use efisetjmp implementation can include
+    the header on their own.
+
+    Signed-off-by: leo <[email protected]>
+
+So we act as specified, and include <efisetjmp.h> from efi/main.c.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+Upstream: https://www.syslinux.org/archives/2020-March/026621.html
+---
+ efi/main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/efi/main.c b/efi/main.c
+index 6a748412..e924cfb1 100644
+--- a/efi/main.c
++++ b/efi/main.c
+@@ -12,6 +12,7 @@
+ #include <sys/ansi.h>
+ 
+ #include "efi.h"
++#include <efisetjmp.h>
+ #include "fio.h"
+ #include "version.h"
+ #include "efi_pxe.h"
+-- 
+2.25.1
+
Signature · 1 line
2.25.1
author Applied
#1 lore raw

PATCH 1/2 boot/syslinux: fix build of efi part with gnu-efi 3.0.10

Quoted 17 lines · On Tue, 24 Mar 2020 15:23:55 +0100 Thomas Petazzoni…

The following defconfig:

BR2_x86_i686=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.bootlin.com/downloads/releases/toolchains/x86-i686/tarballs/x86-i686--glibc--bleeding-edge-2018.11-1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_TARGET_SYSLINUX=y
BR2_TARGET_SYSLINUX_EFI=y

fails to build due to missing setjmp/longjmp definitions, which is a consequence of a change introduced between gnu-efi 3.0.9 and 3.0.10.

Quoted 8 lines

This build failure is fixed by adding another syslinux paytch, which has been submitted upstream.

---
 .../0015-efi-main.c-include-efisetjmp.h.patch | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 boot/syslinux/0015-efi-main.c-include-efisetjmp.h.patch

I've applied my two patches. Thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 2/2 support/testing: add build tests for the syslinux bootloader

In reply to Thomas Petazzoni

This commit adds four new tests for the syslinux bootloader:

- Building on x86, for legacy BIOS
- Building on x86, for EFI BIOS
- Building on x86-64, for legacy BIOS
- Building on x86-64, for EFI BIOS

Runtime testing in Qemu would certainly be possible, but is left as a future addition to these tests.

---
 .gitlab-ci.yml                              |  4 +
 DEVELOPERS                                  |  1 +
 support/testing/tests/boot/test_syslinux.py | 83 +++++++++++++++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 support/testing/tests/boot/test_syslinux.py
.gitlab-ci.yml +4 -0
index f5ed95f5e7..b505e842ca 100644
@@ -335,6 +335,10 @@ zynqmp_zcu106_defconfig: { extends: .defconfig }
 tests.boot.test_atf.TestATFAllwinner: { extends: .runtime_test }
 tests.boot.test_atf.TestATFMarvell: { extends: .runtime_test }
 tests.boot.test_atf.TestATFVexpress: { extends: .runtime_test }
+tests.boot.test_syslinux.TestSysLinuxX86EFI: { extends: .runtime_test }
+tests.boot.test_syslinux.TestSysLinuxX86LegacyBios: { extends: .runtime_test }
+tests.boot.test_syslinux.TestSysLinuxX86_64EFI: { extends: .runtime_test }
+tests.boot.test_syslinux.TestSysLinuxX86_64LegacyBios: { extends: .runtime_test }
 tests.core.test_file_capabilities.TestFileCapabilities: { extends: .runtime_test }
 tests.core.test_hardening.TestFortifyConserv: { extends: .runtime_test }
 tests.core.test_hardening.TestFortifyNone: { extends: .runtime_test }
DEVELOPERS +1 -0
index 8ea08739f7..fb12347512 100644
@@ -2501,6 +2501,7 @@ F:	package/scons/
 F:	package/squashfs/
 F:	package/wayland/
 F:	package/weston/
+F:	support/testing/tests/boot/test_syslinux.py
 F:	toolchain/
 
 N:	Timo Ketola <[email protected]>
support/testing/tests/boot/test_syslinux.py new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH 1/2 boot/syslinux: fix build of efi part with gnu-efi 3.0.10

In reply to Thomas Petazzoni
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The following defconfig:
BR2_x86_i686=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.bootlin.com/downloads/releases/toolchains/x86-i686/tarballs/x86-i686--glibc--bleeding-edge-2018.11-1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_TARGET_SYSLINUX=y
BR2_TARGET_SYSLINUX_EFI=y

Quoted 7 lines

fails to build due to missing setjmp/longjmp definitions, which is a consequence of a change introduced between gnu-efi 3.0.9 and 3.0.10.

This build failure is fixed by adding another syslinux paytch, which has been submitted upstream.

Committed to 2020.02.x and 2019.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard