Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. include $(TOPDIR)/rules.mk
  3. include $(INCLUDE_DIR)/image.mk
  4. KERNEL_LOADADDR = 0x80000000
  5. KERNEL_ENTRY = 0x80000400
  6. DEVICE_VARS += ZYXEL_VERS DLINK_KERNEL_PART_SIZE
  7. DEVICE_VARS += CAMEO_KERNEL_PART CAMEO_ROOTFS_PART CAMEO_CUSTOMER_SIGNATURE CAMEO_BOARD_VERSION
  8. DEVICE_VARS += H3C_PRODUCT_ID H3C_DEVICE_ID
  9. define Build/zyxel-vers
  10. ( echo VERS;\
  11. for hw in $(ZYXEL_VERS); do\
  12. echo -n "V9.99($$hw.0) | ";\
  13. date -d @$(SOURCE_DATE_EPOCH) +%m/%d/%Y;\
  14. done ) >> $@
  15. endef
  16. define Build/dlink-cameo
  17. $(SCRIPT_DIR)/cameo-tag.py $@ $(DLINK_KERNEL_PART_SIZE)
  18. endef
  19. define Build/dlink-version
  20. echo -n "OpenWrt" >> $@
  21. dd if=/dev/zero bs=25 count=1 >> $@
  22. endef
  23. define Build/dlink-headers
  24. dd if=$@ bs=$(DLINK_KERNEL_PART_SIZE) count=1 [email protected]_part; \
  25. dd if=$@ bs=$(DLINK_KERNEL_PART_SIZE) skip=1 [email protected]_part; \
  26. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  27. "$(DEVICE_MODEL)" os $(CAMEO_KERNEL_PART) \
  28. $(CAMEO_CUSTOMER_SIGNATURE) \
  29. $(CAMEO_BOARD_VERSION) \
  30. $(KERNEL_LOADADDR); \
  31. $(SCRIPT_DIR)/cameo-imghdr.py [email protected]_part [email protected]_part.hex \
  32. "$(DEVICE_MODEL)" squashfs $(CAMEO_ROOTFS_PART) \
  33. $(CAMEO_CUSTOMER_SIGNATURE) \
  34. $(CAMEO_BOARD_VERSION); \
  35. cat [email protected]_part.hex [email protected]_part.hex > $@
  36. endef
  37. define Build/7z
  38. $(STAGING_DIR_HOST)/bin/7zr a $(@).new -t7z -m0=lzma $(@)
  39. mv [email protected] $@
  40. endef
  41. define Build/h3c-image
  42. $(STAGING_DIR_HOST)/bin/mkh3cimg \
  43. -i $(@) \
  44. -o $(@).new \
  45. -c 7z \
  46. -p $(H3C_PRODUCT_ID) \
  47. -d $(H3C_DEVICE_ID)
  48. mv [email protected] $@
  49. endef
  50. define Build/h3c-vfs
  51. $(STAGING_DIR_HOST)/bin/mkh3cvfs \
  52. -i $(@) \
  53. -o $(@).new \
  54. -f openwrt-kernel.bin
  55. mv [email protected] $@
  56. endef
  57. define Build/relocate-kernel
  58. rm -rf [email protected]
  59. $(CP) ../../generic/image/relocate [email protected]
  60. $(MAKE) -j1 -C [email protected] KERNEL_ADDR=$(KERNEL_LOADADDR) LZMA_TEXT_START=0x82000000 \
  61. CROSS_COMPILE=$(TARGET_CROSS)
  62. ( \
  63. dd [email protected]/loader.bin bs=32 conv=sync && \
  64. perl -e '@s = stat("$@"); print pack("N", @s[7])' && \
  65. cat "$@" \
  66. ) > "[email protected]"
  67. mv "[email protected]" "$@"
  68. rm -rf [email protected]
  69. endef
  70. define Device/Default
  71. PROFILES = Default
  72. KERNEL := kernel-bin | append-dtb | gzip | uImage gzip
  73. KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | uImage gzip
  74. DEVICE_DTS_DIR := ../dts-$(KERNEL_PATCHVER)
  75. DEVICE_DTS = $$(SOC)_$(1)
  76. IMAGES := sysupgrade.bin
  77. IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | \
  78. check-size | append-metadata
  79. endef
  80. define Device/hpe_1920
  81. DEVICE_VENDOR := HPE
  82. IMAGE_SIZE := 29632k
  83. BLOCKSIZE := 64k
  84. H3C_PRODUCT_ID := 0x3c010501
  85. KERNEL := kernel-bin | append-dtb | relocate-kernel | 7z | h3c-image | h3c-vfs
  86. KERNEL_INITRAMFS := kernel-bin | append-dtb | relocate-kernel | 7z | h3c-image
  87. IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
  88. pad-rootfs | check-size | append-metadata
  89. endef
  90. # "NGE" refers to the uImage magic
  91. define Device/netgear_nge
  92. KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
  93. KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
  94. SOC := rtl8380
  95. IMAGE_SIZE := 14848k
  96. UIMAGE_MAGIC := 0x4e474520
  97. DEVICE_VENDOR := NETGEAR
  98. endef
  99. include $(SUBTARGET).mk
  100. $(eval $(call BuildImage))