sunxi: tidy up and sort alphabetically in image Makefiles
[openwrt/openwrt.git] / target / linux / sunxi / image / Makefile
1 #
2 # Copyright (C) 2013-2016 OpenWrt.org
3 # Copyright (C) 2016 Yousong Zhou
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/image.mk
10
11 FAT32_BLOCK_SIZE=1024
12 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
13
14 KERNEL_LOADADDR:=0x40008000
15
16 define Build/sunxi-sdcard
17 rm -f $@.boot
18 mkfs.fat $@.boot -C $(FAT32_BLOCKS)
19
20 mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
21 mcopy -i $@.boot $(DTS_DIR)/$(SUNXI_DTS).dtb ::dtb
22 mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
23 ./gen_sunxi_sdcard_img.sh $@ \
24 $@.boot \
25 $(IMAGE_ROOTFS) \
26 $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
27 $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
28 $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot-with-spl.bin
29 rm -f $@.boot
30 endef
31
32 # why \x00\x00\x00\x00 for zImage-initramfs
33 define Device/Default
34 PROFILES := Default
35 DEVICE_VARS := SUNXI_DTS SUNXI_DTS_DIR SUNXI_UBOOT
36 KERNEL_NAME := zImage
37 KERNEL := kernel-bin | uImage none
38 IMAGES := sdcard.img.gz
39 IMAGE/sdcard.img.gz := sunxi-sdcard | append-metadata | gzip
40 SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
41 SUNXI_DTS_DIR :=
42 SUNXI_DTS = $$(SUNXI_DTS_DIR)$$(SOC)-$(lastword $(subst _, ,$(1)))
43 endef
44
45 ifeq ($(SUBTARGET),cortexa7)
46 include cortex-a7.mk
47 endif
48
49 ifeq ($(SUBTARGET),cortexa8)
50 include cortex-a8.mk
51 endif
52
53 ifeq ($(SUBTARGET),cortexa53)
54 include cortex-a53.mk
55 endif
56
57 $(eval $(call BuildImage))