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