Makefile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. include $(SUBTARGET).mk
  81. $(eval $(call BuildImage))