0c53c853f31831bbac2c6155c08ee75559c3804c
[openwrt/openwrt.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 -f $(word 1,$^) \
37 -a 0x20000 -f $(KDIR)/root-block-0x20000-min-0x800.ubi \
38 -a 0x20000 -A $(KDIR)/fs_mark
39 endef
40
41 define Build/netgear-chk
42 $(STAGING_DIR_HOST)/bin/mkchkimg \
43 -o $@.new -k $@ -b $(BOARD_ID) -r $(REGION)
44 mv $@.new $@
45 endef
46
47 DEVICE_VARS += DT BOARD_ID REGION
48
49 define Device/Default
50 # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
51 # extract the full dtb name based on the device info
52 DT := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
53 KERNEL := kernel-bin | append-dtb | lzma-d16
54 FILESYSTEMS := squashfs
55 KERNEL_NAME := zImage
56 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
57 IMAGES := trx
58 IMAGE/trx := trx-nand
59 endef
60
61 define Device/netgear
62 IMAGES := chk
63 IMAGE/chk := trx-nand | netgear-chk
64 REGION := 1
65 endef
66
67 define Device/netgear-r6250
68 $(Device/netgear)
69 BOARD_ID := U12H245T00_NETGEAR
70 endef
71
72 define Device/netgear-r6300-v2
73 $(Device/netgear)
74 BOARD_ID := U12H240T00_NETGEAR
75 endef
76
77 define Device/netgear-r8000
78 $(Device/netgear)
79 BOARD_ID := U12H315T00_NETGEAR
80 endef
81
82 TARGET_DEVICES += \
83 asus-rt-ac56u asus-rt-ac68u asus-rt-ac87u asus-rt-n18u \
84 netgear-r6250 netgear-r6300-v2 netgear-r8000 \
85 buffalo-wzr-1750dhp buffalo-wzr-600dhp2 buffalo-wzr-900dhp
86
87 $(eval $(call BuildImage))