bcm53xx: add pending patch adding Luxul XWC-2000 DTS file
[oweals/openwrt.git] / target / linux / imx6 / 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 #################################################
11 # Images
12 #################################################
13
14 DEVICE_VARS += MKUBIFS_OPTS UBOOT BOOT_SCRIPT
15
16 define Build/boot-overlay
17         rm -rf $@.boot
18         mkdir -p $@.boot
19
20         $(CP) $@ $@.boot/$(IMG_PREFIX)-uImage
21         ln -sf $(IMG_PREFIX)-uImage $@.boot/uImage
22
23         $(foreach dts,$(DEVICE_DTS), \
24                 $(CP) \
25                         $(DTS_DIR)/$(dts).dtb \
26                         $@.boot/$(IMG_PREFIX)-$(dts).dtb; \
27                 ln -sf \
28                         $(IMG_PREFIX)-$(dts).dtb \
29                         $@.boot/$(dts).dtb; \
30         )
31         mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
32                 -n '$(DEVICE_ID) OpenWrt bootscript' \
33                 -d ./bootscript-$(DEVICE_NAME) \
34                 $@.boot/6x_bootscript-$(DEVICE_NAME)
35
36         $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
37                 --space-fixup --compr=zlib --squash-uids \
38                 $(MKUBIFS_OPTS) -c 8124 \
39                 -o $@.boot.ubifs -d $@.boot
40
41         $(TAR) -C $@.boot -cf $@.boot.tar .
42 endef
43
44 define Build/bootfs.tar.gz
45         rm -rf $@.boot
46         mkdir -p $@.boot
47
48         $(TAR) -C $@.boot -xf $(IMAGE_KERNEL).boot.tar
49         $(TAR) -C $@.boot \
50                 --numeric-owner --owner=0 --group=0 --transform "s,./,./boot/," \
51                 -czvf $@ .
52 endef
53
54 define Build/boot-scr
55         mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
56         -n '$(DEVICE_ID) OpenWrt bootscript' \
57         -d ./bootscript-$(DEVICE_NAME) \
58         $(BIN_DIR)/boot.scr
59 endef
60
61 define Build/recovery-scr
62         mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
63         -n '$(DEVICE_ID) OpenWrt recovery bootscript' \
64         -d ./recovery-$(DEVICE_NAME) $@
65 endef
66
67 define Build/imx6-combined-image-prepare
68         rm -rf $@.boot
69         mkdir -p $@.boot
70 endef
71
72 define Build/imx6-combined-image-clean
73         rm -rf $@.boot $@.fs
74 endef
75
76 define Build/imx6-combined-image
77         $(CP) $(IMAGE_KERNEL) $@.boot/uImage
78
79         $(foreach dts,$(DEVICE_DTS), \
80                 $(CP) \
81                         $(DTS_DIR)/$(dts).dtb \
82                         $@.boot/;
83         )
84
85         mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
86                 -n '$(DEVICE_ID) OpenWrt bootscript' \
87                 -d $(BOOT_SCRIPT) \
88                 $@.boot/boot.scr
89
90         cp $@ $@.fs
91
92         $(SCRIPT_DIR)/gen_image_generic.sh $@ \
93                 $(CONFIG_TARGET_KERNEL_PARTSIZE) \
94                 $@.boot \
95                 $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
96                 $@.fs \
97                 1024
98 endef
99
100 define Build/imx6-sdcard
101         $(Build/imx6-combined-image-prepare)
102
103         $(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img $@.boot/u-boot.img
104         $(Build/imx6-combined-image)
105         dd if=$(STAGING_DIR_IMAGE)/$(UBOOT)-SPL of=$@ bs=1024 seek=1 conv=notrunc
106
107         $(Build/imx6-combined-image-clean)
108 endef
109
110 define Build/apalis-emmc
111         $(Build/imx6-combined-image-prepare)
112         $(Build/imx6-combined-image)
113         $(Build/imx6-combined-image-clean)
114 endef
115
116 #################################################
117 # Devices
118 #################################################
119
120 KERNEL_LOADADDR=0x10008000
121
122 define Device/Default
123   PROFILES := Generic
124   FILESYSTEMS := squashfs ext4
125   KERNEL_INSTALL := 1
126   KERNEL_SUFFIX := -uImage
127   KERNEL_NAME := zImage
128   KERNEL_PREFIX := $$(IMAGE_PREFIX)
129   KERNEL := kernel-bin | uImage none
130   IMAGES :=
131 endef
132
133 define Device/ventana
134   DEVICE_TITLE := Gateworks Ventana family (normal NAND flash)
135   DEVICE_DTS:= \
136         imx6dl-gw51xx \
137         imx6dl-gw52xx \
138         imx6dl-gw53xx \
139         imx6dl-gw54xx \
140         imx6dl-gw551x \
141         imx6dl-gw552x \
142         imx6dl-gw553x \
143         imx6dl-gw5904 \
144         imx6q-gw51xx \
145         imx6q-gw52xx \
146         imx6q-gw53xx \
147         imx6q-gw54xx \
148         imx6q-gw5400-a \
149         imx6q-gw551x \
150         imx6q-gw552x \
151         imx6q-gw553x \
152         imx6q-gw5904
153   DEVICE_PACKAGES := kmod-sky2 kmod-sound-core kmod-sound-soc-imx kmod-sound-soc-imx-sgtl5000 \
154         kmod-can kmod-can-flexcan kmod-can-raw \
155         kmod-hwmon-gsc \
156         kmod-leds-gpio kmod-pps-gpio \
157         kobs-ng
158   KERNEL += | boot-overlay
159   IMAGES := nand.ubi bootfs.tar.gz
160   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
161   UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
162   BOOT_SCRIPT := bootscript-ventana
163   IMAGE/nand.ubi := append-ubi
164   IMAGE/bootfs.tar.gz := bootfs.tar.gz | install-dtb
165   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
166   PAGESIZE := 2048
167   BLOCKSIZE := 128k
168   MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB
169 endef
170 TARGET_DEVICES += ventana
171
172 define Device/ventana-large
173   $(Device/ventana)
174   DEVICE_NAME := ventana
175   DEVICE_TITLE := Gateworks Ventana family (large NAND flash)
176   IMAGES := nand.ubi
177   PAGESIZE := 4096
178   BLOCKSIZE := 256k
179   MKUBIFS_OPTS := -m $$(PAGESIZE) -e 248KiB
180 endef
181 TARGET_DEVICES += ventana-large
182
183 define Device/wandboard
184   DEVICE_TITLE := Wandboard Dual
185   DEVICE_DTS := imx6dl-wandboard
186 endef
187 TARGET_DEVICES += wandboard
188
189 define Device/cubox-i
190   KERNEL := kernel-bin | install-dtb
191   UBOOT := mx6cuboxi
192   BOOT_SCRIPT = bootscript-cubox
193   DEVICE_NAME := cubox
194   DEVICE_TITLE := SolidRun CuBox-i
195   DEVICE_PACKAGES := kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid
196   DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i imx6q-hummingboard imx6dl-hummingboard
197   IMAGES := combined.bin
198   FILESYSTEMS := squashfs
199   IMAGE/combined.bin := append-rootfs | pad-extra 128k | imx6-sdcard
200 endef
201 TARGET_DEVICES += cubox-i
202
203 define Device/apalis
204   DEVICE_TITLE := Toradex Apalis family
205   SUPPORTED_DEVICES := apalis,ixora apalis,eval
206   DEVICE_DTS := \
207           imx6q-apalis-eval \
208           imx6q-apalis-ixora \
209           imx6q-apalis-ixora-v1.1
210   DEVICE_PACKAGES := \
211         kmod-can kmod-can-flexcan kmod-can-raw \
212         kmod-leds-gpio kmod-gpio-button-hotplug \
213         kmod-pps-gpio kmod-rtc-ds1307
214   BOOT_SCRIPT := bootscript-apalis
215   UBOOT := apalis_imx6
216   FILESYSTEMS := squashfs
217   IMAGES := combined.bin sysupgrade.bin
218   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
219   IMAGE/combined.bin := append-rootfs | pad-extra 128k | apalis-emmc
220   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
221   ARTIFACTS := recovery.scr
222   ARTIFACT/recovery.scr := recovery-scr
223 endef
224 TARGET_DEVICES += apalis
225
226 $(eval $(call BuildImage))