mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 0/2] Add u-boot template
@ 2021-08-26  8:48 Alexander Dahl
  2021-08-26  8:48 ` [ptxdist] [PATCH 1/2] u-boot: Introduce make macro for URL Alexander Dahl
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexander Dahl @ 2021-08-26  8:48 UTC (permalink / raw)
  To: ptxdist

Hei hei,

I crafted this in the last weeks for a DistroKit based generic BSP,
which uses U-Boot for half a dozen boards.  Maybe someone else finds it
useful?

I also have another template for at91bootstrap3, but maybe that's a
little to special?

Greets
Alex

Alexander Dahl (2):
  u-boot: Introduce make macro for URL
  templates: Introduce new u-boot template

 rules/pre/u-boot.make                |  15 ++
 rules/templates/template-u-boot-in   | 221 +++++++++++++++++++++++++
 rules/templates/template-u-boot-make | 233 +++++++++++++++++++++++++++
 rules/u-boot.make                    |   2 +-
 scripts/lib/ptxd_lib_template.sh     |  10 ++
 5 files changed, 480 insertions(+), 1 deletion(-)
 create mode 100644 rules/pre/u-boot.make
 create mode 100644 rules/templates/template-u-boot-in
 create mode 100644 rules/templates/template-u-boot-make


base-commit: 76d1f680233955839298435e9faf11f15434b4a4
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH 1/2] u-boot: Introduce make macro for URL
  2021-08-26  8:48 [ptxdist] [PATCH 0/2] Add u-boot template Alexander Dahl
@ 2021-08-26  8:48 ` Alexander Dahl
  2021-08-26  8:48 ` [ptxdist] [PATCH 2/2] templates: Introduce new u-boot template Alexander Dahl
       [not found] ` <CABDcavZJN7-BmEKPi5s_r=J-vi=_5=-RHofjbsVgNmuBz5QPQg@mail.gmail.com>
  2 siblings, 0 replies; 6+ messages in thread
From: Alexander Dahl @ 2021-08-26  8:48 UTC (permalink / raw)
  To: ptxdist

This can be used in additional u-boot packages as well.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 rules/pre/u-boot.make | 15 +++++++++++++++
 rules/u-boot.make     |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 rules/pre/u-boot.make

diff --git a/rules/pre/u-boot.make b/rules/pre/u-boot.make
new file mode 100644
index 000000000..291a7764e
--- /dev/null
+++ b/rules/pre/u-boot.make
@@ -0,0 +1,15 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Alexander Dahl <ada@thorsis.com>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+u-boot/url = \
+	https://ftp.denx.de/pub/u-boot/u-boot-$($(1)_VERSION).$($(1)_SUFFIX)
+
+u-boot-url = \
+	$(call u-boot/url,$(strip $(1)))
+
+# vim: ft=make noet ts=8 sw=8
diff --git a/rules/u-boot.make b/rules/u-boot.make
index 38c32bf27..d9a7ece3b 100644
--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -20,7 +20,7 @@ U_BOOT_VERSION		:= $(call ptx/config-version, PTXCONF_U_BOOT)
 U_BOOT_MD5		:= $(call ptx/config-md5, PTXCONF_U_BOOT)
 U_BOOT			:= u-boot-$(U_BOOT_VERSION)
 U_BOOT_SUFFIX		:= tar.bz2
-U_BOOT_URL		:= https://ftp.denx.de/pub/u-boot/$(U_BOOT).$(U_BOOT_SUFFIX)
+U_BOOT_URL		:= $(call u-boot-url, U_BOOT)
 U_BOOT_SOURCE		:= $(SRCDIR)/$(U_BOOT).$(U_BOOT_SUFFIX)
 U_BOOT_DIR		:= $(BUILDDIR)/$(U_BOOT)
 U_BOOT_BUILD_DIR	:= $(U_BOOT_DIR)-build
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH 2/2] templates: Introduce new u-boot template
  2021-08-26  8:48 [ptxdist] [PATCH 0/2] Add u-boot template Alexander Dahl
  2021-08-26  8:48 ` [ptxdist] [PATCH 1/2] u-boot: Introduce make macro for URL Alexander Dahl
@ 2021-08-26  8:48 ` Alexander Dahl
  2021-09-03 15:23   ` Michael Olbrich
       [not found] ` <CABDcavZJN7-BmEKPi5s_r=J-vi=_5=-RHofjbsVgNmuBz5QPQg@mail.gmail.com>
  2 siblings, 1 reply; 6+ messages in thread
