2013-11-05 16:00:34 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2013 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/image.mk
|
2014-09-14 21:47:42 +08:00
|
|
|
include $(INCLUDE_DIR)/host.mk
|
|
|
|
|
|
|
|
FAT32_BLOCK_SIZE=1024
|
|
|
|
FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
|
2013-11-05 16:00:34 +08:00
|
|
|
|
2013-11-15 07:12:52 +08:00
|
|
|
BOARDS:= \
|
|
|
|
sun4i-a10-cubieboard \
|
2014-01-12 01:19:04 +08:00
|
|
|
sun4i-a10-olinuxino-lime \
|
2014-01-13 03:23:29 +08:00
|
|
|
sun4i-a10-pcduino \
|
2013-11-15 07:12:52 +08:00
|
|
|
sun5i-a13-olinuxino \
|
2014-02-06 05:11:59 +08:00
|
|
|
sun6i-a31-colombus \
|
2015-01-10 03:35:14 +08:00
|
|
|
sun6i-a31-m9 \
|
2014-06-02 02:44:10 +08:00
|
|
|
sun7i-a20-bananapi \
|
2015-01-10 03:35:14 +08:00
|
|
|
sun7i-a20-bananapro \
|
2014-01-13 03:23:29 +08:00
|
|
|
sun7i-a20-cubieboard2 \
|
|
|
|
sun7i-a20-cubietruck \
|
2014-11-06 08:05:23 +08:00
|
|
|
sun7i-a20-olinuxino-lime \
|
2014-05-01 03:50:15 +08:00
|
|
|
sun7i-a20-olinuxino-micro \
|
2015-01-30 08:17:16 +08:00
|
|
|
sun7i-a20-pcduino3 \
|
|
|
|
sun7i-a20-lamobo-r1
|
2013-11-05 16:00:34 +08:00
|
|
|
|
2013-11-15 07:12:52 +08:00
|
|
|
define Image/BuildKernel
|
|
|
|
mkimage -A arm -O linux -T kernel -C none \
|
|
|
|
-a 0x40008000 -e 0x40008000 \
|
|
|
|
-n 'ARM OpenWrt Linux-$(LINUX_VERSION)' \
|
|
|
|
-d $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
2013-11-05 16:00:34 +08:00
|
|
|
$(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
|
|
|
|
echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
|
|
|
|
$(call Image/BuildKernel/MkuImage, \
|
|
|
|
none, 0x40008000, 0x40008000, \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \
|
|
|
|
)
|
2013-11-15 07:12:52 +08:00
|
|
|
endif
|
2013-11-05 16:00:34 +08:00
|
|
|
|
2013-11-15 07:12:52 +08:00
|
|
|
$(foreach board,$(BOARDS),
|
2014-07-22 02:42:06 +08:00
|
|
|
$(CP) $(DTS_DIR)/$(board).dtb $(BIN_DIR)/
|
2013-11-05 16:00:34 +08:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2014-09-14 21:47:42 +08:00
|
|
|
define Image/Build/SDCard
|
|
|
|
rm -f $(KDIR)/boot.img
|
|
|
|
mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
|
|
|
|
|
2015-05-27 23:34:48 +08:00
|
|
|
mcopy -i $(KDIR)/boot.img $(BIN_DIR)/uboot-sunxi-$(PROFILE)/$(IMG_PREFIX)-$(PROFILE)-boot.scr ::boot.scr
|
2014-09-14 21:47:42 +08:00
|
|
|
mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(2).dtb ::dtb
|
|
|
|
mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
|
|
|
|
|
|
|
|
./gen_sunxi_sdcard_img.sh \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
|
|
|
|
$(KDIR)/boot.img \
|
|
|
|
$(KDIR)/root.$(1) \
|
|
|
|
$(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
|
|
|
|
$(CONFIG_TARGET_ROOTFS_PARTSIZE) \
|
2015-05-27 23:34:48 +08:00
|
|
|
$(BIN_DIR)/uboot-sunxi-$(PROFILE)/$(IMG_PREFIX)-$(PROFILE)-u-boot-with-spl.bin
|
2014-09-14 21:47:42 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/A10-OLinuXino-Lime
|
|
|
|
$(call Image/Build/SDCard,$(1),sun4i-a10-olinuxino-lime)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/A13-OLinuXino
|
|
|
|
$(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
|
|
|
|
endef
|
|
|
|
|
2015-02-13 01:30:09 +08:00
|
|
|
define Image/Build/Profile/A20-OLinuXino-Lime
|
2014-11-06 08:05:23 +08:00
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-lime)
|
|
|
|
endef
|
|
|
|
|
2014-09-14 21:47:42 +08:00
|
|
|
define Image/Build/Profile/A20-OLinuXino_MICRO
|
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-micro)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/Bananapi
|
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-bananapi)
|
|
|
|
endef
|
|
|
|
|
2015-01-10 03:35:14 +08:00
|
|
|
define Image/Build/Profile/Bananapro
|
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-bananapro)
|
|
|
|
endef
|
|
|
|
|
2015-01-30 08:17:16 +08:00
|
|
|
define Image/Build/Profile/Lamobo_R1
|
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-lamobo-r1)
|
|
|
|
endef
|
|
|
|
|
2014-09-14 21:47:42 +08:00
|
|
|
define Image/Build/Profile/Cubieboard
|
|
|
|
$(call Image/Build/SDCard,$(1),sun4i-a10-cubieboard)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/Cubieboard2
|
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-cubieboard2)
|
|
|
|
endef
|
|
|
|
|
2015-01-10 03:35:14 +08:00
|
|
|
define Image/Build/Profile/Cubietruck
|
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-cubietruck)
|
|
|
|
endef
|
|
|
|
|
2015-01-19 00:58:35 +08:00
|
|
|
define Image/Build/Profile/OLIMEX_A13_SOM
|
2014-09-14 21:47:42 +08:00
|
|
|
$(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino)
|
|
|
|
endef
|
|
|
|
|
2015-01-10 03:35:14 +08:00
|
|
|
define Image/Build/Profile/Mele_M9
|
|
|
|
$(call Image/Build/SDCard,$(1),sun6i-a31-hummingbird)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/Linksprite_pcDuino
|
2014-09-14 21:47:42 +08:00
|
|
|
$(call Image/Build/SDCard,$(1),sun4i-a10-pcduino)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/Linksprite_pcDuino3
|
|
|
|
$(call Image/Build/SDCard,$(1),sun7i-a20-pcduino3)
|
|
|
|
endef
|
|
|
|
|
2013-11-05 16:00:34 +08:00
|
|
|
define Image/Build
|
2013-11-15 07:12:52 +08:00
|
|
|
$(call Image/Build/$(1),$(1))
|
2014-09-14 21:47:42 +08:00
|
|
|
$(call Image/Build/Profile/$(PROFILE),$(1))
|
2014-10-06 01:32:36 +08:00
|
|
|
|
2015-05-27 23:34:48 +08:00
|
|
|
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
|
2013-11-05 16:00:34 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildImage))
|