Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL
@ 2015-10-25 19:33 Pieter Smith
  2015-10-25 19:33 ` [Buildroot] [PATCH 1/4] barebox: prepare for x-loader build Pieter Smith
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Pieter Smith @ 2015-10-25 19:33 UTC (permalink / raw)
  To: buildroot

This patch-set in 4 parts adds support for building a second barebox build (the
x-loader). This implements the design proposed in
http://elinux.org/Buildroot#Todo_list:
1. Have boot/barebox/ containing the common stuff.
2. Add two separate packages boot/barebox-boot/ and boot/barebox-xload/.
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 black that makes use of the added functionality.

Pieter Smith (4):
  barebox: prepare for x-loader build
  barebox: adds option to build x-loader
  barebox: user selection of build output images
  beaglebone: adds barebox bootloader defconfig

 boot/barebox/Config.in                        | 92 +++++++++++++++++++++++++++
 boot/barebox/barebox-boot/barebox-boot.hash   |  1 +
 boot/barebox/barebox-boot/barebox-boot.mk     | 89 ++++++++++++++++++++++++++
 boot/barebox/barebox-xload/barebox-xload.hash |  1 +
 boot/barebox/barebox-xload/barebox-xload.mk   | 51 +++++++++++++++
 boot/barebox/barebox.mk                       | 60 +----------------
 configs/beaglebone_barebox_defconfig          | 38 +++++++++++
 7 files changed, 273 insertions(+), 59 deletions(-)
 create mode 120000 boot/barebox/barebox-boot/barebox-boot.hash
 create mode 100644 boot/barebox/barebox-boot/barebox-boot.mk
 create mode 120000 boot/barebox/barebox-xload/barebox-xload.hash
 create mode 100644 boot/barebox/barebox-xload/barebox-xload.mk
 create mode 100644 configs/beaglebone_barebox_defconfig

-- 
2.1.4

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

* [Buildroot] [PATCH 1/4] barebox: prepare for x-loader build
  2015-10-25 19:33 [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Pieter Smith
@ 2015-10-25 19:33 ` Pieter Smith
  2015-10-25 19:33 ` [Buildroot] [PATCH 2/4] barebox: adds option to build x-loader Pieter Smith
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Pieter Smith @ 2015-10-25 19:33 UTC (permalink / raw)
  To: buildroot

No functional changes, but prepares barebox for building with two
configurations (similar to package/gcc).
---
 boot/barebox/Config.in                      |  9 ++++
 boot/barebox/barebox-boot/barebox-boot.hash |  1 +
 boot/barebox/barebox-boot/barebox-boot.mk   | 80 +++++++++++++++++++++++++++++
 boot/barebox/barebox.mk                     | 60 +---------------------
 4 files changed, 91 insertions(+), 59 deletions(-)
 create mode 120000 boot/barebox/barebox-boot/barebox-boot.hash
 create mode 100644 boot/barebox/barebox-boot/barebox-boot.mk

diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
index 7e81181..437407d 100644
--- a/boot/barebox/Config.in
+++ b/boot/barebox/Config.in
@@ -64,6 +64,13 @@ config BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION
 
 endif
 
+config BR2_TARGET_BAREBOX_BOOT
+	bool "Build Barebox bootloader"
+	default y
+	help
+	  Build the Barebox bootloader
+
+if BR2_TARGET_BAREBOX_BOOT
 
 choice
 	prompt "Barebox configuration"
@@ -122,3 +129,5 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
 	  the same name as the directory name given here.
 
 endif
+
+endif
diff --git a/boot/barebox/barebox-boot/barebox-boot.hash b/boot/barebox/barebox-boot/barebox-boot.hash
new file mode 120000
index 0000000..b6462b8
--- /dev/null
+++ b/boot/barebox/barebox-boot/barebox-boot.hash
@@ -0,0 +1 @@
+../barebox.hash
\ No newline at end of file
diff --git a/boot/barebox/barebox-boot/barebox-boot.mk b/boot/barebox/barebox-boot/barebox-boot.mk
new file mode 100644
index 0000000..a76a496
--- /dev/null
+++ b/boot/barebox/barebox-boot/barebox-boot.mk
@@ -0,0 +1,80 @@
+################################################################################
+#
+# barebox-boot
+#
+################################################################################
+
+BAREBOX_BOOT_VERSION = $(BAREBOX_VERSION)
+BAREBOX_BOOT_SITE = $(BAREBOX_SITE)
+BAREBOX_BOOT_SITE_METHOD = $(BAREBOX_SITE_METHOD)
+BAREBOX_BOOT_SOURCE = $(BAREBOX_SOURCE)
+BAREBOX_BOOT_DEPENDENCIES = $(BAREBOX_DEPENDENCIES)
+BAREBOX_BOOT_LICENSE = $(BAREBOX_LICENSE)
+BAREBOX_BOOT_LICENSE_FILES = $(BAREBOX_LICENSE_FILES)
+BAREBOX_BOOT_POST_PATCH_HOOKS += $(BAREBOX_POST_PATCH_HOOKS)
+BAREBOX_BOOT_MAKE_FLAGS = $(BAREBOX_MAKE_FLAGS)
+BAREBOX_BOOT_MAKE_ENV = $(BAREBOX_MAKE_ENV)
+BAREBOX_BOOT_INSTALL_IMAGES = $(BAREBOX_INSTALL_IMAGES)
+
+ifeq ($(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
+BAREBOX_BOOT_SOURCE_CONFIG = $(BAREBOX_BOOT_DIR)/arch/$(BAREBOX_ARCH)/configs/$(call qstrip,\
+	$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
+else ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
+BAREBOX_BOOT_SOURCE_CONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
+endif
+
+BAREBOX_BOOT_KCONFIG_FILE = $(BAREBOX_BOOT_SOURCE_CONFIG)
+BAREBOX_BOOT_KCONFIG_FRAGMENT_FILES = $(BAREBOX_KCONFIG_FRAGMENT_FILES)
+BAREBOX_BOOT_KCONFIG_EDITORS = $(BAREBOX_KCONFIG_EDITORS)
+BAREBOX_BOOT_KCONFIG_OPTS = $(BAREBOX_MAKE_FLAGS)
+
+ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+define BAREBOX_BOOT_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_BOOT_ENV_NAME = $(notdir $(call qstrip,\
+	$(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)))
+define BAREBOX_BOOT_BUILD_CUSTOM_ENV
+	$(@D)/scripts/bareboxenv -s \
+		$(call qstrip, $(BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH)) \
+		$(@D)/$(BAREBOX_BOOT_ENV_NAME)
+endef
+define BAREBOX_BOOT_INSTALL_CUSTOM_ENV
+	cp $(@D)/$(BAREBOX_BOOT_ENV_NAME) $(BINARIES_DIR)
+endef
+endif
+
+define BAREBOX_BOOT_BUILD_CMDS
+	$(BAREBOX_BOOT_BUILD_BAREBOXENV_CMDS)
+	$(TARGET_MAKE_ENV) $(MAKE) $(BAREBOX_BOOT_MAKE_FLAGS) -C $(@D)
+	$(BAREBOX_BOOT_BUILD_CUSTOM_ENV)
+endef
+
+define BAREBOX_BOOT_INSTALL_IMAGES_CMDS
+	if test -h $(@D)/barebox-flash-image ; then \
+		cp -L $(@D)/barebox-flash-image $(BINARIES_DIR)/barebox.bin ; \
+	else \
+		cp $(@D)/barebox.bin $(BINARIES_DIR);\
+	fi
+	$(BAREBOX_BOOT_INSTALL_CUSTOM_ENV)
+endef
+
+ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
+define BAREBOX_BOOT_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 ($(BAREBOX_BOOT_SOURCE_CONFIG),)
+$(error No Barebox config file. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
+endif
+endif
+
+$(eval $(kconfig-package))
diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index 00e1537..55bd187 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -55,65 +55,7 @@ endif
 BAREBOX_MAKE_FLAGS = ARCH=$(BAREBOX_ARCH) CROSS_COMPILE="$(TARGET_CROSS)"
 BAREBOX_MAKE_ENV = $(TARGET_MAKE_ENV)
 
-ifeq ($(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
-BAREBOX_SOURCE_CONFIG = $(BAREBOX_DIR)/arch/$(BAREBOX_ARCH)/configs/$(call qstrip,\
-	$(BR2_TARGET_BAREBOX_BOARD_DEFCONFIG))_defconfig
-else ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
-BAREBOX_SOURCE_CONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
-endif
-
-BAREBOX_KCONFIG_FILE = $(BAREBOX_SOURCE_CONFIG)
 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)
-
-ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-define BAREBOX_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
-	$(@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)
-endef
-endif
-
-define BAREBOX_BUILD_CMDS
-	$(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 -h $(@D)/barebox-flash-image ; then \
-		cp -L $(@D)/barebox-flash-image $(BINARIES_DIR)/barebox.bin ; \
-	else \
-		cp $(@D)/barebox.bin $(BINARIES_DIR);\
-	fi
-	$(BAREBOX_INSTALL_CUSTOM_ENV)
-endef
-
-ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
-define BAREBOX_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 ($(BAREBOX_SOURCE_CONFIG),)
-$(error No Barebox config file. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG or BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE settings)
-endif
-endif
 
-$(eval $(kconfig-package))
+include $(sort $(wildcard boot/barebox/*/*.mk))
-- 
2.1.4

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

* [Buildroot] [PATCH 2/4] barebox: adds option to build x-loader
  2015-10-25 19:33 [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Pieter Smith
  2015-10-25 19:33 ` [Buildroot] [PATCH 1/4] barebox: prepare for x-loader build Pieter Smith
