Makefile 2.4 KB

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