From: Alexander Dahl @ 2021-08-26  8:48 UTC (permalink / raw)
  To: ptxdist

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 <ada@thorsis.com>
---
 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-@package@.config 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-@package@.scr 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-@package@.config)
+endif
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+ifdef PTXCONF_U_BOOT_@PACKAGE@_BOOT_SCRIPT
+U_BOOT_@PACKAGE@_BOOT_SCRIPT_TXT := $(call ptx/in-platformconfigdir, \
+	u-boot-@package@.scr)
+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-@package@.prepare:
+	@$(call targetinfo)
+	$(U_BOOT_@PACKAGE@_CONF_ENV) $(MAKE) $(U_BOOT_@PACKAGE@_CONF_OPT)
+	@$(call touch)
+endif
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot-@package@.compile:
+	@$(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-@package@.install:
+	@$(call targetinfo)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot-@package@.targetinstall:
+	@$(call targetinfo)
+	@install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.bin \
+		$(IMAGEDIR)/u-boot-@package@.bin
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_SREC
+	@install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.srec \
+		$(IMAGEDIR)/u-boot-@package@.srec
+endif
+ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_ELF
+	@install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot \
+		$(IMAGEDIR)/u-boot-@package@.elf
+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-@package@-app.efi
+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-@package@-payload.efi
+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-@package@.img
+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-@package@.imx
+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-@package@-dtb.imx
+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-@package@-dtb.bin
+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-@package@-with-spl-pbl.bin
+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-@package@.stm32
+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-@package@-env.img
+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 <ada@thorsis.com>")
+	@$(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-@package@.clean:
+	@$(call targetinfo)
+	@$(call clean_pkg, U_BOOT_@PACKAGE@)
+	@rm -vf $(IMAGEDIR)/u-boot-@package@.bin \
+		$(IMAGEDIR)/u-boot-@package@.srec \
+		$(IMAGEDIR)/u-boot-@package@.elf
+	@rm -vf $(IMAGEDIR)/u-boot-@package@.img $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
+	@rm -vf $(IMAGEDIR)/u-boot-@package@.imx \
+		$(IMAGEDIR)/u-boot-@package@-dtb.imx
+	@rm -vf $(IMAGEDIR)/u-boot-@package@-env.img
+	@rm -vf	$(IMAGEDIR)/u-boot-@package@-dtb.bin \
+		$(IMAGEDIR)/u-boot-@package@-with-spl-pbl.bin
+	@rm -vf $(IMAGEDIR)/u-boot-@package@.stm32
+
+# ----------------------------------------------------------------------------
+# oldconfig / menuconfig
+# ----------------------------------------------------------------------------
+
+u-boot-@package@_oldconfig u-boot-@package@_menuconfig u-boot-@package@_nconfig: $(STATEDIR)/u-boot-@package@.extract
+	@$(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
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH 0/2] Add u-boot template
       [not found] ` <CABDcavZJN7-BmEKPi5s_r=J-vi=_5=-RHofjbsVgNmuBz5QPQg@mail.gmail.com>
@ 2021-08-26 12:25   ` Alexander Dahl
       [not found]     ` <CABDcavbtnikGhiNaJXk1AxBiTgwe_YsuHHEUVu-_3YnyyhT53A@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Dahl @ 2021-08-26 12:25 UTC (permalink / raw)
  To: ptxdist; +Cc: Guillermo Rodriguez Garcia

Hello Guillermo,

Am Thu, Aug 26, 2021 at 01:43:25PM +0200 schrieb Guillermo Rodriguez Garcia:
> Hi Alexander,
> 
> El jueves, 26 de agosto de 2021, Alexander Dahl <ada@thorsis.com> escribió:
> 
> > Hei hei,
> >
> > I crafted this in the last weeks for a DistroKit based generic BSP,
> > which uses U-Boot for half a dozen boards.  Maybe someone else finds it
> > useful?
> 
> 
> What does this do exactly, and how does it work?

This adds a new package type 'u-boot' to the `ptxdist newpackage`
command.  That newpackage command uses templates to create the
necessary rule files for a new package.  You can write your own
templates and add it to your BSP, too.

So why a package type 'u-boot' if there's already an u-boot package?
I had the idea when working with DistroKit [1] as a base layer for
another generic BSP.  You can build a BSP with a rootfs common to
different SoCs of the armv7 family and use a common kernel as well.
However bootloaders for different SoC families differ, so for such a
generic BSP you need to build different bootloaders, and what you do
then is duplicate those bootloaders packages in ptxdist with slighty
changed names/variables making them unique.  DistroKit for example has
multiple barebox packages.

Creating such packages by copy and paste and search and replace is
cumbersome and error prone, so I thought why not doing the same thing
pengutronix did with barebox for u-boot as well?!

Greets
Alex

[1] https://www.pengutronix.de/de/software/distrokit.html


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH 0/2] Add u-boot template
       [not found]     ` <CABDcavbtnikGhiNaJXk1AxBiTgwe_YsuHHEUVu-_3YnyyhT53A@mail.gmail.com>
@ 2021-08-27  5:47       ` Alexander Dahl
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Dahl @ 2021-08-27  5:47 UTC (permalink / raw)
  To: ptxdist; +Cc: Guillermo Rodriguez Garcia

Hello Guillermo,

Am Donnerstag, 26. August 2021, 18:16:37 CEST schrieb Guillermo Rodriguez 
Garcia:
> Hi Alexandar,
> 
> El jue, 26 ago 2021 a las 14:25, Alexander Dahl (<ada@thorsis.com>)
> 
> escribió:
> > Hello Guillermo,
> > 
> > Am Thu, Aug 26, 2021 at 01:43:25PM +0200 schrieb Guillermo Rodriguez
> > 
> > Garcia:
> > > Hi Alexander,
> > > 
> > > El jueves, 26 de agosto de 2021, Alexander Dahl <ada@thorsis.com>
> > 
> > escribió:
> > > > Hei hei,
> > > > 
> > > > I crafted this in the last weeks for a DistroKit based generic BSP,
> > > > which uses U-Boot for half a dozen boards.  Maybe someone else finds
> > > > it
> > > > useful?
> > > 
> > > What does this do exactly, and how does it work?
> > 
> > This adds a new package type 'u-boot' to the `ptxdist newpackage`
> > command.  That newpackage command uses templates to create the
> > necessary rule files for a new package.  You can write your own
> > templates and add it to your BSP, too.
> > 
> > So why a package type 'u-boot' if there's already an u-boot package?
> > I had the idea when working with DistroKit [1] as a base layer for
> > another generic BSP.  You can build a BSP with a rootfs common to
> > different SoCs of the armv7 family and use a common kernel as well.
> > However bootloaders for different SoC families differ, so for such a
> > generic BSP you need to build different bootloaders, and what you do
> > then is duplicate those bootloaders packages in ptxdist with slighty
> > changed names/variables making them unique.  DistroKit for example has
> > multiple barebox packages.
> > 
> > Creating such packages by copy and paste and search and replace is
> > cumbersome and error prone, so I thought why not doing the same thing
> > pengutronix did with barebox for u-boot as well?!
> 
> This looks great. I am sure I have a use for this in my BSPs.
> 
> Is it possible to add these templates to my BSP without modifying ptxdist
> itself?

Yes.

> Where should the files be installed?

The templates go to 'rules/templates' or to 'configs/platform-foo/rules/
templates', I'm not sure however if there are constraints on file names, I 
just sticked with the scheme I found in distributed template files.  Have a 
look at patch 2/2 of the series.

You don't need to change 'scripts/lib/ptxd_lib_template.sh' however (like I 
did for upstreaming).  I have the same pieces (added lines) from that file in 
a separate script 'configs/platform-v7a/scripts/lib/ptxd_lib_u_boot.sh', but I 
think putting that just to 'scripts/lib' should also work?  Probably the 
script must have that 'ptxd_lib_' prefix, but I'm not sure about that.

Don't know if someone should put all that information into 'doc'?  At least my 
colleague already urged me to do so for our internal library/application 
rules?! *lol*

What might be interesting though is how you can add additional script pieces 
like I did in patch 1/2 for that u-boot-url thing, which I copied from 
barebox.  Or how you can extend those functions in scripts/lib with your own.  
But that's anothing topic.

HTH & Greets
Alex




_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH 2/2] templates: Introduce new u-boot template
  2021-08-26  8:48 ` [ptxdist] [PATCH 2/2] templates: Introduce new u-boot template Alexander Dahl
@ 2021-09-03 15:23   ` Michael Olbrich
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2021-09-03 15:23 UTC (permalink / raw)
  To: Alexander Dahl; +Cc: ptxdist

On Thu, Aug 26, 2021 at 10:48:42AM +0200, Alexander Dahl wrote:
> 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.

I like this in general, but I think, most of the options should not be
here. We're generating a packages that probably needs to be modified
anyways.
So I'd drop some of the more obscure stuff and add queries to the template,
e.g. which files to install.

Michael

> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> ---
>  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-@package@.config 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-@package@.scr 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-@package@.config)
> +endif
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +ifdef PTXCONF_U_BOOT_@PACKAGE@_BOOT_SCRIPT
> +U_BOOT_@PACKAGE@_BOOT_SCRIPT_TXT := $(call ptx/in-platformconfigdir, \
> +	u-boot-@package@.scr)
> +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-@package@.prepare:
> +	@$(call targetinfo)
> +	$(U_BOOT_@PACKAGE@_CONF_ENV) $(MAKE) $(U_BOOT_@PACKAGE@_CONF_OPT)
> +	@$(call touch)
> +endif
> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/u-boot-@package@.compile:
> +	@$(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-@package@.install:
> +	@$(call targetinfo)
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/u-boot-@package@.targetinstall:
> +	@$(call targetinfo)
> +	@install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.bin \
> +		$(IMAGEDIR)/u-boot-@package@.bin
> +ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_SREC
> +	@install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot.srec \
> +		$(IMAGEDIR)/u-boot-@package@.srec
> +endif
> +ifdef PTXCONF_U_BOOT_@PACKAGE@_INSTALL_ELF
> +	@install -v -D -m644 $(U_BOOT_@PACKAGE@_BUILD_DIR)/u-boot \
> +		$(IMAGEDIR)/u-boot-@package@.elf
> +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-@package@-app.efi
> +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-@package@-payload.efi
> +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-@package@.img
> +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-@package@.imx
> +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-@package@-dtb.imx
> +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-@package@-dtb.bin
> +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-@package@-with-spl-pbl.bin
> +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-@package@.stm32
> +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-@package@-env.img
> +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 <ada@thorsis.com>")
> +	@$(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-@package@.clean:
> +	@$(call targetinfo)
> +	@$(call clean_pkg, U_BOOT_@PACKAGE@)
> +	@rm -vf $(IMAGEDIR)/u-boot-@package@.bin \
> +		$(IMAGEDIR)/u-boot-@package@.srec \
> +		$(IMAGEDIR)/u-boot-@package@.elf
> +	@rm -vf $(IMAGEDIR)/u-boot-@package@.img $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
> +	@rm -vf $(IMAGEDIR)/u-boot-@package@.imx \
> +		$(IMAGEDIR)/u-boot-@package@-dtb.imx
> +	@rm -vf $(IMAGEDIR)/u-boot-@package@-env.img
> +	@rm -vf	$(IMAGEDIR)/u-boot-@package@-dtb.bin \
> +		$(IMAGEDIR)/u-boot-@package@-with-spl-pbl.bin
> +	@rm -vf $(IMAGEDIR)/u-boot-@package@.stm32
> +
> +# ----------------------------------------------------------------------------
> +# oldconfig / menuconfig
> +# ----------------------------------------------------------------------------
> +
> +u-boot-@package@_oldconfig u-boot-@package@_menuconfig u-boot-@package@_nconfig: $(STATEDIR)/u-boot-@package@.extract
> +	@$(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
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-03 15:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26  8:48 [ptxdist] [PATCH 0/2] Add u-boot template Alexander Dahl
2021-08-26  8:48 ` [ptxdist] [PATCH 1/2] u-boot: Introduce make macro for URL Alexander Dahl
2021-08-26  8:48 ` [ptxdist] [PATCH 2/2] templates: Introduce new u-boot template Alexander Dahl
2021-09-03 15:23   ` Michael Olbrich
     [not found] ` <CABDcavZJN7-BmEKPi5s_r=J-vi=_5=-RHofjbsVgNmuBz5QPQg@mail.gmail.com>
2021-08-26 12:25   ` [ptxdist] [PATCH 0/2] Add " Alexander Dahl
     [not found]     ` <CABDcavbtnikGhiNaJXk1AxBiTgwe_YsuHHEUVu-_3YnyyhT53A@mail.gmail.com>
2021-08-27  5:47       ` Alexander Dahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox