This differs slightly from the generic u-boot package to have consistent
naming schemes for file names you can configure through menu in the
generic package.  Also version is not configurable through menu here.

Signed-off-by: Alexander Dahl <[email protected]>
---
 rules/templates/template-u-boot-in   | 221 +++++++++++++++++++++++++
 rules/templates/template-u-boot-make | 233 +++++++++++++++++++++++++++
 scripts/lib/ptxd_lib_template.sh     |  10 ++
 3 files changed, 464 insertions(+)
 create mode 100644 rules/templates/template-u-boot-in
 create mode 100644 rules/templates/template-u-boot-make

diff --git a/rules/templates/template-u-boot-in 
b/rules/templates/template-u-boot-in
new file mode 100644
index 000000000..6b02b412b
--- /dev/null
+++ b/rules/templates/template-u-boot-in
@@ -0,0 +1,221 @@
+## SECTION=bootloader_u_boot
+
+menuconfig U_BOOT_@PACKAGE@
+       bool
+       select BOOTLOADER
+       prompt "U-Boot (@package@)"
+
+if U_BOOT_@PACKAGE@
+
+choice
+       prompt "config system"
+       default U_BOOT_@PACKAGE@_CONFIGSYSTEM_LEGACY
+
+config U_BOOT_@PACKAGE@_CONFIGSYSTEM_KCONFIG
+       prompt "Kconfig"
+       bool
+       help
+         U-Boot from version 2014.10 uses Kconfig for configuring a target.
+         Use this if you want to configure U-Boot inside the BSP, e.g.
+         with menuconfig.
+         
+         Put a file named u-boot-@[email protected] into your platform folder.
+         
+         NOTE: if you just want to use a defconfig, you can still use the
+         legacy config system by using the name of a defconfig file from
+         the "configs" folder as config target.
+
+config U_BOOT_@PACKAGE@_CONFIGSYSTEM_LEGACY
+       prompt "legacy"
+       bool
+       help
+         Select this if you use an old U-Boot prior 2014.10 or want to use
+         a defconfig as config target.
+
+endchoice
+
+if U_BOOT_@PACKAGE@_CONFIGSYSTEM_LEGACY
+
+config U_BOOT_@PACKAGE@_CONFIG
+       prompt "U-Boot config target"
+       string
+       help
+         The U-Boot make config target. Usually something like
+         "yourbox_config". Before U-Boot 2014.10 that was something from
+         the file "boards.cfg". With version 2014.10 U-Boot switched to
+         Kconfig based build and configuration, and from there you could
+         use some defconfig name as config target, e.g.
+         "yourbox_defconfig", where that name is a file from the folder
+         "configs".
+
+endif
+
+config U_BOOT_@PACKAGE@_CUSTOM_MAKE_OPTS
+       prompt "Custom make options"
+       string
+       help
+         List of custom make options passed at build time. Can be
+         used for example to pass a DEVICE_TREE= value.
+
+choice
+       prompt "Generate environment image"
+       default U_BOOT_@PACKAGE@_ENV_IMAGE_NONE
+       help
+         U-Boot from version 2018.03 supports out-of-tree environment
+         image generation.
+
+config U_BOOT_@PACKAGE@_ENV_IMAGE_NONE
+       prompt "none"
+       bool
+       help
+         Don't generate an U-Boot environment image.
+
+config U_BOOT_@PACKAGE@_ENV_IMAGE_DEFAULT
+       prompt "default"
+       bool
+       help
+         Use U-Boot's mkenvimage to compile a default U-Boot environment
+         image for use in e.g. device manufacturing or development.
+
+config U_BOOT_@PACKAGE@_ENV_IMAGE_CUSTOM
+       prompt "custom"
+       bool
+       help
+         Use U-Boot's mkenvimage to compile a custom U-Boot environment
+         image based on the text file u-boot-@package@_custom_env.config
+         for use in e.g. device manufacturing or development.
+
+endchoice
+
+if !U_BOOT_@PACKAGE@_ENV_IMAGE_NONE
+
+config U_BOOT_@PACKAGE@_ENV_IMAGE_SIZE
+       prompt "Environment image size"
+       hex
+       default 0x2000
+       help
+         Enter the U-Boot environment size in hexadecimal for generation
+         of image. A wrong size will typically cause crc error when used.
+         Must match size defined in target config and "/etc/fw_env.config".
+
+config U_BOOT_@PACKAGE@_ENV_IMAGE_REDUNDANT
+       prompt "Environment image with redundant copy"
+       bool
+       help
+         Use to generate a redundant environment in the image.
+         Must match target config and "/etc/fw_env.config".
+
+endif
+
+config U_BOOT_@PACKAGE@_BOOT_SCRIPT
+       prompt "Compile U-Boot boot script"
+       bool
+       help
+         Use U-Boot's mkimage to compile a U-Boot boot script and install it
+         into the rootfs. Put a file named u-boot-@[email protected] in your
+         platform folder.
+
+if U_BOOT_@PACKAGE@_BOOT_SCRIPT
+
+config U_BOOT_@PACKAGE@_BOOT_SCRIPT_ROOTFS_PATH
+       string
+       default "/boot/boot.scr.uimg"
+       prompt "Installation path"
+       help
+         Target rootfs path where the U-Boot script should be located
+
+endif
+
+comment "target install"
+
+config U_BOOT_@PACKAGE@_INSTALL_SREC
+       prompt "install u-boot.srec"
+       bool
+       help
+         Installing the U-Boot srec hexfile into platform image directory.
+
+config U_BOOT_@PACKAGE@_INSTALL_ELF
+       prompt "install u-boot.elf"
+       bool
+       help
+         Installing the U-Boot ELF binary into platform image directory.
+
+config U_BOOT_@PACKAGE@_INSTALL_EFI_APPLICATION
+       prompt "install u-boot-app.efi"
+       bool
+       help
+         Installing the U-Boot EFI application into platform image directory.
+
+config U_BOOT_@PACKAGE@_INSTALL_EFI_PAYLOAD
+       prompt "install u-boot-payload.efi"
+       bool
+       help
+         Installing the U-Boot EFI payload into platform image directory.
+
+config U_BOOT_@PACKAGE@_INSTALL_SPL
+       prompt "install SPL"
+       bool
+       help
+         Installing the U-Boot SPL (Secondary Program Loader) binary into
+         platform image directory.
+
+config U_BOOT_@PACKAGE@_INSTALL_MLO
+       prompt "install MLO"
+       bool
+       depends on !X_LOAD
+       help
+         Installing the U-Boot SPL ("MLO") binary needed for OMAP CPUs into 
platform
+         image directory.
+
+if U_BOOT_@PACKAGE@_INSTALL_MLO || U_BOOT_@PACKAGE@_INSTALL_SPL
+
+config U_BOOT_@PACKAGE@_INSTALL_U_BOOT_IMG
+       prompt "install u-boot.img"
+       bool
+       help
+         Installing the U-Boot image with header ("u-boot.img") which is 
executed
+         by U-Boot SPL into platform image directory.
+
+endif
+
+config U_BOOT_@PACKAGE@_INSTALL_U_BOOT_IMX
+       prompt "install u-boot.imx"
+       bool
+       help
+         Installing the U-Boot image with imx header (u-boot.imx) into 
platform 
+         image directory. Say yes if you are building for freescale i.MX SOCs
+         and are not using SPL.
+
+config U_BOOT_@PACKAGE@_INSTALL_U_BOOT_DTB_IMX
+        prompt "install u-boot-dtb.imx"
+        bool
+        help
+          Installing the U-Boot image with device tree support and imx header 
(u-boot-dtb.imx)
+          into platform image directory. Say yes if you are building for 
freescale i.MX SOCs
+          and are not using SPL.
+
+config U_BOOT_@PACKAGE@_INSTALL_U_BOOT_DTB
+       prompt "install u-boot-dtb.bin"
+       bool
+       help
+         Installing the U-Boot binary concatenated with the device tree
+         into platform image directory.
+
+config U_BOOT_@PACKAGE@_INSTALL_U_BOOT_WITH_SPL_PBL
+       prompt "install u-boot-with-spl-pbl.bin"
+       bool
+       help
+         Installing the U-Boot binary which contains as well the SPL and PBL.
+         Say yes if you are building for Layerscape SoCs
+
+config U_BOOT_@PACKAGE@_INSTALL_U_BOOT_STM32
+       prompt "install u-boot.stm32"
+       bool
+       help
+         Installing the U-Boot image with stm32 header (u-boot.stm32) into
+         platform image directory. Say yes if you are building for STM32MP1
+         SOCs.
+
+endif
+
+# vim: ft=kconfig noet tw=72 ts=8 sw=8
diff --git a/rules/templates/template-u-boot-make 
b/rules/templates/template-u-boot-make
new file mode 100644
index 000000000..343eea9c0
--- /dev/null
+++ b/rules/templates/template-u-boot-make
@@ -0,0 +1,233 @@
+# -*-makefile-*-
+#
+# Copyright (C) @YEAR@ by @AUTHOR@
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_U_BOOT_@PACKAGE@) += u-boot-@package@
+
+#
+# Paths and names
+#
+U_BOOT_@PACKAGE@_VERSION       := @VERSION@
+U_BOOT_@PACKAGE@_MD5           := 
+U_BOOT_@PACKAGE@               := u-boot-@package@-$(U_BOOT_@PACKAGE@_VERSION)
+U_BOOT_@PACKAGE@_SUFFIX                := tar.bz2
+U_BOOT_@PACKAGE@_URL           := $(call u-boot-url, U_BOOT_@PACKAGE@)
+U_BOOT_@PACKAGE@_PATCHES       := u-boot-$(U_BOOT_@PACKAGE@_VERSION)
+U_BOOT_@PACKAGE@_SOURCE                := 
$(SRCDIR)/$(U_BOOT_@PACKAGE@_PATCHES).$(U_BOOT_SUFFIX)
+U_BOOT_@PACKAGE@_DIR           := $(BUILDDIR)/$(U_BOOT_@PACKAGE@)
+U_BOOT_@PACKAGE@_BUILD_DIR     := $(U_BOOT_@PACKAGE@_DIR)-build
+U_BOOT_@PACKAGE@_DEVPKG                := NO
+U_BOOT_@PACKAGE@_BUILD_OOT     := KEEP
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_CONFIGSYSTEM_KCONFIG
+U_BOOT_@PACKAGE@_CONFIG                := $(call ptx/in-platformconfigdir, 
u-boot-@[email protected])
+endif
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_BOOT_SCRIPT
+U_BOOT_@PACKAGE@_BOOT_SCRIPT_TXT := $(call ptx/in-platformconfigdir, \
+       u-boot-@[email protected])
+U_BOOT_@PACKAGE@_BOOT_SCRIPT_BIN := $(call remove_quotes, \
+       $(PTXCONF_U_BOOT_@PACKAGE@_BOOT_SCRIPT_ROOTFS_PATH))
+$(call ptx/cfghash-file, U_BOOT_@PACKAGE@, $(U_BOOT_@PACKAGE@_BOOT_SCRIPT_TXT))
+endif
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_CUSTOM
+U_BOOT_@PACKAGE@_ENV_IMAGE_CUSTOM_SRC := $(call ptx/in-platformconfigdir, \
+       u-boot-@package@_custom_env.config)
+$(call ptx/cfghash-file, U_BOOT_@PACKAGE@, 
$(U_BOOT_@PACKAGE@_ENV_IMAGE_CUSTOM_SRC))
+endif
+
+U_BOOT_@PACKAGE@_WRAPPER_BLACKLIST := \
+       $(PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST)
+
+U_BOOT_@PACKAGE@_CONF_OPT      := \
+       -C $(U_BOOT_@PACKAGE@_DIR) \
+       O=$(U_BOOT_@PACKAGE@_BUILD_DIR) \
+       V=$(PTXDIST_VERBOSE) \
+       $(call remove_quotes,$(PTXCONF_U_BOOT_@PACKAGE@_CUSTOM_MAKE_OPTS))
+
+U_BOOT_@PACKAGE@_MAKE_ENV      := \
+       CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) \
+       HOSTCC=$(HOSTCC)
+U_BOOT_@PACKAGE@_MAKE_OPT      := $(U_BOOT_@PACKAGE@_CONF_OPT)
+
+U_BOOT_@PACKAGE@_TAGS_OPT      := ctags cscope etags
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_CONFIGSYSTEM_KCONFIG
+U_BOOT_@PACKAGE@_CONF_TOOL     := kconfig
+U_BOOT_@PACKAGE@_CONF_ENV      := $(U_BOOT_@PACKAGE@_MAKE_ENV)
+endif
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_CONFIGSYSTEM_LEGACY
+U_BOOT_@PACKAGE@_CONF_ENV      := PATH=$(CROSS_PATH) 
$(U_BOOT_@PACKAGE@_MAKE_ENV)
+U_BOOT_@PACKAGE@_CONF_OPT      += $(call remove_quotes, 
$(PTXCONF_U_BOOT_@PACKAGE@_CONFIG))
+U_BOOT_@PACKAGE@_MAKE_PAR      := NO
+endif
+
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@
+$(U_BOOT_@PACKAGE@_CONFIG):
+       @echo
+       @echo 
"***************************************************************************************"
+       @echo "***** Please generate an u-boot config with 'ptxdist menuconfig 
u-boot-@package@' *****"
+       @echo 
"***************************************************************************************"
+       @echo
+       @echo
+       @exit 1
+endif
+
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_CONFIGSYSTEM_LEGACY
+$(STATEDIR)/u-boot-@[email protected]:
+       @$(call targetinfo)
+       $(U_BOOT_@PACKAGE@_CONF_ENV) $(MAKE) $(U_BOOT_@PACKAGE@_CONF_OPT)
+       @$(call touch)
+endif
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot-@[email protected]:
+       @$(call targetinfo)
+       @$(call world/compile, U_BOOT_@PACKAGE@)
+ifdef PTXCONF_U_BOOT_@PACKAGE@_BOOT_SCRIPT
+       @$(U_BOOT_@PACKAGE@_BUILD_DIR)/tools/mkimage -T script -C none \
+               -d $(U_BOOT_@PACKAGE@_BOOT_SCRIPT_TXT) \
+               $(U_BOOT_@PACKAGE@_BUILD_DIR)/boot.scr.uimg
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_DEFAULT
+       $(U_BOOT_@PACKAGE@_MAKE_ENV) 
$(U_BOOT_@PACKAGE@_DIR)/scripts/get_default_envs.sh 
$(U_BOOT_@PACKAGE@_BUILD_DIR) | \
+               $(U_BOOT_@PACKAGE@_BUILD_DIR)/tools/mkenvimage \
+               $(call 
ptx/ifdef,PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_REDUNDANT,-r,) \
+               -s $(PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_SIZE) \
+               -o $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-env.img -
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_CUSTOM
+       $(U_BOOT_@PACKAGE@_BUILD_DIR)/tools/mkenvimage \
+               $(call 
ptx/ifdef,PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_REDUNDANT,-r,) \
+               -s $(PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_SIZE) \
+               -o $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-env.img \
+               $(U_BOOT_@PACKAGE@_ENV_IMAGE_CUSTOM_SRC)
+endif
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot-@[email protected]:
+       @$(call targetinfo)
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot-@[email protected]:
+       @$(call targetinfo)
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.bin \
+               $(IMAGEDIR)/u-boot-@[email protected]
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_SREC
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.srec \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_ELF
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_EFI_APPLICATION
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-app.efi \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_EFI_PAYLOAD
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-payload.efi \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_SPL
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/SPL $(IMAGEDIR)/SPL
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_MLO
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/MLO $(IMAGEDIR)/MLO
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_U_BOOT_IMG
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.img \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_U_BOOT_IMX
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.imx \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_U_BOOT_DTB_IMX
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-dtb.imx \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_U_BOOT_DTB
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-dtb.bin \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_U_BOOT_WITH_SPL_PBL
+       @install -v -D -m644 
$(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-with-spl-pbl.bin \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_U_BOOT_STM32
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.stm32 \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+ifndef PTXCONF_U_BOOT_@PACKAGE@_ENV_IMAGE_NONE
+       @install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot-env.img \
+               $(IMAGEDIR)/u-boot-@[email protected]
+endif
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_BOOT_SCRIPT
+       @$(call install_init, u-boot-@package@)
+       @$(call install_fixup, u-boot-@package@, PRIORITY, optional)
+       @$(call install_fixup, u-boot-@package@, SECTION, base)
+       @$(call install_fixup, u-boot-@package@, AUTHOR, "Alexander Dahl 
<[email protected]>")
+       @$(call install_fixup, u-boot-@package@, DESCRIPTION, "U-Boot boot 
script")
+
+       @$(call install_copy, u-boot-@package@, 0, 0, 0644, \
+               $(U_BOOT_@PACKAGE@_BUILD_DIR)/boot.scr.uimg, \
+               $(U_BOOT_@PACKAGE@_BOOT_SCRIPT_BIN))
+
+       @$(call install_finish, u-boot-@package@)
+endif
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot-@[email protected]:
+       @$(call targetinfo)
+       @$(call clean_pkg, U_BOOT_@PACKAGE@)
+       @rm -vf $(IMAGEDIR)/u-boot-@[email protected] \
+               $(IMAGEDIR)/u-boot-@[email protected] \
+               $(IMAGEDIR)/u-boot-@[email protected]
+       @rm -vf $(IMAGEDIR)/u-boot-@[email protected] $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
+       @rm -vf $(IMAGEDIR)/u-boot-@[email protected] \
+               $(IMAGEDIR)/u-boot-@[email protected]
+       @rm -vf $(IMAGEDIR)/u-boot-@[email protected]
+       @rm -vf $(IMAGEDIR)/u-boot-@[email protected] \
+               $(IMAGEDIR)/u-boot-@[email protected]
+       @rm -vf $(IMAGEDIR)/u-boot-@[email protected]
+
+# ----------------------------------------------------------------------------
+# oldconfig / menuconfig
+# ----------------------------------------------------------------------------
+
+u-boot-@package@_oldconfig u-boot-@package@_menuconfig 
u-boot-@package@_nconfig: $(STATEDIR)/u-boot-@[email protected]
+       @$(call world/kconfig, U_BOOT_@PACKAGE@, $(subst u-boot-@package@_,,$@))
+
+# vim: ft=make noet ts=8 sw=8
diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
index ecc2d9a19..db50beb3f 100644
--- a/scripts/lib/ptxd_lib_template.sh
+++ b/scripts/lib/ptxd_lib_template.sh
@@ -624,3 +624,13 @@ ptxd_template_new_code_signing_provider() {
 export -f ptxd_template_new_code_signing_provider
 ptxd_template_help_list[${#ptxd_template_help_list[@]}]="code-signing-provider"
 ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create package for a 
code signing provider"
+
+ptxd_template_new_u_boot() {
+    export class="u-boot-"
+    ptxd_template_read_basic &&
+    ptxd_template_read_author &&
+    ptxd_template_write_platform_rules
+}
+export -f ptxd_template_new_u_boot
+ptxd_template_help_list[${#ptxd_template_help_list[@]}]="u-boot"
+ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create package for an 
extra u-boot"
-- 
2.30.2


_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to 
[email protected]

Reply via email to