[OpenWrt-Devel,RFC,4/5] target: mvebu: Add a generic board
diff mbox

Message ID 1418397665-28828-5-git-send-email-maxime.ripard@free-electrons.com
State RFC
Headers show

Commit Message

Maxime Ripard Dec. 12, 2014, 3:21 p.m. UTC
Create a generic board relying on the board mechanism we just introduced.

So far, the behaviour hasn't really changed, the same boards are supported,
with the same options.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 target/linux/mvebu/boards/generic.mk | 18 ++++++++++++++++++
 target/linux/mvebu/image/Makefile    | 32 +++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 11 deletions(-)
 create mode 100644 target/linux/mvebu/boards/generic.mk

Patch
diff mbox

diff --git a/target/linux/mvebu/boards/generic.mk b/target/linux/mvebu/boards/generic.mk
new file mode 100644
index 000000000000..e4ac20ecf473
--- /dev/null
+++ b/target/linux/mvebu/boards/generic.mk
@@ -0,0 +1,18 @@ 
+#
+# Copyright (C) 2014 Maxime Ripard
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+GENERIC_UBI_OPTS = -m 2048 -p 128KiB -s 512 -O 2048
+GENERIC_DTB = \
+	armada-370-db \
+	armada-370-mirabox \
+	armada-370-rd \
+	armada-xp-db \
+	armada-xp-gp \
+	armada-xp-mamba \
+	armada-xp-openblocks-ax3-4
+
+$(eval $(call Board,GENERIC))
diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile
index 0de7328515ca..d419d639cdf2 100644
--- a/target/linux/mvebu/image/Makefile
+++ b/target/linux/mvebu/image/Makefile
@@ -7,19 +7,12 @@ 
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
-TARGET_DTBS := armada-xp-db armada-370-db armada-xp-openblocks-ax3-4 armada-370-mirabox \
-		armada-370-rd armada-xp-gp armada-xp-mamba
-
 LOADADDR:=0x00008000
 
 JFFS2_BLOCKSIZE = 128k
 
-UBIFS_OPTS = -F -m 2048 -e 124KiB -c 4096 -U
-UBI_OPTS = -m 2048 -p 128KiB -s 512 -O 2048
-
 KDIR_TMP:=$(KDIR)/tmp
 
-
 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
 
 define Image/Build/MkuImage
@@ -35,7 +28,11 @@  define Image/Build/DTB
 endef
 
 define Image/BuildKernel
-	$(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
+	$(foreach board, \
+		$(TARGET_BOARDS), \
+		$(foreach dtb, \
+			$($(board)_DTB), \
+			$(call Image/Build/DTB,$(dtb))))
  ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 	$(call Image/Build/Initramfs)
  endif
@@ -43,7 +40,12 @@  endef
 
 define Image/Build/squashfs
 	$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
-	$(foreach dtb,$(TARGET_DTBS),$(call Image/Build/UbinizeImage,$(dtb),,squashfs,$(UBI_OPTS));)
+	$(foreach board, \
+		$(TARGET_BOARDS), \
+		$(foreach dtb, \
+			$($(board)_DTB), \
+			$(call Image/Build/UbinizeImage,$(dtb),,squashfs, \
+				$($(board)_UBI_OPTS));))
 	( \
 		dd if=$(KDIR)/uImage-armada-xp-mamba bs=3072k conv=sync; \
 		dd if=$(BIN_DIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-ubinized.bin \
@@ -52,7 +54,11 @@  define Image/Build/squashfs
 endef
 
 define Image/Build/Initramfs
-	$(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
+	$(foreach board, \
+		$(TARGET_BOARDS), \
+		$(foreach dtb, \
+			$($(board)_DTB), \
+			$(call Image/Build/DTB,$(dtb),-initramfs)))
 endef
 
 define BuildSysupgrade
@@ -62,7 +68,11 @@  endef
 define Image/Build
 	$(call Image/Build/$(1))
 	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
-	$(foreach dtb,$(TARGET_DTBS),$(call BuildSysupgrade,$(1),$(dtb));)
+	$(foreach board, \
+		$(TARGET_BOARDS), \
+		$(foreach dtb, \
+			$($(board)_DTB), \
+			$(call BuildSysupgrade,$(1),$(dtb));))
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 	$(call Image/Build/Initramfs)
 endif