Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. include $(TOPDIR)/rules.mk
  3. include $(INCLUDE_DIR)/image.mk
  4. KERNEL_LOADADDR = 0x80100000
  5. DEVICE_VARS += \
  6. BELKIN_HEADER \
  7. BELKIN_MODEL \
  8. CAMEO_BOARD_MODEL \
  9. CAMEO_BOARD_VERSION \
  10. CAMEO_CUSTOMER_SIGNATURE \
  11. CAMEO_KERNEL_PART \
  12. CAMEO_KERNEL_PART_SIZE \
  13. CAMEO_ROOTFS_PART \
  14. H3C_DEVICE_ID \
  15. H3C_PRODUCT_ID \
  16. LINKSYS_HEADER \
  17. ZYXEL_VERS
  18. define Build/rt-compress
  19. $(STAGING_DIR_HOST)/bin/xz -9 --format=lzma --stdout "$@" > "[email protected]"
  20. mv "[email protected]" "$@"
  21. endef
  22. define Build/rt-loader
  23. $(MAKE) all clean -C rt-loader CROSS_COMPILE="$(TARGET_CROSS)" \
  24. KERNEL_IMG_IN="$@" KERNEL_IMG_OUT="[email protected]" BUILD_DIR="[email protected]"
  25. mv "[email protected]" "$@"
  26. endef
  27. define Build/zyxel-vers
  28. ( echo VERS;\
  29. for hw in $(ZYXEL_VERS); do\
  30. echo -n "V9.99($$hw.0) | ";\
  31. date -d @$(SOURCE_DATE_EPOCH) +%m/%d/%Y;\
  32. done ) >> $@
  33. endef
  34. define Build/cameo-tag
  35. $(SCRIPT_DIR)/cameo-tag.py $@ $(CAMEO_KERNEL_PART_SIZE)
  36. endef
  37. define Build/cameo-version
  38. echo -n "OpenWrt" >> $@
  39. dd if=/dev/zero bs=25 count=1 >> $@
  40. endef
  41. define Build/cameo-headers
  42. dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) count=1 [email protected]_part; \
  43. dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) skip=1 [email protected]_part; \
  44. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  45. "$(CAMEO_BOARD_MODEL)" os $(CAMEO_KERNEL_PART) \
  46. $(CAMEO_CUSTOMER_SIGNATURE) \
  47. $(CAMEO_BOARD_VERSION) \
  48. $(KERNEL_LOADADDR); \
  49. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  50. "$(CAMEO_BOARD_MODEL)" squashfs $(CAMEO_ROOTFS_PART) \
  51. $(CAMEO_CUSTOMER_SIGNATURE) \
  52. $(CAMEO_BOARD_VERSION); \
  53. cat [email protected]_part.hex [email protected]_part.hex > $@
  54. endef
  55. define Build/7z
  56. $(STAGING_DIR_HOST)/bin/7zr a $(@).new -t7z -m0=lzma $(@)
  57. mv [email protected] $@
  58. endef
  59. define Build/h3c-image
  60. $(STAGING_DIR_HOST)/bin/mkh3cimg \
  61. -i $(@) \
  62. -o $(@).new \
  63. -c 7z \
  64. -p $(H3C_PRODUCT_ID) \
  65. -d $(H3C_DEVICE_ID)
  66. mv [email protected] $@
  67. endef
  68. define Build/h3c-vfs
  69. $(STAGING_DIR_HOST)/bin/mkh3cvfs \
  70. -i $(@) \
  71. -o $(@).new \
  72. -f openwrt-kernel.bin
  73. mv [email protected] $@
  74. endef
  75. define Build/belkin-header
  76. $(SCRIPT_DIR)/belkin-header.py $(@) $(@).new $(BELKIN_HEADER) ${BELKIN_MODEL}
  77. mv [email protected] $@
  78. endef
  79. define Build/linksys-image
  80. $(SCRIPT_DIR)/linksys-image.sh $(@) $(@).new $(LINKSYS_MODEL)
  81. mv [email protected] $@
  82. endef
  83. define Device/Default
  84. PROFILES = Default
  85. KERNEL := \
  86. kernel-bin | \
  87. append-dtb | \
  88. libdeflate-gzip | \
  89. uImage gzip
  90. KERNEL_INITRAMFS := \
  91. kernel-bin | \
  92. append-dtb | \
  93. libdeflate-gzip | \
  94. uImage gzip
  95. DEVICE_DTS_DIR := ../dts
  96. DEVICE_DTS = $$(SOC)_$(1)
  97. IMAGES := sysupgrade.bin
  98. IMAGE/sysupgrade.bin := \
  99. append-kernel | \
  100. pad-to 64k | \
  101. append-rootfs | \
  102. pad-rootfs | \
  103. check-size | \
  104. append-metadata
  105. endef
  106. define Device/kernel-lzma
  107. KERNEL := \
  108. kernel-bin | \
  109. append-dtb | \
  110. lzma | \
  111. uImage lzma
  112. KERNEL_INITRAMFS := \
  113. kernel-bin | \
  114. append-dtb | \
  115. lzma | \
  116. uImage lzma
  117. endef
  118. define Device/uimage-rt-loader
  119. KERNEL/rt-loader := kernel-bin | append-dtb | rt-compress | rt-loader
  120. KERNEL := $$(KERNEL/rt-loader) | uImage none
  121. KERNEL_INITRAMFS := $$(KERNEL/rt-loader) | uImage none
  122. endef
  123. include $(SUBTARGET).mk
  124. $(eval $(call BuildImage))