@ 2015-10-25 19:33 ` Pieter Smith
  2015-10-25 19:33 ` [Buildroot] [PATCH 3/4] barebox: user selection of build output images Pieter Smith
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Pieter Smith @ 2015-10-25 19:33 UTC (permalink / raw)
  To: buildroot

Support selection of x-loader config, but version, source URL and patches are
shared with barebox bootloader build.
---
 boot/barebox/Config.in                        | 47 +++++++++++++++++++++++++++
 boot/barebox/barebox-xload/barebox-xload.hash |  1 +
 boot/barebox/barebox-xload/barebox-xload.mk   | 44 +++++++++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 120000 boot/barebox/barebox-xload/barebox-xload.hash
 create mode 100644 boot/barebox/barebox-xload/barebox-xload.mk

diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
index 437407d..3c0e52e 100644
--- a/boot/barebox/Config.in
+++ b/boot/barebox/Config.in
@@ -130,4 +130,51 @@ config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
 
 endif
 
+config BR2_TARGET_BAREBOX_XLOAD
+	bool "Build Barebox x-loader"
+	help
+	  Build the Barebox x-loader
+
+if BR2_TARGET_BAREBOX_XLOAD
+
+choice
+	prompt "Barebox x-loader configuration"
+	default BR2_TARGET_BAREBOX_XLOAD_USE_DEFCONFIG
+
+config BR2_TARGET_BAREBOX_XLOAD_USE_DEFCONFIG
+	bool "Using a x-loader defconfig"
+
+config BR2_TARGET_BAREBOX_XLOAD_USE_CUSTOM_CONFIG
+	bool "Using a custom x-loader config file"
+
+endchoice
+
+config BR2_TARGET_BAREBOX_XLOAD_BOARD_DEFCONFIG
+	string "X-loader board defconfig"
+	depends on BR2_TARGET_BAREBOX_XLOAD_USE_DEFCONFIG
+	help
+	  Name of the board for which Barebox should be built, without
+	  the _defconfig suffix.
+
+
+config BR2_TARGET_BAREBOX_XLOAD_CUSTOM_CONFIG_FILE
+	string "X-loader configuration file path"
+	depends on BR2_TARGET_BAREBOX_XLOAD_USE_CUSTOM_CONFIG
+	help
+	  Path to the barebox configuration file
+
+config BR2_TARGET_BAREBOX_XLOAD_CONFIG_FRAGMENT_FILES
+	string "Additional x-loader 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_XLOAD_INSTALL_FILENAME
+	string "X-loader image filename when installed"
+	default "MLO"
+	help
+	  Name to give the image in the output/images directory.
+
+endif
+
 endif
