syslinux.mk 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 = GPLv2+
  10. SYSLINUX_LICENSE_FILES = COPYING
  11. SYSLINUX_INSTALL_IMAGES = YES
  12. SYSLINUX_DEPENDENCIES = host-nasm host-util-linux host-upx
  13. ifeq ($(BR2_TARGET_SYSLINUX_LEGACY_BIOS),y)
  14. SYSLINUX_TARGET = bios
  15. endif
  16. # The syslinux build system must be forced to use Buildroot's gnu-efi
  17. # package by setting EFIINC, LIBDIR and LIBEFI. Otherwise, it uses its
  18. # own copy of gnu-efi included in syslinux's sources since 6.03
  19. # release.
  20. ifeq ($(BR2_TARGET_SYSLINUX_EFI),y)
  21. ifeq ($(BR2_ARCH_IS_64),y)
  22. SYSLINUX_EFI_BITS = efi64
  23. else
  24. SYSLINUX_EFI_BITS = efi32
  25. endif # 64-bit
  26. SYSLINUX_DEPENDENCIES += gnu-efi
  27. SYSLINUX_TARGET = $(SYSLINUX_EFI_BITS)
  28. SYSLINUX_EFI_ARGS = \
  29. EFIINC=$(STAGING_DIR)/usr/include/efi \
  30. LIBDIR=$(STAGING_DIR)/usr/lib \
  31. LIBEFI=$(STAGING_DIR)/usr/lib/libefi.a
  32. endif # EFI
  33. # The syslinux tarball comes with pre-compiled binaries.
  34. # Since timestamps might not be in the correct order, a rebuild is
  35. # not always triggered for all the different images.
  36. # Cleanup the mess even before we attempt a build, so we indeed
  37. # build everything from source.
  38. define SYSLINUX_CLEANUP
  39. rm -rf $(@D)/bios $(@D)/efi32 $(@D)/efi64
  40. endef
  41. SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP
  42. # syslinux build system has no convenient way to pass CFLAGS,
  43. # and the internal zlib should take precedence so -I shouldn't
  44. # be used.
  45. define SYSLINUX_BUILD_CMDS
  46. $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
  47. AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET)
  48. endef
  49. # While the actual bootloader is compiled for the target, several
  50. # utilities for installing the bootloader are meant for the host.
  51. # Repeat the target, otherwise syslinux will try to build everything
  52. # Repeat CC and AR, since syslinux really wants to check them at
  53. # install time
  54. define SYSLINUX_INSTALL_TARGET_CMDS
  55. $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
  56. AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \
  57. -C $(@D) $(SYSLINUX_TARGET) install
  58. endef
  59. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin
  60. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += bios/core/pxelinux.bin
  61. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_MBR) += bios/mbr/mbr.bin
  62. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_EFI) += $(SYSLINUX_EFI_BITS)/efi/syslinux.efi
  63. SYSLINUX_C32 = $(call qstrip,$(BR2_TARGET_SYSLINUX_C32))
  64. # We install the c32 modules from the host-installed tree, where they
  65. # are all neatly installed in a single location, while they are
  66. # scattered around everywhere in the build tree.
  67. define SYSLINUX_INSTALL_IMAGES_CMDS
  68. for i in $(SYSLINUX_IMAGES-y); do \
  69. $(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/syslinux/$${i##*/}; \
  70. done
  71. for i in $(SYSLINUX_C32); do \
  72. $(INSTALL) -D -m 0755 $(HOST_DIR)/usr/share/syslinux/$${i} \
  73. $(BINARIES_DIR)/syslinux/$${i}; \
  74. done
  75. endef
  76. $(eval $(generic-package))