mvebu: support building images for a single board
[openwrt/staging/hauke.git] / target / linux / mvebu / image / Makefile
index 0b69d4b38f34731714a460778c94a2d870766b90..5d677f95a9c12e90a673d57a9d271f943c605938 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2012-2014 OpenWrt.org
+# Copyright (C) 2012-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -54,6 +54,53 @@ define NANDProfile
   PROFILES_LIST += $(1)
 endef
 
+# $(1): Profile Name
+# $(2): DTB Name
+# $(3): Erase Block Size
+define UBINORProfile
+  define Image/BuildKernel/Profile/$(1)
+       $(call Image/Build/DTB,$(2))
+    ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+       $(call Image/Build/Profile,$(1)/Initramfs)
+    endif
+  endef
+
+  define Image/Build/Profile/$(1)/Initramfs
+       $(call Image/Build/DTB,$(2),-initramfs)
+  endef
+
+  define Image/Build/Profile/$(1)/squashfs
+       $(call Image/Build/UbinizeImage,$(2),,squashfs, -p $(3) -m 1)
+  endef
+
+  PROFILES_LIST += $(1)
+endef
+
+# $(1): Profile Name
+# $(2): DTB Name
+# $(3): Erase Block Size
+define NORProfile
+  define Image/BuildKernel/Profile/$(1)
+       $(call Image/Build/DTB,$(2))
+    ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+       $(call Image/Build/Profile,$(1)/Initramfs)
+    endif
+  endef
+
+  define Image/Build/Profile/$(1)/Initramfs
+       $(call Image/Build/DTB,$(2),-initramfs)
+  endef
+
+  define Image/Build/Profile/$(1)/squashfs
+       ( \
+               dd if=$(KDIR)/uImage-$(2) bs=$(3) conv=sync; \
+               dd if=$(KDIR)/root.squashfs bs=$(3) conv=sync; \
+       ) > $$(BIN_DIR)/$$(IMG_PREFIX)-$(2)-squashfs-firmware.bin
+  endef
+
+  PROFILES_LIST += $(1)
+endef
+
 # $(1): Profile Name
 # $(2): Sub Profiles list
 define MultiProfile
@@ -78,14 +125,22 @@ define MultiProfile
   endef
 endef
 
+# Boards with NAND, without subpages
+$(eval $(call NANDProfile,370-DB,armada-370-db,512KiB,4096))
+$(eval $(call NANDProfile,370-RD,armada-370-rd,512KiB,4096))
+$(eval $(call NANDProfile,385-DB-AP,armada-385-db-ap,256KiB,4096))
+$(eval $(call NANDProfile,Mirabox,armada-370-mirabox,512KiB,4096))
+$(eval $(call NANDProfile,XP-DB,armada-xp-db,512KiB,4096))
+$(eval $(call NANDProfile,XP-GP,armada-xp-gp,512KiB,4096))
+
 # Boards with NAND, with subpages
-$(eval $(call NANDProfile,370-DB,armada-370-db,128KiB,2048,512))
-$(eval $(call NANDProfile,370-RD,armada-370-rd,128KiB,2048,512))
 $(eval $(call NANDProfile,Mamba,armada-xp-mamba,128KiB,2048,512))
-$(eval $(call NANDProfile,Mirabox,armada-370-mirabox,128KiB,2048,512))
-$(eval $(call NANDProfile,OpenBlocks-AX-3-4,armada-xp-openblocks-ax3-4,128KiB,2048,512))
-$(eval $(call NANDProfile,XP-DB,armada-xp-db,128KiB,2048,512))
-$(eval $(call NANDProfile,XP-GP,armada-xp-gp,128KiB,2048,512))
+
+# Boards with large NOR, where we want to use UBI
+$(eval $(call UBINORProfile,OpenBlocks-AX-3-4,armada-xp-openblocks-ax3-4,128KiB))
+
+# Boards with small NOR, where UBI doesn't make sense
+$(eval $(call NORProfile,385-RD,armada-385-rd,256KiB))
 
 define Image/Build/Profile/Mamba/squashfs
        $(call Image/Build/UbinizeImage,armada-xp-mamba,,squashfs, -p 128KiB -m 2048 -s 512)
@@ -96,8 +151,8 @@ define Image/Build/Profile/Mamba/squashfs
        ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-factory.img
 endef
 
-$(eval $(call MultiProfile,Generic,$(PROFILES_LIST)))
-$(eval $(call MultiProfile,Evalboards,$(PROFILES_LIST)))
+# The Default profile should build everything
+$(eval $(call MultiProfile,Default,$(PROFILES_LIST)))
 
 define Image/BuildKernel
        $(call Image/BuildKernel/Profile/$(PROFILE))