Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. include $(TOPDIR)/rules.mk
  2. include $(INCLUDE_DIR)/image.mk
  3. KERNEL_LOADADDR = 0x80060000
  4. DEVICE_VARS += LOADER_FLASH_OFFS LOADER_TYPE
  5. define Build/combined-image
  6. sh $(TOPDIR)/scripts/combined-image.sh \
  7. "$(IMAGE_KERNEL)" \
  8. "$@" \
  9. "[email protected]"
  10. @mv [email protected] $@
  11. endef
  12. define Build/loader-common
  13. rm -rf [email protected]
  14. $(MAKE) -C lzma-loader \
  15. PKG_BUILD_DIR="[email protected]" \
  16. TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
  17. $(1) compile loader.$(LOADER_TYPE)
  18. mv "$@.$(LOADER_TYPE)" "$@"
  19. rm -rf [email protected]
  20. endef
  21. define Build/loader-kernel
  22. $(call Build/loader-common,LOADER_DATA="$@")
  23. endef
  24. define Build/loader-okli-compile
  25. $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
  26. endef
  27. # Arguments: <output name> <kernel offset>
  28. define Build/loader-okli
  29. dd if=$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE) bs=$(word 2,$(1)) conv=sync of="[email protected]"
  30. cat "$@" >> "[email protected]"
  31. mv "[email protected]" "$@"
  32. endef
  33. define Build/append-loader-okli
  34. cat "$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE)" >> "$@"
  35. endef
  36. define Build/relocate-kernel
  37. rm -rf [email protected]
  38. $(CP) ../../generic/image/relocate [email protected]
  39. $(MAKE) -j1 -C [email protected] KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
  40. ( \
  41. dd [email protected]/loader.bin bs=32 conv=sync && \
  42. perl -e '@s = stat("$@"); print pack("N", @s[7])' && \
  43. cat "$@" \
  44. ) > "[email protected]"
  45. mv "[email protected]" "$@"
  46. rm -rf [email protected]
  47. endef
  48. define Device/Default
  49. DEVICE_DTS_DIR := ../dts
  50. DEVICE_DTS = $$(SOC)_$(1)
  51. PROFILES = Default
  52. MTDPARTS :=
  53. BLOCKSIZE := 64k
  54. KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
  55. KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
  56. COMPILE :=
  57. SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
  58. IMAGES := sysupgrade.bin
  59. IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
  60. append-rootfs | pad-rootfs | append-metadata | check-size
  61. endef
  62. include $(SUBTARGET).mk
  63. ifeq ($(SUBTARGET),generic)
  64. include generic-tp-link.mk
  65. include generic-ubnt.mk
  66. endif
  67. ifeq ($(SUBTARGET),tiny)
  68. include tiny-netgear.mk
  69. include tiny-tp-link.mk
  70. endif
  71. $(eval $(call BuildImage))