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
13 KERNEL_LOADADDR
:=0x40008000
15 define Build
/sunxi-sdcard
17 mkfs.fat
$@.boot
-C
$(FAT32_BLOCKS
)
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
$@ \
25 $(CONFIG_SUNXI_SD_BOOT_PARTSIZE
) \
26 $(CONFIG_TARGET_ROOTFS_PARTSIZE
) \
27 $(STAGING_DIR_IMAGE
)/$(DEVICE_NAME
)-u-boot-with-spl.bin
31 # why \x00\x00\x00\x00 for zImage-initramfs
35 KERNEL
:= kernel-bin | uImage none
36 IMAGES
:= sdcard.img.gz
37 IMAGE
/sdcard.img.gz
:= sunxi-sdcard | append-metadata | gzip
39 SUNXI_DTS
= $$(SUNXI_DTS_DIR
)$$(SOC
)-$(lastword
$(subst _
, ,$(1)))
42 include $(SUBTARGET
).mk
44 $(eval
$(call BuildImage
))