Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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/zyxel-vers
  19. ( echo VERS;\
  20. for hw in $(ZYXEL_VERS); do\
  21. echo -n "V9.99($$hw.0) | ";\
  22. date -d @$(SOURCE_DATE_EPOCH) +%m/%d/%Y;\
  23. done ) >> $@
  24. endef
  25. define Build/cameo-tag
  26. $(SCRIPT_DIR)/cameo-tag.py $@ $(CAMEO_KERNEL_PART_SIZE)
  27. endef
  28. define Build/cameo-version
  29. echo -n "OpenWrt" >> $@
  30. dd if=/dev/zero bs=25 count=1 >> $@
  31. endef
  32. define Build/cameo-headers
  33. dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) count=1 [email protected]_part; \
  34. dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) skip=1 [email protected]_part; \
  35. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  36. "$(CAMEO_BOARD_MODEL)" os $(CAMEO_KERNEL_PART) \
  37. $(CAMEO_CUSTOMER_SIGNATURE) \
  38. $(CAMEO_BOARD_VERSION) \
  39. $(KERNEL_LOADADDR); \
  40. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  41. "$(CAMEO_BOARD_MODEL)" squashfs $(CAMEO_ROOTFS_PART) \
  42. $(CAMEO_CUSTOMER_SIGNATURE) \
  43. $(CAMEO_BOARD_VERSION); \
  44. cat [email protected]_part.hex [email protected]_part.hex > $@
  45. endef
  46. define Build/7z
  47. $(STAGING_DIR_HOST)/bin/7zr a $(@).new -t7z -m0=lzma $(@)
  48. mv [email protected] $@
  49. endef
  50. define Build/h3c-image
  51. $(STAGING_DIR_HOST)/bin/mkh3cimg \
  52. -i $(@) \
  53. -o $(@).new \
  54. -c 7z \
  55. -p $(H3C_PRODUCT_ID) \
  56. -d $(H3C_DEVICE_ID)
  57. mv [email protected] $@
  58. endef
  59. define Build/h3c-vfs
  60. $(STAGING_DIR_HOST)/bin/mkh3cvfs \
  61. -i $(@) \
  62. -o $(@).new \
  63. -f openwrt-kernel.bin
  64. mv [email protected] $@
  65. endef
  66. define Build/belkin-header
  67. $(SCRIPT_DIR)/belkin-header.py $(@) $(@).new $(BELKIN_HEADER) ${BELKIN_MODEL}
  68. mv [email protected] $@
  69. endef
  70. define Build/linksys-image
  71. $(SCRIPT_DIR)/linksys-image.sh $(@) $(@).new $(LINKSYS_MODEL)
  72. mv [email protected] $@
  73. endef
  74. define Device/Default
  75. PROFILES = Default
  76. KERNEL := \
  77. kernel-bin | \
  78. append-dtb | \
  79. libdeflate-gzip | \
  80. uImage gzip
  81. KERNEL_INITRAMFS := \
  82. kernel-bin | \
  83. append-dtb | \
  84. libdeflate-gzip | \
  85. uImage gzip
  86. DEVICE_DTS_DIR := ../dts
  87. DEVICE_DTS = $$(SOC)_$(1)
  88. IMAGES := sysupgrade.bin
  89. IMAGE/sysupgrade.bin := \
  90. append-kernel | \
  91. pad-to 64k | \
  92. append-rootfs | \
  93. pad-rootfs | \
  94. check-size | \
  95. append-metadata
  96. endef
  97. include $(SUBTARGET).mk
  98. $(eval $(call BuildImage))