diff --git a/boot/barebox/barebox-xload/barebox-xload.hash b/boot/barebox/barebox-xload/barebox-xload.hash
new file mode 120000
index 0000000..b6462b8
--- /dev/null
+++ b/boot/barebox/barebox-xload/barebox-xload.hash
@@ -0,0 +1 @@
+../barebox.hash
\ No newline at end of file
diff --git a/boot/barebox/barebox-xload/barebox-xload.mk b/boot/barebox/barebox-xload/barebox-xload.mk
new file mode 100644
index 0000000..19bcc1c
--- /dev/null
+++ b/boot/barebox/barebox-xload/barebox-xload.mk
@@ -0,0 +1,44 @@
+################################################################################
+#
+# barebox-xload
+#
+################################################################################
+
+BAREBOX_XLOAD_VERSION = $(BAREBOX_VERSION)
+BAREBOX_XLOAD_SITE = $(BAREBOX_SITE)
+BAREBOX_XLOAD_SITE_METHOD = $(BAREBOX_SITE_METHOD)
+BAREBOX_XLOAD_SOURCE = $(BAREBOX_SOURCE)
+BAREBOX_XLOAD_DEPENDENCIES = $(BAREBOX_DEPENDENCIES)
+BAREBOX_XLOAD_LICENSE = $(BAREBOX_LICENSE)
+BAREBOX_XLOAD_LICENSE_FILES = $(BAREBOX_LICENSE_FILES)
+BAREBOX_XLOAD_POST_PATCH_HOOKS += $(BAREBOX_POST_PATCH_HOOKS)
+BAREBOX_XLOAD_MAKE_FLAGS = $(BAREBOX_MAKE_FLAGS)
+BAREBOX_XLOAD_MAKE_ENV = $(BAREBOX_MAKE_ENV)
+BAREBOX_XLOAD_INSTALL_IMAGES = $(BAREBOX_INSTALL_IMAGES)
+BAREBOX_XLOAD_INSTALL_DEST = $(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_BAREBOX_XLOAD_INSTALL_FILENAME))
+
+ifeq ($(BR2_TARGET_BAREBOX_XLOAD_USE_DEFCONFIG),y)
+BAREBOX_XLOAD_SOURCE_CONFIG = $(BAREBOX_XLOAD_DIR)/arch/$(BAREBOX_ARCH)/configs/$(call qstrip,\
+	$(BR2_TARGET_BAREBOX_XLOAD_BOARD_DEFCONFIG))_defconfig
+else ifeq ($(BR2_TARGET_BAREBOX_XLOAD_USE_CUSTOM_CONFIG),y)
+BAREBOX_XLOAD_SOURCE_CONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_XLOAD_CUSTOM_CONFIG_FILE))
+endif
+
+BAREBOX_XLOAD_KCONFIG_FILE = $(BAREBOX_XLOAD_SOURCE_CONFIG)
+BAREBOX_XLOAD_KCONFIG_FRAGMENT_FILES = $(BAREBOX_KCONFIG_FRAGMENT_FILES)
+BAREBOX_XLOAD_KCONFIG_EDITORS = $(BAREBOX_KCONFIG_EDITORS)
+BAREBOX_XLOAD_KCONFIG_OPTS = $(BAREBOX_MAKE_FLAGS)
+
+define BAREBOX_XLOAD_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(BAREBOX_XLOAD_MAKE_FLAGS) -C $(@D)
+endef
+
+define BAREBOX_XLOAD_INSTALL_IMAGES_CMDS
+	if test -h $(@D)/barebox-flash-image ; then \
+		cp -L $(@D)/barebox-flash-image $(BAREBOX_XLOAD_INSTALL_DEST) ; \
+	else \
+		cp $(@D)/barebox.bin $(BAREBOX_XLOAD_INSTALL_DEST);\
+	fi
+endef
+
+$(eval $(kconfig-package))
-- 
2.1.4

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

