vexpress: Tidy up config so it's clearer and more maintainable

Give the three active projects using the vexpress device their own
cleanly separated sections in BoardConfig.mk and refactor bootloader.mk
so the MP and IKS projects can build the bootloaders they require.

Change-Id: Ib61f68460b2a6b8273168ec82516b8fe99931354
Signed-off-by: Jon Medhurst <tixy@linaro.org>
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 293d2eb..ff62461 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -7,50 +7,9 @@
 TARGET_NO_BOOTLOADER := true # We use our own methods for building bootloaders
 TARGET_NO_KERNEL := false
 TARGET_HWPACK_CONFIG := device/linaro/vexpress/config
-ifeq ($(strip $(ANDROID_64)),true)
-KERNEL_TOOLS_PREFIX := aarch64-linux-android-
-KERNEL_CONFIG := vexpress-android_defconfig
-TARGET_USE_UBOOT := false
-CUSTOM_BOOTLOADER_MAKEFILE := device/linaro/vexpress/bootloader64.mk
-else
-#
-# Build IKS kernel depending on config.
-#
-ifneq ($(strip $(BUILD_IKS)),true)
-KERNEL_CONFIG := linaro/configs/linaro-base.conf \
-                 linaro/configs/android.conf \
-                 linaro/configs/big-LITTLE-MP.conf \
-                 linaro/configs/vexpress.conf
-ifeq ($(wildcard $(TOP)/boot-wrapper/bootwrapper.mk),)
-TARGET_USE_UBOOT := false
-UBOOT_CONFIG := vexpress_ca9x4_config
-UBOOT_FLAVOURS := vexpress_ca9x4:u-boot_v2p-ca9.bin vexpress_ca5x2:u-boot_v2p-ca5s.bin vexpress_ca15x2:u-boot_v2p-ca15-tc1.bin
-DEVICE_TREES := vexpress-v2p-ca5s:v2p-ca5s.dtb vexpress-v2p-ca9:v2p-ca9.dtb vexpress-v2p-ca15-tc1:v2p-ca15-tc1.dtb vexpress-v2p-ca15-tc2:v2p-ca15-tc2.dtb \
-		rtsm_ve-cortex_a9x2:rtsm/rtsm_ve-ca9x2.dtb \
-		rtsm_ve-cortex_a9x4:rtsm/rtsm_ve-ca9x4.dtb \
-		rtsm_ve-cortex_a15x1:rtsm/rtsm_ve-ca15x1.dtb \
-		rtsm_ve-cortex_a15x2:rtsm/rtsm_ve-ca15x2.dtb \
-		rtsm_ve-cortex_a15x4:rtsm/rtsm_ve-ca15x4.dtb \
-		rtsm_ve-v2p-ca15x1-ca7x1:rtsm/rtsm_ve-ca15x1-ca7x1.dtb \
-		rtsm_ve-v2p-ca15x4-ca7x4:rtsm/rtsm_ve-ca15x4-ca7x4.dtb
-CUSTOM_BOOTLOADER_MAKEFILE := device/linaro/vexpress/bootloader.mk
-INCLUDE_PERF := 0
-else
-TARGET_USE_UBOOT := false
-DEVICE_TREES := rtsm_ve-v2p-ca15x1-ca7x1:rtsm/rtsm_ve-ca15x1-ca7x1.dtb \
-		rtsm_ve-v2p-ca15x4-ca7x4:rtsm/rtsm_ve-ca15x4-ca7x4.dtb
-CUSTOM_BOOTLOADER_MAKEFILE := boot-wrapper/bootwrapper.mk
-endif
-else
-ifeq ($(KERNEL_CONFIG),)
-KERNEL_CONFIG := vexpress_bL_defconfig
-endif
-TARGET_USE_UBOOT := true
-UBOOT_CONFIG := vexpress_ca5x2
-DEVICE_TREES := vexpress-v2p-ca15-tc2:v2p-ca15-tc2.dtb
-endif
-endif
+
 TARGET_USE_XLOADER := false
+TARGET_USE_UBOOT := false
 TARGET_NO_RECOVERY := true
 TARGET_NO_RADIOIMAGE := true
 BOARD_USES_GENERIC_AUDIO := false
@@ -73,23 +32,60 @@
 TARGET_USERIMAGES_USE_EXT4 := true
 TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
 
-# bootargs
-BOARD_KERNEL_CMDLINE := mmci.fmax=4000000
-
-# Dual-Core Cortex A9
 TARGET_CPU_SMP := true
-#TARGET_EXTRA_CFLAGS += -mtune=cortex-a9 -mcpu=cortex-a9
 
 # ARMs gator (DS-5)
 TARGET_USE_GATOR:= true
 
+
 ifeq ($(strip $(ANDROID_64)),true)
-TARGET_BOOTLOADER_TYPE := none
-else
-ifeq ($(wildcard $(TOP)/boot-wrapper/bootwrapper.mk),)
-TARGET_BOOTLOADER_TYPE := none
+#
+# Juice
+#
+KERNEL_TOOLS_PREFIX := aarch64-linux-android-
+KERNEL_CONFIG := vexpress-android_defconfig
+CUSTOM_BOOTLOADER_MAKEFILE := device/linaro/vexpress/bootloader64.mk
+
+else ifeq ($(strip $(BUILD_IKS)),true)
+#
+# IKS
+#
+ifeq ($(KERNEL_CONFIG),)
+KERNEL_CONFIG := vexpress_bL_defconfig
+endif
+DEVICE_TREES := vexpress-v2p-ca15-tc2:v2p-ca15-tc2.dtb
+UBOOT_FLAVOURS := vexpress_ca5x2:u-boot.bin
+CUSTOM_BOOTLOADER_MAKEFILE := device/linaro/vexpress/bootloader-uboot-files.mk
 INSTALLED_KERNEL_TARGET_NAME := zImage
 INSTALLED_RAMDISK_TARGET_NAME := initrd
