treewide: provide global default for SUPPORTED_DEVICES
[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 DEVICE_VARS := SUNXI_DTS SUNXI_DTS_DIR
15 KERNEL_LOADADDR:=0x40008000
16
17 define Build/sunxi-sdcard
18 rm -f $@.boot
19 mkfs.fat $@.boot -C $(FAT32_BLOCKS)
20
21 mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
22 mcopy -i $@.boot $(DTS_DIR)/$(SUNXI_DTS).dtb ::dtb
23 mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
24 ./gen_sunxi_sdcard_img.sh $@ \
25 $@.boot \
26 $(IMAGE_ROOTFS) \
27 $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
28 $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
29 $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot-with-spl.bin
30 rm -f $@.boot
31 endef
32
33 # why \x00\x00\x00\x00 for zImage-initramfs
34 define Device/Default
35 PROFILES := Default
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 SUNXI_DTS_DIR :=
41 SUNXI_DTS = $$(SUNXI_DTS_DIR)$$(SOC)-$(lastword $(subst _, ,$(1)))
42 endef
43
44 include $(SUBTARGET).mk
45
46 $(eval $(call BuildImage))