imx6: add GW553x support
[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
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                         $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(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 --force-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 #################################################
55 # Devices
56 #################################################
57
58 KERNEL_LOADADDR=0x10008000
59
60 define Device/Default
61   PROFILES := Generic
62   FILESYSTEMS := squashfs ext4
63   KERNEL_INSTALL := 1
64   KERNEL_SUFFIX := -uImage
65   KERNEL_NAME := zImage
66   KERNEL_PREFIX := $$(IMAGE_PREFIX)
67   KERNEL := kernel-bin | uImage none
68   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
69   IMAGES :=
70 endef
71
72 define Device/ventana
73   DEVICE_TITLE := Gateworks Ventana family (normal NAND flash)
74   DEVICE_DTS:= \
75         imx6dl-gw51xx \
76         imx6dl-gw52xx \
77         imx6dl-gw53xx \
78         imx6dl-gw54xx \
79         imx6dl-gw551x \
80         imx6dl-gw552x \
81         imx6q-gw51xx \
82         imx6q-gw52xx \
83         imx6q-gw53xx \
84         imx6q-gw54xx \
85         imx6q-gw5400-a \
86         imx6q-gw551x \
87         imx6q-gw552x \
88         imx6q-gw553x
89   DEVICE_PACKAGES := kmod-thermal-imx kmod-sky2 kmod-usb-chipidea-imx kmod-usb-mxs-phy \
90         kmod-sound-core kmod-sound-soc-imx kmod-sound-soc-imx-sgtl5000 \
91         kmod-can kmod-can-flexcan kmod-can-raw \
92         kmod-rtc-ds1672 kmod-gpio-pca953x kmod-hwmon-gsc kmod-eeprom-at24 \
93         kmod-leds-gpio kmod-pps-gpio kmod-gw16083 \
94         kobs-ng
95   KERNEL += | boot-overlay
96   IMAGES := nand.ubi bootfs.tar.gz
97   UBINIZE_OPTS :=
98   UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
99   IMAGE/nand.ubi := append-ubi
100   IMAGE/bootfs.tar.gz := bootfs.tar.gz | install-dtb
101   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
102   PAGESIZE := 2048
103   BLOCKSIZE := 128KiB
104   MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB
105 endef
106
107 define Device/ventana-large
108   $(Device/ventana)
109   DEVICE_NAME := ventana
110   DEVICE_TITLE := Gateworks Ventana family (large NAND flash)
111   IMAGES := nand.ubi
112   PAGESIZE := 4096
113   BLOCKSIZE := 256KiB
114   MKUBIFS_OPTS := -m $$(PAGESIZE) -e 248KiB
115 endef
116
117 define Device/wandboard
118   DEVICE_TITLE := Wandboard Dual
119   DEVICE_DTS := imx6dl-wandboard
120   DEVICE_PACKAGES := kmod-thermal-imx kmod-usb-chipidea-imx kmod-usb-mxs-phy
121 endef
122
123 TARGET_DEVICES += \
124         ventana ventana-large \
125         wandboard
126
127 $(eval $(call BuildImage))