1 ################################################################################
3 # syslinux to make target msdos/iso9660 filesystems bootable
5 ################################################################################
7 SYSLINUX_VERSION = 6.03
8 SYSLINUX_SOURCE = syslinux-$(SYSLINUX_VERSION).tar.xz
9 SYSLINUX_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/boot/syslinux
11 SYSLINUX_LICENSE = GPL-2.0+
12 SYSLINUX_LICENSE_FILES = COPYING
14 SYSLINUX_INSTALL_IMAGES = YES
16 SYSLINUX_DEPENDENCIES = host-nasm host-upx util-linux
18 ifeq ($(BR2_TARGET_SYSLINUX_LEGACY_BIOS),y)
19 SYSLINUX_TARGET += bios
22 # The syslinux build system must be forced to use Buildroot's gnu-efi
23 # package by setting EFIINC, LIBDIR and LIBEFI. Otherwise, it uses its
24 # own copy of gnu-efi included in syslinux's sources since 6.03
26 ifeq ($(BR2_TARGET_SYSLINUX_EFI),y)
27 ifeq ($(BR2_ARCH_IS_64),y)
28 SYSLINUX_EFI_BITS = efi64
30 SYSLINUX_EFI_BITS = efi32
32 SYSLINUX_DEPENDENCIES += gnu-efi
33 SYSLINUX_TARGET += $(SYSLINUX_EFI_BITS)
35 EFIINC=$(STAGING_DIR)/usr/include/efi \
36 LIBDIR=$(STAGING_DIR)/usr/lib \
37 LIBEFI=$(STAGING_DIR)/usr/lib/libefi.a
40 # The syslinux tarball comes with pre-compiled binaries.
41 # Since timestamps might not be in the correct order, a rebuild is
42 # not always triggered for all the different images.
43 # Cleanup the mess even before we attempt a build, so we indeed
44 # build everything from source.
45 define SYSLINUX_CLEANUP
46 rm -rf $(@D)/bios $(@D)/efi32 $(@D)/efi64
48 SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP
50 # syslinux build system has no convenient way to pass CFLAGS,
51 # and the internal zlib should take precedence so -I shouldn't
53 define SYSLINUX_BUILD_CMDS
54 $(TARGET_MAKE_ENV) $(MAKE1) \
57 NASM="$(HOST_DIR)/usr/bin/nasm" \
58 CC_FOR_BUILD="$(HOSTCC)" \
59 CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
60 LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
61 $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET)
64 # While the actual bootloader is compiled for the target, several
65 # utilities for installing the bootloader are meant for the host.
66 # Repeat the target, otherwise syslinux will try to build everything
67 # Repeat LD (and CC) as it happens that some binaries are linked at
69 define SYSLINUX_INSTALL_TARGET_CMDS
70 $(TARGET_MAKE_ENV) $(MAKE1) $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \
73 -C $(@D) $(SYSLINUX_TARGET) install
76 # That 'syslinux' binary is an installer actually built for the target.
77 # However, buildroot makes no usage of it, so better delete it than have it
78 # installed at the wrong place
79 define SYSLINUX_POST_INSTALL_CLEANUP
80 rm -rf $(HOST_DIR)/usr/bin/syslinux
82 SYSLINUX_POST_INSTALL_TARGET_HOOKS += SYSLINUX_POST_INSTALL_CLEANUP
84 SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin
85 SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += bios/core/pxelinux.bin
86 SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_MBR) += bios/mbr/mbr.bin
87 SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_EFI) += $(SYSLINUX_EFI_BITS)/efi/syslinux.efi
89 SYSLINUX_C32 = $(call qstrip,$(BR2_TARGET_SYSLINUX_C32))
91 # We install the c32 modules from the host-installed tree, where they
92 # are all neatly installed in a single location, while they are
93 # scattered around everywhere in the build tree.
94 define SYSLINUX_INSTALL_IMAGES_CMDS
95 for i in $(SYSLINUX_IMAGES-y); do \
96 $(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/syslinux/$${i##*/}; \
98 for i in $(SYSLINUX_C32); do \
99 $(INSTALL) -D -m 0755 $(HOST_DIR)/usr/share/syslinux/$${i} \
100 $(BINARIES_DIR)/syslinux/$${i}; \
104 $(eval $(generic-package))