summaryrefslogtreecommitdiffstats
path: root/boot/syslinux/syslinux.mk
diff options
context:
space:
mode:
authorBenoît Allard <benoit.allard@greenbone.net>2017-04-07 11:05:13 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-04-08 16:07:49 +0200
commit6e432d5ecb46959f3c27dbbca48e41512bb40a70 (patch)
tree9a740d4167d7b281cd55bcec339be6b9bd882dac /boot/syslinux/syslinux.mk
parenta4d8252ee940bfcf2ad3261ea9f9a87e99d0056f (diff)
downloadbuildroot-6e432d5ecb46959f3c27dbbca48e41512bb40a70.tar.gz
buildroot-6e432d5ecb46959f3c27dbbca48e41512bb40a70.zip
syslinux: build with the target toolchain
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. 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. Signed-off-by: Benoît Allard <benoit.allard@greenbone.net> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'boot/syslinux/syslinux.mk')
-rw-r--r--boot/syslinux/syslinux.mk29
1 files changed, 22 insertions, 7 deletions
diff --git a/boot/syslinux/syslinux.mk b/boot/syslinux/syslinux.mk
index 5b7906cffd..2b3b9a75f4 100644
--- a/boot/syslinux/syslinux.mk
+++ b/boot/syslinux/syslinux.mk
@@ -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 at 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
OpenPOWER on IntegriCloud