syslinux.mk 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ################################################################################
  2. #
  3. # syslinux to make target msdos/iso9660 filesystems bootable
  4. #
  5. ################################################################################
  6. SYSLINUX_VERSION = 6.02
  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. ifeq ($(BR2_TARGET_SYSLINUX_EFI),y)
  17. ifeq ($(BR2_ARCH_IS_64),y)
  18. SYSLINUX_EFI_BITS = efi64
  19. else
  20. SYSLINUX_EFI_BITS = efi32
  21. endif # 64-bit
  22. SYSLINUX_DEPENDENCIES += gnu-efi
  23. SYSLINUX_TARGET = $(SYSLINUX_EFI_BITS)
  24. endif # EFI
  25. # The syslinux tarball comes with pre-compiled binaries.
  26. # Since timestamps might not be in the correct order, a rebuild is
  27. # not always triggered for all the different images.
  28. # Cleanup the mess even before we attempt a build, so we indeed
  29. # build everything from source.
  30. define SYSLINUX_CLEANUP
  31. rm -rf $(@D)/bios $(@D)/efi32 $(@D)/efi64
  32. endef
  33. SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP
  34. # syslinux build system has no convenient way to pass CFLAGS,
  35. # and the internal zlib should take precedence so -I shouldn't
  36. # be used.
  37. define SYSLINUX_BUILD_CMDS
  38. $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
  39. AR="$(HOSTAR)" SYSROOT=$(STAGING_DIR) -C $(@D) $(SYSLINUX_TARGET)
  40. endef
  41. # While the actual bootloader is compiled for the target, several
  42. # utilities for installing the bootloader are meant for the host.
  43. # Repeat the target, otherwise syslinux will try to build everything
  44. # Repeat CC and AR, since syslinux really wants to check them at
  45. # install time
  46. define SYSLINUX_INSTALL_TARGET_CMDS
  47. $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
  48. AR="$(HOSTAR)" SYSROOT=$(STAGING_DIR) INSTALLROOT=$(HOST_DIR) \
  49. -C $(@D) $(SYSLINUX_TARGET) install
  50. endef
  51. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin
  52. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += bios/core/pxelinux.bin
  53. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_MBR) += bios/mbr/mbr.bin
  54. SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_EFI) += $(SYSLINUX_EFI_BITS)/efi/syslinux.efi
  55. SYSLINUX_C32 = $(call qstrip,$(BR2_TARGET_SYSLINUX_C32))
  56. # We install the c32 modules from the host-installed tree, where they
  57. # are all neatly installed in a single location, while they are
  58. # scattered around everywhere in the build tree.
  59. define SYSLINUX_INSTALL_IMAGES_CMDS
  60. for i in $(SYSLINUX_IMAGES-y); do \
  61. $(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/syslinux/$${i##*/}; \
  62. done
  63. for i in $(SYSLINUX_C32); do \
  64. $(INSTALL) -D -m 0755 $(HOST_DIR)/usr/share/syslinux/$${i} \
  65. $(BINARIES_DIR)/syslinux/$${i}; \
  66. done
  67. endef
  68. $(eval $(generic-package))