1
0

Makefile 2.1 KB

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