Skip to contentSkip to conversation

Support building a second Barebox config (incl. BBB)

PATCH Superseded Pieter Smith 5 participants 58 messages Mar 20, 2016 – Apr 24, 2016

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

This patch-set adds support for building barebox with up to 2 configurations. It can be used to build the barebox x-loader or MLO (also called Secondary Program Loader) in addition to the standard barebox build (Tertiary Program Loader). This implements the design proposed in
http://elinux.org/Buildroot#Todo_list, with minor adjustments:
1. Have boot/barebox/barebox.mk contain the common stuff.
2. Add a second package boot/barebox/barebox-2.
3. There is only one version selection, but each package allows to define the configuration to be used.
4. Design is a little bit like package/gcc, where we have multiple gcc builds, but share a lot of common definitions between the packages.

To demonstrate that it works as advertized, the last patch adds a defconfig for the beaglebone that makes use of the added functionality.

Revision history:
v4: Introduces barebox-package function to reduce duplication and maintenance
Simplifies built image selection
Ease review with smaller patches
Review re-work: Special thanks to Arnout Vandecappelle and Yegor Yefremov
v3: Updated for master at 544e2c5871f223facd1ab3c2853cd07ad70dd9d1
v2: Dropped x-loader build specialization in favor of 2 generic barebox builds
v1: Initial posting

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

 board/beaglebone/barebox.env/boot/sd      |   6 +
 board/beaglebone/barebox.env/config-board |   4 +
 boot/barebox/Config.in                    |  18 +++
 boot/barebox/barebox-2/Config.in          |  79 +++++++++++++
 boot/barebox/barebox-2/barebox-2.hash     |   1 +
 boot/barebox/barebox-2/barebox-2.mk       |   9 ++
 boot/barebox/barebox.mk                   | 178 ++++++++++++++++++------------
 configs/beaglebone_barebox_defconfig      |  41 +++++++
 8 files changed, 266 insertions(+), 70 deletions(-)
 create mode 100644 board/beaglebone/barebox.env/boot/sd
 create mode 100644 board/beaglebone/barebox.env/config-board
 create mode 100644 boot/barebox/barebox-2/Config.in
 create mode 120000 boot/barebox/barebox-2/barebox-2.hash
 create mode 100644 boot/barebox/barebox-2/barebox-2.mk
 create mode 100644 configs/beaglebone_barebox_defconfig
Signature · 1 line
2.5.0
#1 lore raw

PATCH v4 1/7 barebox: support multi-image-build image selection

Support selection of the built image filename in a multi-image barebox build. This makes it possible to specify which image to pick in a in a multi-image barebox config such as the am335x_defconfig.

The specified image can either be located in the barebox build directory or the barebox build images directory.

For compatibility with contemporary barbox builds, a sane default has been chosen. For barebox versions older than 2012.10, the user will have to specify 'barebox.bin'.

---
 boot/barebox/Config.in  | 9 +++++++++
 boot/barebox/barebox.mk | 9 ++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
boot/barebox/Config.in +9 -0
index bbe6ae2..4f6872c 100644
@@ -97,6 +97,15 @@ config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES
 	  A space-separated list of configuration fragment files,
 	  that will be merged to the main Barebox configuration file.
 
+config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
+	string "Built image filename"
+	default "barebox-flash-image"
+	help
+	  Name of the built barebox image filename in the barebox build or
+	  build images directory.
+
+	  Set to barebox.bin for barebox versions older than 2012.10.
+
 config BR2_TARGET_BAREBOX_BAREBOXENV
 	bool "bareboxenv tool in target"
 	help
boot/barebox/barebox.mk +6 -3
index 7715daf..2a3b724 100644
@@ -92,10 +92,10 @@ define BAREBOX_BUILD_CMDS
 endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
-	if test -h $(@D)/barebox-flash-image ; then \
-		cp -L $(@D)/barebox-flash-image $(BINARIES_DIR)/barebox.bin ; \
+	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
 	else \
-		cp $(@D)/barebox.bin $(BINARIES_DIR);\
+		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
 	fi
 	$(BAREBOX_INSTALL_CUSTOM_ENV)
 endef
