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