4720aaf309ab1fdbcf724ee97f57fc0986506d4b
[openwrt/staging/chunkeey.git] / target / linux / bcm53xx / image / Makefile
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
10 define Image/Prepare
11 $(CP) $(DTS_DIR)/*.dtb $(KDIR)/
12
13 rm -f $(KDIR)/fs_mark
14 echo -ne '\xde\xad\xc0\xde' > $(KDIR)/fs_mark
15 $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
16
17 $(CP) ./ubinize.cfg $(KDIR)
18 endef
19
20 define Build/append-dtb
21 cat $(KDIR)/$(DT).dtb >> $@
22 endef
23
24 define Build/lzma-d16
25 $(STAGING_DIR_HOST)/bin/lzma e $@ -d16 $(1) $@.new
26 @mv $@.new $@
27 endef
28
29 define Build/mkfs/squashfs
30 ( cd $(KDIR); $(STAGING_DIR_HOST)/bin/ubinize -p 128KiB -m 2048 -o $(KDIR)/root-block-0x20000-min-0x800.ubi ubinize.cfg )
31 endef
32
33 define Build/trx-nand
34 $(STAGING_DIR_HOST)/bin/trx \
35 -o $@ \
36 -m 33554432 \
37 -f $(word 1,$^) \
38 -a 0x20000 -f $(KDIR)/root-block-0x20000-min-0x800.ubi \
39 -a 0x20000 -A $(KDIR)/fs_mark
40 endef
41
42 define Build/netgear-chk
43 $(STAGING_DIR_HOST)/bin/mkchkimg \
44 -o $@.new -k $@ -b $(BOARD_ID) -r $(REGION)
45 mv $@.new $@
46 endef
47
48 DEVICE_VARS += DT BOARD_ID REGION
49
50 define Device/Default
51 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
52 # extract the full dtb name based on the device info
53 DT := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
54 KERNEL := kernel-bin | append-dtb | lzma-d16
55 FILESYSTEMS := squashfs
56 KERNEL_NAME := zImage
57 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
58 IMAGES := trx
59 IMAGE/trx := trx-nand
60 endef
61
62 define Device/netgear
63 IMAGES := chk
64 IMAGE/chk := trx-nand | netgear-chk
65 REGION := 1
66 endef
67
68 define Device/netgear-r6250
69 $(Device/netgear)
70 BOARD_ID := U12H245T00_NETGEAR
71 endef
72
73 define Device/netgear-r6300-v2
74 $(Device/netgear)
75 BOARD_ID := U12H240T00_NETGEAR
76 endef
77
78 define Device/netgear-r8000
79 $(Device/netgear)
80 BOARD_ID := U12H315T00_NETGEAR
81 endef
82
83 TARGET_DEVICES += \
84 asus-rt-ac56u asus-rt-ac68u asus-rt-ac87u asus-rt-n18u \
85 netgear-r6250 netgear-r6300-v2 netgear-r8000 \
86 buffalo-wzr-1750dhp buffalo-wzr-600dhp2 buffalo-wzr-900dhp \
87 buffalo-wxr-1900dhp
88
89 $(eval $(call BuildImage))