1 # SPDX-License-Identifier: GPL-2.0-only
3 # Copyright (C) 2013-2016 OpenWrt.org
4 # Copyright (C) 2016 Yousong Zhou
6 include $(TOPDIR
)/rules.mk
7 include $(INCLUDE_DIR
)/image.mk
10 FAT32_BLOCKS
=$(shell echo
$$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE
)*1024*1024/$(FAT32_BLOCK_SIZE
))))
12 DEVICE_VARS
:= SUNXI_DTS SUNXI_DTS_DIR
14 define Build
/sunxi-sdcard
16 mkfs.fat
$@.boot
-C
$(FAT32_BLOCKS
)
18 mcopy
-i
$@.boot
$(STAGING_DIR_IMAGE
)/$(DEVICE_NAME
)-boot.scr
::boot.scr
19 mcopy
-i
$@.boot
$(DTS_DIR
)/$(SUNXI_DTS
).dtb
::dtb
20 mcopy
-i
$@.boot
$(IMAGE_KERNEL
) ::uImage
21 .
/gen_sunxi_sdcard_img.sh
$@ \
24 $(CONFIG_SUNXI_SD_BOOT_PARTSIZE
) \
25 $(CONFIG_TARGET_ROOTFS_PARTSIZE
) \
26 $(STAGING_DIR_IMAGE
)/$(DEVICE_NAME
)-u-boot-with-spl.bin
30 # why \x00\x00\x00\x00 for zImage-initramfs
34 KERNEL
:= kernel-bin | uImage none
35 IMAGES
:= sdcard.img.gz
36 IMAGE
/sdcard.img.gz
:= sunxi-sdcard | append-metadata | gzip
38 SUNXI_DTS
= $$(SUNXI_DTS_DIR
)$$(SOC
)-$(lastword
$(subst _
, ,$(1)))
41 include $(SUBTARGET
).mk
43 $(eval
$(call BuildImage
))