2 # Copyright (C) 2013 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
11 $(CP) $(DTS_DIR)/*.dtb $(KDIR)/
14 echo -ne '\xde\xad\xc0\xde' > $(KDIR)/fs_mark
15 $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
17 # For UBI we want only one extra block
18 rm -f $(KDIR)/ubi_mark
19 echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
21 $(CP) ./ubinize.cfg $(KDIR)
24 define Build/append-dtb
25 cat $(KDIR)/$(DT).dtb >> $@
29 $(STAGING_DIR_HOST)/bin/lzma e $@ -d16 $(1) $@.new
33 define Build/mkfs/squashfs
34 ( cd $(KDIR); $(STAGING_DIR_HOST)/bin/ubinize -p 128KiB -m 2048 -o $(KDIR)/root-block-0x20000-min-0x800.ubi ubinize.cfg )
37 define Build/trx-serial
38 $(STAGING_DIR_HOST)/bin/trx \
41 -f $(word 1,$^) -a 1024 \
42 -f $(KDIR)/root.squashfs -a 0x10000 -A $(KDIR)/fs_mark
46 # kernel: always use 4 MiB (-28 B or TRX header) to allow upgrades even
47 # if it grows up between releases
48 # root: UBI with one extra block containing UBI mark to trigger erasing
50 $(STAGING_DIR_HOST)/bin/trx \
53 -f $(word 1,$^) -a 0x20000 -b 0x400000 \
54 -f $(KDIR)/root-block-0x20000-min-0x800.ubi \
55 -A $(KDIR)/ubi_mark -a 0x20000
59 $(STAGING_DIR_HOST)/bin/asustrx \
60 -p $(PRODUCTID) -i $@ -o $@.new
64 define Build/seama-nand
66 $(STAGING_DIR_HOST)/bin/oseama \
68 -m "dev=/dev/mtdblock/7" \
72 -f $(KDIR)/root-block-0x20000-min-0x800.ubi \
75 $(STAGING_DIR_HOST)/bin/seama \
77 -m "signature=$(SIGNATURE)" \
81 DEVICE_VARS += DT PRODUCTID SIGNATURE NETGEAR_BOARD_ID NETGEAR_REGION
84 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
85 # extract the full dtb name based on the device info
86 DT := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
87 KERNEL := kernel-bin | append-dtb | lzma-d16
88 KERNEL_DEPENDS = $$(wildcard $(KDIR)/$$(DT).dts)
89 FILESYSTEMS := squashfs
91 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
98 IMAGE/trx := trx-nand | asus-trx
102 define Device/asus-$(1)
106 TARGET_DEVICES += asus-$(1)
109 define Device/linksys
111 IMAGE/trx := trx-nand
115 define Device/linksys-$(1)
118 TARGET_DEVICES += linksys-$(1)
123 IMAGE/bin := seama-nand
127 define Device/dlink-$(1)
131 TARGET_DEVICES += dlink-$(1)
134 define Device/netgear
136 IMAGE/chk := trx-nand | netgear-chk
141 define Device/netgear-$(1)
143 NETGEAR_BOARD_ID := $(2)
145 TARGET_DEVICES += netgear-$(1)
148 define Device/netgear-r6250
150 NETGEAR_BOARD_ID := U12H245T00_NETGEAR
153 define Device/netgear-r6300-v2
155 NETGEAR_BOARD_ID := U12H240T00_NETGEAR
158 define Device/netgear-r8000
160 NETGEAR_BOARD_ID := U12H315T00_NETGEAR
163 define Device/smartrg-sr400ac
165 IMAGE/trx := trx-serial
169 buffalo-wzr-1750dhp buffalo-wzr-600dhp2 buffalo-wzr-900dhp \
170 buffalo-wxr-1900dhp \
171 netgear-r6250 netgear-r6300-v2 netgear-r8000 \
174 $(eval $(call AsusDevice,rt-ac56u,RT-AC56U))
175 $(eval $(call AsusDevice,rt-ac68u,RT-AC68U))
176 $(eval $(call AsusDevice,rt-ac87u,RT-AC87U))
177 $(eval $(call AsusDevice,rt-n18u,RT-N18U))
178 $(eval $(call DLinkDevice,dir-885l,wrgac42_dlink.2015_dir885l))
179 $(eval $(call LinksysDevice,ea6300-v1))
180 $(eval $(call NetgearDevice,r7000,U12H270T00_NETGEAR))
181 $(eval $(call NetgearDevice,r7900,U12H315T30_NETGEAR))
182 # $(eval $(call NetgearDevice,r8500,U12H334T00_NETGEAR))
184 $(eval $(call BuildImage))