[Buildroot] [PATCH 2/2] u-boot: Add support for Altera mkpimage generation

Lionel Flandrin lionel at svkt.org
Mon Jan 30 10:33:26 UTC 2017


This image format is used by Altera's SoC FPGAs BootROMs.

Signed-off-by: Lionel Flandrin <lionel at svkt.org>
---
 boot/uboot/Config.in | 30 ++++++++++++++++++++++++++++++
 boot/uboot/uboot.mk  | 12 ++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 4e629c0ef..30db8d8b4 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -255,6 +255,36 @@ config BR2_TARGET_UBOOT_FORMAT_NAND_ERASE_SIZE
 
 endif
 
+config BR2_TARGET_UBOOT_FORMAT_MKPIMAGE
+       bool "u-boot-dtb.mkpimage (Altera SoC BootROMs)"
+       help
+          Altera's mkpimage format used on their SoCs.
+
+if BR2_TARGET_UBOOT_FORMAT_MKPIMAGE
+
+choice
+       prompt "mkpimage header"
+       default BR2_TARGET_UBOOT_FORMAT_MKPIMAGE_V1
+       help
+         Select the header format for mkpimage
+
+config BR2_TARGET_UBOOT_FORMAT_MKPIMAGE_V0
+       bool "Arria/Cyclone V (v0)"
+       help
+         Header version 1, used by the Arria V and Cyclone V SoCs
+
+config BR2_TARGET_UBOOT_FORMAT_MKPIMAGE_V1
+       bool "Arria 10 (v1)"
+       help
+         Header version 1, used by the Arria10 SoC
+endchoice
+
+config BR2_TARGET_UBOOT_FORMAT_MKPIMAGE_VERSION
+       int
+       default 0 if BR2_TARGET_UBOOT_FORMAT_MKPIMAGE_V0
+       default 1 if BR2_TARGET_UBOOT_FORMAT_MKPIMAGE_V1
+endif
+
 config BR2_TARGET_UBOOT_FORMAT_CUSTOM
 	bool "Custom (specify below)"
 	help
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 6b9d54454..7637349fa 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -104,6 +104,18 @@ UBOOT_MAKE_TARGET += u-boot.sb
 UBOOT_DEPENDENCIES += host-elftosb host-openssl
 endif
 
+ifeq ($(BR2_TARGET_UBOOT_FORMAT_MKPIMAGE),y)
+define UBOOT_ALTERA_MKPIMAGE
+       $(HOST_DIR)/usr/bin/mkpimage \
+               -v $(BR2_TARGET_UBOOT_FORMAT_MKPIMAGE_VERSION) \
+               -o $(BINARIES_DIR)/u-boot-dtb.mkpimage \
+               $(@D)/u-boot-dtb.bin
+endef
+UBOOT_MAKE_TARGET += u-boot-dtb.bin
+UBOOT_DEPENDENCIES += host-mkpimage
+UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_ALTERA_MKPIMAGE
+endif
+
 ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
 UBOOT_BINS += $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
 endif
-- 
2.11.0




More information about the buildroot mailing list