imx6: Initial support for SolidRun CuBox-i devices based on i.MX6 processors (i1...
[openwrt/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 $(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 #################################################
62 # Devices
63 #################################################
64
65 KERNEL_LOADADDR=0x10008000
66
67 define Device/Default
68 PROFILES := Generic
69 FILESYSTEMS := squashfs ext4
70 KERNEL_INSTALL := 1
71 KERNEL_SUFFIX := -uImage
72 KERNEL_NAME := zImage
73 KERNEL_PREFIX := $$(IMAGE_PREFIX)
74 KERNEL := kernel-bin | uImage none
75 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
76 IMAGES :=
77 endef
78
79 define Device/ventana
80 DEVICE_TITLE := Gateworks Ventana family (normal NAND flash)
81 DEVICE_DTS:= \
82 imx6dl-gw51xx \
83 imx6dl-gw52xx \
84 imx6dl-gw53xx \
85 imx6dl-gw54xx \
86 imx6dl-gw551x \
87 imx6dl-gw552x \
88 imx6dl-gw553x \
89 imx6dl-gw5904 \
90 imx6q-gw51xx \
91 imx6q-gw52xx \
92 imx6q-gw53xx \
93 imx6q-gw54xx \
94 imx6q-gw5400-a \
95 imx6q-gw551x \
96 imx6q-gw552x \
97 imx6q-gw553x \
98 imx6q-gw5904
99 DEVICE_PACKAGES := kmod-sky2 kmod-sound-core kmod-sound-soc-imx kmod-sound-soc-imx-sgtl5000 \
100 kmod-can kmod-can-flexcan kmod-can-raw \
101 kmod-hwmon-gsc \
102 kmod-leds-gpio kmod-pps-gpio \
103 kobs-ng
104 KERNEL += | boot-overlay
105 IMAGES := nand.ubi bootfs.tar.gz
106 UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
107 IMAGE/nand.ubi := append-ubi
108 IMAGE/bootfs.tar.gz := bootfs.tar.gz | install-dtb
109 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
110 PAGESIZE := 2048
111 BLOCKSIZE := 128k
112 MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB
113 endef
114 TARGET_DEVICES += ventana
115
116 define Device/ventana-large
117 $(Device/ventana)
118 DEVICE_NAME := ventana
119 DEVICE_TITLE := Gateworks Ventana family (large NAND flash)
120 IMAGES := nand.ubi
121 PAGESIZE := 4096
122 BLOCKSIZE := 256k
123 MKUBIFS_OPTS := -m $$(PAGESIZE) -e 248KiB
124 endef
125 TARGET_DEVICES += ventana-large
126
127 define Device/wandboard
128 DEVICE_TITLE := Wandboard Dual
129 DEVICE_DTS := imx6dl-wandboard
130 endef
131 TARGET_DEVICES += wandboard
132
133 define Device/cubox-i
134 KERNEL := kernel-bin | install-dtb | boot-scr
135 DEVICE_NAME := cubox
136 DEVICE_TITLE := SolidRun CuBox-i
137 DEVICE_PACKAGES := u-boot-mx6cuboxi kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid
138 DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i
139 endef
140 TARGET_DEVICES += cubox-i
141
142 $(eval $(call BuildImage))