target: use SPDX license identifiers on Makefiles
[openwrt/openwrt.git] / target / linux / sunxi / image / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2013-2016 OpenWrt.org
4 # Copyright (C) 2016 Yousong Zhou
5
6 include $(TOPDIR)/rules.mk
7 include $(INCLUDE_DIR)/image.mk
8
9 FAT32_BLOCK_SIZE=1024
10 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
11
12 DEVICE_VARS := SUNXI_DTS SUNXI_DTS_DIR
13 KERNEL_LOADADDR:=0x40008000
14
15 define Build/sunxi-sdcard
16 rm -f $@.boot
17 mkfs.fat $@.boot -C $(FAT32_BLOCKS)
18
19 mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
20 mcopy -i $@.boot $(DTS_DIR)/$(SUNXI_DTS).dtb ::dtb
21 mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
22 ./gen_sunxi_sdcard_img.sh $@ \
23 $@.boot \
24 $(IMAGE_ROOTFS) \
25 $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \
26 $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
27 $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot-with-spl.bin
28 rm -f $@.boot
29 endef
30
31 # why \x00\x00\x00\x00 for zImage-initramfs
32 define Device/Default
33 PROFILES := Default
34 KERNEL_NAME := zImage
35 KERNEL := kernel-bin | uImage none
36 IMAGES := sdcard.img.gz
37 IMAGE/sdcard.img.gz := sunxi-sdcard | append-metadata | gzip
38 SUNXI_DTS_DIR :=
39 SUNXI_DTS = $$(SUNXI_DTS_DIR)$$(SOC)-$(lastword $(subst _, ,$(1)))
40 endef
41
42 include $(SUBTARGET).mk
43
44 $(eval $(call BuildImage))