2 # Copyright (C) 2013 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/image.mk
10 include $(INCLUDE_DIR)/host.mk
13 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_MXS_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
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
23 define Image/InstallKernel
25 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),)
26 mkdir -p $(TARGET_DIR)/boot
27 $(CP) $(LINUX_DIR)/arch/arm/boot/zImage $(TARGET_DIR)/boot/
30 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),)
31 mkdir -p $(TARGET_DIR)/boot
32 $(foreach board,$(BOARDS),
33 $(CP) $(DTS_DIR)/$(board).dtb $(TARGET_DIR)/boot/
39 define Image/Build/SDCard
40 rm -f $(KDIR)/boot.img
41 mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
43 mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(2).dtb ::$(2).dtb
44 mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
46 ./gen_mxs_sdcard_img.sh \
47 $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
50 $(CONFIG_MXS_SD_BOOT_PARTSIZE) \
51 $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
52 $(BIN_DIR)/uboot-mxs-$(3).sb
55 define Image/Build/Profile/olinuxino-maxi
56 $(call Image/Build/SDCard,$(1),imx23-olinuxino,mx23_olinuxino)
59 define Image/Build/Profile/olinuxino-micro
60 $(call Image/Build/SDCard,$(1),imx23-olinuxino,mx23_olinuxino)
63 define Image/Build/Profile/duckbill
64 $(call Image/Build/SDCard,$(1),imx28-duckbill,duckbill)
68 $(call Image/Build/$(1),$(1))
69 $(call Image/Build/Profile/$(PROFILE),$(1))
72 $(eval $(call BuildImage))