Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #
  2. # Copyright (C) 2013 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/image.mk
  9. define Image/Prepare
  10. $(CP) $(DTS_DIR)/*.dtb $(KDIR)/
  11. rm -f $(KDIR)/fs_mark
  12. echo -ne '\xde\xad\xc0\xde' > $(KDIR)/fs_mark
  13. $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
  14. $(CP) ./ubinize.cfg $(KDIR)
  15. endef
  16. define Build/append-dtb
  17. cat $(KDIR)/$(DT).dtb >> $@
  18. endef
  19. define Build/lzma-d16
  20. $(STAGING_DIR_HOST)/bin/lzma e $@ -d16 $(1) [email protected]
  21. @mv [email protected] $@
  22. endef
  23. define Build/mkfs/squashfs
  24. ( cd $(KDIR); $(STAGING_DIR_HOST)/bin/ubinize -p 128KiB -m 2048 -o $(KDIR)/root-block-0x20000-min-0x800.ubi ubinize.cfg )
  25. endef
  26. define Build/trx-nand
  27. $(STAGING_DIR_HOST)/bin/trx \
  28. -o $@ \
  29. -f $(word 1,$^) \
  30. -a 0x20000 -f $(KDIR)/root-block-0x20000-min-0x800.ubi \
  31. -a 0x20000 -A $(KDIR)/fs_mark
  32. endef
  33. define Build/netgear-chk
  34. $(STAGING_DIR_HOST)/bin/mkchkimg \
  35. -o [email protected] -k $@ -b $(BOARD_ID) -r $(REGION)
  36. mv [email protected] $@
  37. endef
  38. DEVICE_VARS += DT BOARD_ID REGION
  39. define Device/Default
  40. # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
  41. # extract the full dtb name based on the device info
  42. DT := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
  43. KERNEL := kernel-bin | append-dtb | lzma-d16
  44. FILESYSTEMS := squashfs
  45. KERNEL_NAME := zImage
  46. IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
  47. IMAGES := trx
  48. IMAGE/trx := trx-nand
  49. endef
  50. define Device/netgear
  51. IMAGES := chk
  52. IMAGE/chk := trx-nand | netgear-chk
  53. REGION := 1
  54. endef
  55. define Device/netgear-r6250
  56. $(Device/netgear)
  57. BOARD_ID := U12H245T00_NETGEAR
  58. endef
  59. define Device/netgear-r6300-v2
  60. $(Device/netgear)
  61. BOARD_ID := U12H240T00_NETGEAR
  62. endef
  63. define Device/netgear-r8000
  64. $(Device/netgear)
  65. BOARD_ID := U12H315T00_NETGEAR
  66. endef
  67. TARGET_DEVICES += \
  68. asus-rt-ac68u asus-rt-n18u asus-rt-ac87u \
  69. netgear-r6250 netgear-r6300-v2 netgear-r8000 \
  70. buffalo-wzr-1750dhp buffalo-wzr-600dhp2 buffalo-wzr-900dhp
  71. $(eval $(call BuildImage))