syslinux: Builds with the target toolchain
PATCH 1/1 syslinux: Builds with the target toolchain
--- DEVELOPERS | 1 + boot/syslinux/0003-fix_ftbfs_no_dynamic_linker.patch | 16 ++++++++++++++++ boot/syslinux/0004-fix-ld-oformat-32bits.patch | 15 +++++++++++++++ .../0005-build-utils-with-host-toolchain.patch | 18 ++++++++++++++++++ boot/syslinux/syslinux.mk | 10 +++++----- 5 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 boot/syslinux/0003-fix_ftbfs_no_dynamic_linker.patch create mode 100644 boot/syslinux/0004-fix-ld-oformat-32bits.patch create mode 100644 boot/syslinux/0005-build-utils-with-host-toolchain.patch
DEVELOPERS +1 -0
@@ -150,6 +150,7 @@ N: Benjamin Kamath <[email protected]> F: package/lapack/ N: Beno?t Allard <[email protected]> +F: boot/syslinux/ F: package/dc3dd/ N: Bernd Kuhls <[email protected]>
boot/syslinux/0003-fix_ftbfs_no_dynamic_linker.patch new file +16 -0
@@ -0,0 +1,16 @@ +Fix for https://bugs.debian.org/846679 : syslinux: FTBFS: ld: +ldlinux.elf: Not enough room for program headers, try linking with -N + +Patch from: Steve McIntyre <[email protected]> +https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=846679;filename=syslinux_6.03%2Bdfsg-14.1.debdiff;msg=10 +--- a/core/Makefile 2017-01-28 18:33:22.750959519 +0000 ++++ b/core/Makefile 2017-01-28 18:27:47.387981830 +0000 +@@ -165,7 +165,7 @@ + + %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS) + $(LD) $(LDFLAGS) -Bsymbolic $(LD_PIE) -E --hash-style=gnu -T $(LDSCRIPT) -M -o $@ $< \ +- --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group \ ++ --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group --no-dynamic-linker \ + > $(@:.elf=.map) + $(OBJDUMP) -h $@ > $(@:.elf=.sec) + $(PERL) $(SRC)/lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
boot/syslinux/0004-fix-ld-oformat-32bits.patch new file +15 -0
@@ -0,0 +1,15 @@ +Force ld to output i386 bytecodes and not x86_64 to be consistent with the +other .o files. + +Signed-off-by: Beno?t Allard <[email protected]> +--- a/memdisk/Makefile 2017-04-04 16:45:43.033844618 +0200 ++++ b/memdisk/Makefile 2017-04-04 16:45:11.298619204 +0200 +@@ -78,7 +78,7 @@ memdisk16.o: memdisk16.asm + $(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $< + + memdisk_%.o: memdisk_%.bin +- $(LD) -r -b binary -o $@ $< ++ $(LD) --oformat elf32-i386 -r -b binary -o $@ $< + + memdisk16.elf: $(OBJS16) + $(LD) -Ttext 0 -o $@ $^
boot/syslinux/0005-build-utils-with-host-toolchain.patch new file +18 -0
@@ -0,0 +1,18 @@ +The utilities are meant to run on the host machine, hence must be built using +the host toolchain. + +Signed-off-by: Beno?t Allard <[email protected]> +--- a/utils/Makefile 2017-04-05 11:49:48.156097181 +0200 ++++ b/utils/Makefile 2017-04-05 11:50:30.234872515 +0200 +@@ -17,8 +17,9 @@ + VPATH = $(SRC) + include $(MAKEDIR)/syslinux.mk + +-CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) +-LDFLAGS = -O2 ++CC = $(HOSTCC) ++CFLAGS = $(HOST_CFLAGS) $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) ++LDFLAGS = $(HOST_LDFLAGS) -O2 + + C_TARGETS = isohybrid gethostip memdiskfind + SCRIPT_TARGETS = mkdiskimage
boot/syslinux/syslinux.mk +5 -5
@@ -51,8 +51,10 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(TARGET_MAKE_ENV) $(MAKE1) \ + CC="$(TARGET_CC)" LD="$(TARGET_LD)" NASM="$(HOST_DIR)/usr/bin/nasm" \ + HOSTCC="$(HOSTCC)" HOST_CFLAGS="$(HOST_CFLAGS)" HOST_LDFLAGS="$(HOST_LDFLAGS)" \ + $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) endef # While the actual bootloader is compiled for the target, several
@@ -61,9 +63,7 @@ endef # Repeat CC and AR, since syslinux really wants to check them at # install time define SYSLINUX_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ - -C $(@D) $(SYSLINUX_TARGET) install + $(TARGET_MAKE_ENV) $(MAKE) $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) -C $(@D) $(SYSLINUX_TARGET) install endef SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin
Signature · 1 line
2.1.4
PATCH 1/1 syslinux: Builds with the target toolchain
Hello,
Thanks a lot for doing this work. I have a number of comments below, nothing really major.
First of all, this deserves a longer commit log to explain why you're doing this.
Quoted 3 lines · Beno?t Allard
Signed-off-by Beno?t Allard <[email protected]>--- DEVELOPERS | 1 +
This change should be in a separate patch. For new packages, we want it to be with the patch adding the package. But since the syslinux package already exists, it should be a separate patch, as it's unrelated to making syslinux build with the target toolchain.
boot/syslinux/0003-fix_ftbfs_no_dynamic_linker.patch line 5
Quoted 11 lines
boot/syslinux/0003-fix_ftbfs_no_dynamic_linker.patch new file +5
-0@@ -0,0 +1,16 @@ +Fix for https://bugs.debian.org/846679 : syslinux: FTBFS: ld: +ldlinux.elf: Not enough room for program headers, try linking with -N + +Patch from: Steve McIntyre <[email protected]> +https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=846679;filename=syslinux_6.03%2Bdfsg-14.1.debdiff;msg=10
This needs your Signed-off-by as well. Also leave an empty line between the Signed-off-by line and the start of the patch itself.
boot/syslinux/0004-fix-ld-oformat-32bits.patch line 4
Quoted 10 lines
boot/syslinux/0004-fix-ld-oformat-32bits.patch new file +4
-0@@ -0,0 +1,15 @@ +Force ld to output i386 bytecodes and not x86_64 to be consistent with the +other .o files. + +Signed-off-by: Beno?t Allard <[email protected]>
Ditto: add an empty line here. But in fact, since syslinux is using Git
(http://www.syslinux.org/wiki/index.php?title=Development), we would like to have Git-formatted patches instead (i.e patches generated with git format-patch).
boot/syslinux/0005-build-utils-with-host-toolchain.patch line 4
Quoted 10 lines
boot/syslinux/0005-build-utils-with-host-toolchain.patch new file +4
-0@@ -0,0 +1,18 @@ +The utilities are meant to run on the host machine, hence must be built using +the host toolchain. + +Signed-off-by: Beno?t Allard <[email protected]>
Please format with "git format-patch" as well.
Quoted 4 lines
boot/syslinux/0005-build-utils-with-host-toolchain.patch new file +4
-0+--- a/utils/Makefile 2017-04-05 11:49:48.156097181 +0200 ++++ b/utils/Makefile 2017-04-05 11:50:30.234872515 +0200 +@@ -17,8 +17,9 @@ + VPATH = $(SRC)
boot/syslinux/0005-build-utils-with-host-toolchain.patch line 18
Quoted 10 lines
boot/syslinux/0005-build-utils-with-host-toolchain.patch new file +10
-0+ include $(MAKEDIR)/syslinux.mk + +-CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) +-LDFLAGS = -O2 ++CC = $(HOSTCC) ++CFLAGS = $(HOST_CFLAGS) $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) ++LDFLAGS = $(HOST_LDFLAGS) -O2 + + C_TARGETS = isohybrid gethostip memdiskfind + SCRIPT_TARGETS = mkdiskimage
Also, if you could submit those patches to the upstream syslinux project, it would be nice.
boot/syslinux/syslinux.mk SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP · line 56
Quoted 13 lines
boot/syslinux/syslinux.mk +3
-2@@ -51,8 +51,10 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(TARGET_MAKE_ENV) $(MAKE1) \ + CC="$(TARGET_CC)" LD="$(TARGET_LD)" NASM="$(HOST_DIR)/usr/bin/nasm" \ + HOSTCC="$(HOSTCC)" HOST_CFLAGS="$(HOST_CFLAGS)" HOST_LDFLAGS="$(HOST_LDFLAGS)" \
In fact, it would have been better to use CC_FOR_BUILD, CFLAGS_FOR_BUILD, LDFLAGS_FOR_BUILD in the syslinux Makefile. If you do this, then you can simplify this to:
$(TARGET_MAKE_ENV) $(MAKE1) $(TARGET_CONFIGURE_OPTS) \ NASM=... $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET)
boot/syslinux/syslinux.mk endef · line 64
Quoted 2 lines
boot/syslinux/syslinux.mk +0
-0# Repeat CC and AR, since syslinux really wants to check them at # install time
You're no longer repeating CC and AR, so this comment no longer makes sense.
boot/syslinux/syslinux.mk endef · line 67
Quoted 6 lines
boot/syslinux/syslinux.mk +1
-3define SYSLINUX_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ - -C $(@D) $(SYSLINUX_TARGET) install + $(TARGET_MAKE_ENV) $(MAKE) $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) -C $(@D) $(SYSLINUX_TARGET) install endef
It would also be good in the commit log to explicitly say that you have tested this with a x86-64 Buildroot toolchain, and that it produces as expected a working 32-bit syslinux, tested on HW.
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 1/2 syslinux: Builds with the target toolchain
In reply to Benoît AllardUntil now, the host toolchain was used to build syslinux. syslinux does requires gnu-efi, and this is built using the target toolchain. Mixing different toolchains doesn't work well, so let's use the target toolchain for syslinux as well.
Well, almost, as syslinux also contains some utilities that have to run on the host. Those ones need to be built with the host toolchain.
This was tested using a buildroot's built x86_64 toolchain, and checked that some output binaries are 32-bits. It was tested as well if they actually boot on Hardware.
---
Changes v1 -> v2:
- Move the DEVELOPERS note to another patch
- Add Signed-Off-By to the patch 0003
- Format the patches using git format-patch
- Use XX_FOR_BUILD instead of HOSTXX
- Remove old comment in the syslinuc.mk file
--- .../0003-fix_ftbfs_no_dynamic_linker.patch | 19 ++++++++++++ ...memdisk-Force-ld-output-format-to-32-bits.patch | 32 ++++++++++++++++++++ ...005-utils-Use-the-host-toolchain-to-build.patch | 35 ++++++++++++++++++++++ boot/syslinux/syslinux.mk | 12 ++++---- 4 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 boot/syslinux/0003-fix_ftbfs_no_dynamic_linker.patch create mode 100644 boot/syslinux/0004-memdisk-Force-ld-output-format-to-32-bits.patch create mode 100644 boot/syslinux/0005-utils-Use-the-host-toolchain-to-build.patch
boot/syslinux/0003-fix_ftbfs_no_dynamic_linker.patch new file +19 -0
@@ -0,0 +1,19 @@ +Fix for https://bugs.debian.org/846679 : syslinux: FTBFS: ld: +ldlinux.elf: Not enough room for program headers, try linking with -N + +Patch from: Steve McIntyre <[email protected]> +https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=846679;filename=syslinux_6.03%2Bdfsg-14.1.debdiff;msg=10 + +Signed-off-by: Beno?t Allard <[email protected]> + +--- a/core/Makefile 2017-01-28 18:33:22.750959519 +0000 ++++ b/core/Makefile 2017-01-28 18:27:47.387981830 +0000 +@@ -165,7 +165,7 @@ + + %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS) + $(LD) $(LDFLAGS) -Bsymbolic $(LD_PIE) -E --hash-style=gnu -T $(LDSCRIPT) -M -o $@ $< \ +- --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group \ ++ --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group --no-dynamic-linker \ + > $(@:.elf=.map) + $(OBJDUMP) -h $@ > $(@:.elf=.sec) + $(PERL) $(SRC)/lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
boot/syslinux/0004-memdisk-Force-ld-output-format-to-32-bits.patch new file +32 -0
@@ -0,0 +1,32 @@ +From 948aec20d1b0233e509f547dba7efb2274359947 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <[email protected]> +Date: Wed, 5 Apr 2017 14:18:09 +0200 +Subject: [PATCH 1/2] memdisk: Force ld output format to 32-bits +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On toolchains where the default output is x86_64, we need to be +consistent with the other .o files + +Signed-off-by: Beno?t Allard <[email protected]> +--- + memdisk/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/memdisk/Makefile b/memdisk/Makefile +index 42e56e0..ccd5738 100644 +--- a/memdisk/Makefile ++++ b/memdisk/Makefile +@@ -78,7 +78,7 @@ memdisk16.o: memdisk16.asm + $(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $< + + memdisk_%.o: memdisk_%.bin +- $(LD) -r -b binary -o $@ $< ++ $(LD) --oformat elf32-i386 -r -b binary -o $@ $< + + memdisk16.elf: $(OBJS16) + $(LD) -Ttext 0 -o $@ $^ +-- +2.1.4 +
boot/syslinux/0005-utils-Use-the-host-toolchain-to-build.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 91777a0a7f693db71b5f77813c188ad6ebe4c9e8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <[email protected]> +Date: Wed, 5 Apr 2017 14:25:02 +0200 +Subject: [PATCH 2/2] utils: Use the host toolchain to build. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The utilities are meant to run on the host machine, hence must be built using +the host toolchain. + +Signed-off-by: Beno?t Allard <[email protected]> +--- + utils/Makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/utils/Makefile b/utils/Makefile +index dfe6259..f31f117 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -17,8 +17,9 @@ + VPATH = $(SRC) + include $(MAKEDIR)/syslinux.mk + +-CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) +-LDFLAGS = -O2 ++CC = $(CC_FOR_BUILD) ++CFLAGS = $(CFLAGS_FOR_BUILD) $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) ++LDFLAGS = $(LDFLAGS_FOR_BUILD) -O2 + + C_TARGETS = isohybrid gethostip memdiskfind + SCRIPT_TARGETS = mkdiskimage +-- +2.1.4 +
boot/syslinux/syslinux.mk +5 -7
@@ -51,19 +51,17 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(TARGET_MAKE_ENV) $(MAKE1) \ + CC="$(TARGET_CC)" LD="$(TARGET_LD)" NASM="$(HOST_DIR)/usr/bin/nasm" \ + CC_FOR_BUILD="$(HOSTCC)" CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \ + $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) endef # While the actual bootloader is compiled for the target, several # utilities for installing the bootloader are meant for the host. # Repeat the target, otherwise syslinux will try to build everything -# Repeat CC and AR, since syslinux really wants to check them at -# install time define SYSLINUX_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ - -C $(@D) $(SYSLINUX_TARGET) install + $(TARGET_MAKE_ENV) $(MAKE) $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) -C $(@D) $(SYSLINUX_TARGET) install endef SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin
Signature · 1 line
2.1.4
PATCH v2 2/2 Take ownership of the (orphaned) syslinux package.
As it turns out, I am the only one who touched it in the last year.
--- DEVELOPERS | 1 + 1 file changed, 1 insertion(+)
DEVELOPERS +1 -0
@@ -150,6 +150,7 @@ N: Benjamin Kamath <[email protected]> F: package/lapack/ N: Beno?t Allard <[email protected]> +F: boot/syslinux/ F: package/dc3dd/ N: Bernd Kuhls <[email protected]>
Signature · 1 line
2.1.4
PATCH 1/1 syslinux: Builds with the target toolchain
In reply to Thomas PetazzoniQuoted 22 lines · On Wed, 5 Apr 2017 13:02:27 +0200 Thomas Petazzoni…
Quoted 16 lines
boot/syslinux/syslinux.mk +3
-2@@ -51,8 +51,10 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(TARGET_MAKE_ENV) $(MAKE1) \ + CC="$(TARGET_CC)" LD="$(TARGET_LD)" NASM="$(HOST_DIR)/usr/bin/nasm" \ + HOSTCC="$(HOSTCC)" HOST_CFLAGS="$(HOST_CFLAGS)"Quoted 1 line
HOST_LDFLAGS="$(HOST_LDFLAGS)" \
In fact, it would have been better to use
CC_FOR_BUILD,CFLAGS_FOR_BUILD,LDFLAGS_FOR_BUILDin the syslinuxMakefile. If you do this, then you can simplify this to:
Quoted 4 lines
$(TARGET_MAKE_ENV) $(MAKE1) $(TARGET_CONFIGURE_OPTS) \ NASM=... $(SYSLINUX_EFI_ARGS) -C $(@D)$(SYSLINUX_TARGET)
I didn't addressed this in my version 2 of the patch as somehow, when using $(TARGET_CONFIGURE_OPTS) instead of the various variables, the Makefiles from syslinux were not able to define CFLAGS on their own, or somehow, they didn't used their version of it.
Regards,
Ben.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170405/6d7b9aff/attachment.asc>
PATCH 1/1 syslinux: Builds with the target toolchain
Quoted 29 lines · Beno?t Allard
Quoted 22 lines · On Wed, 5 Apr 2017 13:02:27 +0200 Thomas Petazzoni…
Quoted 16 lines
boot/syslinux/syslinux.mk +3
-2@@ -51,8 +51,10 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(TARGET_MAKE_ENV) $(MAKE1) \ + CC="$(TARGET_CC)" LD="$(TARGET_LD)" NASM="$(HOST_DIR)/usr/bin/nasm" \ + HOSTCC="$(HOSTCC)" HOST_CFLAGS="$(HOST_CFLAGS)"Quoted 1 line
HOST_LDFLAGS="$(HOST_LDFLAGS)" \
In fact, it would have been better to use
CC_FOR_BUILD,CFLAGS_FOR_BUILD,LDFLAGS_FOR_BUILDin the syslinuxMakefile. If you do this, then you can simplify this to:Quoted 4 lines
$(TARGET_MAKE_ENV) $(MAKE1) $(TARGET_CONFIGURE_OPTS) \ NASM=... $(SYSLINUX_EFI_ARGS) -C $(@D)$(SYSLINUX_TARGET)
Quoted 4 lines
I didn't addressed this in my version 2 of the patch as somehow, when using $(TARGET_CONFIGURE_OPTS) instead of the various variables, the Makefiles from syslinux were not able to define CFLAGS on their own, or somehow, they didn't used their version of it.
That's because the Makefile in syslinux does
CFLAGS = ...
This means that if you pass CFLAGS on the left-hand side of $(MAKE) (i.e., in the environment), they won't be used at all, and if you pass it on the right-hand side, the one from the Makefile won't be used.
The solution is to patch the syslinux Makefile to either:
- not assign to CFLAGS at all, instead use some other variable and use that in the build command;
- assign CFLAGS with either ?= (for defaults that can be overridden by the user) or += (for things that always have to be there) instead of just =; in this case you should pass TARGET_CONFIGURE_OPTS in the environment, not as a Makefile override.
The second option is a bit simpler to patch in, but it requires GNU make which
some upstreams don't like.
Regards,
Arnout
PS should we make this a FAQ entry in the manual?
Signature · 14 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170405/119d142e/attachment.asc>
PATCH v2 2/2 Take ownership of the (orphaned) syslinux package.
In reply to Benoît AllardProbably Thomas will apply before you respin, but if he doesn't:
It is nice for 'git log --oneline' output if the subject line contains your
name, i.e.:
DEVELOPERS: add Beno?t Allard for boot/syslinux
Quoted 1 line · Beno?t Allard
As it turns out, I am the only one who touched it in the last year.
Also we generally avoid using "I" in commit messages (except below --- of
course). In this case I think it's warranted, though.
Regards,
Arnout
Quoted 19 lines
Signed-off-by Beno?t Allard <[email protected]>--- DEVELOPERS | 1 + 1 file changed, 1 insertion(+)DEVELOPERS +1
-0@@ -150,6 +150,7 @@ N: Benjamin Kamath <[email protected]> F: package/lapack/ N: Beno?t Allard <[email protected]> +F: boot/syslinux/ F: package/dc3dd/ N: Bernd Kuhls <[email protected]>
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Thomas Petazzoni
AppliedPATCH v2 2/2 Take ownership of the (orphaned) syslinux package.
In reply to Benoît AllardHello,
Quoted 6 lines · Beno?t Allard
As it turns out, I am the only one who touched it in the last year.
Signed-off-by Beno?t Allard <[email protected]>--- DEVELOPERS | 1 + 1 file changed, 1 insertion(+)
Applied to master after tweaking the commit log as suggested by Arnout.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 syslinux: Builds with the target toolchain
In reply to Benoît AllardHello,
Quoted 7 lines · Beno?t Allard
Until now, the host toolchain was used to build syslinux. syslinux does requires gnu-efi, and this is built using the target toolchain. Mixing different toolchains doesn't work well, so let's use the target toolchain for syslinux as well.
Well, almost, as syslinux also contains some utilities that have to run on the host. Those ones need to be built with the host toolchain.
This was tested using a buildroot's built
x86_64toolchain, and checked that some output binaries are 32-bits. It was tested as well if they actually boot on Hardware.Signed-off-by Beno?t Allard <[email protected]>
Unfortunately, this doesn't build for me: the prepcore tool is built for the target, but executed on the host. I've intentionally tested with a x86-64 musl toolchain, so that the C library of the target is not the one of my host machine, which guarantees a target executable will not run on my host machine. It fails with:
perl /home/thomas/projets/buildroot/output/build/syslinux-6.03/core/lstadjust.pl ldlinux.lsr ldlinux.sec ldlinux.lst objcopy -O binary -S ldlinux.elf ldlinux.raw /home/thomas/projets/buildroot/output/build/syslinux-6.03/bios/core/../lzo/prepcore ldlinux.raw ldlinux.bin make[5]: /home/thomas/projets/buildroot/output/build/syslinux-6.03/bios/core/../lzo/prepcore: Command not found /home/thomas/projets/buildroot/output/build/syslinux-6.03/core/Makefile:153: recipe for target 'ldlinux.bin' failed make[5]: *** [ldlinux.bin] Error 127
rm ldlinux.o ldlinux.raw/home/thomas/projets/buildroot/output/build/syslinux-6.03/Makefile:285: recipe for target 'core' failed make[4]: *** [core] Error 2 /home/thomas/projets/buildroot/output/build/syslinux-6.03/Makefile:254: recipe for target 'bios' failed make[3]: *** [bios] Error 2
Makefile:103: recipe for target 'bios' failed
make[2]: *** [bios] Error 2
To reproduce this issue, build the following configuration:
BR2_x86_64=y
BR2_x86_atom=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-x86-64-musl-2017.02-744-g40962a0.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_5=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_10=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_SYSLINUX=y
BR2_TARGET_SYSLINUX_ISOLINUX=y
BR2_TARGET_SYSLINUX_PXELINUX=y
BR2_TARGET_SYSLINUX_MBR=y
Also, I've done a number of improvements to your patch, so if you could restart from the version I was about to commit before seeing the issue, it would be nice. I pushed it at:
http://git.free-electrons.com/users/thomas-petazzoni/buildroot/commit/?h=syslinux-fix
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v4 1/1 syslinux: build with the target toolchain
In reply to Benoît AllardUntil now, the host toolchain was used to build syslinux, as it was not possible to build a 32-bit syslinux with a x86-64 toolchain.
However, syslinux requires gnu-efi, and gnu-efi is built using the target toolchain. Mixing different toolchains doesn't work well, so this commit changes the syslinux package to use the target toolchain for syslinux as well. This is made possible by patches 0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch and 0004-memdisk-Force-ld-output-format-to-32-bits.patch.
Since syslinux also contains some utilities that have to run on the host, those have to continue being built with the host toolchain, which requires patch 0005-utils-Use-the-host-toolchain-to-build.patch.
This was tested using a Buildroot's built x86_64 toolchain, and checked that the output binaries are 32-bits. It was tested as well if they actually boot on hardware.
---
Changes v1 -> v2:
- Move the DEVELOPERS note to another patch
- Add Signed-Off-By to the patch 0003
- Format the patches using git format-patch
- Use XX_FOR_BUILD instead of HOSTXX
- Remove old comment in the syslinuc.mk file
Changes v2 -> v3 (by Thomas):
- reformat patch 0003 as a Git formatted patch, remove numbering in patches 0004 and 0005
- remove BR2_HOSTARCH_NEEDS_IA32_COMPILER dependency
- improve commit log.
- fix indentation in .mk file.
Changes v3 -> v4:
- Add patch 0006 to build lzo and prepcore with the host toolchain as well.
- Rewrite patch 0004 to use new variable and not redefine previous ones.
- Add dependency to libuuid needed by extlinux.
- Define LD in the install command. Somehow installing finalize some linking.
- Remove dependency on host-util-linux.
--- ....elf-Not-enough-room-for-program-headers-.patch | 35 +++++++++++++ ...memdisk-Force-ld-output-format-to-32-bits.patch | 32 ++++++++++++ ...005-utils-Use-the-host-toolchain-to-build.patch | 60 ++++++++++++++++++++++ ...6-lzo-Use-the-host-toolchain-for-prepcore.patch | 44 ++++++++++++++++ boot/syslinux/Config.in | 3 +- boot/syslinux/syslinux.mk | 21 +++++--- 6 files changed, 187 insertions(+), 8 deletions(-) create mode 100644 boot/syslinux/0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch create mode 100644 boot/syslinux/0004-memdisk-Force-ld-output-format-to-32-bits.patch create mode 100644 boot/syslinux/0005-utils-Use-the-host-toolchain-to-build.patch create mode 100644 boot/syslinux/0006-lzo-Use-the-host-toolchain-for-prepcore.patch
boot/syslinux/0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 61de7762389d460da7ffdd644f50c60175cce23b Mon Sep 17 00:00:00 2001 +From: Steve McIntyre <[email protected]> +Date: Wed, 5 Apr 2017 22:09:37 +0200 +Subject: [PATCH] Fix 'ldlinux.elf: Not enough room for program headers, try + linking with -N' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix for https://bugs.debian.org/846679: syslinux: FTBFS: ld: +ldlinux.elf: Not enough room for program headers, try linking with -N + +https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=846679;filename=syslinux_6.03%2Bdfsg-14.1.debdiff;msg=10 + +Signed-off-by: Beno?t Allard <[email protected]> +--- + core/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/core/Makefile b/core/Makefile +index ad0acb5..58a3545 100644 +--- a/core/Makefile ++++ b/core/Makefile +@@ -165,7 +165,7 @@ LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld + + %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS) + $(LD) $(LDFLAGS) -Bsymbolic $(LD_PIE) -E --hash-style=gnu -T $(LDSCRIPT) -M -o $@ $< \ +- --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group \ ++ --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group --no-dynamic-linker \ + > $(@:.elf=.map) + $(OBJDUMP) -h $@ > $(@:.elf=.sec) + $(PERL) $(SRC)/lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst) +-- +2.7.4 +
boot/syslinux/0004-memdisk-Force-ld-output-format-to-32-bits.patch new file +32 -0
@@ -0,0 +1,32 @@ +From c0287594239d5af2082cac20817f8e8b11a4b1b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <[email protected]> +Date: Wed, 5 Apr 2017 14:18:09 +0200 +Subject: [PATCH] memdisk: Force ld output format to 32-bits +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On toolchains where the default output is x86_64, we need to be +consistent with the other .o files + +Signed-off-by: Beno?t Allard <[email protected]> +--- + memdisk/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/memdisk/Makefile b/memdisk/Makefile +index e6557d8..06613ff 100644 +--- a/memdisk/Makefile ++++ b/memdisk/Makefile +@@ -78,7 +78,7 @@ memdisk16.o: memdisk16.asm + $(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $< + + memdisk_%.o: memdisk_%.bin +- $(LD) -r -b binary -o $@ $< ++ $(LD) --oformat elf32-i386 -r -b binary -o $@ $< + + memdisk16.elf: $(OBJS16) + $(LD) -Ttext 0 -o $@ $^ +-- +2.7.4 +
boot/syslinux/0005-utils-Use-the-host-toolchain-to-build.patch new file +60 -0
60 lines not on this page · raw message
boot/syslinux/0006-lzo-Use-the-host-toolchain-for-prepcore.patch new file +44 -0
44 lines not on this page · raw message
boot/syslinux/Config.in +2 -1
@@ -1,12 +1,13 @@ config BR2_TARGET_SYSLINUX bool "syslinux" depends on BR2_i386 || BR2_x86_64 - select BR2_HOSTARCH_NEEDS_IA32_COMPILER # Make sure@least one of the flavors is installed select BR2_TARGET_SYSLINUX_ISOLINUX \ if !BR2_TARGET_SYSLINUX_PXELINUX && \ !BR2_TARGET_SYSLINUX_MBR && \ !BR2_TARGET_SYSLINUX_EFI + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_LIBUUID help The syslinux bootloader for x86 systems. This includes: syslinux, pxelinux, extlinux.
boot/syslinux/syslinux.mk +14 -7
@@ -13,7 +13,7 @@ SYSLINUX_LICENSE_FILES = COPYING SYSLINUX_INSTALL_IMAGES = YES -SYSLINUX_DEPENDENCIES = host-nasm host-util-linux host-upx +SYSLINUX_DEPENDENCIES = host-nasm host-upx util-linux ifeq ($(BR2_TARGET_SYSLINUX_LEGACY_BIOS),y) SYSLINUX_TARGET += bios
@@ -51,18 +51,25 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(TARGET_MAKE_ENV) $(MAKE1) \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_LD)" \ + NASM="$(HOST_DIR)/usr/bin/nasm" \ + CC_FOR_BUILD="$(HOSTCC)" \ + CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \ + LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \ + $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) endef # While the actual bootloader is compiled for the target, several # utilities for installing the bootloader are meant for the host. # Repeat the target, otherwise syslinux will try to build everything -# Repeat CC and AR, since syslinux really wants to check them at -# install time +# Repeat LD (and CC) as it happens that some binaries are linked at +# install-time. define SYSLINUX_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ + $(TARGET_MAKE_ENV) $(MAKE1) $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_LD)" \ -C $(@D) $(SYSLINUX_TARGET) install endef
Signature · 1 line
2.1.4
PATCH v4 1/1 syslinux: build with the target toolchain
Hello,
Quoted 14 lines · Beno?t Allard
Until now, the host toolchain was used to build syslinux, as it was not possible to build a 32-bit syslinux with a x86-64 toolchain.
However, syslinux requires gnu-efi, and gnu-efi is built using the target toolchain. Mixing different toolchains doesn't work well, so this commit changes the syslinux package to use the target toolchain for syslinux as well. This is made possible by patches 0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch and 0004-memdisk-Force-ld-output-format-to-32-bits.patch.
Since syslinux also contains some utilities that have to run on the host, those have to continue being built with the host toolchain, which requires patch 0005-utils-Use-the-host-toolchain-to-build.patch.
Quoted 5 lines
This was tested using a Buildroot's built
x86_64toolchain, and checked that the output binaries are 32-bits. It was tested as well if they actually boot on hardware.Signed-off-by Beno?t Allard <[email protected]>
Thanks, this now builds fine. However, in output/host/usr/bin, I still have a program built with the target toolchain:
$ file output/host/usr/bin/syslinux output/host/usr/bin/syslinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, not stripped
See the /lib/ld-musl-x86_64 interpreter? This means it has been built against the musl C library, and therefore with the target toolchain.
What is this program useful for?
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v4 1/1 syslinux: build with the target toolchain
Quoted 32 lines · On Thu, 6 Apr 2017 17:13:23 +0200 Thomas Petazzoni…
Hello,
Quoted 15 lines · Beno?t Allard
Until now, the host toolchain was used to build syslinux, as it was not possible to build a 32-bit syslinux with a x86-64 toolchain.
However, syslinux requires gnu-efi, and gnu-efi is built using the target toolchain. Mixing different toolchains doesn't work well, so this commit changes the syslinux package to use the target toolchain for syslinux as well. This is made possible by patches 0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch and 0004-memdisk-Force-ld-output-format-to-32-bits.patch.
Since syslinux also contains some utilities that have to run on the host, those have to continue being built with the host toolchain, which requires patch 0005-utils-Use-the-host-toolchain-to-build.patch.
Quoted 5 lines
This was tested using a Buildroot's built
x86_64toolchain, and checked that the output binaries are 32-bits. It was tested as well if they actually boot on hardware.Signed-off-by Beno?t Allard <[email protected]>Thanks, this now builds fine. However, in output/host/usr/bin, I still have a program built with the target toolchain:
$ file output/host/usr/bin/syslinux output/host/usr/bin/syslinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, not stripped
Quoted 4 lines
See the
/lib/ld-musl-x86_64interpreter? This means it has been built against the musl C library, and therefore with the target toolchain.What is this program useful for?
As I understand it, this is an "installer" you should run on the target machine in order to install the syslinux bootloader. There should be (?) another one "extlinux" next to it that is suitable for installing the bootloader on an ext2 (4?) filesystem (that is the binary that has dependency on libuuid).
Regards,
Ben.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170407/22533656/attachment.asc>
PATCH v4 1/1 syslinux: build with the target toolchain
Hello,
Quoted 10 lines · Beno?t Allard
Quoted 4 lines
See the
/lib/ld-musl-x86_64interpreter? This means it has been built against the musl C library, and therefore with the target toolchain.What is this program useful for?
As I understand it, this is an "installer" you should run on the target machine in order to install the syslinux bootloader. There should be (?) another one "extlinux" next to it that is suitable for installing the bootloader on an ext2 (4?) filesystem (that is the binary that has dependency on libuuid).
If this program is not useful on the host (and therefore it is expected to have it built with the target toolchain), then we should not install it in HOST_DIR. On my side, I am fine with a post-install hook that simply deletes it, provided it comes with a comment that explains why.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v5 1/1 syslinux: build with the target toolchain
In reply to Benoît AllardUntil now, the host toolchain was used to build syslinux, as it was not possible to build a 32-bit syslinux with a x86-64 toolchain.
However, syslinux requires gnu-efi, and gnu-efi is built using the target toolchain. Mixing different toolchains doesn't work well, so this commit changes the syslinux package to use the target toolchain for syslinux as well. This is made possible by patches 0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch and 0004-memdisk-Force-ld-output-format-to-32-bits.patch.
Since syslinux also contains some utilities that have to run on the host, those have to continue being built with the host toolchain, which requires patch 0005-utils-Use-the-host-toolchain-to-build.patch.
Patch 0006-lzo-Use-the-host-toolchain-for-prepcore.patch is about building prepcore, another utility with the host toolchain as it is required at build-time.
This was tested using a Buildroot's built x86_64 toolchain, and checked that the output binaries are 32-bits. It was tested as well if they actually boot on hardware.
---
Changes v1 -> v2:
- Move the DEVELOPERS note to another patch
- Add Signed-Off-By to the patch 0003
- Format the patches using git format-patch
- Use XX_FOR_BUILD instead of HOSTXX
- Remove old comment in the syslinuc.mk file
Changes v2 -> v3 (by Thomas):
- reformat patch 0003 as a Git formatted patch, remove numbering in patches 0004 and 0005
- remove BR2_HOSTARCH_NEEDS_IA32_COMPILER dependency
- improve commit log.
- fix indentation in .mk file.
Changes v3 -> v4:
- Add patch 0006 to build lzo and prepcore with the host toolchain as well.
- Rewrite patch 0004 to use new variable and not redefine previous ones.
- Add dependency to libuuid needed by extlinux.
- Define LD in the install command. Somehow installing finalize some linking.
- Remove dependency on host-util-linux.
Changes v4 -> v5:
- Remove host/usr/bin/syslinux as it's meant for the target
- Extend commit message about patch 0006.
--- ....elf-Not-enough-room-for-program-headers-.patch | 35 +++++++++++++ ...memdisk-Force-ld-output-format-to-32-bits.patch | 32 ++++++++++++ ...005-utils-Use-the-host-toolchain-to-build.patch | 60 ++++++++++++++++++++++ ...6-lzo-Use-the-host-toolchain-for-prepcore.patch | 44 ++++++++++++++++ boot/syslinux/Config.in | 3 +- boot/syslinux/syslinux.mk | 29 ++++++++--- 6 files changed, 195 insertions(+), 8 deletions(-) create mode 100644 boot/syslinux/0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch create mode 100644 boot/syslinux/0004-memdisk-Force-ld-output-format-to-32-bits.patch create mode 100644 boot/syslinux/0005-utils-Use-the-host-toolchain-to-build.patch create mode 100644 boot/syslinux/0006-lzo-Use-the-host-toolchain-for-prepcore.patch
boot/syslinux/0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 61de7762389d460da7ffdd644f50c60175cce23b Mon Sep 17 00:00:00 2001 +From: Steve McIntyre <[email protected]> +Date: Wed, 5 Apr 2017 22:09:37 +0200 +Subject: [PATCH] Fix 'ldlinux.elf: Not enough room for program headers, try + linking with -N' +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix for https://bugs.debian.org/846679: syslinux: FTBFS: ld: +ldlinux.elf: Not enough room for program headers, try linking with -N + +https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=846679;filename=syslinux_6.03%2Bdfsg-14.1.debdiff;msg=10 + +Signed-off-by: Beno?t Allard <[email protected]> +--- + core/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/core/Makefile b/core/Makefile +index ad0acb5..58a3545 100644 +--- a/core/Makefile ++++ b/core/Makefile +@@ -165,7 +165,7 @@ LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld + + %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS) + $(LD) $(LDFLAGS) -Bsymbolic $(LD_PIE) -E --hash-style=gnu -T $(LDSCRIPT) -M -o $@ $< \ +- --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group \ ++ --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group --no-dynamic-linker \ + > $(@:.elf=.map) + $(OBJDUMP) -h $@ > $(@:.elf=.sec) + $(PERL) $(SRC)/lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst) +-- +2.7.4 +
boot/syslinux/0004-memdisk-Force-ld-output-format-to-32-bits.patch new file +32 -0
@@ -0,0 +1,32 @@ +From c0287594239d5af2082cac20817f8e8b11a4b1b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <[email protected]> +Date: Wed, 5 Apr 2017 14:18:09 +0200 +Subject: [PATCH] memdisk: Force ld output format to 32-bits +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On toolchains where the default output is x86_64, we need to be +consistent with the other .o files + +Signed-off-by: Beno?t Allard <[email protected]> +--- + memdisk/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/memdisk/Makefile b/memdisk/Makefile +index e6557d8..06613ff 100644 +--- a/memdisk/Makefile ++++ b/memdisk/Makefile +@@ -78,7 +78,7 @@ memdisk16.o: memdisk16.asm + $(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $< + + memdisk_%.o: memdisk_%.bin +- $(LD) -r -b binary -o $@ $< ++ $(LD) --oformat elf32-i386 -r -b binary -o $@ $< + + memdisk16.elf: $(OBJS16) + $(LD) -Ttext 0 -o $@ $^ +-- +2.7.4 +
boot/syslinux/0005-utils-Use-the-host-toolchain-to-build.patch new file +60 -0
60 lines not on this page · raw message
boot/syslinux/0006-lzo-Use-the-host-toolchain-for-prepcore.patch new file +44 -0
44 lines not on this page · raw message
boot/syslinux/Config.in +2 -1
@@ -1,12 +1,13 @@ config BR2_TARGET_SYSLINUX bool "syslinux" depends on BR2_i386 || BR2_x86_64 - select BR2_HOSTARCH_NEEDS_IA32_COMPILER # Make sure at least one of the flavors is installed select BR2_TARGET_SYSLINUX_ISOLINUX \ if !BR2_TARGET_SYSLINUX_PXELINUX && \ !BR2_TARGET_SYSLINUX_MBR && \ !BR2_TARGET_SYSLINUX_EFI + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_LIBUUID help The syslinux bootloader for x86 systems. This includes: syslinux, pxelinux, extlinux.
boot/syslinux/syslinux.mk +22 -7
@@ -13,7 +13,7 @@ SYSLINUX_LICENSE_FILES = COPYING SYSLINUX_INSTALL_IMAGES = YES -SYSLINUX_DEPENDENCIES = host-nasm host-util-linux host-upx +SYSLINUX_DEPENDENCIES = host-nasm host-upx util-linux ifeq ($(BR2_TARGET_SYSLINUX_LEGACY_BIOS),y) SYSLINUX_TARGET += bios
@@ -51,21 +51,36 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(TARGET_MAKE_ENV) $(MAKE1) \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_LD)" \ + NASM="$(HOST_DIR)/usr/bin/nasm" \ + CC_FOR_BUILD="$(HOSTCC)" \ + CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \ + LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \ + $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) endef # While the actual bootloader is compiled for the target, several # utilities for installing the bootloader are meant for the host. # Repeat the target, otherwise syslinux will try to build everything -# Repeat CC and AR, since syslinux really wants to check them at -# install time +# Repeat LD (and CC) as it happens that some binaries are linked at +# install-time. define SYSLINUX_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ + $(TARGET_MAKE_ENV) $(MAKE1) $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_LD)" \ -C $(@D) $(SYSLINUX_TARGET) install endef +# That 'syslinux' binary is an installer actually built for the target. +# However, buildroot makes no usage of it, so better delete it than have it +# installed@the wrong place +define SYSLINUX_POST_INSTALL_CLEANUP + rm -rf $(HOST_DIR)/usr/bin/syslinux +endef +SYSLINUX_POST_INSTALL_TARGET_HOOKS += SYSLINUX_POST_INSTALL_CLEANUP + SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += bios/core/pxelinux.bin SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_MBR) += bios/mbr/mbr.bin
Signature · 1 line
2.1.4
Thomas Petazzoni
AppliedPATCH v5 1/1 syslinux: build with the target toolchain
Hello,
Quoted 18 lines · Beno?t Allard
Until now, the host toolchain was used to build syslinux, as it was not possible to build a 32-bit syslinux with a x86-64 toolchain.
However, syslinux requires gnu-efi, and gnu-efi is built using the target toolchain. Mixing different toolchains doesn't work well, so this commit changes the syslinux package to use the target toolchain for syslinux as well. This is made possible by patches 0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch and 0004-memdisk-Force-ld-output-format-to-32-bits.patch.
Since syslinux also contains some utilities that have to run on the host, those have to continue being built with the host toolchain, which requires patch 0005-utils-Use-the-host-toolchain-to-build.patch.
Patch 0006-lzo-Use-the-host-toolchain-for-prepcore.patch is about building prepcore, another utility with the host toolchain as it is required at build-time.
Quoted 7 lines
This was tested using a Buildroot's built
x86_64toolchain, and checked that the output binaries are 32-bits. It was tested as well if they actually boot on hardware.Signed-off-by Beno?t Allard <[email protected]>---
Applied to master, thanks. Now, could you try to submit those patches to the upstream project?
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v5 1/1 syslinux: build with the target toolchain
Quoted 2 lines · On Sat, 8 Apr 2017 16:08:25 +0200 Thomas Petazzoni…
Applied to master, thanks. Now, could you try to submit those patches to the upstream project?
I'm on it, unfortunately, the traction is not very high. I feel like I opened one of those can of worms that have been tackled over and over again without reaching a satisfactory solution (autoconf ?!). The first answer I got was 'stop assuming everyone has needs similars to yours', I'm now waiting on further one.
You can follow the show over there:
http://www.syslinux.org/archives/2017-April/
Regards,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170411/0badbbcc/attachment.asc>
PATCH v5 1/1 syslinux: build with the target toolchain
Hello,
Quoted 11 lines · Beno?t Allard
Quoted 2 lines
Applied to master, thanks. Now, could you try to submit those patches to the upstream project?
I'm on it, unfortunately, the traction is not very high. I feel like I opened one of those can of worms that have been tackled over and over again without reaching a satisfactory solution (autoconf ?!). The first answer I got was 'stop assuming everyone has needs similars to yours', I'm now waiting on further one.
You can follow the show over there:
http://www.syslinux.org/archives/2017-April/
Thanks for doing this work. I think your reply is good, and hopefully will make the syslinux developers change a bit their mind. If not, then fine, we can keep the patches in Buildroot. I at least would like people to try upstreaming the patches, and make reasonable efforts, which you did.
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v5 1/1 syslinux: build with the target toolchain
In reply to Benoît AllardQuoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Beno?t" == Beno?t Allard <[email protected]> writes:
Until now, the host toolchain was used to build syslinux, as it was not possible to build a 32-bit syslinux with a x86-64 toolchain.
However, syslinux requires gnu-efi, and gnu-efi is built using the target toolchain. Mixing different toolchains doesn't work well, so this commit changes the syslinux package to use the target toolchain for syslinux as well. This is made possible by patches 0003-Fix-ldlinux.elf-Not-enough-room-for-program-headers-.patch and 0004-memdisk-Force-ld-output-format-to-32-bits.patch.
Since syslinux also contains some utilities that have to run on the host, those have to continue being built with the host toolchain, which requires patch 0005-utils-Use-the-host-toolchain-to-build.patch.
Patch 0006-lzo-Use-the-host-toolchain-for-prepcore.patch is about building prepcore, another utility with the host toolchain as it is required at build-time.
Quoted 5 lines
This was tested using a Buildroot's built
x86_64toolchain, and checked that the output binaries are 32-bits. It was tested as well if they actually boot on hardware.Signed-off-by Beno?t Allard <[email protected]>
Committed to 2017.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard