sunxi: add support for Lamobo R1
[openwrt/svn-archive/archive.git] / target / linux / sunxi / 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 include $(INCLUDE_DIR)/host.mk
10
11 FAT32_BLOCK_SIZE=1024
12 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
13
14 BOARDS:= \
15 sun4i-a10-cubieboard \
16 sun4i-a10-olinuxino-lime \
17 sun4i-a10-pcduino \
18 sun5i-a13-olinuxino \
19 sun6i-a31-colombus \
20 sun6i-a31-m9 \
21 sun7i-a20-bananapi \
22 sun7i-a20-bananapro \
23 sun7i-a20-cubieboard2 \
24 sun7i-a20-cubietruck \
25 sun7i-a20-olinuxino-lime \
26 sun7i-a20-olinuxino-micro \
27 sun7i-a20-pcduino3 \
28 sun7i-a20-lamobo-r1
29
30 define Image/BuildKernel
31 mkimage -A arm -O linux -T kernel -C none \
32 -a 0x40008000 -e 0x40008000 \
33 -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' \
34 -d $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
35
36 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
37 $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
38 echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
39 $(call Image/BuildKernel/MkuImage, \
40 none, 0x40008000, 0x40008000, \
41 $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \
42 $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \
43 )
44 endif
45
46 $(foreach board,$(BOARDS),
47 $(CP) $(DTS_DIR)/$(board).dtb $(BIN_DIR)/
48 )
49 endef
50
51 define Image/Build/SDCard
52 rm -f $(KDIR)/boot.img
53 mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
54
55 mcopy -i $(KDIR)/boot.img $(BIN_DIR)/uboot-sunxi-$(PROFILE)/openwrt-sunxi-$(PROFILE)-boot.scr ::boot.scr
56 mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(2).dtb ::dtb
57 mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
58
59 ./gen_sunxi_sdcard_img.sh \
60 $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
61 $(KDIR)/boot.img \
62 $(KDIR)/root.$(1) \
63 $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
64 $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
65 $(BIN_DIR)/uboot-sunxi-$(PROFILE)/openwrt-sunxi-$(PROFILE)-u-boot-with-spl.bin
66 endef
67
68 define Image/Build/Profile/A10-OLinuXino-Lime
69 $(call Image/Build/SDCard,$(1),sun4i-a10-olinuxino-lime)
70 endef
71
72 define Image/Build/Profile/A13-OLinuXino
73 $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
74 endef
75
76 define Image/Build/Profile/A20-OLinuXino_Lime
77 $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-lime)
78 endef
79
80 define Image/Build/Profile/A20-OLinuXino_MICRO
81 $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-micro)
82 endef
83
84 define Image/Build/Profile/Bananapi
85 $(call Image/Build/SDCard,$(1),sun7i-a20-bananapi)
86 endef
87
88 define Image/Build/Profile/Bananapro
89 $(call Image/Build/SDCard,$(1),sun7i-a20-bananapro)
90 endef
91
92 define Image/Build/Profile/Lamobo_R1
93 $(call Image/Build/SDCard,$(1),sun7i-a20-lamobo-r1)
94 endef
95
96 define Image/Build/Profile/Cubieboard
97 $(call Image/Build/SDCard,$(1),sun4i-a10-cubieboard)
98 endef
99
100 define Image/Build/Profile/Cubieboard2
101 $(call Image/Build/SDCard,$(1),sun7i-a20-cubieboard2)
102 endef
103
104 define Image/Build/Profile/Cubietruck
105 $(call Image/Build/SDCard,$(1),sun7i-a20-cubietruck)
106 endef
107
108 define Image/Build/Profile/OLIMEX_A13_SOM
109 $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
110 endef
111
112 define Image/Build/Profile/Mele_M9
113 $(call Image/Build/SDCard,$(1),sun6i-a31-hummingbird)
114 endef
115
116 define Image/Build/Profile/Linksprite_pcDuino
117 $(call Image/Build/SDCard,$(1),sun4i-a10-pcduino)
118 endef
119
120 define Image/Build/Profile/Linksprite_pcDuino3
121 $(call Image/Build/SDCard,$(1),sun7i-a20-pcduino3)
122 endef
123
124 define Image/Build
125 $(call Image/Build/$(1),$(1))
126 $(call Image/Build/Profile/$(PROFILE),$(1))
127
128 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync
129 endef
130
131 $(eval $(call BuildImage))