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