syslinux.mk 3.7 KB

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