mxs: put u-boot images into image staging directory
[openwrt/openwrt.git] / target / linux / mxs / image / Makefile
index 55e88c25f3f344d5982f84a44e599f354f43526b..7c332cd7c2ec91735734cd849b2385c5c1a709d1 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# Copyright (C) 2013 OpenWrt.org
+# Copyright (C) 2013-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -7,10 +7,13 @@
 
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
-include $(INCLUDE_DIR)/host.mk
+
+BOARDS:= \
+       imx23-olinuxino \
+       imx28-duckbill
 
 FAT32_BLOCK_SIZE=1024
 
 FAT32_BLOCK_SIZE=1024
-FAT32_BLOCKS=$(shell echo $$(($(CONFIG_MXS_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
+FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_BOOTFS_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
 
 define Image/BuildKernel
        mkimage -A arm -O linux -T kernel -C none \
 
 define Image/BuildKernel
        mkimage -A arm -O linux -T kernel -C none \
@@ -21,52 +24,56 @@ define Image/BuildKernel
 endef
 
 define Image/InstallKernel
 endef
 
 define Image/InstallKernel
-
-  ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),)
        mkdir -p $(TARGET_DIR)/boot
        mkdir -p $(TARGET_DIR)/boot
-       $(CP) $(LINUX_DIR)/arch/arm/boot/zImage $(TARGET_DIR)/boot/
-  endif
-  
-  ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),)
-       mkdir -p $(TARGET_DIR)/boot
-       $(foreach board,$(BOARDS),
-               $(CP) $(DTS_DIR)/$(board).dtb $(TARGET_DIR)/boot/
-       )
-  endif
-
+       cp \
+               $(KDIR)/zImage $(KDIR)/uImage \
+               $(foreach board,$(BOARDS),$(DTS_DIR)/$(board).dtb) \
+               $(TARGET_DIR)/boot/
 endef
 
 endef
 
-define Image/Build/SDCard
+define Image/Build/SDCard-vfat-ext4
        rm -f $(KDIR)/boot.img
        rm -f $(KDIR)/boot.img
-       mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
+       mkfs.fat $(KDIR)/boot.img -C $(FAT32_BLOCKS)
 
 
-       mcopy -i $(KDIR)/boot.img $(DTS_DIR)/$(2).dtb ::$(2).dtb
+       mcopy -i $(KDIR)/boot.img $(DTS_DIR)/$(3).dtb ::$(3).dtb
        mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
 
        mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
 
-       ./gen_mxs_sdcard_img.sh \
-               $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \
+       ./gen_sdcard_vfat_ext4.sh \
+               $(BIN_DIR)/$(2) \
+               $(STAGING_DIR_IMAGE)/$(4)-u-boot.sb \
                $(KDIR)/boot.img \
                $(KDIR)/root.$(1) \
                $(KDIR)/boot.img \
                $(KDIR)/root.$(1) \
-               $(CONFIG_MXS_SD_BOOT_PARTSIZE) \
-               $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
-               $(BIN_DIR)/uboot-mxs-$(3).sb
+               $(CONFIG_TARGET_BOOTFS_PARTSIZE) \
+               $(CONFIG_TARGET_ROOTFS_PARTSIZE)
+       $(call Image/Gzip,$(BIN_DIR)/$(2))
+endef
+
+define Image/Build/SDCard-ext4-ext4
+       ./gen_sdcard_ext4_ext4.sh \
+               $(BIN_DIR)/$(2) \
+               $(STAGING_DIR_IMAGE)/$(4)-u-boot.sb \
+               $(KDIR)/root.$(1) \
+               $(CONFIG_TARGET_ROOTFS_PARTSIZE)
+       $(call Image/Gzip,$(BIN_DIR)/$(2))
 endef
 
 define Image/Build/Profile/olinuxino-maxi
 endef
 
 define Image/Build/Profile/olinuxino-maxi
-       $(call Image/Build/SDCard,$(1),imx23-olinuxino,mx23_olinuxino)
+       $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino)
 endef
 
 define Image/Build/Profile/olinuxino-micro
 endef
 
 define Image/Build/Profile/olinuxino-micro
-       $(call Image/Build/SDCard,$(1),imx23-olinuxino,mx23_olinuxino)
+       $(call Image/Build/SDCard-vfat-ext4,$(1),$(2),imx23-olinuxino,mx23_olinuxino)
 endef
 
 define Image/Build/Profile/duckbill
 endef
 
 define Image/Build/Profile/duckbill
-       $(call Image/Build/SDCard,$(1),imx28-duckbill,duckbill)
+       $(call Image/Build/SDCard-ext4-ext4,$(1),$(2),imx28-duckbill,duckbill)
 endef
 
 define Image/Build
        $(call Image/Build/$(1),$(1))
 endef
 
 define Image/Build
        $(call Image/Build/$(1),$(1))
-       $(call Image/Build/Profile/$(PROFILE),$(1))
+       $(call Image/Build/Profile/$(PROFILE),$(1),$(IMG_PREFIX)-$(PROFILE)-sdcard.img)
+       dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
+       $(call Image/Gzip,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1))
 endef
 
 $(eval $(call BuildImage))
 endef
 
 $(eval $(call BuildImage))