* [Buildroot] [PATCH 3/4] barebox: user selection of build output images
  2015-10-25 19:33 [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Pieter Smith
  2015-10-25 19:33 ` [Buildroot] [PATCH 1/4] barebox: prepare for x-loader build Pieter Smith
  2015-10-25 19:33 ` [Buildroot] [PATCH 2/4] barebox: adds option to build x-loader Pieter Smith
@ 2015-10-25 19:33 ` Pieter Smith
  2015-10-25 19:33 ` [Buildroot] [PATCH 4/4] beaglebone: adds barebox bootloader defconfig Pieter Smith
  2015-10-26  3:57 ` [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Thomas Petazzoni
  4 siblings, 0 replies; 10+ messages in thread
From: Pieter Smith @ 2015-10-25 19:33 UTC (permalink / raw)
  To: buildroot

A non-default image can be selected as the barebox build output in the images/
directory. This typically is needed to select the appropriate image generated
by multi-platform support defconfigs (E.g. am335x).
---
 boot/barebox/Config.in                      | 36 +++++++++++++++++++++++++++++
 boot/barebox/barebox-boot/barebox-boot.mk   | 13 +++++++++--
 boot/barebox/barebox-xload/barebox-xload.mk |  7 ++++++
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
index 3c0e52e..a138507 100644
--- a/boot/barebox/Config.in
+++ b/boot/barebox/Config.in
@@ -104,6 +104,24 @@ 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.
 
+choice
+	prompt "Barebox image file"
+	default BR2_TARGET_BAREBOX_USE_DEFAULT_IMAGE
+
+config BR2_TARGET_BAREBOX_USE_DEFAULT_IMAGE
+	bool "Using the default image file"
+
+config BR2_TARGET_BAREBOX_USE_SPECIFIC_IMAGE
+	bool "Using a specific image file"
+
+endchoice
+
+config BR2_TARGET_BAREBOX_IMAGE_FILE
+	string "Image file path"
+	depends on BR2_TARGET_BAREBOX_USE_SPECIFIC_IMAGE
+	help
+	  Name of the built barebox image file
+
 config BR2_TARGET_BAREBOX_BAREBOXENV
 	bool "bareboxenv tool in target"
 	help
@@ -169,6 +187,24 @@ config BR2_TARGET_BAREBOX_XLOAD_CONFIG_FRAGMENT_FILES
 	  A space-separated list of configuration fragment files,
 	  that will be merged to the main Barebox configuration file.
 
+choice
+	prompt "Barebox x-loader image file"
+	default BR2_TARGET_BAREBOX_XLOAD_USE_DEFAULT_IMAGE
+
+config BR2_TARGET_BAREBOX_XLOAD_USE_DEFAULT_IMAGE
+	bool "Using the default x-loader image file"
+
+config BR2_TARGET_BAREBOX_XLOAD_USE_SPECIFIC_IMAGE
+	bool "Using a specific x-loader image file"
+
+endchoice
+
+config BR2_TARGET_BAREBOX_XLOAD_IMAGE_FILE
+	string "X-loader image file path"
+	depends on BR2_TARGET_BAREBOX_XLOAD_USE_SPECIFIC_IMAGE
+	help
+	  Name of the built x-loader barebox image file
+
 config BR2_TARGET_BAREBOX_XLOAD_INSTALL_FILENAME
 	string "X-loader image filename when installed"
 	default "MLO"
diff --git a/boot/barebox/barebox-boot/barebox-boot.mk b/boot/barebox/barebox-boot/barebox-boot.mk
index a76a496..e1cde18 100644
--- a/boot/barebox/barebox-boot/barebox-boot.mk
+++ b/boot/barebox/barebox-boot/barebox-boot.mk
@@ -15,6 +15,7 @@ BAREBOX_BOOT_POST_PATCH_HOOKS += $(BAREBOX_POST_PATCH_HOOKS)
 BAREBOX_BOOT_MAKE_FLAGS = $(BAREBOX_MAKE_FLAGS)
 BAREBOX_BOOT_MAKE_ENV = $(BAREBOX_MAKE_ENV)
 BAREBOX_BOOT_INSTALL_IMAGES = $(BAREBOX_INSTALL_IMAGES)
+BAREBOX_BOOT_INSTALL_DEST = $(BINARIES_DIR)/barebox.bin
 
 ifeq ($(BR2_TARGET_BAREBOX_USE_DEFCONFIG),y)
 BAREBOX_BOOT_SOURCE_CONFIG = $(BAREBOX_BOOT_DIR)/arch/$(BAREBOX_ARCH)/configs/$(call qstrip,\
@@ -54,14 +55,22 @@ define BAREBOX_BOOT_BUILD_CMDS
 	$(BAREBOX_BOOT_BUILD_CUSTOM_ENV)
 endef
 
+ifdef BR2_TARGET_BAREBOX_USE_SPECIFIC_IMAGE
+define BAREBOX_BOOT_INSTALL_IMAGES_CMDS
+	cp -L $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_IMAGE_FILE)) \
+		$(BAREBOX_BOOT_INSTALL_DEST)
+	$(BAREBOX_BOOT_INSTALL_CUSTOM_ENV)
+endef
+else
 define BAREBOX_BOOT_INSTALL_IMAGES_CMDS
 	if test -h $(@D)/barebox-flash-image ; then \
-		cp -L $(@D)/barebox-flash-image $(BINARIES_DIR)/barebox.bin ; \
+		cp -L $(@D)/barebox-flash-image $(BAREBOX_BOOT_INSTALL_DEST) ; \
 	else \
-		cp $(@D)/barebox.bin $(BINARIES_DIR);\
+		cp $(@D)/barebox.bin $(BAREBOX_BOOT_INSTALL_DEST);\
 	fi
 	$(BAREBOX_BOOT_INSTALL_CUSTOM_ENV)
 endef
+endif
 
 ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
 define BAREBOX_BOOT_INSTALL_TARGET_CMDS
diff --git a/boot/barebox/barebox-xload/barebox-xload.mk b/boot/barebox/barebox-xload/barebox-xload.mk
index 19bcc1c..9ab552a 100644
--- a/boot/barebox/barebox-xload/barebox-xload.mk
+++ b/boot/barebox/barebox-xload/barebox-xload.mk
@@ -33,6 +33,12 @@ define BAREBOX_XLOAD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) $(BAREBOX_XLOAD_MAKE_FLAGS) -C $(@D)
 endef
 
+ifdef BR2_TARGET_BAREBOX_XLOAD_USE_SPECIFIC_IMAGE
+define BAREBOX_XLOAD_INSTALL_IMAGES_CMDS
+	cp -L $(@D)/images/$(call qstrip,$(BR2_TARGET_BAREBOX_XLOAD_IMAGE_FILE)) \
+		$(BAREBOX_XLOAD_INSTALL_DEST)
+endef
+else
 define BAREBOX_XLOAD_INSTALL_IMAGES_CMDS
 	if test -h $(@D)/barebox-flash-image ; then \
 		cp -L $(@D)/barebox-flash-image $(BAREBOX_XLOAD_INSTALL_DEST) ; \
@@ -40,5 +46,6 @@ define BAREBOX_XLOAD_INSTALL_IMAGES_CMDS
 		cp $(@D)/barebox.bin $(BAREBOX_XLOAD_INSTALL_DEST);\
 	fi
 endef
+endif
 
 $(eval $(kconfig-package))
-- 
2.1.4

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

* [Buildroot] [PATCH 4/4] beaglebone: adds barebox bootloader defconfig
  2015-10-25 19:33 [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Pieter Smith
                   ` (2 preceding siblings ...)
  2015-10-25 19:33 ` [Buildroot] [PATCH 3/4] barebox: user selection of build output images Pieter Smith
@ 2015-10-25 19:33 ` Pieter Smith
  2015-10-26  3:57 ` [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Thomas Petazzoni
  4 siblings, 0 replies; 10+ messages in thread
From: Pieter Smith @ 2015-10-25 19:33 UTC (permalink / raw)
  To: buildroot

* Builds barebox x-loader (MLO) and the barebox bootloader.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is
  being generated with the kernel.
---
 configs/beaglebone_barebox_defconfig | 38 ++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 configs/beaglebone_barebox_defconfig

diff --git a/configs/beaglebone_barebox_defconfig b/configs/beaglebone_barebox_defconfig
new file mode 100644
index 0000000..d34a5bc
--- /dev/null
+++ b/configs/beaglebone_barebox_defconfig
@@ -0,0 +1,38 @@
+# 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="board/beaglebone/post-image.sh"
+
+# filesystem
+BR2_PACKAGE_AM33X_CM3=y
+BR2_TARGET_ROOTFS_EXT2=y
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# lock down headers to avoid breaking with new defaults
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.12.10"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_12=y
+
+# bootloader
+BR2_TARGET_BAREBOX=y
+BR2_TARGET_BAREBOX_BOARD_DEFCONFIG="am335x"
+BR2_TARGET_BAREBOX_USE_SPECIFIC_IMAGE=y
+BR2_TARGET_BAREBOX_IMAGE_FILE="barebox-am33xx-beaglebone.img"
+BR2_TARGET_BAREBOX_XLOAD=y
+BR2_TARGET_BAREBOX_XLOAD_BOARD_DEFCONFIG="am335x_mlo"
+BR2_TARGET_BAREBOX_XLOAD_USE_SPECIFIC_IMAGE=y
+BR2_TARGET_BAREBOX_XLOAD_IMAGE_FILE="barebox-am33xx-beaglebone-mlo.img"
+
+# kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_LATEST_VERSION=y
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
+BR2_LINUX_KERNEL_DEFCONFIG="omap2plus"
+BR2_LINUX_KERNEL_ZIMAGE=y
-- 
2.1.4

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

* [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL
  2015-10-25 19:33 [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Pieter Smith
                   ` (3 preceding siblings ...)
  2015-10-25 19:33 ` [Buildroot] [PATCH 4/4] beaglebone: adds barebox bootloader defconfig Pieter Smith
@ 2015-10-26  3:57 ` Thomas Petazzoni
  2015-10-26 21:27   ` Pieter Smith
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2015-10-26  3:57 UTC (permalink / raw)
  To: buildroot

Dear Pieter Smith,

On Sun, 25 Oct 2015 20:33:52 +0100, Pieter Smith wrote:

> Pieter Smith (4):
>   barebox: prepare for x-loader build
>   barebox: adds option to build x-loader
>   barebox: user selection of build output images
>   beaglebone: adds barebox bootloader defconfig
> 
>  boot/barebox/Config.in                        | 92 +++++++++++++++++++++++++++
>  boot/barebox/barebox-boot/barebox-boot.hash   |  1 +
>  boot/barebox/barebox-boot/barebox-boot.mk     | 89 ++++++++++++++++++++++++++
>  boot/barebox/barebox-xload/barebox-xload.hash |  1 +
>  boot/barebox/barebox-xload/barebox-xload.mk   | 51 +++++++++++++++
>  boot/barebox/barebox.mk                       | 60 +----------------
>  configs/beaglebone_barebox_defconfig          | 38 +++++++++++

I believe "xload" is really a term tied to the OMAP platforms, but
Barebox can have this dual configuration situation for other platforms
as well (ex: Atmel). Some other platforms use the term "SPL".

Can we find some better name ?

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

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

* [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL
  2015-10-26  3:57 ` [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Thomas Petazzoni
@ 2015-10-26 21:27   ` Pieter Smith
  2015-10-27 17:21     ` Pieter Smith
  0 siblings, 1 reply; 10+ messages in thread
From: Pieter Smith @ 2015-10-26 21:27 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Mon, Oct 26, 2015 at 04:57:35AM +0100, Thomas Petazzoni wrote:
> Dear Pieter Smith,
> 
> On Sun, 25 Oct 2015 20:33:52 +0100, Pieter Smith wrote:
> 
> > Pieter Smith (4):
> >   barebox: prepare for x-loader build
> >   barebox: adds option to build x-loader
> >   barebox: user selection of build output images
> >   beaglebone: adds barebox bootloader defconfig
> > 
> >  boot/barebox/Config.in                        | 92 +++++++++++++++++++++++++++
> >  boot/barebox/barebox-boot/barebox-boot.hash   |  1 +
> >  boot/barebox/barebox-boot/barebox-boot.mk     | 89 ++++++++++++++++++++++++++
> >  boot/barebox/barebox-xload/barebox-xload.hash |  1 +
> >  boot/barebox/barebox-xload/barebox-xload.mk   | 51 +++++++++++++++
> >  boot/barebox/barebox.mk                       | 60 +----------------
> >  configs/beaglebone_barebox_defconfig          | 38 +++++++++++
> 
> I believe "xload" is really a term tied to the OMAP platforms, but
> Barebox can have this dual configuration situation for other platforms
> as well (ex: Atmel). Some other platforms use the term "SPL".
> 
> Can we find some better name ?

Yes please, but selecting a use-case agnostic name might be tricky:

U-Boot uses SPL (Secondary Program Loader) to describe a "run from internal
SRAM" build as opposed to TPL (Tertiary Program Loader) for the normal "run
from external RAM" build. This terminology however is U-Boot specific.

From a pure barebox perspective, there is nothing distinctive about the second
build. It is just another defconfig, so there does not seem to be barebox
terminology to differentiate between these types of builds. (Barebox even
leaves the naming as a configuration option)

From an OMAP perspective, the second build is used to generate the X-loader
when booting from NAND or MLO when booting from MMC.

I would have loved to just stick with the boot stage naming, but the stage is
very much architecture dependent:
For BBB for example:
1. First-stage bootloader runs from internal hard-coded ROM
2. Second-stage bootloader runs from the internal SRAM (TI MLO) and is
   generated with a trimmed down configuration.
3. Third-stage bootloader runs from the external RAM and is generated with a
   full configuration.
But for the QCA4531 and family:
1. First-stage bootloader runs from external serial NOR flash and is generated
   with a full-blown configuration.

IMHO, let's just go with the suggested U-Boot naming (SPL) and if no barebox
developers complain, stick to that.

Agreed?

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

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

* [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL
  2015-10-26 21:27   ` Pieter Smith
@ 2015-10-27 17:21     ` Pieter Smith
  2015-10-27 20:18       ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: Pieter Smith @ 2015-10-27 17:21 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Mon, Oct 26, 2015 at 10:27:26PM +0100, Pieter Smith wrote:
> Hi Thomas,
> 
> On Mon, Oct 26, 2015 at 04:57:35AM +0100, Thomas Petazzoni wrote:
> > 
> > I believe "xload" is really a term tied to the OMAP platforms, but
> > Barebox can have this dual configuration situation for other platforms
> > as well (ex: Atmel). Some other platforms use the term "SPL".
> > 
> > Can we find some better name ?
> 
> Yes please, but selecting a use-case agnostic name might be tricky:
> 
> U-Boot uses SPL (Secondary Program Loader) to describe a "run from internal
> SRAM" build as opposed to TPL (Tertiary Program Loader) for the normal "run
> from external RAM" build. This terminology however is U-Boot specific.
> 
> From a pure barebox perspective, there is nothing distinctive about the second
> build. It is just another defconfig, so there does not seem to be barebox
> terminology to differentiate between these types of builds. (Barebox even
> leaves the naming as a configuration option)
> 
> From an OMAP perspective, the second build is used to generate the X-loader
> when booting from NAND or MLO when booting from MMC.
> 
> I would have loved to just stick with the boot stage naming, but the stage is
> very much architecture dependent:
> For BBB for example:
> 1. First-stage bootloader runs from internal hard-coded ROM
> 2. Second-stage bootloader runs from the internal SRAM (TI MLO) and is
>    generated with a trimmed down configuration.
> 3. Third-stage bootloader runs from the external RAM and is generated with a
>    full configuration.
> But for the QCA4531 and family:
> 1. First-stage bootloader runs from external serial NOR flash and is generated
>    with a full-blown configuration.
> 
> IMHO, let's just go with the suggested U-Boot naming (SPL) and if no barebox
> developers complain, stick to that.
> 
> Agreed?

I have a more use-case agnostic suggestion. I can add a KConfig choice to
specify the number of barebox configs to build. Until otherwise required, the
only valid choices are 1 or 2. To avoid wasting creativity on something
guaranteed to raise criticism, the two sub-packages are named:
  boot/barebox/barebox-config1
  boot/barebox/barebox-config2 

In the help I will obviously describe possible use-cases for the two
sub-configs, but I will steer clear from giving a generic mechanism a specific
name.

What are your thoughts on this?

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

* [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL
  2015-10-27 17:21     ` Pieter Smith
@ 2015-10-27 20:18       ` Arnout Vandecappelle
  2015-11-02 21:38         ` Pieter Smith
  0 siblings, 1 reply; 10+ messages in thread
From: Arnout Vandecappelle @ 2015-10-27 20:18 UTC (permalink / raw)
  To: buildroot

On 27-10-15 18:21, Pieter Smith wrote:
> What are your thoughts on this?

 Thinking out of the box here: would it be possible to keep a single barebox
package and do everything twice (or more) in the _CMDS, with different output
directories?

 Granted, that will be a bit tricky w.r.t. the kconfig infra.


 Regards,
 Arnout

-- 
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

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

* [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL
  2015-10-27 20:18       ` Arnout Vandecappelle
@ 2015-11-02 21:38         ` Pieter Smith
  0 siblings, 0 replies; 10+ messages in thread
From: Pieter Smith @ 2015-11-02 21:38 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

On Tue, Oct 27, 2015 at 09:18:25PM +0100, Arnout Vandecappelle wrote:
> On 27-10-15 18:21, Pieter Smith wrote:
> > What are your thoughts on this?
> 
>  Thinking out of the box here: would it be possible to keep a single barebox
> package and do everything twice (or more) in the _CMDS, with different output
> directories?
> 
>  Granted, that will be a bit tricky w.r.t. the kconfig infra.

My initial approach was exactly what you are suggesting. It works fine for
compiling the images, but it falls apart on other useful make infrastructure
that you would want to run at a finer granularity:

Wanting to build barebox with two configs, you would typically want to run
%-menuconfig for each of the two. This is not possible if the two builds are
not implemented by two separate packages in the buildroot make environment. It
simply ends up not being handy if the two build configurations are not
addressable as two separate packages.

> 
>  Regards,
>  Arnout
> 
> -- 
> 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

Regards,
Pieter Smith

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

end of thread, other threads:[~2015-11-02 21:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-25 19:33 [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Pieter Smith
2015-10-25 19:33 ` [Buildroot] [PATCH 1/4] barebox: prepare for x-loader build Pieter Smith
2015-10-25 19:33 ` [Buildroot] [PATCH 2/4] barebox: adds option to build x-loader Pieter Smith
2015-10-25 19:33 ` [Buildroot] [PATCH 3/4] barebox: user selection of build output images Pieter Smith
2015-10-25 19:33 ` [Buildroot] [PATCH 4/4] beaglebone: adds barebox bootloader defconfig Pieter Smith
2015-10-26  3:57 ` [Buildroot] [PATCH 0/4] Supporting a second Barebox build to build the MLO/SPL Thomas Petazzoni
2015-10-26 21:27   ` Pieter Smith
2015-10-27 17:21     ` Pieter Smith
2015-10-27 20:18       ` Arnout Vandecappelle
2015-11-02 21:38         ` Pieter Smith

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