Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. include $(TOPDIR)/rules.mk
  2. PKG_DISTNAME:=u-boot
  3. PKG_VERSION:=2026.04
  4. PKG_RELEASE:=1
  5. PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
  6. PKG_SOURCE_URL:= \
  7. https://ftp.denx.de/pub/u-boot \
  8. https://mirror.cyberbits.eu/u-boot \
  9. ftp://ftp.denx.de/pub/u-boot
  10. PKG_URL:=https://docs.u-boot.org/en/latest/
  11. PKG_HASH:=ac7c04b8b7004923b00a4e5d6699c5df4d21233bac9fda690d8cfbc209fff2fd
  12. PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
  13. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
  14. PKG_BUILD_DEPENDS:=fstools
  15. PKG_LICENSE:=GPL-2.0 GPL-2.0+
  16. PKG_LICENSE_FILES:=Licenses/README
  17. PKG_BUILD_PARALLEL:=1
  18. #PKG_FLAGS:=nonshared # Use PKGFLAGS instead of PKG_FLAGS for per-binary flags
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/dumpimage
  21. SECTION:=utils
  22. CATEGORY:=Utilities
  23. SUBMENU:=Boot Loaders
  24. TITLE:=dumpimage lists and extracts data from U-Boot images.
  25. endef
  26. define Package/dumpimage/description
  27. dumpimage lists and extracts data from U-Boot images.
  28. If -l is specified, dumpimage lists the components in
  29. image.Otherwise, dumpimage extracts the component at
  30. position to outfile.
  31. endef
  32. define Package/fit-check-sign
  33. SECTION:=utils
  34. CATEGORY:=Utilities
  35. SUBMENU:=Boot Loaders
  36. TITLE:=verify uImage.FIT
  37. endef
  38. define Package/fit-check-sign/description
  39. fit_check_sign validates uImage.FIT hashes and signatures
  40. endef
  41. define Package/uboot-envtools
  42. SECTION:=utils
  43. CATEGORY:=Utilities
  44. SUBMENU:=Boot Loaders
  45. PKGFLAGS+=nonshared
  46. TITLE:=read/modify U-Boot bootloader environment
  47. endef
  48. define Package/uboot-envtools/description
  49. This package includes tools to read and modify U-Boot
  50. bootloader environment.
  51. endef
  52. define Package/uboot-envtools/conffiles
  53. /etc/config/ubootenv
  54. /etc/fw_env.config
  55. /etc/fw_sys.config
  56. endef
  57. define Build/Configure
  58. $(call Build/Compile/Default,tools-only_defconfig)
  59. $(PKG_BUILD_DIR)/scripts/config \
  60. --file $(PKG_BUILD_DIR)/.config \
  61. --disable TOOLS_KWBIMAGE \
  62. --disable TOOLS_LIBCRYPTO \
  63. --disable TOOLS_MKEFICAPSULE
  64. endef
  65. MAKE_FLAGS += \
  66. ARCH="sandbox" \
  67. TARGET_CFLAGS="$(TARGET_CFLAGS)" \
  68. TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
  69. PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
  70. NO_PYTHON=1 \
  71. V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1,)
  72. define Build/Compile
  73. ifneq ($(CONFIG_PACKAGE_uboot-envtools),)
  74. $(call Build/Compile/Default,envtools)
  75. endif
  76. ifneq ($(CONFIG_PACKAGE_dumpimage)$(CONFIG_PACKAGE_fit-check-sign),)
  77. $(call Build/Compile/Default,cross_tools)
  78. endif
  79. endef
  80. define Package/dumpimage/install
  81. $(INSTALL_DIR) $(1)/usr/bin
  82. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/dumpimage $(1)/usr/bin
  83. endef
  84. define Package/fit-check-sign/install
  85. $(INSTALL_DIR) $(1)/usr/bin
  86. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/fit_check_sign $(1)/usr/bin
  87. endef
  88. define Package/uboot-envtools/install
  89. $(INSTALL_DIR) $(1)/usr/sbin
  90. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $(1)/usr/sbin
  91. $(LN) fw_printenv $(1)/usr/sbin/fw_setenv
  92. $(INSTALL_BIN) ./uboot-envtools/files/fw_printsys $(1)/usr/sbin
  93. $(INSTALL_BIN) ./uboot-envtools/files/fw_setsys $(1)/usr/sbin
  94. $(INSTALL_BIN) ./uboot-envtools/files/fw_loadenv $(1)/usr/sbin
  95. $(INSTALL_DIR) $(1)/etc/board.d
  96. $(INSTALL_DATA) ./uboot-envtools/files/fw_defaults $(1)/etc/board.d/05_fw_defaults
  97. $(INSTALL_DIR) $(1)/lib
  98. $(INSTALL_DATA) ./uboot-envtools/files/uboot-envtools.sh $(1)/lib
  99. $(INSTALL_DIR) $(1)/etc/uci-defaults
  100. $(if $(wildcard ./uboot-envtools/files/$(BOARD)_$(SUBTARGET)), \
  101. $(INSTALL_DATA) ./uboot-envtools/files/$(BOARD)_$(SUBTARGET) \
  102. $(1)/etc/uci-defaults/30_uboot-envtools, \
  103. $(if $(wildcard ./uboot-envtools/files/$(BOARD)), \
  104. $(INSTALL_DATA) ./uboot-envtools/files/$(BOARD) \
  105. $(1)/etc/uci-defaults/30_uboot-envtools \
  106. ) \
  107. )
  108. endef
  109. $(eval $(call BuildPackage,dumpimage))
  110. $(eval $(call BuildPackage,fit-check-sign))
  111. $(eval $(call BuildPackage,uboot-envtools))