Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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/rt-loader-no-uimage
  28. $(MAKE) all clean -C rt-loader CROSS_COMPILE="$(TARGET_CROSS)" \
  29. KERNEL_ADDR="$(KERNEL_LOADADDR)" KERNEL_IMG_IN="$@" \
  30. KERNEL_IMG_OUT="[email protected]" BUILD_DIR="[email protected]"
  31. mv "[email protected]" "$@"
  32. endef
  33. define Build/rt-loader-standalone
  34. $(MAKE) all clean -C rt-loader CROSS_COMPILE="$(TARGET_CROSS)" \
  35. FLASH_ADDR=$(FLASH_ADDR) KERNEL_IMG_OUT="[email protected]" BUILD_DIR="[email protected]"
  36. mv "[email protected]" "$@"
  37. endef
  38. define Build/zyxel-vers
  39. ( echo VERS;\
  40. for hw in $(ZYXEL_VERS); do\
  41. echo -n "V9.99($$hw.0) | ";\
  42. date -d @$(SOURCE_DATE_EPOCH) +%m/%d/%Y;\
  43. done ) >> $@
  44. endef
  45. define Build/cameo-tag
  46. $(SCRIPT_DIR)/cameo-tag.py $@ $(CAMEO_KERNEL_PART_SIZE)
  47. endef
  48. define Build/cameo-version
  49. echo -n "OpenWrt" >> $@
  50. dd if=/dev/zero bs=25 count=1 >> $@
  51. endef
  52. define Build/cameo-headers
  53. dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) count=1 [email protected]_part; \
  54. dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) skip=1 [email protected]_part; \
  55. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  56. "$(CAMEO_BOARD_MODEL)" os $(CAMEO_KERNEL_PART) \
  57. $(CAMEO_CUSTOMER_SIGNATURE) \
  58. $(CAMEO_BOARD_VERSION) \
  59. $(KERNEL_LOADADDR); \
  60. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  61. "$(CAMEO_BOARD_MODEL)" squashfs $(CAMEO_ROOTFS_PART) \
  62. $(CAMEO_CUSTOMER_SIGNATURE) \
  63. $(CAMEO_BOARD_VERSION); \
  64. cat [email protected]_part.hex [email protected]_part.hex > $@
  65. endef
  66. define Build/7z
  67. $(STAGING_DIR_HOST)/bin/7zr a $(@).new -t7z -m0=lzma $(@)
  68. mv [email protected] $@
  69. endef
  70. define Build/h3c-image
  71. $(STAGING_DIR_HOST)/bin/mkh3cimg \
  72. -i $(@) \
  73. -o $(@).new \
  74. -c 7z \
  75. -p $(H3C_PRODUCT_ID) \
  76. -d $(H3C_DEVICE_ID)
  77. mv [email protected] $@
  78. endef
  79. define Build/h3c-vfs
  80. $(STAGING_DIR_HOST)/bin/mkh3cvfs \
  81. -i $(@) \
  82. -o $(@).new \
  83. -f openwrt-kernel.bin
  84. mv [email protected] $@
  85. endef
  86. define Build/belkin-header
  87. $(SCRIPT_DIR)/belkin-header.py $(@) $(@).new $(BELKIN_HEADER) ${BELKIN_MODEL}
  88. mv [email protected] $@
  89. endef
  90. define Build/linksys-image
  91. $(SCRIPT_DIR)/linksys-image.sh $(@) $(@).new $(LINKSYS_MODEL)
  92. mv [email protected] $@
  93. endef
  94. define Build/zynsig
  95. $(STAGING_DIR_HOST)/bin/zynsig -i $@ \
  96. -o [email protected]
  97. mv [email protected] $@
  98. endef
  99. define Device/Default
  100. PROFILES = Default
  101. KERNEL := \
  102. kernel-bin | \
  103. append-dtb | \
  104. libdeflate-gzip | \
  105. uImage gzip
  106. KERNEL_INITRAMFS := \
  107. kernel-bin | \
  108. append-dtb | \
  109. libdeflate-gzip | \
  110. uImage gzip
  111. DEVICE_DTS_DIR := ../dts
  112. DEVICE_DTS = $$(SOC)_$(1)
  113. IMAGES := sysupgrade.bin
  114. IMAGE/sysupgrade.bin := \
  115. append-kernel | \
  116. pad-to 64k | \
  117. append-rootfs | \
  118. pad-rootfs | \
  119. check-size | \
  120. append-metadata
  121. endef
  122. define Device/kernel-lzma
  123. KERNEL := \
  124. kernel-bin | \
  125. append-dtb | \
  126. lzma | \
  127. uImage lzma
  128. KERNEL_INITRAMFS := \
  129. kernel-bin | \
  130. append-dtb | \
  131. lzma | \
  132. uImage lzma
  133. endef
  134. define Device/uimage-rt-loader
  135. KERNEL/rt-loader := kernel-bin | append-dtb | rt-compress | rt-loader
  136. KERNEL := $$(KERNEL/rt-loader) | uImage none
  137. KERNEL_INITRAMFS := $$(KERNEL/rt-loader) | uImage none
  138. endef
  139. include $(SUBTARGET).mk
  140. $(eval $(call BuildImage))