target: use SPDX license identifiers on Makefiles
[openwrt/staging/chunkeey.git] / target / linux / mxs / image / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2013-2015 OpenWrt.org
4
5 include $(TOPDIR)/rules.mk
6 include $(INCLUDE_DIR)/image.mk
7
8 BOARDS:= \
9 imx23-olinuxino \
10 imx28-duckbill
11
12 FAT32_BLOCK_SIZE=1024
13 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_BOOTFS_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
14
15 define Image/BuildKernel
16 mkimage -A arm -O linux -T kernel -C none \
17 -a 0x40008000 -e 0x40008000 \
18 -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' \
19 -d $(KDIR)/zImage $(KDIR)/uImage
20 cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
21 endef
22
23 define Image/InstallKernel
24 mkdir -p $(TARGET_DIR)/boot
25 cp \
26 $(KDIR)/zImage $(KDIR)/uImage \
27 $(foreach board,$(BOARDS),$(DTS_DIR)/$(board).dtb) \
28 $(TARGET_DIR)/boot/
29 endef
30
31 define Image/Build/SDCard-vfat-ext4
32 rm -f $(KDIR)/boot.img
33 mkfs.fat $(KDIR)/boot.img -C $(FAT32_BLOCKS)
34
35 mcopy -i $(KDIR)/boot.img $(DTS_DIR)/$(3).dtb ::$(3).dtb
36 mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
37
38 ./gen_sdcard_vfat_ext4.sh \
39 $(BIN_DIR)/$(2) \
40 $(STAGING_DIR_IMAGE)/$(4)-u-boot.sb \
41 $(KDIR)/boot.img \
42 $(KDIR)/root.$(1) \
43 $(CONFIG_TARGET_BOOTFS_PARTSIZE) \
44 $(CONFIG_TARGET_ROOTFS_PARTSIZE)
45 $(call Image/Gzip,$(BIN_DIR)/$(2))
46 endef
47
48 define Image/Build/SDCard-ext4-ext4
49 ./gen_sdcard_ext4_ext4.sh \
50 $(BIN_DIR)/$(2) \
51 $(STAGING_DIR_IMAGE)/$(4)-u-boot.sb \
52 $(KDIR)/root.$(1) \
53 $(CONFIG_TARGET_ROOTFS_PARTSIZE)
54 $(call Image/Gzip,$(BIN_DIR)/$(2))
55 endef
56
57 define Image/Build/Profile/olinuxino-maxi
58 $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino)
59 endef
60
61 define Image/Build/Profile/olinuxino-micro
62 $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino)
63 endef
64
65 define Image/Build/Profile/duckbill
66 $(call Image/Build/SDCard-ext4-ext4,$(1),$(2),imx28-duckbill,duckbill)
67 endef
68
69 define Image/Build
70 $(call Image/Build/$(1),$(1))
71 $(call Image/Build/Profile/$(PROFILE),$(1),$(IMG_PREFIX)-$(PROFILE)-sdcard.img)
72 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
73 $(call Image/Gzip,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1))
74 endef
75
76 $(eval $(call BuildImage))