2 # Copyright (C) 2013 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/image.mk
9 include $(INCLUDE_DIR
)/host.mk
12 FAT32_BLOCKS
=$(shell echo
$$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE
)*1024*1024/$(FAT32_BLOCK_SIZE
))))
14 define Image
/BuildKernel
17 mkimage
-A arm
-O linux
-T kernel
-C none \
18 -a
0x40008000 -e
0x40008000 \
19 -n
'ARM OpenWrt Linux-$(LINUX_VERSION)' \
20 -d
$(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-uImage
22 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
23 $(CP
) $(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
24 echo
-ne
'\x00\x00\x00\x00' >> $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
25 $(call Image
/BuildKernel
/MkuImage
, \
26 none
, 0x40008000, 0x40008000, \
27 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
, \
28 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage-initramfs \
33 define Image
/Build
/SDCard
34 rm -f
$(KDIR_TMP
)/$(IMG_PREFIX
)-$(PROFILE
)-boot.img
35 mkdosfs
$(KDIR_TMP
)/$(IMG_PREFIX
)-$(PROFILE
)-boot.img
-C
$(FAT32_BLOCKS
)
37 mcopy
-i
$(KDIR_TMP
)/$(IMG_PREFIX
)-$(PROFILE
)-boot.img
$(KDIR
)/uboot-sunxi-
$(PROFILE
)-boot.scr
::boot.scr
38 mcopy
-i
$(KDIR_TMP
)/$(IMG_PREFIX
)-$(PROFILE
)-boot.img
$(DTS_DIR
)/$(2).dtb
::dtb
39 mcopy
-i
$(KDIR_TMP
)/$(IMG_PREFIX
)-$(PROFILE
)-boot.img
$(BIN_DIR
)/$(IMG_PREFIX
)-uImage
::uImage
41 .
/gen_sunxi_sdcard_img.sh \
42 $(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE
)-sdcard-vfat-
$(1).img \
43 $(KDIR_TMP
)/$(IMG_PREFIX
)-$(PROFILE
)-boot.img \
45 $(CONFIG_SUNXI_SD_BOOT_PARTSIZE
) \
46 $(CONFIG_TARGET_ROOTFS_PARTSIZE
) \
47 $(KDIR
)/uboot-sunxi-
$(PROFILE
)-u-boot-with-spl.bin
49 ifneq ($(CONFIG_TARGET_IMAGES_GZIP
),)
50 gzip
-f9n
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE
)-sdcard-vfat-
$(1).img
54 define Image
/Build
/Profile
/A10-OLinuXino-Lime
55 $(call Image
/Build
/SDCard
,$(1),sun4i-a10-olinuxino-lime
)
58 define Image
/Build
/Profile
/A13-OLinuXino
59 $(call Image
/Build
/SDCard
,$(1),sun5i-a13-olinuxino
)
62 define Image
/Build
/Profile
/A20-OLinuXino-Lime
63 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-olinuxino-lime
)
66 define Image
/Build
/Profile
/A20-OLinuXino_MICRO
67 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-olinuxino-micro
)
70 define Image
/Build
/Profile
/Bananapi
71 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-bananapi
)
74 define Image
/Build
/Profile
/Bananapro
75 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-bananapro
)
78 define Image
/Build
/Profile
/Lamobo_R1
79 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-lamobo-r1
)
82 define Image
/Build
/Profile
/Cubieboard
83 $(call Image
/Build
/SDCard
,$(1),sun4i-a10-cubieboard
)
86 define Image
/Build
/Profile
/Cubieboard2
87 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-cubieboard2
)
90 define Image
/Build
/Profile
/Cubietruck
91 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-cubietruck
)
94 define Image
/Build
/Profile
/OLIMEX_A13_SOM
95 $(call Image
/Build
/SDCard
,$(1),sun5i-a13-olinuxino
)
98 define Image
/Build
/Profile
/Mele_M9
99 $(call Image
/Build
/SDCard
,$(1),sun6i-a31-hummingbird
)
102 define Image
/Build
/Profile
/Linksprite_pcDuino
103 $(call Image
/Build
/SDCard
,$(1),sun4i-a10-pcduino
)
106 define Image
/Build
/Profile
/Linksprite_pcDuino3
107 $(call Image
/Build
/SDCard
,$(1),sun7i-a20-pcduino3
)
111 $(call Image
/Build
/$(1),$(1))
112 $(call Image
/Build
/Profile
/$(PROFILE
),$(1))
114 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=128k conv
=sync
117 $(eval
$(call BuildImage
))