-MAKE_UIMAGE_AND_UINITRD := true # For compatibility during transition to zImage
+
+else
+#
+# MP
+#
+KERNEL_CONFIG := linaro/configs/linaro-base.conf \
+                 linaro/configs/android.conf \
+                 linaro/configs/big-LITTLE-MP.conf \
+                 linaro/configs/vexpress.conf
+DEVICE_TREES := vexpress-v2p-ca5s:v2p-ca5s.dtb \
+		vexpress-v2p-ca9:v2p-ca9.dtb \
+		vexpress-v2p-ca15-tc1:v2p-ca15-tc1.dtb \
+		vexpress-v2p-ca15-tc2:v2p-ca15-tc2.dtb \
+		rtsm_ve-cortex_a9x2:rtsm/rtsm_ve-ca9x2.dtb \
+		rtsm_ve-cortex_a9x4:rtsm/rtsm_ve-ca9x4.dtb \
+		rtsm_ve-cortex_a15x1:rtsm/rtsm_ve-ca15x1.dtb \
+		rtsm_ve-cortex_a15x2:rtsm/rtsm_ve-ca15x2.dtb \
+		rtsm_ve-cortex_a15x4:rtsm/rtsm_ve-ca15x4.dtb \
+		rtsm_ve-v2p-ca15x1-ca7x1:rtsm/rtsm_ve-ca15x1-ca7x1.dtb \
+		rtsm_ve-v2p-ca15x4-ca7x4:rtsm/rtsm_ve-ca15x4-ca7x4.dtb
+UBOOT_FLAVOURS := vexpress_ca9x4:u-boot_v2p-ca9.bin \
+		  vexpress_ca5x2:u-boot_v2p-ca5s.bin \
+		  vexpress_ca15x2:u-boot_v2p-ca15-tc1.bin
+CUSTOM_BOOTLOADER_MAKEFILE := device/linaro/vexpress/bootloader.mk
+INSTALLED_KERNEL_TARGET_NAME := zImage
+INSTALLED_RAMDISK_TARGET_NAME := initrd
+INCLUDE_PERF := 0
+
 endif
-endif
+
+
diff --git a/bootloader-uboot-files.mk b/bootloader-uboot-files.mk
new file mode 100644
index 0000000..f9aa504
--- /dev/null
+++ b/bootloader-uboot-files.mk
@@ -0,0 +1,14 @@
+#
+# Temporary (hopefully) ability to build uImage and uInitrd for
+# compatibility purposes during transition to zImage...
+#
+$(BOOTLOADER_OUT)/uImage : $(INSTALLED_KERNEL_TARGET)
+	$(eval UIMAGE_LOADADDR ?= 0x60008000)
+	mkimage -A arm -O linux -T kernel -n "Android Kernel" -C none -a $(UIMAGE_LOADADDR) -e $(UIMAGE_LOADADDR) -d $< $@
+
+BOOTLOADER_TARGETS += $(BOOTLOADER_OUT)/uImage
+
+$(BOOTLOADER_OUT)/uInitrd : $(INSTALLED_RAMDISK_TARGET)
+	mkimage -A arm -O linux -T ramdisk -n "Android Ramdisk Image" -d $< $@
+
+BOOTLOADER_TARGETS += $(BOOTLOADER_OUT)/uInitrd
diff --git a/bootloader.mk b/bootloader.mk
index cf74d0c..d78c423 100644
--- a/bootloader.mk
+++ b/bootloader.mk
@@ -15,23 +15,4 @@
 BOOTLOADER_TARGETS += $(BOOTLOADER_OUT)/rtsm/linux-system-semi.axf
 
 
-#
-# Temporary (hopefully) ability to build uImage and uInitrd for
-# compatibility purposes during transition to zImage...
-#
-ifneq ($(strip $(TARGET_BOOTLOADER_TYPE)),uboot)
-ifeq ($(strip $(MAKE_UIMAGE_AND_UINITRD)),true)
-
-$(BOOTLOADER_OUT)/uImage : $(INSTALLED_KERNEL_TARGET)
-	$(eval UIMAGE_LOADADDR ?= 0x60008000)
-	mkimage -A arm -O linux -T kernel -n "Android Kernel" -C none -a $(UIMAGE_LOADADDR) -e $(UIMAGE_LOADADDR) -d $< $@
-
-BOOTLOADER_TARGETS += $(BOOTLOADER_OUT)/uImage
-
-$(BOOTLOADER_OUT)/uInitrd : $(INSTALLED_RAMDISK_TARGET)
-	mkimage -A arm -O linux -T ramdisk -n "Android Ramdisk Image" -d $< $@
-
-BOOTLOADER_TARGETS += $(BOOTLOADER_OUT)/uInitrd
-
-endif
-endif
\ No newline at end of file
+include $(call my-dir)/bootloader-uboot-files.mk