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