@@ -115,6 +115,9 @@ ifeq ($(BR2_TARGET_BAREBOX)$(BR_BUILDING),yy)
 ifeq ($(or $(BAREBOX_KCONFIG_FILE),$(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
 $(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
 endif
+ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
+$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
+endif
 endif
 
 $(eval $(kconfig-package))
Signature · 1 line
2.5.0
#2 lore raw

PATCH v4 1/7 barebox: support multi-image-build image selection

Quoted 2 lines · Pieter Smith

Support selection of the built image filename in a multi-image barebox build. This makes it possible to specify which image to pick in a in a multi-image

you seem to have double "in a"

Quoted 10 lines

barebox config such as the am335x_defconfig.

The specified image can either be located in the barebox build directory or the barebox build images directory.

For compatibility with contemporary barbox builds, a sane default has been chosen. For barebox versions older than 2012.10, the user will have to specify 'barebox.bin'.

Quoted 56 lines
---
 boot/barebox/Config.in  | 9 +++++++++
 boot/barebox/barebox.mk | 9 ++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
boot/barebox/Config.in +9 -0
index bbe6ae2..4f6872c 100644
@@ -97,6 +97,15 @@ config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES
          A space-separated list of configuration fragment files,
          that will be merged to the main Barebox configuration file.
 
+config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
+       string "Built image filename"
+       default "barebox-flash-image"
+       help
+         Name of the built barebox image filename in the barebox build or
+         build images directory.
+
+         Set to barebox.bin for barebox versions older than 2012.10.
+
 config BR2_TARGET_BAREBOX_BAREBOXENV
        bool "bareboxenv tool in target"
        help
boot/barebox/barebox.mk +6 -4
index 7715daf..2a3b724 100644
@@ -92,10 +92,10 @@ define BAREBOX_BUILD_CMDS
 endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
-       if test -h $(@D)/barebox-flash-image ; then \
-               cp -L $(@D)/barebox-flash-image $(BINARIES_DIR)/barebox.bin ; \
+       if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+               cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
        else \
-               cp $(@D)/barebox.bin $(BINARIES_DIR);\
+               cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
        fi
        $(BAREBOX_INSTALL_CUSTOM_ENV)
 endef
@@ -115,6 +115,9 @@ ifeq ($(BR2_TARGET_BAREBOX)$(BR_BUILDING),yy)
 ifeq ($(or $(BAREBOX_KCONFIG_FILE),$(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
 $(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
 endif
+ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
+$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
+endif
 endif
 
 $(eval $(kconfig-package))
--

2.5.0

#3 lore raw

PATCH v4 1/7 barebox: support multi-image-build image selection

Quoted 5 lines · Yegor Yefremov
Quoted 2 lines · Pieter Smith

Support selection of the built image filename in a multi-image barebox build. This makes it possible to specify which image to pick in a in a multi-image

you seem to have double "in a"

ACK. Will be fixed in v5.

[snip]

- Pieter

#4 lore raw

PATCH v4 1/7 barebox: support multi-image-build image selection

In reply to Pieter Smith

Hello,

First of all, thanks a lot for keeping up the work on this topic!

boot/barebox/barebox.mk define BAREBOX_BUILD_CMDS · line 100

Quoted 10 lines · Pieter Smith

define BAREBOX_INSTALL_IMAGES_CMDS

boot/barebox/barebox.mk +3 -3
-	if test -h $(@D)/barebox-flash-image ; then \
-		cp -L $(@D)/barebox-flash-image $(BINARIES_DIR)/barebox.bin ; \
+	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
 	else \
-		cp $(@D)/barebox.bin $(BINARIES_DIR);\
+		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
 	fi
 	$(BAREBOX_INSTALL_CUSTOM_ENV)

I think I don't like two things here:

1/ That it potentially breaks existing configurations, where
barebox.bin was used.

2/ That is automatically searches in images/, which this could be made
explicit rather than implicit.

So, what about changing this to:

1/ Have an option that defaults to empty, and if it's empty, preserves
the current behavior.

2/ Change the code in the .mk file to do:

BAREBOX_IMAGE_FILE = $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)

ifeq ($(BAREBOX_IMAGE_FILE),)
define BARBEOX_INSTALL_IMAGE

	# old code here, using barebox-flash-image, falling back to barebox.bin
endef
else
define BAREBOX_INSTALL_IMAGE
	# install BAREBOX_IMAGE_FILE
endef
endif

and that's it?

Alternatively, you could do that with shell conditionals only, testing is BAREBOX_IMAGE_FILE is empty or not. This may be even easier to read:

	if test -n $(BAREBOX_IMAGE) ; then
		install $(BAREBOX_IMAGE)
	elif test -h $(@D)/barebox-flash-image ; then
		cp -L $(@D)/barebox-flash-image ...
	else
		cp $(@D)/barebox.bin ...
	fi

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v4 1/7 barebox: support multi-image-build image selection

On 04/02/16 17:31, Thomas Petazzoni wrote:
[snip]

Quoted 10 lines

Alternatively, you could do that with shell conditionals only, testing is BAREBOX_IMAGE_FILE is empty or not. This may be even easier to read:

	if test -n $(BAREBOX_IMAGE) ; then
		install $(BAREBOX_IMAGE)
	elif test -h $(@D)/barebox-flash-image ; then
		cp -L $(@D)/barebox-flash-image ...
	else
		cp $(@D)/barebox.bin ...
	fi

+1 to that.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#6 lore raw

PATCH v4 1/7 barebox: support multi-image-build image selection

In reply to Pieter Smith
Quoted 22 lines · Pieter Smith

Support selection of the built image filename in a multi-image barebox build. This makes it possible to specify which image to pick in a in a multi-image barebox config such as the am335x_defconfig.

The specified image can either be located in the barebox build directory or the barebox build images directory.

For compatibility with contemporary barbox builds, a sane default has been chosen. For barebox versions older than 2012.10, the user will have to specify 'barebox.bin'.

---
  boot/barebox/Config.in  | 9 +++++++++
  boot/barebox/barebox.mk | 9 ++++++---
  2 files changed, 15 insertions(+), 3 deletions(-)
boot/barebox/Config.in +0 -0
index bbe6ae2..4f6872c 100644

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES · line 101

Quoted 5 lines
boot/barebox/Config.in +2 -0
@@ -97,6 +97,15 @@ config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES
  	  A space-separated list of configuration fragment files,
  	  that will be merged to the main Barebox configuration file.
 
+config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
+	string "Built image filename"

I think the 'built' part is redundant. For example, the kernel just has
BR2_LINUX_KERNEL_IMAGE_NAME with prompt "Kernel image name", so I'd go for BR2_TARGET_BAREBOX_IMAGE_NAME and "Barebox image name".

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES · line 107

Quoted 6 lines
boot/barebox/Config.in +6 -0
+	default "barebox-flash-image"
+	help
+	  Name of the built barebox image filename in the barebox build or
+	  build images directory.
+
+	  Set to barebox.bin for barebox versions older than 2012.10.

With Thomas's suggestion, the help text could become

The filename of the built barebox image. For current barebox, this is usually barebox-flash-image; for barebox versions older than 2012.10, it is barebox.bin. Leave empty to try these two options. This option only needs to be set for multi-image barebox configs.

This file will be copied to the images directory as 'barebox.bin'.

Quoted 23 lines
boot/barebox/Config.in +1 -0
+
  config BR2_TARGET_BAREBOX_BAREBOXENV
  	bool "bareboxenv tool in target"
  	help
boot/barebox/barebox.mk +3 -3
index 7715daf..2a3b724 100644
@@ -92,10 +92,10 @@ define BAREBOX_BUILD_CMDS
  endef
 
  define BAREBOX_INSTALL_IMAGES_CMDS
-	if test -h $(@D)/barebox-flash-image ; then \
-		cp -L $(@D)/barebox-flash-image $(BINARIES_DIR)/barebox.bin ; \
+	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
  	else \
-		cp $(@D)/barebox.bin $(BINARIES_DIR);\
+		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
  	fi
  	$(BAREBOX_INSTALL_CUSTOM_ENV)
  endef

boot/barebox/barebox.mk ifeq ($(BR2_TARGET_BAREBOX)$(BR_BUILDING),yy) · line 120

Quoted 6 lines
boot/barebox/barebox.mk +3 -0
@@ -115,6 +115,9 @@ ifeq ($(BR2_TARGET_BAREBOX)$(BR_BUILDING),yy)
  ifeq ($(or $(BAREBOX_KCONFIG_FILE),$(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
  $(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
  endif
+ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
+$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
+endif

With Thomas's suggestion, this check should be removed.

Regards,
Arnout

Quoted 4 lines
boot/barebox/barebox.mk +0 -0
  endif
 
  $(eval $(kconfig-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#7 lore raw

PATCH v4 2/7 barebox: friendly error on missing built image

In reply to Pieter Smith

Gives the user a friendly error to help him troubleshoot missing built barebox image.

---
 boot/barebox/barebox.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
boot/barebox/barebox.mk +7 -1
index 2a3b724..d0f28cf 100644
@@ -94,8 +94,14 @@ endef
 define BAREBOX_INSTALL_IMAGES_CMDS
 	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
 		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
-	else \
+	elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
 		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+	else \
+		echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
+		echo "       in: $(@D)/" >&2 ; \
+		echo "       or: $(@D)/images/" >&2 ; \
+		echo "       Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting." >&2 ; \
+		exit 1 ; \
 	fi
 	$(BAREBOX_INSTALL_CUSTOM_ENV)
 endef
Signature · 1 line
2.5.0
#8 lore raw

PATCH v4 2/7 barebox: friendly error on missing built image

Quoted 4 lines · Pieter Smith

Gives the user a friendly error to help him troubleshoot missing built barebox image.

Quoted 27 lines
---
 boot/barebox/barebox.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
boot/barebox/barebox.mk +7 -2
index 2a3b724..d0f28cf 100644
@@ -94,8 +94,14 @@ endef
 define BAREBOX_INSTALL_IMAGES_CMDS
        if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
                cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
-       else \
+       elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
                cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+       else \
+               echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
+               echo "       in: $(@D)/" >&2 ; \
+               echo "       or: $(@D)/images/" >&2 ; \
+               echo "       Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting." >&2 ; \
+               exit 1 ; \
        fi
        $(BAREBOX_INSTALL_CUSTOM_ENV)
 endef
--

2.5.0

#9 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

In reply to Pieter Smith

In preparation for building a 2nd barebox config, a configuration option is added to allow customization of the image filename when the built image is copied to the output/images directory.

---
 boot/barebox/Config.in  | 7 +++++++
 boot/barebox/barebox.mk | 9 +++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
boot/barebox/Config.in +7 -0
index 4f6872c..7769866 100644
@@ -106,6 +106,13 @@ config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
 
 	  Set to barebox.bin for barebox versions older than 2012.10.
 
+config BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+	string "Output image filename"
+	default "barebox.bin"
+	help
+	  Name to use when copying the barebox image to the output/images
+	  directory.
+
 config BR2_TARGET_BAREBOX_BAREBOXENV
 	bool "bareboxenv tool in target"
 	help
boot/barebox/barebox.mk +7 -2
index d0f28cf..4eea470 100644
@@ -93,9 +93,11 @@ endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
 	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		      $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
 	elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		   $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
 	else \
 		echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
 		echo "       in: $(@D)/" >&2 ; \
@@ -124,6 +126,9 @@ endif
 ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
 $(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
 endif
+ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+endif
 endif
 
 $(eval $(kconfig-package))
Signature · 1 line
2.5.0
#10 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

Quoted 5 lines · Pieter Smith

In preparation for building a 2nd barebox config, a configuration option is added to allow customization of the image filename when the built image is copied to the output/images directory.

Quoted 54 lines
---
 boot/barebox/Config.in  | 7 +++++++
 boot/barebox/barebox.mk | 9 +++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
boot/barebox/Config.in +7 -0
index 4f6872c..7769866 100644
@@ -106,6 +106,13 @@ config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
 
          Set to barebox.bin for barebox versions older than 2012.10.
 
+config BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+       string "Output image filename"
+       default "barebox.bin"
+       help
+         Name to use when copying the barebox image to the output/images
+         directory.
+
 config BR2_TARGET_BAREBOX_BAREBOXENV
        bool "bareboxenv tool in target"
        help
boot/barebox/barebox.mk +7 -3
index d0f28cf..4eea470 100644
@@ -93,9 +93,11 @@ endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
        if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-               cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+               cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+                     $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
        elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-               cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+               cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+                  $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
        else \
                echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
                echo "       in: $(@D)/" >&2 ; \
@@ -124,6 +126,9 @@ endif
 ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
 $(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
 endif
+ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+endif
 endif
 
 $(eval $(kconfig-package))
--

2.5.0

#11 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

In reply to Pieter Smith
Quoted 5 lines · Pieter Smith

In preparation for building a 2nd barebox config, a configuration option is added to allow customization of the image filename when the built image is copied to the output/images directory.

Regards,
Arnout

Quoted 52 lines
---
  boot/barebox/Config.in  | 7 +++++++
  boot/barebox/barebox.mk | 9 +++++++--
  2 files changed, 14 insertions(+), 2 deletions(-)
boot/barebox/Config.in +7 -0
index 4f6872c..7769866 100644
@@ -106,6 +106,13 @@ config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
 
  	  Set to barebox.bin for barebox versions older than 2012.10.
 
+config BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+	string "Output image filename"
+	default "barebox.bin"
+	help
+	  Name to use when copying the barebox image to the output/images
+	  directory.
+
  config BR2_TARGET_BAREBOX_BAREBOXENV
  	bool "bareboxenv tool in target"
  	help
boot/barebox/barebox.mk +7 -2
index d0f28cf..4eea470 100644
@@ -93,9 +93,11 @@ endef
 
  define BAREBOX_INSTALL_IMAGES_CMDS
  	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		      $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
  	elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		   $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
  	else \
  		echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
  		echo "       in: $(@D)/" >&2 ; \
@@ -124,6 +126,9 @@ endif
  ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
  $(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
  endif
+ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+endif
  endif
 
  $(eval $(kconfig-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#12 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

In reply to Pieter Smith
Quoted 15 lines · Pieter Smith

In preparation for building a 2nd barebox config, a configuration option is added to allow customization of the image filename when the built image is copied to the output/images directory.

---
  boot/barebox/Config.in  | 7 +++++++
  boot/barebox/barebox.mk | 9 +++++++--
  2 files changed, 14 insertions(+), 2 deletions(-)
boot/barebox/Config.in +0 -0
index 4f6872c..7769866 100644

boot/barebox/Config.in config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE · line 110

Quoted 5 lines
boot/barebox/Config.in +2 -0
@@ -106,6 +106,13 @@ config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
 
  	  Set to barebox.bin for barebox versions older than 2012.10.
 
+config BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+	string "Output image filename"

With my suggestion of BR2_TARGET_BAREBOX_IMAGE_NAME, this should be changed
to e.g. BR2_TARGET_BAREBOX_OUTPUT_IMAGE_NAME. The prompt looks OK though.

However, on second thought I'm wondering if it is really needed. For u-boot or
the kernel, we always copy the images with the same name as they were built. If that is not what the ROM boot loader expects, the name can be changed in the image generation script. For example, genimage.cfg could contain:

image boot.vfat {
         vfat {
                 file MLO {
			"barebox-am33xx-beaglebone-mlo.img"
		}
		file barebox.img {
			"barebox-am33xx-beaglebone.img"
                 }
         }
         size = 8M
}

What do you think?

Regards,
Arnout

Quoted 37 lines
boot/barebox/Config.in +5 -0
+	default "barebox.bin"
+	help
+	  Name to use when copying the barebox image to the output/images
+	  directory.
+
  config BR2_TARGET_BAREBOX_BAREBOXENV
  	bool "bareboxenv tool in target"
  	help
boot/barebox/barebox.mk +7 -2
index d0f28cf..4eea470 100644
@@ -93,9 +93,11 @@ endef
 
  define BAREBOX_INSTALL_IMAGES_CMDS
  	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		      $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
  	elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) $(BINARIES_DIR)/barebox.bin ; \
+		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		   $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
  	else \
  		echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
  		echo "       in: $(@D)/" >&2 ; \
@@ -124,6 +126,9 @@ endif
  ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
  $(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
  endif
+ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+endif
  endif
 
  $(eval $(kconfig-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#13 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

Hello,

Quoted 25 lines · Arnout Vandecappelle

boot/barebox/Config.in config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE · line 110

Quoted 2 lines
boot/barebox/Config.in +2 -0
+config BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+	string "Output image filename"

With my suggestion of BR2_TARGET_BAREBOX_IMAGE_NAME, this should be changed
to e.g. BR2_TARGET_BAREBOX_OUTPUT_IMAGE_NAME. The prompt looks OK though.

However, on second thought I'm wondering if it is really needed. For u-boot or
the kernel, we always copy the images with the same name as they were built. If that is not what the ROM boot loader expects, the name can be changed in the image generation script. For example, genimage.cfg could contain:

image boot.vfat {
         vfat {
                 file MLO {
			"barebox-am33xx-beaglebone-mlo.img"
		}
		file barebox.img {
			"barebox-am33xx-beaglebone.img"
                 }
         }
         size = 8M
}
Quoted 1 line

What do you think?

I agree, we don't do this for U-Boot/kernel or any other thing, so I don't think we should be doing it for Barebox.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#14 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

In reply to Arnout Vandecappelle

Hi Arnout / Thomas,

Quoted 46 lines · Arnout Vandecappelle
Quoted 15 lines · Pieter Smith

In preparation for building a 2nd barebox config, a configuration option is added to allow customization of the image filename when the built image is copied to the output/images directory.

---
 boot/barebox/Config.in  | 7 +++++++
 boot/barebox/barebox.mk | 9 +++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
boot/barebox/Config.in +0 -0
index 4f6872c..7769866 100644

boot/barebox/Config.in config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE · line 110

Quoted 5 lines
boot/barebox/Config.in +2 -0
@@ -106,6 +106,13 @@ config BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
 
 	  Set to barebox.bin for barebox versions older than 2012.10.
 
+config BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
+	string "Output image filename"

With my suggestion of BR2_TARGET_BAREBOX_IMAGE_NAME, this should be
changed to e.g. BR2_TARGET_BAREBOX_OUTPUT_IMAGE_NAME. The prompt looks OK though.

However, on second thought I'm wondering if it is really needed. For u-boot
or the kernel, we always copy the images with the same name as they were built. If that is not what the ROM boot loader expects, the name can be changed in the image generation script. For example, genimage.cfg could contain:

image boot.vfat {
        vfat {
                file MLO {
			"barebox-am33xx-beaglebone-mlo.img"
		}
		file barebox.img {
			"barebox-am33xx-beaglebone.img"
                }
        }
        size = 8M
}
Quoted 1 line

What do you think?

I agree that this is cleaner from a buildroot perspective. But this would require carrying a genimage.cfg patch for barebox as part of beaglebone_barebox_defconfig. Is this what you are suggesting?

Quoted 2 lines

Regards,
Arnout

[snip]

- Pieter

#15 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

Quoted 3 lines · Pieter Smith

Hi Arnout / Thomas,

On Tue, Apr 05, 2016 at 01:20:13AM +0200, Arnout Vandecappelle wrote:

[snip]

Quoted 19 lines
Quoted 19 lines

However, on second thought I'm wondering if it is really needed. For u-boot
or the kernel, we always copy the images with the same name as they were built. If that is not what the ROM boot loader expects, the name can be changed in the image generation script. For example, genimage.cfg could contain:

image boot.vfat {
         vfat {
                 file MLO {
			"barebox-am33xx-beaglebone-mlo.img"
		}
		file barebox.img {
			"barebox-am33xx-beaglebone.img"
                 }
         }
         size = 8M
}
Quoted 5 lines
Quoted 1 line

What do you think?

I agree that this is cleaner from a buildroot perspective. But this would require carrying a genimage.cfg patch for barebox as part of beaglebone_barebox_defconfig. Is this what you are suggesting?

I don't really understand what you mean. As I suggested in that patch, it
would be nice to add a genimage config as well. When you do that, you can use a fragment like above to make sure the files will have the correct name in the filesystem. (Like above, except I screwed up the indentation :-)

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#16 lore raw

PATCH v4 3/7 barebox: support custom barebox output image name

Quoted 26 lines · Arnout Vandecappelle
Quoted 3 lines · Pieter Smith

Hi Arnout / Thomas,

On Tue, Apr 05, 2016 at 01:20:13AM +0200, Arnout Vandecappelle wrote:

[snip]

Quoted 21 lines
Quoted 20 lines

However, on second thought I'm wondering if it is really needed. For u-boot
or the kernel, we always copy the images with the same name as they were built. If that is not what the ROM boot loader expects, the name can be changed in the image generation script. For example, genimage.cfg could contain:

image boot.vfat {
        vfat {
                file MLO {
			"barebox-am33xx-beaglebone-mlo.img"
		}
		file barebox.img {
			"barebox-am33xx-beaglebone.img"
                }
        }
        size = 8M
}

What do you think?

Quoted 8 lines
Quoted 3 lines

I agree that this is cleaner from a buildroot perspective. But this would require carrying a genimage.cfg patch for barebox as part of beaglebone_barebox_defconfig. Is this what you are suggesting?

I don't really understand what you mean. As I suggested in that patch, it
would be nice to add a genimage config as well. When you do that, you can use a fragment like above to make sure the files will have the correct name in the filesystem. (Like above, except I screwed up the indentation :-)

The vfat file attribute also expects an "image=" key, not just the image name.

Thanks! This will be in v5 of the patch-set.

[snip]

- Pieter Smith

#17 lore raw

PATCH v4 4/7 barebox: introduce barebox-package function

In reply to Pieter Smith

No functional changes: Introduces a barebox-package function towards re-use by a 2nd config build.

Because the function is meant to be called from within a $(eval), all instances of '$' has to be escaped. I.e. rename '$' -> '$$'.

---
 boot/barebox/barebox.mk | 134 +++++++++++++++++++++++++++---------------------
 1 file changed, 76 insertions(+), 58 deletions(-)
boot/barebox/barebox.mk +76 -58
index 4eea470..d84c479 100644
@@ -4,23 +4,31 @@
 #
 ################################################################################
 
-BAREBOX_VERSION = $(call qstrip,$(BR2_TARGET_BAREBOX_VERSION))
+################################################################################
+# inner-barebox-package -- generates the KConfig logic and make targets needed
+# to support a barebox package. All barebox packages are built from the same
+# source (origin, version and patches).
+################################################################################
+
+define inner-barebox-package
 
-ifeq ($(BAREBOX_VERSION),custom)
+BAREBOX_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
+
+ifeq ($$(BAREBOX_VERSION),custom)
 # Handle custom Barebox tarballs as specified by the configuration
-BAREBOX_TARBALL = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
-BAREBOX_SITE = $(patsubst %/,%,$(dir $(BAREBOX_TARBALL)))
-BAREBOX_SOURCE = $(notdir $(BAREBOX_TARBALL))
-BR_NO_CHECK_HASH_FOR += $(BAREBOX_SOURCE)
-else ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
-BAREBOX_SITE = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
+BAREBOX_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
+BAREBOX_SITE = $$(patsubst %/,%,$$(dir $$(BAREBOX_TARBALL)))
+BAREBOX_SOURCE = $$(notdir $$(BAREBOX_TARBALL))
+BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
+else ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
+BAREBOX_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
 BAREBOX_SITE_METHOD = git
 else
 # Handle stable official Barebox versions
-BAREBOX_SOURCE = barebox-$(BAREBOX_VERSION).tar.bz2
+BAREBOX_SOURCE = barebox-$$(BAREBOX_VERSION).tar.bz2
 BAREBOX_SITE = http://www.barebox.org/download
-ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_VERSION),y)
-BR_NO_CHECK_HASH_FOR += $(BAREBOX_SOURCE)
+ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_VERSION),y)
+BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
 endif
 endif
 
@@ -28,107 +36,117 @@ BAREBOX_DEPENDENCIES = host-lzop
 BAREBOX_LICENSE = GPLv2 with exceptions
 BAREBOX_LICENSE_FILES = COPYING
 
-ifneq ($(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
+ifneq ($$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
 define BAREBOX_APPLY_CUSTOM_PATCHES
-	$(APPLY_PATCHES) $(@D) \
-		$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
+	$$(APPLY_PATCHES) $$(@D) \
+		$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
 endef
 
 BAREBOX_POST_PATCH_HOOKS += BAREBOX_APPLY_CUSTOM_PATCHES
 endif
 
 BAREBOX_INSTALL_IMAGES = YES
-ifneq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+ifneq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
 BAREBOX_INSTALL_TARGET = NO
 endif
 
-ifeq ($(KERNEL_ARCH),i386)
+ifeq ($$(KERNEL_ARCH),i386)
 BAREBOX_ARCH = x86
-else ifeq ($(KERNEL_ARCH),x86_64)
+else ifeq ($$(KERNEL_ARCH),x86_64)
 BAREBOX_ARCH = x86
-else ifeq ($(KERNEL_ARCH),powerpc)
+else ifeq ($$(KERNEL_ARCH),powerpc)
 BAREBOX_ARCH = ppc
 else
-BAREBOX_ARCH = $(KERNEL_ARCH)
+BAREBOX_ARCH = $$(KERNEL_ARCH)
 endif
 
-BAREBOX_MAKE_FLAGS = ARCH=$(BAREBOX_ARCH) CROSS_COMPILE="$(TARGET_CROSS)"
-BAREBOX_MAKE_ENV = $(TARGET_MAKE_ENV)
+BAREBOX_MAKE_FLAGS = ARCH=$$(BAREBOX_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
+BAREBOX_MAKE_ENV = $$(TARGET_MAKE_ENV)
 
-ifeq ($(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
-BAREBOX_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
-else ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
-BAREBOX_KCONFIG_FILE = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
+ifeq ($$(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
+BAREBOX_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
+else ifeq ($$(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
+BAREBOX_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
 endif
 
-BAREBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
+BAREBOX_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
 BAREBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
-BAREBOX_KCONFIG_OPTS = $(BAREBOX_MAKE_FLAGS)
+BAREBOX_KCONFIG_OPTS = $$(BAREBOX_MAKE_FLAGS)
 
-ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
 define BAREBOX_BUILD_BAREBOXENV_CMDS
-	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o $(@D)/bareboxenv \
-		$(@D)/scripts/bareboxenv.c
+	$$(TARGET_CC) $$(TARGET_CFLAGS) $$(TARGET_LDFLAGS) -o $$(@D)/bareboxenv \
+		$$(@D)/scripts/bareboxenv.c
 endef
 endif
 
-ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
-BAREBOX_ENV_NAME = $(notdir $(call qstrip,\
-	$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
+ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
+BAREBOX_ENV_NAME = $$(notdir $$(call qstrip,\
+	$$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
 define BAREBOX_BUILD_CUSTOM_ENV
-	$(@D)/scripts/bareboxenv -s \
-		$(call qstrip, $(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
-		$(@D)/$(BAREBOX_ENV_NAME)
+	$$(@D)/scripts/bareboxenv -s \
+		$$(call qstrip, $$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
+		$$(@D)/$$(BAREBOX_ENV_NAME)
 endef
 define BAREBOX_INSTALL_CUSTOM_ENV
-	cp $(@D)/$(BAREBOX_ENV_NAME) $(BINARIES_DIR)
+	cp $$(@D)/$$(BAREBOX_ENV_NAME) $$(BINARIES_DIR)
 endef
 endif
 
 define BAREBOX_BUILD_CMDS
-	$(BAREBOX_BUILD_BAREBOXENV_CMDS)
-	$(TARGET_MAKE_ENV) $(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D)
-	$(BAREBOX_BUILD_CUSTOM_ENV)
+	$$(BAREBOX_BUILD_BAREBOXENV_CMDS)
+	$$(TARGET_MAKE_ENV) $$(MAKE) $$(BAREBOX_MAKE_FLAGS) -C $$(@D)
+	$$(BAREBOX_BUILD_CUSTOM_ENV)
 endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
-	if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-		      $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
-	elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-		   $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
+	if test -e $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+		cp -L $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		      $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
+	elif test -e $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+		cp $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+		   $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
 	else \
-		echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
-		echo "       in: $(@D)/" >&2 ; \
-		echo "       or: $(@D)/images/" >&2 ; \
+		echo "error: Specified built image file not found: $$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
+		echo "       in: $$(@D)/" >&2 ; \
+		echo "       or: $$(@D)/images/" >&2 ; \
 		echo "       Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting." >&2 ; \
 		exit 1 ; \
 	fi
-	$(BAREBOX_INSTALL_CUSTOM_ENV)
+	$$(BAREBOX_INSTALL_CUSTOM_ENV)
 endef
 
-ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
 define BAREBOX_INSTALL_TARGET_CMDS
-	cp $(@D)/bareboxenv $(TARGET_DIR)/usr/bin
+	cp $$(@D)/bareboxenv $$(TARGET_DIR)/usr/bin
 endef
 endif
 
 # Checks to give errors that the user can understand
 # Must be before we call to kconfig-package
-ifeq ($(BR2_TARGET_BAREBOX)$(BR_BUILDING),yy)
+ifeq ($$(BR2_TARGET_BAREBOX)$$(BR_BUILDING),yy)
 # We must use the user-supplied kconfig value, because
 # BAREBOX_KCONFIG_DEFCONFIG will at least contain the
 # trailing _defconfig
-ifeq ($(or $(BAREBOX_KCONFIG_FILE),$(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
-$(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
+ifeq ($$(or $$(BAREBOX_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
+$$(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
 endif
 ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
-$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
+$$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
 endif
 ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
-$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+$$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
 endif
 endif
 
-$(eval $(kconfig-package))
+$$(eval $$(kconfig-package))
+endef
+
+################################################################################
+# barebox-package -- the target generator macro for barebox packages
+################################################################################
+
+barebox-package=$(call inner-barebox-package)
+
+# instantiate this barebox package
+$(eval $(call barebox-package))
Signature · 1 line
2.5.0
#18 lore raw

PATCH v4 4/7 barebox: introduce barebox-package function

Quoted 7 lines · Pieter Smith

No functional changes: Introduces a barebox-package function towards re-use by a 2nd config build.

Because the function is meant to be called from within a $(eval), all instances of '$' has to be escaped. I.e. rename '$' -> '$$'.

below some typos

Quoted 9 lines
---
 boot/barebox/barebox.mk | 134 +++++++++++++++++++++++++++---------------------
 1 file changed, 76 insertions(+), 58 deletions(-)
boot/barebox/barebox.mk +0 -0
index 4eea470..d84c479 100644

boot/barebox/barebox.mk line 8

Quoted 6 lines
boot/barebox/barebox.mk +2 -1
@@ -4,23 +4,31 @@
 #
 ################################################################################
 
-BAREBOX_VERSION = $(call qstrip,$(BR2_TARGET_BAREBOX_VERSION))
+################################################################################
+# inner-barebox-package -- generates the KConfig logic and make targets needed

s/KConfig/Kconfig and s/make/makes

Quoted 204 lines
boot/barebox/barebox.mk +74 -58
+# to support a barebox package. All barebox packages are built from the same
+# source (origin, version and patches).
+################################################################################
+
+define inner-barebox-package
 
-ifeq ($(BAREBOX_VERSION),custom)
+BAREBOX_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
+
+ifeq ($$(BAREBOX_VERSION),custom)
 # Handle custom Barebox tarballs as specified by the configuration
-BAREBOX_TARBALL = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
-BAREBOX_SITE = $(patsubst %/,%,$(dir $(BAREBOX_TARBALL)))
-BAREBOX_SOURCE = $(notdir $(BAREBOX_TARBALL))
-BR_NO_CHECK_HASH_FOR += $(BAREBOX_SOURCE)
-else ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
-BAREBOX_SITE = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
+BAREBOX_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
+BAREBOX_SITE = $$(patsubst %/,%,$$(dir $$(BAREBOX_TARBALL)))
+BAREBOX_SOURCE = $$(notdir $$(BAREBOX_TARBALL))
+BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
+else ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
+BAREBOX_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
 BAREBOX_SITE_METHOD = git
 else
 # Handle stable official Barebox versions
-BAREBOX_SOURCE = barebox-$(BAREBOX_VERSION).tar.bz2
+BAREBOX_SOURCE = barebox-$$(BAREBOX_VERSION).tar.bz2
 BAREBOX_SITE = http://www.barebox.org/download
-ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_VERSION),y)
-BR_NO_CHECK_HASH_FOR += $(BAREBOX_SOURCE)
+ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_VERSION),y)
+BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
 endif
 endif
 
@@ -28,107 +36,117 @@ BAREBOX_DEPENDENCIES = host-lzop
 BAREBOX_LICENSE = GPLv2 with exceptions
 BAREBOX_LICENSE_FILES = COPYING
 
-ifneq ($(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
+ifneq ($$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
 define BAREBOX_APPLY_CUSTOM_PATCHES
-       $(APPLY_PATCHES) $(@D) \
-               $(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
+       $$(APPLY_PATCHES) $$(@D) \
+               $$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
 endef
 
 BAREBOX_POST_PATCH_HOOKS += BAREBOX_APPLY_CUSTOM_PATCHES
 endif
 
 BAREBOX_INSTALL_IMAGES = YES
-ifneq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+ifneq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
 BAREBOX_INSTALL_TARGET = NO
 endif
 
-ifeq ($(KERNEL_ARCH),i386)
+ifeq ($$(KERNEL_ARCH),i386)
 BAREBOX_ARCH = x86
-else ifeq ($(KERNEL_ARCH),x86_64)
+else ifeq ($$(KERNEL_ARCH),x86_64)
 BAREBOX_ARCH = x86
-else ifeq ($(KERNEL_ARCH),powerpc)
+else ifeq ($$(KERNEL_ARCH),powerpc)
 BAREBOX_ARCH = ppc
 else
-BAREBOX_ARCH = $(KERNEL_ARCH)
+BAREBOX_ARCH = $$(KERNEL_ARCH)
 endif
 
-BAREBOX_MAKE_FLAGS = ARCH=$(BAREBOX_ARCH) CROSS_COMPILE="$(TARGET_CROSS)"
-BAREBOX_MAKE_ENV = $(TARGET_MAKE_ENV)
+BAREBOX_MAKE_FLAGS = ARCH=$$(BAREBOX_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
+BAREBOX_MAKE_ENV = $$(TARGET_MAKE_ENV)
 
-ifeq ($(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
-BAREBOX_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
-else ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
-BAREBOX_KCONFIG_FILE = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
+ifeq ($$(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
+BAREBOX_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
+else ifeq ($$(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
+BAREBOX_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
 endif
 
-BAREBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
+BAREBOX_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
 BAREBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
-BAREBOX_KCONFIG_OPTS = $(BAREBOX_MAKE_FLAGS)
+BAREBOX_KCONFIG_OPTS = $$(BAREBOX_MAKE_FLAGS)
 
-ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
 define BAREBOX_BUILD_BAREBOXENV_CMDS
-       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o $(@D)/bareboxenv \
-               $(@D)/scripts/bareboxenv.c
+       $$(TARGET_CC) $$(TARGET_CFLAGS) $$(TARGET_LDFLAGS) -o $$(@D)/bareboxenv \
+               $$(@D)/scripts/bareboxenv.c
 endef
 endif
 
-ifeq ($(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
-BAREBOX_ENV_NAME = $(notdir $(call qstrip,\
-       $(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
+ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
+BAREBOX_ENV_NAME = $$(notdir $$(call qstrip,\
+       $$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
 define BAREBOX_BUILD_CUSTOM_ENV
-       $(@D)/scripts/bareboxenv -s \
-               $(call qstrip, $(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
-               $(@D)/$(BAREBOX_ENV_NAME)
+       $$(@D)/scripts/bareboxenv -s \
+               $$(call qstrip, $$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
+               $$(@D)/$$(BAREBOX_ENV_NAME)
 endef
 define BAREBOX_INSTALL_CUSTOM_ENV
-       cp $(@D)/$(BAREBOX_ENV_NAME) $(BINARIES_DIR)
+       cp $$(@D)/$$(BAREBOX_ENV_NAME) $$(BINARIES_DIR)
 endef
 endif
 
 define BAREBOX_BUILD_CMDS
-       $(BAREBOX_BUILD_BAREBOXENV_CMDS)
-       $(TARGET_MAKE_ENV) $(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D)
-       $(BAREBOX_BUILD_CUSTOM_ENV)
+       $$(BAREBOX_BUILD_BAREBOXENV_CMDS)
+       $$(TARGET_MAKE_ENV) $$(MAKE) $$(BAREBOX_MAKE_FLAGS) -C $$(@D)
+       $$(BAREBOX_BUILD_CUSTOM_ENV)
 endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
-       if test -e $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-               cp -L $(@D)/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-                     $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
-       elif test -e $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-               cp $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-                  $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
+       if test -e $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+               cp -L $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+                     $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
+       elif test -e $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
+               cp $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
+                  $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
        else \
-               echo "error: Specified built image file not found: $(call qstrip,$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
-               echo "       in: $(@D)/" >&2 ; \
-               echo "       or: $(@D)/images/" >&2 ; \
+               echo "error: Specified built image file not found: $$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
+               echo "       in: $$(@D)/" >&2 ; \
+               echo "       or: $$(@D)/images/" >&2 ; \
                echo "       Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting." >&2 ; \
                exit 1 ; \
        fi
-       $(BAREBOX_INSTALL_CUSTOM_ENV)
+       $$(BAREBOX_INSTALL_CUSTOM_ENV)
 endef
 
-ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
 define BAREBOX_INSTALL_TARGET_CMDS
-       cp $(@D)/bareboxenv $(TARGET_DIR)/usr/bin
+       cp $$(@D)/bareboxenv $$(TARGET_DIR)/usr/bin
 endef
 endif
 
 # Checks to give errors that the user can understand
 # Must be before we call to kconfig-package
-ifeq ($(BR2_TARGET_BAREBOX)$(BR_BUILDING),yy)
+ifeq ($$(BR2_TARGET_BAREBOX)$$(BR_BUILDING),yy)
 # We must use the user-supplied kconfig value, because
 # BAREBOX_KCONFIG_DEFCONFIG will at least contain the
 # trailing _defconfig
-ifeq ($(or $(BAREBOX_KCONFIG_FILE),$(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
-$(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
+ifeq ($$(or $$(BAREBOX_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
+$$(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
 endif
 ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
-$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
+$$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
 endif
 ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
-$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+$$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
 endif
 endif
 
-$(eval $(kconfig-package))
+$$(eval $$(kconfig-package))
+endef
+
+################################################################################
+# barebox-package -- the target generator macro for barebox packages
+################################################################################
+
+barebox-package=$(call inner-barebox-package)
+
+# instantiate this barebox package
+$(eval $(call barebox-package))
--

2.5.0

#19 lore raw

PATCH v4 4/7 barebox: introduce barebox-package function

In reply to Pieter Smith
Quoted 7 lines · Pieter Smith

No functional changes: Introduces a barebox-package function towards re-use by a 2nd config build.

Because the function is meant to be called from within a $(eval), all instances of '$' has to be escaped. I.e. rename '$' -> '$$'.

Checked that it is exactly the same except for the '$' -> '$$' replacement.

However, I wonder if it wouldn't be better to hoist the parts that are really
common (or only for barebox-1) out of the function. In particular, I'm thinking of:

- everything concerning BR2_TARGET_BAREBOX_BAREBOXENV, because that option doesn't exist for barebox-2 and it can be cleanly separated;

- the definition of BAREBOX_APPLY_CUSTOM_PATCHES, because there is only a single BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR;

- the definition of BAREBOX_ARCH and BAREBOX_MAKE_FLAGS, because they are not used by kconfig-package but only internally.

I'm not entirely sure if it is better that way. Pieter, I leave it up to you
to decide.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#20 lore raw

PATCH v4 4/7 barebox: introduce barebox-package function

In reply to Pieter Smith

Oh, one thing I forgot...

Quoted 2 lines · Pieter Smith

+# instantiate this barebox package
+$(eval $(call barebox-package))

  The $(call ...) is not needed here. call is only needed if there are arguments.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#21 lore raw

PATCH v4 4/7 barebox: introduce barebox-package function

Quoted 7 lines · Arnout Vandecappelle

Oh, one thing I forgot...

Quoted 2 lines · Pieter Smith

+# instantiate this barebox package
+$(eval $(call barebox-package))

The $(call ...) is not needed here. call is only needed if there are arguments.

ACK. Already fixed for v5.

Quoted 9 lines

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

- Pieter

#22 lore raw

PATCH v4 5/7 barebox: extract package name argument

In reply to Pieter Smith

No functional changes: Extracts an argument to the inner-barebox-package function to automatically determine the uppercase package name. This is needed to support a 2nd config build. This results in the following renaming:
'BAREBOX' -> '$(1)'

All barebox packages are meant to be built from the same sources, so related KConfig variables (origin, version and patch directory) are not extracted.

---
 boot/barebox/barebox.mk | 139 +++++++++++++++++++++++++-----------------------
 1 file changed, 71 insertions(+), 68 deletions(-)
boot/barebox/barebox.mk +71 -68
index d84c479..8892ab5 100644
@@ -7,135 +7,138 @@
 ################################################################################
 # inner-barebox-package -- generates the KConfig logic and make targets needed
 # to support a barebox package. All barebox packages are built from the same
-# source (origin, version and patches).
+# source (origin, version and patches). The remainder of the package
+# configuration is unique to each barebox package.
+#
+#  argument 1 is the uppercase package name (used for variable name-space)
 ################################################################################
 
 define inner-barebox-package
 
-BAREBOX_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
+$(1)_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
 
-ifeq ($$(BAREBOX_VERSION),custom)
+ifeq ($$($(1)_VERSION),custom)
 # Handle custom Barebox tarballs as specified by the configuration
-BAREBOX_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
-BAREBOX_SITE = $$(patsubst %/,%,$$(dir $$(BAREBOX_TARBALL)))
-BAREBOX_SOURCE = $$(notdir $$(BAREBOX_TARBALL))
-BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
+$(1)_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
+$(1)_SITE = $$(patsubst %/,%,$$(dir $$($(1)_TARBALL)))
+$(1)_SOURCE = $$(notdir $$($(1)_TARBALL))
+BR_NO_CHECK_HASH_FOR += $$($(1)_SOURCE)
 else ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
-BAREBOX_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
-BAREBOX_SITE_METHOD = git
+$(1)_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
+$(1)_SITE_METHOD = git
 else
 # Handle stable official Barebox versions
-BAREBOX_SOURCE = barebox-$$(BAREBOX_VERSION).tar.bz2
-BAREBOX_SITE = http://www.barebox.org/download
+$(1)_SOURCE = barebox-$$($(1)_VERSION).tar.bz2
+$(1)_SITE = http://www.barebox.org/download
 ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_VERSION),y)
-BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
+BR_NO_CHECK_HASH_FOR += $$($(1)_SOURCE)
 endif
 endif
 
-BAREBOX_DEPENDENCIES = host-lzop
-BAREBOX_LICENSE = GPLv2 with exceptions
-BAREBOX_LICENSE_FILES = COPYING
+$(1)_DEPENDENCIES = host-lzop
+$(1)_LICENSE = GPLv2 with exceptions
+$(1)_LICENSE_FILES = COPYING
 
 ifneq ($$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
-define BAREBOX_APPLY_CUSTOM_PATCHES
+define $(1)_APPLY_CUSTOM_PATCHES
 	$$(APPLY_PATCHES) $$(@D) \
 		$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
 endef
 
-BAREBOX_POST_PATCH_HOOKS += BAREBOX_APPLY_CUSTOM_PATCHES
+$(1)_POST_PATCH_HOOKS += $(1)_APPLY_CUSTOM_PATCHES
 endif
 
-BAREBOX_INSTALL_IMAGES = YES
-ifneq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-BAREBOX_INSTALL_TARGET = NO
+$(1)_INSTALL_IMAGES = YES
+ifneq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
+$(1)_INSTALL_TARGET = NO
 endif
 
 ifeq ($$(KERNEL_ARCH),i386)
-BAREBOX_ARCH = x86
+$(1)_ARCH = x86
 else ifeq ($$(KERNEL_ARCH),x86_64)
-BAREBOX_ARCH = x86
+$(1)_ARCH = x86
 else ifeq ($$(KERNEL_ARCH),powerpc)
-BAREBOX_ARCH = ppc
+$(1)_ARCH = ppc
 else
-BAREBOX_ARCH = $$(KERNEL_ARCH)
+$(1)_ARCH = $$(KERNEL_ARCH)
 endif
 
-BAREBOX_MAKE_FLAGS = ARCH=$$(BAREBOX_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
-BAREBOX_MAKE_ENV = $$(TARGET_MAKE_ENV)
+$(1)_MAKE_FLAGS = ARCH=$$($(1)_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
+$(1)_MAKE_ENV = $$(TARGET_MAKE_ENV)
 
-ifeq ($$(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
-BAREBOX_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
-else ifeq ($$(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
-BAREBOX_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
+ifeq ($$(BR2_TARGET_$(1)_USE_DEFCONFIG),y)
+$(1)_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))_defconfig
+else ifeq ($$(BR2_TARGET_$(1)_USE_CUSTOM_CONFIG),y)
+$(1)_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE))
 endif
 
-BAREBOX_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
-BAREBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
-BAREBOX_KCONFIG_OPTS = $$(BAREBOX_MAKE_FLAGS)
+$(1)_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_$(1)_CONFIG_FRAGMENT_FILES))
+$(1)_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
+$(1)_KCONFIG_OPTS = $$($(1)_MAKE_FLAGS)
 
-ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-define BAREBOX_BUILD_BAREBOXENV_CMDS
+ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
+define $(1)_BUILD_BAREBOXENV_CMDS
 	$$(TARGET_CC) $$(TARGET_CFLAGS) $$(TARGET_LDFLAGS) -o $$(@D)/bareboxenv \
 		$$(@D)/scripts/bareboxenv.c
 endef
 endif
 
-ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
-BAREBOX_ENV_NAME = $$(notdir $$(call qstrip,\
-	$$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
-define BAREBOX_BUILD_CUSTOM_ENV
+ifeq ($$(BR2_TARGET_$(1)_CUSTOM_ENV),y)
+$(1)_ENV_NAME = $$(notdir $$(call qstrip,\
+	$$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)))
+define $(1)_BUILD_CUSTOM_ENV
 	$$(@D)/scripts/bareboxenv -s \
-		$$(call qstrip, $$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
-		$$(@D)/$$(BAREBOX_ENV_NAME)
+		$$(call qstrip, $$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)) \
+		$$(@D)/$$($(1)_ENV_NAME)
 endef
-define BAREBOX_INSTALL_CUSTOM_ENV
-	cp $$(@D)/$$(BAREBOX_ENV_NAME) $$(BINARIES_DIR)
+define $(1)_INSTALL_CUSTOM_ENV
+	cp $$(@D)/$$($(1)_ENV_NAME) $$(BINARIES_DIR)
 endef
 endif
 
-define BAREBOX_BUILD_CMDS
-	$$(BAREBOX_BUILD_BAREBOXENV_CMDS)
-	$$(TARGET_MAKE_ENV) $$(MAKE) $$(BAREBOX_MAKE_FLAGS) -C $$(@D)
-	$$(BAREBOX_BUILD_CUSTOM_ENV)
+define $(1)_BUILD_CMDS
+	$$($(1)_BUILD_BAREBOXENV_CMDS)
+	$$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
+	$$($(1)_BUILD_CUSTOM_ENV)
 endef
 
-define BAREBOX_INSTALL_IMAGES_CMDS
-	if test -e $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp -L $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-		      $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
-	elif test -e $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-		cp $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-		   $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
+define $(1)_INSTALL_IMAGES_CMDS
+	if test -e $$(@D)/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)); then \
+		cp -L $$(@D)/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)) \
+		      $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE)) ; \
+	elif test -e $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)); then \
+		cp $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)) \
+		   $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE)) ; \
 	else \
-		echo "error: Specified built image file not found: $$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
+		echo "error: Specified built image file not found: $$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE))" >&2 ; \
 		echo "       in: $$(@D)/" >&2 ; \
 		echo "       or: $$(@D)/images/" >&2 ; \
-		echo "       Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting." >&2 ; \
+		echo "       Check your BR2_TARGET_$(1)_BUILT_IMAGE_FILE setting." >&2 ; \
 		exit 1 ; \
 	fi
-	$$(BAREBOX_INSTALL_CUSTOM_ENV)
+	$$($(1)_INSTALL_CUSTOM_ENV)
 endef
 
-ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-define BAREBOX_INSTALL_TARGET_CMDS
+ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
+define $(1)_INSTALL_TARGET_CMDS
 	cp $$(@D)/bareboxenv $$(TARGET_DIR)/usr/bin
 endef
 endif
 
 # Checks to give errors that the user can understand
 # Must be before we call to kconfig-package
-ifeq ($$(BR2_TARGET_BAREBOX)$$(BR_BUILDING),yy)
+ifeq ($$(BR2_TARGET_$(1))$$(BR_BUILDING),yy)
 # We must use the user-supplied kconfig value, because
-# BAREBOX_KCONFIG_DEFCONFIG will at least contain the
+# $(1)_KCONFIG_DEFCONFIG will at least contain the
 # trailing _defconfig
-ifeq ($$(or $$(BAREBOX_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
-$$(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
+ifeq ($$(or $$($(1)_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))),)
+$$(error No Barebox config. Check your BR2_TARGET_$(1)_BOARD_DEFCONFIG or BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE settings)
 endif
-ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
-$$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
+ifndef BR2_TARGET_$(1)_BUILT_IMAGE_FILE
+$$(error No barebox built image filename specified. Check your BR2_TARGET_$(1)_BUILT_IMAGE_FILE setting)
 endif
-ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
-$$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+ifndef BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE
+$$(error No barebox output image filename specified. Check your BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE setting)
 endif
 endif
 
@@ -146,7 +149,7 @@ endef
 # barebox-package -- the target generator macro for barebox packages
 ################################################################################
 
-barebox-package=$(call inner-barebox-package)
+barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname)))
 
 # instantiate this barebox package
 $(eval $(call barebox-package))
Signature · 1 line
2.5.0
#23 lore raw

PATCH v4 5/7 barebox: extract package name argument

Quoted 7 lines · Pieter Smith

No functional changes: Extracts an argument to the inner-barebox-package function to automatically determine the uppercase package name. This is needed to support a 2nd config build. This results in the following renaming:
'BAREBOX' -> '$(1)'

All barebox packages are meant to be built from the same sources, so related KConfig variables (origin, version and patch directory) are not extracted.

Kconfig

Quoted 2 lines
Quoted 226 lines
---
 boot/barebox/barebox.mk | 139 +++++++++++++++++++++++++-----------------------
 1 file changed, 71 insertions(+), 68 deletions(-)
boot/barebox/barebox.mk +71 -69
index d84c479..8892ab5 100644
@@ -7,135 +7,138 @@
 ################################################################################
 # inner-barebox-package -- generates the KConfig logic and make targets needed
 # to support a barebox package. All barebox packages are built from the same
-# source (origin, version and patches).
+# source (origin, version and patches). The remainder of the package
+# configuration is unique to each barebox package.
+#
+#  argument 1 is the uppercase package name (used for variable name-space)
 ################################################################################
 
 define inner-barebox-package
 
-BAREBOX_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
+$(1)_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
 
-ifeq ($$(BAREBOX_VERSION),custom)
+ifeq ($$($(1)_VERSION),custom)
 # Handle custom Barebox tarballs as specified by the configuration
-BAREBOX_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
-BAREBOX_SITE = $$(patsubst %/,%,$$(dir $$(BAREBOX_TARBALL)))
-BAREBOX_SOURCE = $$(notdir $$(BAREBOX_TARBALL))
-BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
+$(1)_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
+$(1)_SITE = $$(patsubst %/,%,$$(dir $$($(1)_TARBALL)))
+$(1)_SOURCE = $$(notdir $$($(1)_TARBALL))
+BR_NO_CHECK_HASH_FOR += $$($(1)_SOURCE)
 else ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
-BAREBOX_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
-BAREBOX_SITE_METHOD = git
+$(1)_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
+$(1)_SITE_METHOD = git
 else
 # Handle stable official Barebox versions
-BAREBOX_SOURCE = barebox-$$(BAREBOX_VERSION).tar.bz2
-BAREBOX_SITE = http://www.barebox.org/download
+$(1)_SOURCE = barebox-$$($(1)_VERSION).tar.bz2
+$(1)_SITE = http://www.barebox.org/download
 ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_VERSION),y)
-BR_NO_CHECK_HASH_FOR += $$(BAREBOX_SOURCE)
+BR_NO_CHECK_HASH_FOR += $$($(1)_SOURCE)
 endif
 endif
 
-BAREBOX_DEPENDENCIES = host-lzop
-BAREBOX_LICENSE = GPLv2 with exceptions
-BAREBOX_LICENSE_FILES = COPYING
+$(1)_DEPENDENCIES = host-lzop
+$(1)_LICENSE = GPLv2 with exceptions
+$(1)_LICENSE_FILES = COPYING
 
 ifneq ($$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
-define BAREBOX_APPLY_CUSTOM_PATCHES
+define $(1)_APPLY_CUSTOM_PATCHES
        $$(APPLY_PATCHES) $$(@D) \
                $$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
 endef
 
-BAREBOX_POST_PATCH_HOOKS += BAREBOX_APPLY_CUSTOM_PATCHES
+$(1)_POST_PATCH_HOOKS += $(1)_APPLY_CUSTOM_PATCHES
 endif
 
-BAREBOX_INSTALL_IMAGES = YES
-ifneq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-BAREBOX_INSTALL_TARGET = NO
+$(1)_INSTALL_IMAGES = YES
+ifneq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
+$(1)_INSTALL_TARGET = NO
 endif
 
 ifeq ($$(KERNEL_ARCH),i386)
-BAREBOX_ARCH = x86
+$(1)_ARCH = x86
 else ifeq ($$(KERNEL_ARCH),x86_64)
-BAREBOX_ARCH = x86
+$(1)_ARCH = x86
 else ifeq ($$(KERNEL_ARCH),powerpc)
-BAREBOX_ARCH = ppc
+$(1)_ARCH = ppc
 else
-BAREBOX_ARCH = $$(KERNEL_ARCH)
+$(1)_ARCH = $$(KERNEL_ARCH)
 endif
 
-BAREBOX_MAKE_FLAGS = ARCH=$$(BAREBOX_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
-BAREBOX_MAKE_ENV = $$(TARGET_MAKE_ENV)
+$(1)_MAKE_FLAGS = ARCH=$$($(1)_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
+$(1)_MAKE_ENV = $$(TARGET_MAKE_ENV)
 
-ifeq ($$(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
-BAREBOX_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
-else ifeq ($$(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
-BAREBOX_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
+ifeq ($$(BR2_TARGET_$(1)_USE_DEFCONFIG),y)
+$(1)_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))_defconfig
+else ifeq ($$(BR2_TARGET_$(1)_USE_CUSTOM_CONFIG),y)
+$(1)_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE))
 endif
 
-BAREBOX_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
-BAREBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
-BAREBOX_KCONFIG_OPTS = $$(BAREBOX_MAKE_FLAGS)
+$(1)_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_$(1)_CONFIG_FRAGMENT_FILES))
+$(1)_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
+$(1)_KCONFIG_OPTS = $$($(1)_MAKE_FLAGS)
 
-ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-define BAREBOX_BUILD_BAREBOXENV_CMDS
+ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
+define $(1)_BUILD_BAREBOXENV_CMDS
        $$(TARGET_CC) $$(TARGET_CFLAGS) $$(TARGET_LDFLAGS) -o $$(@D)/bareboxenv \
                $$(@D)/scripts/bareboxenv.c
 endef
 endif
 
-ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_ENV),y)
-BAREBOX_ENV_NAME = $$(notdir $$(call qstrip,\
-       $$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
-define BAREBOX_BUILD_CUSTOM_ENV
+ifeq ($$(BR2_TARGET_$(1)_CUSTOM_ENV),y)
+$(1)_ENV_NAME = $$(notdir $$(call qstrip,\
+       $$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)))
+define $(1)_BUILD_CUSTOM_ENV
        $$(@D)/scripts/bareboxenv -s \
-               $$(call qstrip, $$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
-               $$(@D)/$$(BAREBOX_ENV_NAME)
+               $$(call qstrip, $$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)) \
+               $$(@D)/$$($(1)_ENV_NAME)
 endef
-define BAREBOX_INSTALL_CUSTOM_ENV
-       cp $$(@D)/$$(BAREBOX_ENV_NAME) $$(BINARIES_DIR)
+define $(1)_INSTALL_CUSTOM_ENV
+       cp $$(@D)/$$($(1)_ENV_NAME) $$(BINARIES_DIR)
 endef
 endif
 
-define BAREBOX_BUILD_CMDS
-       $$(BAREBOX_BUILD_BAREBOXENV_CMDS)
-       $$(TARGET_MAKE_ENV) $$(MAKE) $$(BAREBOX_MAKE_FLAGS) -C $$(@D)
-       $$(BAREBOX_BUILD_CUSTOM_ENV)
+define $(1)_BUILD_CMDS
+       $$($(1)_BUILD_BAREBOXENV_CMDS)
+       $$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
+       $$($(1)_BUILD_CUSTOM_ENV)
 endef
 
-define BAREBOX_INSTALL_IMAGES_CMDS
-       if test -e $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-               cp -L $$(@D)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-                     $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
-       elif test -e $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)); then \
-               cp $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE)) \
-                  $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE)) ; \
+define $(1)_INSTALL_IMAGES_CMDS
+       if test -e $$(@D)/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)); then \
+               cp -L $$(@D)/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)) \
+                     $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE)) ; \
+       elif test -e $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)); then \
+               cp $$(@D)/images/$$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE)) \
+                  $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE)) ; \
        else \
-               echo "error: Specified built image file not found: $$(call qstrip,$$(BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE))" >&2 ; \
+               echo "error: Specified built image file not found: $$(call qstrip,$$(BR2_TARGET_$(1)_BUILT_IMAGE_FILE))" >&2 ; \
                echo "       in: $$(@D)/" >&2 ; \
                echo "       or: $$(@D)/images/" >&2 ; \
-               echo "       Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting." >&2 ; \
+               echo "       Check your BR2_TARGET_$(1)_BUILT_IMAGE_FILE setting." >&2 ; \
                exit 1 ; \
        fi
-       $$(BAREBOX_INSTALL_CUSTOM_ENV)
+       $$($(1)_INSTALL_CUSTOM_ENV)
 endef
 
-ifeq ($$(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-define BAREBOX_INSTALL_TARGET_CMDS
+ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
+define $(1)_INSTALL_TARGET_CMDS
        cp $$(@D)/bareboxenv $$(TARGET_DIR)/usr/bin
 endef
 endif
 
 # Checks to give errors that the user can understand
 # Must be before we call to kconfig-package
-ifeq ($$(BR2_TARGET_BAREBOX)$$(BR_BUILDING),yy)
+ifeq ($$(BR2_TARGET_$(1))$$(BR_BUILDING),yy)
 # We must use the user-supplied kconfig value, because
-# BAREBOX_KCONFIG_DEFCONFIG will at least contain the
+# $(1)_KCONFIG_DEFCONFIG will at least contain the
 # trailing _defconfig
-ifeq ($$(or $$(BAREBOX_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))),)
-$$(error No Barebox config. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
+ifeq ($$(or $$($(1)_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))),)
+$$(error No Barebox config. Check your BR2_TARGET_$(1)_BOARD_DEFCONFIG or BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE settings)
 endif
-ifndef BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE
-$$(error No barebox built image filename specified. Check your BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE setting)
+ifndef BR2_TARGET_$(1)_BUILT_IMAGE_FILE
+$$(error No barebox built image filename specified. Check your BR2_TARGET_$(1)_BUILT_IMAGE_FILE setting)
 endif
-ifndef BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE
-$$(error No barebox output image filename specified. Check your BR2_TARGET_BAREBOX_OUTPUT_IMAGE_FILE setting)
+ifndef BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE
+$$(error No barebox output image filename specified. Check your BR2_TARGET_$(1)_OUTPUT_IMAGE_FILE setting)
 endif
 endif
 
@@ -146,7 +149,7 @@ endef
 # barebox-package -- the target generator macro for barebox packages
 ################################################################################
 
-barebox-package=$(call inner-barebox-package)
+barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname)))
 
 # instantiate this barebox package
 $(eval $(call barebox-package))
--

2.5.0

#24 lore raw

PATCH v4 5/7 barebox: extract package name argument

In reply to Pieter Smith
Quoted 7 lines · Pieter Smith

No functional changes: Extracts an argument to the inner-barebox-package function to automatically determine the uppercase package name. This is needed to support a 2nd config build. This results in the following renaming:

   'BAREBOX' -> '$(1)'

All barebox packages are meant to be built from the same sources, so related KConfig variables (origin, version and patch directory) are not extracted.

The first paragraph of the commit message makes it sound as if all BAREBOX
instances are replaced with $(1), which is not true (as clarified by the second paragraph). But I don't see how to formulate it better, so:

Quoted 2 lines

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#25 lore raw

PATCH v4 6/7 barebox: support 2nd config build

In reply to Pieter Smith

Adds support to build barebox with a 2nd config.

This is useful for building an SPL (Secondary Program Loader) in addition to the traditional TPL (Tertiary Program Loader). The Beaglebone Black for example has two barebox configurations:
- am335x_defconfig builds the full barebox bootloader with device tree, and
- am335x_mlo_defconfig builds the smaller MLO bootloader that loads the full barebox bootloader from the eMMC or SD card.

---
 boot/barebox/Config.in                |  2 +
 boot/barebox/barebox-2/Config.in      | 79 +++++++++++++++++++++++++++++++++++
 boot/barebox/barebox-2/barebox-2.hash |  1 +
 boot/barebox/barebox-2/barebox-2.mk   |  9 ++++
 boot/barebox/barebox.mk               |  3 ++
 5 files changed, 94 insertions(+)
 create mode 100644 boot/barebox/barebox-2/Config.in
 create mode 120000 boot/barebox/barebox-2/barebox-2.hash
 create mode 100644 boot/barebox/barebox-2/barebox-2.mk
boot/barebox/Config.in +2 -0
index 7769866..e92cdc3 100644
@@ -137,4 +137,6 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
 	  barebox devfs format, stored in the images directory, with
 	  the same name as the directory name given here.
 
+source boot/barebox/barebox-2/Config.in
+
 endif
boot/barebox/barebox-2/Config.in new file +79 -0

79 lines not on this page · raw message

boot/barebox/barebox-2/barebox-2.hash new file +1 -0
new file mode 120000
index 0000000..b6462b8
@@ -0,0 +1 @@
+../barebox.hash
\ No newline at end of file
boot/barebox/barebox-2/barebox-2.mk new file +9 -0
new file mode 100644
index 0000000..7a88f93
@@ -0,0 +1,9 @@
+################################################################################
+#
+# barebox-2
+#
+################################################################################
+
+# Instantiate a 2nd barebox package, built from the same sources as the 1st,
+# but with it's own configuration:
+$(eval $(call barebox-package))
boot/barebox/barebox.mk +3 -0
index 8892ab5..71eb33a 100644
@@ -153,3 +153,6 @@ barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname)))
 
 # instantiate this barebox package
 $(eval $(call barebox-package))
+
+# add the 2nd barebox package build
+include boot/barebox/barebox-2/barebox-2.mk
Signature · 1 line
2.5.0
#26 lore raw

PATCH v4 6/7 barebox: support 2nd config build

Quoted 10 lines · Pieter Smith

Adds support to build barebox with a 2nd config.

This is useful for building an SPL (Secondary Program Loader) in addition to the traditional TPL (Tertiary Program Loader). The Beaglebone Black for example has two barebox configurations:
- am335x_defconfig builds the full barebox bootloader with device tree, and
- am335x_mlo_defconfig builds the smaller MLO bootloader that loads the full barebox bootloader from the eMMC or SD card.

Quoted 144 lines
---
 boot/barebox/Config.in                |  2 +
 boot/barebox/barebox-2/Config.in      | 79 +++++++++++++++++++++++++++++++++++
 boot/barebox/barebox-2/barebox-2.hash |  1 +
 boot/barebox/barebox-2/barebox-2.mk   |  9 ++++
 boot/barebox/barebox.mk               |  3 ++
 5 files changed, 94 insertions(+)
 create mode 100644 boot/barebox/barebox-2/Config.in
 create mode 120000 boot/barebox/barebox-2/barebox-2.hash
 create mode 100644 boot/barebox/barebox-2/barebox-2.mk
boot/barebox/Config.in +2 -0
index 7769866..e92cdc3 100644
@@ -137,4 +137,6 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
          barebox devfs format, stored in the images directory, with
          the same name as the directory name given here.
 
+source boot/barebox/barebox-2/Config.in
+
 endif
boot/barebox/barebox-2/Config.in new file +79 -0
new file mode 100644
index 0000000..5bd8347
@@ -0,0 +1,79 @@
+menuconfig BR2_TARGET_BAREBOX_2
+       bool "Build barebox with a 2nd config"
+       help
+         Build barebox with a 2nd configuration.
+
+         Useful for building an SPL (Secondary Program Loader) in addition to
+         the traditional TPL (Tertiary Program Loader), such as the X-Loader
+         or MLO for Texas Instruments processors.
+
+if BR2_TARGET_BAREBOX_2
+
+choice
+       prompt "Barebox configuration"
+       default BR2_TARGET_BAREBOX_2_USE_DEFCONFIG
+
+config BR2_TARGET_BAREBOX_2_USE_DEFCONFIG
+       bool "Using a defconfig"
+
+config BR2_TARGET_BAREBOX_2_USE_CUSTOM_CONFIG
+       bool "Using a custom config file"
+
+endchoice
+
+config BR2_TARGET_BAREBOX_2_BOARD_DEFCONFIG
+       string "board defconfig"
+       depends on BR2_TARGET_BAREBOX_2_USE_DEFCONFIG
+       help
+         Name of the board for which Barebox should be built, without
+         the _defconfig suffix.
+
+
+config BR2_TARGET_BAREBOX_2_CUSTOM_CONFIG_FILE
+       string "Configuration file path"
+       depends on BR2_TARGET_BAREBOX_2_USE_CUSTOM_CONFIG
+       help
+         Path to the barebox configuration file
+
+config BR2_TARGET_BAREBOX_2_CONFIG_FRAGMENT_FILES
+       string "Additional configuration fragment files"
+       help
+         A space-separated list of configuration fragment files,
+         that will be merged to the main Barebox configuration file.
+
+config BR2_TARGET_BAREBOX_2_BUILT_IMAGE_FILE
+       string "Built image filename"
+       default "barebox-flash-image"
+       help
+         Name of the built barebox image filename in the barebox build or
+         build images directory.
+
+         Set to barebox.bin for barebox versions older than 2012.10.
+
+config BR2_TARGET_BAREBOX_2_OUTPUT_IMAGE_FILE
+       string "Output image filename"
+       default "barebox-2.bin"
+       help
+         Name to use when copying the barebox image to the output/images
+         directory.
+
+config BR2_TARGET_BAREBOX_2_CUSTOM_ENV
+       bool "Generate an environment image"
+       help
+         Generate a custom environment image. This environment will
+         contain the variables and scripts to be used at boot by
+         barebox.
+
+config BR2_TARGET_BAREBOX_2_CUSTOM_ENV_PATH
+       string "Environment path"
+       depends on BR2_TARGET_BAREBOX_2_CUSTOM_ENV
+       help
+         Path to the directory containing the custom barebox
+         environment. Depending on your setup, it will probably be
+         based on either the content of the defaultenv or
+         defaultenv-2 directories in the barebox source code, plus
+         the additions needed. The output will be an image in the
+         barebox devfs format, stored in the images directory, with
+         the same name as the directory name given here.
+
+endif
boot/barebox/barebox-2/barebox-2.hash new file +1 -0
new file mode 120000
index 0000000..b6462b8
@@ -0,0 +1 @@
+../barebox.hash
\ No newline at end of file
boot/barebox/barebox-2/barebox-2.mk new file +9 -0
new file mode 100644
index 0000000..7a88f93
@@ -0,0 +1,9 @@
+################################################################################
+#
+# barebox-2
+#
+################################################################################
+
+# Instantiate a 2nd barebox package, built from the same sources as the 1st,
+# but with it's own configuration:
+$(eval $(call barebox-package))
boot/barebox/barebox.mk +3 -1
index 8892ab5..71eb33a 100644
@@ -153,3 +153,6 @@ barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname)))
 
 # instantiate this barebox package
 $(eval $(call barebox-package))
+
+# add the 2nd barebox package build
+include boot/barebox/barebox-2/barebox-2.mk
--

2.5.0

#27 lore raw

PATCH v4 6/7 barebox: support 2nd config build

In reply to Pieter Smith
Quoted 10 lines · Pieter Smith

Adds support to build barebox with a 2nd config.

This is useful for building an SPL (Secondary Program Loader) in addition to the traditional TPL (Tertiary Program Loader). The Beaglebone Black for example has two barebox configurations:
- am335x_defconfig builds the full barebox bootloader with device tree, and
- am335x_mlo_defconfig builds the smaller MLO bootloader that loads the full barebox bootloader from the eMMC or SD card.

Looks good to me, except for the comments I made for barebox-1:

- BR2_TARGET_BAREBOX_2_BUILT_IMAGE_FILE name+prompt;

- BR2_TARGET_BAREBOX_2_OUTPUT_IMAGE_FILE name or maybe remove;

- Redundant $(call ...)

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#28 lore raw

PATCH v4 6/7 barebox: support 2nd config build

Hi Arnout,

Quoted 12 lines · Arnout Vandecappelle
Quoted 10 lines · Pieter Smith

Adds support to build barebox with a 2nd config.

This is useful for building an SPL (Secondary Program Loader) in addition to the traditional TPL (Tertiary Program Loader). The Beaglebone Black for example has two barebox configurations:
- am335x_defconfig builds the full barebox bootloader with device tree, and
- am335x_mlo_defconfig builds the smaller MLO bootloader that loads the full barebox bootloader from the eMMC or SD card.

Quoted 7 lines

Looks good to me, except for the comments I made for barebox-1:

- BR2_TARGET_BAREBOX_2_BUILT_IMAGE_FILE name+prompt;

- BR2_TARGET_BAREBOX_2_OUTPUT_IMAGE_FILE name or maybe remove;

- Redundant $(call ...)

All three are resolved in patch v5.

[snip]

Regards,
Pieter

#29 lore raw

PATCH v4 7/7 beaglebone: adds barebox bootloader defconfig

In reply to Pieter Smith

* Builds the barebox MLO and bootloader.
* Generates a barebox environment that boots from eMMC by default.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.

---
 board/beaglebone/barebox.env/boot/sd      |  6 +++++
 board/beaglebone/barebox.env/config-board |  4 +++
 configs/beaglebone_barebox_defconfig      | 41 +++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 board/beaglebone/barebox.env/boot/sd
 create mode 100644 board/beaglebone/barebox.env/config-board
 create mode 100644 configs/beaglebone_barebox_defconfig
board/beaglebone/barebox.env/boot/sd new file +6 -0
new file mode 100644
index 0000000..7a80e29
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+global.bootm.image=/boot/zImage
+#global.bootm.oftree=/boot/oftree
+#global.bootm.initrd=<path to initrd>
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext2 rootwait"
board/beaglebone/barebox.env/config-board new file +4 -0
new file mode 100644
index 0000000..cd7b26d
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+global.boot.default=sd
+
configs/beaglebone_barebox_defconfig new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.5.0
#30 lore raw

PATCH v4 7/7 beaglebone: adds barebox bootloader defconfig

Quoted 6 lines · Pieter Smith

* Builds the barebox MLO and bootloader.
* Generates a barebox environment that boots from eMMC by default.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.

Quoted 81 lines
---
 board/beaglebone/barebox.env/boot/sd      |  6 +++++
 board/beaglebone/barebox.env/config-board |  4 +++
 configs/beaglebone_barebox_defconfig      | 41 +++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 board/beaglebone/barebox.env/boot/sd
 create mode 100644 board/beaglebone/barebox.env/config-board
 create mode 100644 configs/beaglebone_barebox_defconfig
board/beaglebone/barebox.env/boot/sd new file +6 -0
new file mode 100644
index 0000000..7a80e29
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+global.bootm.image=/boot/zImage
+#global.bootm.oftree=/boot/oftree
+#global.bootm.initrd=<path to initrd>
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext2 rootwait"
board/beaglebone/barebox.env/config-board new file +4 -0
new file mode 100644
index 0000000..cd7b26d
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+global.boot.default=sd
+
configs/beaglebone_barebox_defconfig new file +41 -1
new file mode 100644
index 0000000..6324dbf
@@ -0,0 +1,41 @@
+# architecture
+BR2_arm=y
+BR2_cortex_a8=y
+BR2_ARM_EABIHF=y
+
+# system
+BR2_TARGET_GENERIC_HOSTNAME="beaglebone"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyO0"
+# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
+# BR2_ROOTFS_POST_IMAGE_SCRIPT is not set
+
+# filesystem
+BR2_PACKAGE_AM33X_CM3=y
+BR2_TARGET_ROOTFS_EXT2=y
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Linux headers same as kernel, a 4.4 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y
+
+# bootloader
+BR2_TARGET_BAREBOX=y
+BR2_TARGET_BAREBOX_BOARD_DEFCONFIG="am335x"
+BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE="barebox-am33xx-beaglebone.img"
+BR2_TARGET_BAREBOX_CUSTOM_ENV=y
+BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH="board/beaglebone/barebox.env"
+BR2_TARGET_BAREBOX_2=y
+BR2_TARGET_BAREBOX_2_BOARD_DEFCONFIG="am335x_mlo"
+BR2_TARGET_BAREBOX_2_BUILT_IMAGE_FILE="barebox-am33xx-beaglebone-mlo.img"
+BR2_TARGET_BAREBOX_2_OUTPUT_IMAGE_FILE="MLO"
+
+# kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.4.6"
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
+BR2_LINUX_KERNEL_DEFCONFIG="omap2plus"
+BR2_LINUX_KERNEL_ZIMAGE=y
+
+# Use the barebox built-in dtb
+# BR2_LINUX_KERNEL_DTS_SUPPORT is not set
--

2.5.0

#31 lore raw

PATCH v4 7/7 beaglebone: adds barebox bootloader defconfig

In reply to Pieter Smith
Quoted 21 lines · Pieter Smith

* Builds the barebox MLO and bootloader.
* Generates a barebox environment that boots from eMMC by default.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.

---
  board/beaglebone/barebox.env/boot/sd      |  6 +++++
  board/beaglebone/barebox.env/config-board |  4 +++
  configs/beaglebone_barebox_defconfig      | 41 +++++++++++++++++++++++++++++++
  3 files changed, 51 insertions(+)

create mode 100644 board/beaglebone/barebox.env/boot/sd create mode 100644 board/beaglebone/barebox.env/config-board create mode 100644 configs/beaglebone_barebox_defconfig

board/beaglebone/barebox.env/boot/sd new file +0 -0
new file mode 100644
index 0000000..7a80e29

board/beaglebone/barebox.env/boot/sd line 1

Quoted 1 line
board/beaglebone/barebox.env/boot/sd new file +1 -0
@@ -0,0 +1,6 @@
+#!/bin/sh

Is that needed/useful?

board/beaglebone/barebox.env/boot/sd line 4

Quoted 3 lines
board/beaglebone/barebox.env/boot/sd new file +3 -0
+
+global.bootm.image=/boot/zImage
+#global.bootm.oftree=/boot/oftree

Maybe repeat here the comment about using the built-in DT.

board/beaglebone/barebox.env/boot/sd line 5

Quoted 1 line
board/beaglebone/barebox.env/boot/sd new file +1 -0
+#global.bootm.initrd=<path to initrd>

I would remove this line, it's not very useful.

Quoted 17 lines
board/beaglebone/barebox.env/boot/sd new file +1 -0
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext2 rootwait"
board/beaglebone/barebox.env/config-board new file +4 -0
new file mode 100644
index 0000000..cd7b26d
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+global.boot.default=sd
+
configs/beaglebone_barebox_defconfig new file +0 -0
new file mode 100644
index 0000000..6324dbf

configs/beaglebone_barebox_defconfig line 9

Quoted 9 lines
configs/beaglebone_barebox_defconfig new file +9 -0
@@ -0,0 +1,41 @@
+# architecture
+BR2_arm=y
+BR2_cortex_a8=y
+BR2_ARM_EABIHF=y
+
+# system
+BR2_TARGET_GENERIC_HOSTNAME="beaglebone"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyO0"

Does the default (console) not work well?

configs/beaglebone_barebox_defconfig line 10

Quoted 1 line
configs/beaglebone_barebox_defconfig new file +1 -0
+# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set

Why?

configs/beaglebone_barebox_defconfig line 11

Quoted 1 line
configs/beaglebone_barebox_defconfig new file +1 -0
+# BR2_ROOTFS_POST_IMAGE_SCRIPT is not set

This is the default. However, it would be nice if you could add a genimage
script. Pandaboard should be a good basis.

configs/beaglebone_barebox_defconfig line 15

Quoted 4 lines
configs/beaglebone_barebox_defconfig new file +4 -0
+
+# filesystem
+BR2_PACKAGE_AM33X_CM3=y
+BR2_TARGET_ROOTFS_EXT2=y

We tend to prefer ext4 nowadays.

configs/beaglebone_barebox_defconfig line 19

Quoted 4 lines
configs/beaglebone_barebox_defconfig new file +4 -0
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Linux headers same as kernel, a 4.4 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y

The version should be really locked down, i.e.:

BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.4.6"

Quoted 6 lines
configs/beaglebone_barebox_defconfig new file +6 -0
+
+# bootloader
+BR2_TARGET_BAREBOX=y
+BR2_TARGET_BAREBOX_BOARD_DEFCONFIG="am335x"
+BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE="barebox-am33xx-beaglebone.img"
+BR2_TARGET_BAREBOX_CUSTOM_ENV=y

configs/beaglebone_barebox_defconfig line 35

Quoted 10 lines
configs/beaglebone_barebox_defconfig new file +10 -0
+BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH="board/beaglebone/barebox.env"
+BR2_TARGET_BAREBOX_2=y
+BR2_TARGET_BAREBOX_2_BOARD_DEFCONFIG="am335x_mlo"
+BR2_TARGET_BAREBOX_2_BUILT_IMAGE_FILE="barebox-am33xx-beaglebone-mlo.img"
+BR2_TARGET_BAREBOX_2_OUTPUT_IMAGE_FILE="MLO"
+
+# kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.4.6"

Maybe you can switch to 4.5 already?

configs/beaglebone_barebox_defconfig line 41

Quoted 6 lines
configs/beaglebone_barebox_defconfig new file +6 -0
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
+BR2_LINUX_KERNEL_DEFCONFIG="omap2plus"
+BR2_LINUX_KERNEL_ZIMAGE=y
+
+# Use the barebox built-in dtb
+# BR2_LINUX_KERNEL_DTS_SUPPORT is not set

Good to put this here!

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#32 lore raw

PATCH v4 7/7 beaglebone: adds barebox bootloader defconfig

Quoted 16 lines · Arnout Vandecappelle
Quoted 15 lines · Pieter Smith

* Builds the barebox MLO and bootloader.
* Generates a barebox environment that boots from eMMC by default.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.

---
 board/beaglebone/barebox.env/boot/sd      |  6 +++++
 board/beaglebone/barebox.env/config-board |  4 +++
 configs/beaglebone_barebox_defconfig      | 41 +++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 board/beaglebone/barebox.env/boot/sd
 create mode 100644 board/beaglebone/barebox.env/config-board
 create mode 100644 configs/beaglebone_barebox_defconfig
Quoted 9 lines

board/beaglebone/barebox.env/boot/sd line 1

Quoted 7 lines
board/beaglebone/barebox.env/boot/sd new file +1 -0
new file mode 100644
index 0000000..7a80e29
@@ -0,0 +1,6 @@
+#!/bin/sh

Is that needed/useful?

If you are referring to the interpreter specification: I suspect no, but all barebox scripts in barebox specify the interpreter, so I would like not to stray from the convention.

If you are referring to the presence of the sd script: Yes. The device name needs to be changed from the default to work with the Beaglebone.

Quoted 5 lines

board/beaglebone/barebox.env/boot/sd line 4

Quoted 3 lines
board/beaglebone/barebox.env/boot/sd new file +3 -0
+
+global.bootm.image=/boot/zImage
+#global.bootm.oftree=/boot/oftree

Maybe repeat here the comment about using the built-in DT.

ACK. Will be in v5 of the patch-set. I will not be removing the commented lines though. The convention is to leave these in so that the user can tune them if he wants something different.

Quoted 3 lines

board/beaglebone/barebox.env/boot/sd line 5

Quoted 1 line
board/beaglebone/barebox.env/boot/sd new file +1 -0
+#global.bootm.initrd=<path to initrd>

I would remove this line, it's not very useful.

These are kept in the scripts for a reason. These scripts are left as placeholders for easy tuning by the user. I also decided to retain this because it is present in the defaults included with barebox. If you feel strongly about this, I can remove it, but I would prefer to keep it in.

[snip]

Quoted 6 lines

board/beaglebone/barebox.env/boot/sd

Quoted 4 lines
board/beaglebone/barebox.env/boot/sd new file +4 -0
+# system
+BR2_TARGET_GENERIC_HOSTNAME="beaglebone"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyO0"

Does the default (console) not work well?

I inherited this from the beaglebone_defconfig. I know that the beaglebone uses a different serial port for the console than the Phytec am33xx modules (the default for the BSP), so I am quite sure this is necessary.

Quoted 3 lines
Quoted 1 line

+# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set

Why?

Again... Inherited from beaglebone_defconfig. I see no need to stick to this. Will be RW in v5 of the patch-set.

Quoted 4 lines
Quoted 1 line

+# BR2_ROOTFS_POST_IMAGE_SCRIPT is not set

This is the default. However, it would be nice if you could add a genimage
script. Pandaboard should be a good basis.

ACK. Will be in v5 of the patch-set as per the discussion on "[PATCH v4 3/7]
barebox: support custom barebox output image name"

Quoted 6 lines

board/beaglebone/barebox.env/boot/sd

Quoted 4 lines
board/beaglebone/barebox.env/boot/sd new file +4 -0
+
+# filesystem
+BR2_PACKAGE_AM33X_CM3=y
+BR2_TARGET_ROOTFS_EXT2=y

We tend to prefer ext4 nowadays.

ACK. Will be ext4 in v5 of the patch-set.

Quoted 9 lines

board/beaglebone/barebox.env/boot/sd

Quoted 4 lines
board/beaglebone/barebox.env/boot/sd new file +4 -0
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Linux headers same as kernel, a 4.4 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y

The version should be really locked down, i.e.:

BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.4.6"

ACK. Will be locked down in v5 of the patch-set.

[snip]

Quoted 6 lines

board/beaglebone/barebox.env/boot/sd

Quoted 4 lines
board/beaglebone/barebox.env/boot/sd new file +4 -0
+# kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.4.6"

Maybe you can switch to 4.5 already?

ACK. Will verify and change if nothing breaks.

Quoted 8 lines

board/beaglebone/barebox.env/boot/sd

Quoted 6 lines
board/beaglebone/barebox.env/boot/sd new file +6 -0
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
+BR2_LINUX_KERNEL_DEFCONFIG="omap2plus"
+BR2_LINUX_KERNEL_ZIMAGE=y
+
+# Use the barebox built-in dtb
+# BR2_LINUX_KERNEL_DTS_SUPPORT is not set

Good to put this here!

As per your recommendation on v4 of the patch-set.

[snip]

- Pieter

#33 lore raw

PATCH v4 7/7 beaglebone: adds barebox bootloader defconfig

Quoted 27 lines · Pieter Smith
Quoted 16 lines · Arnout Vandecappelle
Quoted 15 lines · Pieter Smith

* Builds the barebox MLO and bootloader.
* Generates a barebox environment that boots from eMMC by default.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.

---
  board/beaglebone/barebox.env/boot/sd      |  6 +++++
  board/beaglebone/barebox.env/config-board |  4 +++
  configs/beaglebone_barebox_defconfig      | 41 +++++++++++++++++++++++++++++++
  3 files changed, 51 insertions(+)

create mode 100644 board/beaglebone/barebox.env/boot/sd create mode 100644 board/beaglebone/barebox.env/config-board create mode 100644 configs/beaglebone_barebox_defconfig

Quoted 9 lines

board/beaglebone/barebox.env/boot/sd line 1

Quoted 7 lines
board/beaglebone/barebox.env/boot/sd new file +1 -0
new file mode 100644
index 0000000..7a80e29
@@ -0,0 +1,6 @@
+#!/bin/sh

Is that needed/useful?

Quoted 3 lines

If you are referring to the interpreter specification: I suspect no, but all barebox scripts in barebox specify the interpreter, so I would like not to stray from the convention.

That's what I meant. So ok.

Quoted 10 lines

If you are referring to the presence of the sd script: Yes. The device name needs to be changed from the default to work with the Beaglebone.

Quoted 5 lines

board/beaglebone/barebox.env/boot/sd line 4

Quoted 3 lines
board/beaglebone/barebox.env/boot/sd new file +3 -0
+
+global.bootm.image=/boot/zImage
+#global.bootm.oftree=/boot/oftree

Maybe repeat here the comment about using the built-in DT.

Quoted 3 lines

ACK. Will be in v5 of the patch-set. I will not be removing the commented lines though. The convention is to leave these in so that the user can tune them if he wants something different.

ok.

Quoted 9 lines
Quoted 4 lines

board/beaglebone/barebox.env/boot/sd line 5

Quoted 2 lines
board/beaglebone/barebox.env/boot/sd new file +1 -0
+#global.bootm.initrd=<path to initrd>

I would remove this line, it's not very useful.

These are kept in the scripts for a reason. These scripts are left as placeholders for easy tuning by the user. I also decided to retain this because it is present in the defaults included with barebox. If you feel strongly about this, I can remove it, but I would prefer to keep it in.

ok.

Quoted 10 lines

[snip]

Quoted 6 lines

board/beaglebone/barebox.env/boot/sd

Quoted 4 lines
board/beaglebone/barebox.env/boot/sd new file +4 -0
+# system
+BR2_TARGET_GENERIC_HOSTNAME="beaglebone"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyO0"

Does the default (console) not work well?

Quoted 3 lines

I inherited this from the beaglebone_defconfig. I know that the beaglebone uses a different serial port for the console than the Phytec am33xx modules (the default for the BSP), so I am quite sure this is necessary.

The serial port is already set in the barebox config, and is already passed on
the kernel command line, so there shouldn't be a need to set it explicitly again in the buildroot config. The default getty port is 'console', which means to use the kernel console as getty port. In most cases that's what you want.

The beaglebone defconfig still had an explicit getty port because it is still
from the time that the default getty port was tty1.

So, ideally, please test that it still works without this line. But since you
don't have a working beaglebone at the moment that will be tough...

[snip]

Quoted 6 lines
Quoted 4 lines

board/beaglebone/barebox.env/boot/sd

Quoted 2 lines
board/beaglebone/barebox.env/boot/sd new file +2 -0
+# Use the barebox built-in dtb
+# BR2_LINUX_KERNEL_DTS_SUPPORT is not set

Good to put this here!

As per your recommendation on v4 of the patch-set.

I'm so great :-)

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#34 lore raw

PATCH v4 7/7 beaglebone: adds barebox bootloader defconfig

Hi Arnout,

Quoted 3 lines · Arnout Vandecappelle
Quoted 2 lines · Pieter Smith
Quoted 1 line · Arnout Vandecappelle

On 03/20/16 23:35, Pieter Smith wrote:

[snip]

Quoted 14 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+BR2_TARGET_GENERIC_GETTY_PORT="ttyO0"

Does the default (console) not work well?

I inherited this from the beaglebone_defconfig. I know that the beaglebone uses a different serial port for the console than the Phytec am33xx modules (the default for the BSP), so I am quite sure this is necessary.

The serial port is already set in the barebox config, and is already passed
on the kernel command line, so there shouldn't be a need to set it explicitly again in the buildroot config. The default getty port is 'console', which means to use the kernel console as getty port. In most cases that's what you want.

Quoted 5 lines

The beaglebone defconfig still had an explicit getty port because it is
still from the time that the default getty port was tty1.

So, ideally, please test that it still works without this line. But since
you don't have a working beaglebone at the moment that will be tough...

Tested and it works. Will be gone in patch v5.

Quoted 9 lines

[snip]

Quoted 6 lines
Quoted 4 lines

configs/beaglebone_barebox_defconfig line 41

Quoted 2 lines
configs/beaglebone_barebox_defconfig new file +2 -0
+# Use the barebox built-in dtb
+# BR2_LINUX_KERNEL_DTS_SUPPORT is not set

Good to put this here!

As per your recommendation on v4 of the patch-set.

I'm so great :-)

Smile once a while when you look down on us mere mortals ;-)

[snip]

- Pieter Smith

#35 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

In reply to Pieter Smith
Quoted 33 lines · Pieter Smith

This patch-set adds support for building barebox with up to 2 configurations. It can be used to build the barebox x-loader or MLO (also called Secondary Program Loader) in addition to the standard barebox build (Tertiary Program Loader). This implements the design proposed in
http://elinux.org/Buildroot#Todo_list, with minor adjustments:
1. Have boot/barebox/barebox.mk contain the common stuff.
2. Add a second package boot/barebox/barebox-2.
3. There is only one version selection, but each package allows to define the configuration to be used.
4. Design is a little bit like package/gcc, where we have multiple gcc builds, but share a lot of common definitions between the packages.

To demonstrate that it works as advertized, the last patch adds a defconfig for the beaglebone that makes use of the added functionality.

Revision history:
v4: Introduces barebox-package function to reduce duplication and maintenance
Simplifies built image selection
Ease review with smaller patches
Review re-work: Special thanks to Arnout Vandecappelle and Yegor Yefremov
v3: Updated for master at 544e2c5871f223facd1ab3c2853cd07ad70dd9d1
v2: Dropped x-loader build specialization in favor of 2 generic barebox builds
v1: Initial posting

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Quoted 15 lines
 board/beaglebone/barebox.env/boot/sd      |   6 +
 board/beaglebone/barebox.env/config-board |   4 +
 boot/barebox/Config.in                    |  18 +++
 boot/barebox/barebox-2/Config.in          |  79 +++++++++++++
 boot/barebox/barebox-2/barebox-2.hash     |   1 +
 boot/barebox/barebox-2/barebox-2.mk       |   9 ++
 boot/barebox/barebox.mk                   | 178 ++++++++++++++++++------------
 configs/beaglebone_barebox_defconfig      |  41 +++++++
 8 files changed, 266 insertions(+), 70 deletions(-)
 create mode 100644 board/beaglebone/barebox.env/boot/sd
 create mode 100644 board/beaglebone/barebox.env/config-board
 create mode 100644 boot/barebox/barebox-2/Config.in
 create mode 120000 boot/barebox/barebox-2/barebox-2.hash
 create mode 100644 boot/barebox/barebox-2/barebox-2.mk
 create mode 100644 configs/beaglebone_barebox_defconfig

for the whole series.

Yegor

#36 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Quoted 59 lines · On Mon, 21 Mar 2016, 12:39 Yegor Yefremov, <[email protected]> wrote:
Quoted 1 line · Pieter Smith

This patch-set adds support for building barebox with up to 2

configurations.

Quoted 1 line

It can be used to build the barebox x-loader or MLO (also called

Secondary

Quoted 1 line

Program Loader) in addition to the standard barebox build (Tertiary

Program

Quoted 7 lines

Loader). This implements the design proposed in
http://elinux.org/Buildroot#Todo_list, with minor adjustments:
1. Have boot/barebox/barebox.mk contain the common stuff.
2. Add a second package boot/barebox/barebox-2.
3. There is only one version selection, but each package allows to define the configuration to be used.
4. Design is a little bit like package/gcc, where we have multiple gcc

builds,

Quoted 3 lines

but share a lot of common definitions between the packages.

To demonstrate that it works as advertized, the last patch adds a

defconfig for

Quoted 4 lines

the beaglebone that makes use of the added functionality.

Revision history:
v4: Introduces barebox-package function to reduce duplication and

maintenance

Quoted 3 lines

Simplifies built image selection
Ease review with smaller patches
Review re-work: Special thanks to Arnout Vandecappelle and Yegor

Yefremov

Quoted 2 lines

v3: Updated for master at 544e2c5871f223facd1ab3c2853cd07ad70dd9d1
v2: Dropped x-loader build specialization in favor of 2 generic barebox

builds

Quoted 11 lines

v1: Initial posting

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Quoted 7 lines
 board/beaglebone/barebox.env/boot/sd      |   6 +
 board/beaglebone/barebox.env/config-board |   4 +
 boot/barebox/Config.in                    |  18 +++
 boot/barebox/barebox-2/Config.in          |  79 +++++++++++++
 boot/barebox/barebox-2/barebox-2.hash     |   1 +
 boot/barebox/barebox-2/barebox-2.mk       |   9 ++
 boot/barebox/barebox.mk                   | 178

++++++++++++++++++------------

Quoted 8 lines
 configs/beaglebone_barebox_defconfig      |  41 +++++++
 8 files changed, 266 insertions(+), 70 deletions(-)
 create mode 100644 board/beaglebone/barebox.env/boot/sd
 create mode 100644 board/beaglebone/barebox.env/config-board
 create mode 100644 boot/barebox/barebox-2/Config.in
 create mode 120000 boot/barebox/barebox-2/barebox-2.hash
 create mode 100644 boot/barebox/barebox-2/barebox-2.mk
 create mode 100644 configs/beaglebone_barebox_defconfig
Quoted 6 lines

for the whole series.

Yegor

Thanks!

- Pieter

Quoted 1 line

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160321/f9816862/attachment-0001.html>

#37 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

In reply to Pieter Smith

Hello,

Quoted 8 lines · Pieter Smith

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Since there were some comments on this v4, I marked it as Changes Requested in our patch tracking system. When you find some time, can you send an updated v5 of this patch series?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#38 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Thomas,

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · Pieter Smith

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Quoted 3 lines

Since there were some comments on this v4, I marked it as Changes Requested in our patch tracking system. When you find some time, can you send an updated v5 of this patch series?

I have been a little short on time as of late. The patch is complete, but I am having probably unrelated problems with my BBB set-up that I am trying to troubleshoot. Nevertheless, I would like to make sure that everything works before reposting. Maybe Yegor can help to test that everything works?

@Yegor: Do you have time to test the branch on your setup?
URL: https://github.com/smipi1/bbb_buildroot.git
branch: barebox_2nd_config_build-v5

- Pieter

[snip]

#39 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Quoted 20 lines · Pieter Smith

Hi Thomas,

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · Pieter Smith

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Quoted 3 lines

Since there were some comments on this v4, I marked it as Changes Requested in our patch tracking system. When you find some time, can you send an updated v5 of this patch series?

Quoted 8 lines

I have been a little short on time as of late. The patch is complete, but I am having probably unrelated problems with my BBB set-up that I am trying to troubleshoot. Nevertheless, I would like to make sure that everything works before reposting. Maybe Yegor can help to test that everything works?

@Yegor: Do you have time to test the branch on your setup?
URL: https://github.com/smipi1/bbb_buildroot.git
branch: barebox_2nd_config_build-v5

Have made basic tests, i.e. changing configuration for barebox and barebox-2 and running make to see, if proper barebox was compiled. Everything is working the way it was in v4 from this point of view.

Yegor

#40 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Yegor,

Quoted 26 lines · Yegor Yefremov
Quoted 25 lines · Pieter Smith

Hi Thomas,

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · Pieter Smith

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Quoted 3 lines

Since there were some comments on this v4, I marked it as Changes Requested in our patch tracking system. When you find some time, can you send an updated v5 of this patch series?

I have been a little short on time as of late. The patch is complete, but I am having probably unrelated problems with my BBB set-up that I am trying to troubleshoot. Nevertheless, I would like to make sure that everything works before reposting. Maybe Yegor can help to test that everything works?

Quoted 7 lines
Quoted 3 lines

@Yegor: Do you have time to test the branch on your setup?
URL: https://github.com/smipi1/bbb_buildroot.git
branch: barebox_2nd_config_build-v5

Have made basic tests, i.e. changing configuration for barebox and barebox-2 and running make to see, if proper barebox was compiled. Everything is working the way it was in v4 from this point of view.

Thanks! Did you flash a bare SD card or the internal eMMC with boot.vfat and rootfs.ext4 as part of the tests?

Quoted 2 lines

Yegor

- Pieter

#41 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Quoted 33 lines · Pieter Smith

Hi Yegor,

Quoted 30 lines · Yegor Yefremov
Quoted 28 lines · Pieter Smith

Hi Thomas,

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · Pieter Smith

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Quoted 3 lines

Since there were some comments on this v4, I marked it as Changes Requested in our patch tracking system. When you find some time, can you send an updated v5 of this patch series?

I have been a little short on time as of late. The patch is complete, but I am having probably unrelated problems with my BBB set-up that I am trying to troubleshoot. Nevertheless, I would like to make sure that everything works before reposting. Maybe Yegor can help to test that everything works?

@Yegor: Do you have time to test the branch on your setup?
URL: https://github.com/smipi1/bbb_buildroot.git
branch: barebox_2nd_config_build-v5

Quoted 6 lines
Quoted 3 lines

Have made basic tests, i.e. changing configuration for barebox and barebox-2 and running make to see, if proper barebox was compiled. Everything is working the way it was in v4 from this point of view.

Thanks! Did you flash a bare SD card or the internal eMMC with boot.vfat and rootfs.ext4 as part of the tests?

If I copy your images (MLO, barebox.bin) directly to the FAT partition, everything starts as expected. But I dd boot.vfat, the system doesn't boot and shows only CCCCC, though I have no problems mounting the first partition in Linux.

sudo dd if=/tmp/boot.vfat of=/dev/sdd1 bs=1M

Yegor

#42 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hello,

Quoted 7 lines · Yegor Yefremov
Quoted 6 lines
Quoted 3 lines

Have made basic tests, i.e. changing configuration for barebox and barebox-2 and running make to see, if proper barebox was compiled. Everything is working the way it was in v4 from this point of view.

Thanks! Did you flash a bare SD card or the internal eMMC with boot.vfat and rootfs.ext4 as part of the tests?

Quoted 6 lines

If I copy your images (MLO, barebox.bin) directly to the FAT partition, everything starts as expected. But I dd boot.vfat, the system doesn't boot and shows only CCCCC, though I have no problems mounting the first partition in Linux.

sudo dd if=/tmp/boot.vfat of=/dev/sdd1 bs=1M

So this means that the Barebox build is OK, and only the genimage part is causing problems. But this doesn't prevent from merging the barebox aspects of the series (patches 1 to 6), which are really the important part. The last patch is really more a defconfig proving that it works, I am not even sure that in practice we want to merge a defconfig for BeagleBone that is just different from beaglebone_defconfig in the fact that it uses Barebox instead of U-Boot. Peter?

Peter, I think you looked at using genimage on AM335x, what were your conclusion? On OMAP3, there were some very strict geometry restrictions in the romcode, but I don't remember if your conclusion is that they also apply to AM335x or not.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#43 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Thomas,

Quoted 18 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · Yegor Yefremov
Quoted 6 lines
Quoted 3 lines

Have made basic tests, i.e. changing configuration for barebox and barebox-2 and running make to see, if proper barebox was compiled. Everything is working the way it was in v4 from this point of view.

Thanks! Did you flash a bare SD card or the internal eMMC with boot.vfat and rootfs.ext4 as part of the tests?

Quoted 6 lines

If I copy your images (MLO, barebox.bin) directly to the FAT partition, everything starts as expected. But I dd boot.vfat, the system doesn't boot and shows only CCCCC, though I have no problems mounting the first partition in Linux.

sudo dd if=/tmp/boot.vfat of=/dev/sdd1 bs=1M

Quoted 7 lines

So this means that the Barebox build is OK, and only the genimage part is causing problems. But this doesn't prevent from merging the barebox aspects of the series (patches 1 to 6), which are really the important part. The last patch is really more a defconfig proving that it works, I am not even sure that in practice we want to merge a defconfig for BeagleBone that is just different from beaglebone_defconfig in the fact that it uses Barebox instead of U-Boot. Peter?

I agree that the barebox aspects are more important. I would however like to have the defconfig merged as the first example of how to apply this. It provides a consistent set targeting a readily available board. With the help of Yegor I have managed to work the kinks out of the defconfig. The patch has also been reworked it based on Arnouts valuable input. So there is no need to delay the series.

All that is left is the suggested BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE -> BR2_TARGET_BAREBOX_IMAGE_FILE rename and a final master rebase, then I can post.

Quoted 4 lines

Peter, I think you looked at using genimage on AM335x, what were your conclusion? On OMAP3, there were some very strict geometry restrictions in the romcode, but I don't remember if your conclusion is that they also apply to AM335x or not.

Flashing the boot.vfat separately seems to run afoul of such geometry restrictions. Using genimage to generate a full sdcard.img however works well on the BBB. I therefore did not spend more time on the issue because it works now. Do you see any need to dig deeper, or can the patch be merged based on a working sdcard.img?

Quoted 5 lines

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

- Pieter

#44 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hello,

Quoted 3 lines · Pieter Smith

All that is left is the suggested BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE -> BR2_TARGET_BAREBOX_IMAGE_FILE rename and a final master rebase, then I can post.

Good.

Quoted 5 lines

Flashing the boot.vfat separately seems to run afoul of such geometry restrictions. Using genimage to generate a full sdcard.img however works well on the BBB. I therefore did not spend more time on the issue because it works now. Do you see any need to dig deeper, or can the patch be merged based on a working sdcard.img?

As long as the sdcard.img is working, that's fine.

However, I'm still unsure we will want to merge a defconfig whose only difference compared to the other beablebone defconfig is that it uses Barebox. I certainly want to merge the rest of your series, since we do want to support the use case of people using Barebox on AM335x platforms, or other platforms that have a two-stage boot process. But I'm not sure about the defconfig.

Peter, what's your opinion on this?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#45 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Thomas,

Quoted 22 lines · On Sat, 23 Apr 2016, 15:11 Thomas Petazzoni, <…

Hello,

Quoted 2 lines · Pieter Smith

All that is left is the suggested BR2_TARGET_BAREBOX_BUILT_IMAGE_FILE -> BR2_TARGET_BAREBOX_IMAGE_FILE rename and a final master rebase, then I

can

Quoted 1 line

post.

Good.

Quoted 2 lines

Flashing the boot.vfat separately seems to run afoul of such geometry restrictions. Using genimage to generate a full sdcard.img however works

well

Quoted 1 line

on the BBB. I therefore did not spend more time on the issue because it

works

Quoted 1 line

now. Do you see any need to dig deeper, or can the patch be merged based

on a

Quoted 1 line

working sdcard.img?

As long as the sdcard.img is working, that's fine.

Quoted 9 lines

However, I'm still unsure we will want to merge a defconfig whose only difference compared to the other beablebone defconfig is that it uses Barebox. I certainly want to merge the rest of your series, since we do want to support the use case of people using Barebox on AM335x platforms, or other platforms that have a two-stage boot process. But I'm not sure about the defconfig.

Peter, what's your opinion on this?

As I already voiced, I would like to have the defconfig in as a usage example. An example dramatically cuts the amount of time required to understand how to use the features.

I also find the BBB with barebox much easier to play with. It boots faster and is much easier to script.

Do you have another board you would have me target to Illustrate the features?

Quoted 7 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

- Pieter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160423/876be975/attachment.html>

#46 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hello,

Quoted 2 lines · Pieter Smith

As I already voiced, I would like to have the defconfig in as a usage example.

Well, what you want and what the Buildroot maintainer/core developers want may be different :-)

My opinion is that there is no point is having gazillions of different defconfigs for the same board. Your focus is on Barebox, but then the next developer will want a defconfig for BeagleBone+Qt5, the next one for BeagleBone+Wayland, the next one for BeagleBone+Kodi, the next one for BeagleBone as a toaster controller, etc, etc. As you can see, it's going to be an endless list of unmaintainable defconfigs, so we have to cut the line somewhere.

And IMO, having a defconfig whose only difference from the beaglebone_defconfig is to use Barebox instead of U-Boot is not a useful defconfig.

It would however be useful in a "testing" framework so that we can validate automatically that the dual Barebox functionality continues to work over time.

Quoted 2 lines

I also find the BBB with barebox much easier to play with. It boots faster and is much easier to script.

That's very subjective, and the default/defacto standard on BeagleBone remains U-Boot (no matter how much I would prefer Barebox to become more popular).

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#47 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Thomas,

Quoted 9 lines · Thomas Petazzoni

Hello,

Quoted 2 lines · Pieter Smith

As I already voiced, I would like to have the defconfig in as a usage example.

Well, what you want and what the Buildroot maintainer/core developers want may be different :-)

Yup... If all the world was of one mind, it surely would be a boring place ;-)

I do not want to try to force the beaglebone_barebox_defconfig. Everybody knows that it doesn't work that way. Is there no value in having SOME FORM of defconfig to illustrate feature use in buildroot?

Quoted 7 lines

My opinion is that there is no point is having gazillions of different defconfigs for the same board. Your focus is on Barebox, but then the next developer will want a defconfig for BeagleBone+Qt5, the next one for BeagleBone+Wayland, the next one for BeagleBone+Kodi, the next one for BeagleBone as a toaster controller, etc, etc. As you can see, it's going to be an endless list of unmaintainable defconfigs, so we have to cut the line somewhere.

What? No beaglebone_epilator_defconfig? Pity... ;-)

Quoted 3 lines

And IMO, having a defconfig whose only difference from the beaglebone_defconfig is to use Barebox instead of U-Boot is not a useful defconfig.

I can't find fault with your logic. I am all too aware of how painful the maintenance burden can become if you don't say no often enough.

Quoted 3 lines

It would however be useful in a "testing" framework so that we can validate automatically that the dual Barebox functionality continues to work over time.

Agreed. Where can I stall my shiny BBB barebox "regression test" roadster then?

Quoted 6 lines
Quoted 2 lines

I also find the BBB with barebox much easier to play with. It boots faster and is much easier to script.

That's very subjective, and the default/defacto standard on BeagleBone remains U-Boot (no matter how much I would prefer Barebox to become more popular).

Oh, if I could change the world... ;-)

Regards,
Pieter

[snip]

#48 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hello,

Quoted 4 lines · Pieter Smith
Quoted 2 lines

Well, what you want and what the Buildroot maintainer/core developers want may be different :-)

Yup... If all the world was of one mind, it surely would be a boring place ;-)

Indeed :)

Quoted 3 lines

I do not want to try to force the beaglebone_barebox_defconfig. Everybody knows that it doesn't work that way. Is there no value in having SOME FORM of defconfig to illustrate feature use in buildroot?

There is a value, but not as a defconfig in configs/ IMO. Unfortunately, the place/infrastructure where it would have a value doesn't really exist today.

Quoted 9 lines
Quoted 7 lines

My opinion is that there is no point is having gazillions of different defconfigs for the same board. Your focus is on Barebox, but then the next developer will want a defconfig for BeagleBone+Qt5, the next one for BeagleBone+Wayland, the next one for BeagleBone+Kodi, the next one for BeagleBone as a toaster controller, etc, etc. As you can see, it's going to be an endless list of unmaintainable defconfigs, so we have to cut the line somewhere.

What? No beaglebone_epilator_defconfig? Pity... ;-)

beaglebone_toothbrush_defconfig :-)

Quoted 5 lines
Quoted 3 lines

It would however be useful in a "testing" framework so that we can validate automatically that the dual Barebox functionality continues to work over time.

Agreed. Where can I stall my shiny BBB barebox "regression test" roadster then?

My grand plan is to promote something like
https://github.com/tpetazzoni/buildroot-runtime-test in order to collect test cases (both build-time tests and runtime tests).

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#49 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Thomas,

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · Pieter Smith
Quoted 2 lines

Well, what you want and what the Buildroot maintainer/core developers want may be different :-)

Yup... If all the world was of one mind, it surely would be a boring place ;-)

Indeed :)

Quoted 7 lines
Quoted 3 lines

I do not want to try to force the beaglebone_barebox_defconfig. Everybody knows that it doesn't work that way. Is there no value in having SOME FORM of defconfig to illustrate feature use in buildroot?

There is a value, but not as a defconfig in configs/ IMO. Unfortunately, the place/infrastructure where it would have a value doesn't really exist today.

I will post the patch series including the beaglebone_barebox_defconfig. This will at least illustrate usage, even if it only lives in the mailing archives. Should it be required: The buildroot maintainers have my permission to merge only a sub-set of the patch-series. I do not object to this, and I will make it clear in the summary.

Quoted 11 lines
Quoted 9 lines
Quoted 7 lines

My opinion is that there is no point is having gazillions of different defconfigs for the same board. Your focus is on Barebox, but then the next developer will want a defconfig for BeagleBone+Qt5, the next one for BeagleBone+Wayland, the next one for BeagleBone+Kodi, the next one for BeagleBone as a toaster controller, etc, etc. As you can see, it's going to be an endless list of unmaintainable defconfigs, so we have to cut the line somewhere.

What? No beaglebone_epilator_defconfig? Pity... ;-)

beaglebone_toothbrush_defconfig :-)

beaglebone_commodore64_emulator_defconfig?

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

It would however be useful in a "testing" framework so that we can validate automatically that the dual Barebox functionality continues to work over time.

Agreed. Where can I stall my shiny BBB barebox "regression test" roadster then?

My grand plan is to promote something like
https://github.com/tpetazzoni/buildroot-runtime-test in order to collect test cases (both build-time tests and runtime tests).

Promising. I will remember to have a look at it in a few weeks.

Quoted 5 lines

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

- Pieter

#50 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hello,

Quoted 5 lines · Pieter Smith

I will post the patch series including the beaglebone_barebox_defconfig. This will at least illustrate usage, even if it only lives in the mailing archives. Should it be required: The buildroot maintainers have my permission to merge only a sub-set of the patch-series. I do not object to this, and I will make it clear in the summary.

It is in any case very useful to include a defconfig in the series to ease testing. Another possibility is to include the defconfig used for testing inside one of the commit log, so that it remains part of the Git history, and easily available if one looks at the Git commits touching the barebox package.

Quoted 5 lines
Quoted 3 lines

My grand plan is to promote something like
https://github.com/tpetazzoni/buildroot-runtime-test in order to collect test cases (both build-time tests and runtime tests).

Promising. I will remember to have a look at it in a few weeks.

Well, don't hold your breath: I haven't touched it for months :/

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#51 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Thomas,

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 5 lines · Pieter Smith

I will post the patch series including the beaglebone_barebox_defconfig. This will at least illustrate usage, even if it only lives in the mailing archives. Should it be required: The buildroot maintainers have my permission to merge only a sub-set of the patch-series. I do not object to this, and I will make it clear in the summary.

Quoted 5 lines

It is in any case very useful to include a defconfig in the series to ease testing. Another possibility is to include the defconfig used for testing inside one of the commit log, so that it remains part of the Git history, and easily available if one looks at the Git commits touching the barebox package.

Augment the last message in the series with the defconfig? Easy enough. Will be in v5. Or would you like something fancy (E.g. empty commit)?

Quoted 13 lines
Quoted 5 lines
Quoted 3 lines

My grand plan is to promote something like
https://github.com/tpetazzoni/buildroot-runtime-test in order to collect test cases (both build-time tests and runtime tests).

Promising. I will remember to have a look at it in a few weeks.

Well, don't hold your breath: I haven't touched it for months :/

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#52 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hello,

Quoted 2 lines · Pieter Smith

Augment the last message in the series with the defconfig? Easy enough. Will be in v5. Or would you like something fancy (E.g. empty commit)?

Yes, just add it in the message of the last commit, something like:

Tested with the following defconfig:

...

But then it should be a minimal defconfig, not one that includes the kernel and all.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#53 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Thomas,

Quoted 7 lines · Thomas Petazzoni

Hello,

Quoted 2 lines · Pieter Smith

Augment the last message in the series with the defconfig? Easy enough. Will be in v5. Or would you like something fancy (E.g. empty commit)?

Quoted 8 lines

Yes, just add it in the message of the last commit, something like:

Tested with the following defconfig:

...

But then it should be a minimal defconfig, not one that includes the kernel and all.

Understood. I will also omit all the genimage and barebox env tuning scripts.

[snip]

- Pieter

#54 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

In reply to Pieter Smith

Hi Thomas,

Quoted 13 lines · Pieter Smith

Hi Thomas,

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 5 lines · Pieter Smith

I will post the patch series including the beaglebone_barebox_defconfig. This will at least illustrate usage, even if it only lives in the mailing archives. Should it be required: The buildroot maintainers have my permission to merge only a sub-set of the patch-series. I do not object to this, and I will make it clear in the summary.

Quoted 8 lines
Quoted 5 lines

It is in any case very useful to include a defconfig in the series to ease testing. Another possibility is to include the defconfig used for testing inside one of the commit log, so that it remains part of the Git history, and easily available if one looks at the Git commits touching the barebox package.

Augment the last message in the series with the defconfig? Easy enough. Will be in v5. Or would you like something fancy (E.g. empty commit)?

The largest part of the barebox defconfig is the post-image scripting and barebox environment tuning totalling 4 additional files. Should I add these to the commit-log as well?

[snip]

- Pieter

#55 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 15 lines
Quoted 6 lines

If I copy your images (MLO, barebox.bin) directly to the FAT partition, everything starts as expected. But I dd boot.vfat, the system doesn't boot and shows only CCCCC, though I have no problems mounting the first partition in Linux.

sudo dd if=/tmp/boot.vfat of=/dev/sdd1 bs=1M

So this means that the Barebox build is OK, and only the genimage part is causing problems. But this doesn't prevent from merging the barebox aspects of the series (patches 1 to 6), which are really the important part. The last patch is really more a defconfig proving that it works, I am not even sure that in practice we want to merge a defconfig for BeagleBone that is just different from beaglebone_defconfig in the fact that it uses Barebox instead of U-Boot. Peter?

Quoted 4 lines

Peter, I think you looked at using genimage on AM335x, what were your conclusion? On OMAP3, there were some very strict geometry restrictions in the romcode, but I don't remember if your conclusion is that they also apply to AM335x or not.

The rom code afaik checks that the partition size matches exactly with the size of the fat file system, so just dd'ing a fat fs image to an existing partition is unlikely to work:

https://groups.google.com/forum/#!topic/beagleboard/ro5k5r4Cuq4

Signature · 1 line
Bye, Peter Korsgaard
#56 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

Hi Peter,

Quoted 19 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 14 lines
Quoted 6 lines

If I copy your images (MLO, barebox.bin) directly to the FAT partition, everything starts as expected. But I dd boot.vfat, the system doesn't boot and shows only CCCCC, though I have no problems mounting the first partition in Linux.

sudo dd if=/tmp/boot.vfat of=/dev/sdd1 bs=1M

So this means that the Barebox build is OK, and only the genimage part is causing problems. But this doesn't prevent from merging the barebox aspects of the series (patches 1 to 6), which are really the important part. The last patch is really more a defconfig proving that it works, I am not even sure that in practice we want to merge a defconfig for BeagleBone that is just different from beaglebone_defconfig in the fact that it uses Barebox instead of U-Boot. Peter?

Quoted 8 lines
Quoted 4 lines

Peter, I think you looked at using genimage on AM335x, what were your conclusion? On OMAP3, there were some very strict geometry restrictions in the romcode, but I don't remember if your conclusion is that they also apply to AM335x or not.

The rom code afaik checks that the partition size matches exactly with the size of the fat file system, so just dd'ing a fat fs image to an existing partition is unlikely to work:

Thanks! That explains what I have been observing. Everything works well if you have genimage generate a full SD card image, MBR and all.

[snip]

- Pieter

#57 lore raw

v4 cover Support building a second Barebox config (incl. BBB)

In reply to Yegor Yefremov

Hi Yegor,

Quoted 41 lines · Yegor Yefremov
Quoted 33 lines · Pieter Smith

Hi Yegor,

Quoted 30 lines · Yegor Yefremov
Quoted 28 lines · Pieter Smith

Hi Thomas,

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · Pieter Smith

Pieter Smith (7):
barebox: support multi-image-build image selection
barebox: friendly error on missing built image
barebox: support custom barebox output image name
barebox: introduce barebox-package function
barebox: extract package name argument
barebox: support 2nd config build
beaglebone: adds barebox bootloader defconfig

Quoted 3 lines

Since there were some comments on this v4, I marked it as Changes Requested in our patch tracking system. When you find some time, can you send an updated v5 of this patch series?

I have been a little short on time as of late. The patch is complete, but I am having probably unrelated problems with my BBB set-up that I am trying to troubleshoot. Nevertheless, I would like to make sure that everything works before reposting. Maybe Yegor can help to test that everything works?

@Yegor: Do you have time to test the branch on your setup?
URL: https://github.com/smipi1/bbb_buildroot.git
branch: barebox_2nd_config_build-v5

Quoted 6 lines
Quoted 3 lines

Have made basic tests, i.e. changing configuration for barebox and barebox-2 and running make to see, if proper barebox was compiled. Everything is working the way it was in v4 from this point of view.

Thanks! Did you flash a bare SD card or the internal eMMC with boot.vfat and rootfs.ext4 as part of the tests?

Quoted 6 lines

If I copy your images (MLO, barebox.bin) directly to the FAT partition, everything starts as expected. But I dd boot.vfat, the system doesn't boot and shows only CCCCC, though I have no problems mounting the first partition in Linux.

sudo dd if=/tmp/boot.vfat of=/dev/sdd1 bs=1M

As Thomas mentioned in a later mail, there appears to be some tight geometry restrictions in the ROM. I updated the genimage script to generate a full sdcard.img. This seems to work without a hitch. Please give it another twirl.

Quoted 1 line

Yegor

- Pieter