Skip to contentSkip to conversation

Add support for building barebox xloader.

RFC New Marek Belisko 3 participants 5 messages Dec 22, 2012 – Jul 12, 2015

lore
Share & tools
lore
#0 lore raw

cover Add support for building barebox xloader.

Reposting-> first time was sent to wrong mailing list.

Currently Buildroot have support to build barebox only. For some board there is possibility to build also xloader (first stage bootloader) based on barebox. Following patches add support for building barebox + xloader (aka MLO) by once if user specify configuration for xloader.

First patch move building barebox to separate directory. Second patch add support for building xloader. Both binaries are build in separate directories to avoid problems with not clean tree.

With this patches we can build complete image for e.g. pandaboard (which is my case) without building anything by hand.

Marek Belisko (2):
barebox: Build barebox in separate directory.
barebox: Add possibility to build also barebox xloader (MLO).

 boot/barebox/Config.in  |   28 ++++++++++++++++++++++++++++
 boot/barebox/barebox.mk |   45 ++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 66 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

RFC 1/2 barebox: Build barebox in separate directory.

This is necessary when we would like to add support for building also barebox xloader (MLO).

---
 boot/barebox/barebox.mk |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
boot/barebox/barebox.mk +10 -7
index a025d5f..16110b9 100644
@@ -54,9 +54,12 @@ else ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
 BAREBOX_SOURCE_CONFIG = $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE)
 endif
 
+BAREBOX_BUILD_DIR = barebox
+
 define BAREBOX_CONFIGURE_CMDS
+	mkdir -p $(@D)/$(BAREBOX_BUILD_DIR)
 	cp $(BAREBOX_SOURCE_CONFIG) $(@D)/arch/$(BAREBOX_ARCH)/configs/buildroot_defconfig
-	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) buildroot_defconfig
+	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) buildroot_defconfig O=$(BAREBOX_BUILD_DIR)
 endef
 
 ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
@@ -68,11 +71,11 @@ endif
 
 define BAREBOX_BUILD_CMDS
 	$(BAREBOX_BUILD_BAREBOXENV_CMDS)
-	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D)
+	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) O=$(BAREBOX_BUILD_DIR)
 endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
-	cp $(@D)/barebox.bin $(BINARIES_DIR)
+	cp $(@D)/$(BAREBOX_BUILD_DIR)/barebox.bin $(BINARIES_DIR)
 endef
 
 ifeq ($(BR2_TARGET_BAREBOX_BAREBOXENV),y)
@@ -97,15 +100,15 @@ barebox-menuconfig barebox-xconfig barebox-gconfig barebox-nconfig: barebox-conf
 	rm -f $(BAREBOX_DIR)/.stamp_{built,target_installed,images_installed}
 
 barebox-savedefconfig: barebox-configure
-	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(BAREBOX_DIR) \
+	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(BAREBOX_DIR) O=$(BAREBOX_BUILD_DIR) \
 		$(subst barebox-,,$@)
 
 ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y)
-barebox-update-config: barebox-configure $(BAREBOX_DIR)/.config
-	cp -f $(BAREBOX_DIR)/.config $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE)
+barebox-update-config: barebox-configure $(BAREBOX_DIR)/$(BAREBOX_BUILD_DIR)/.config
+	cp -f $(BAREBOX_DIR)/$(BAREBOX_BUILD_DIR)/.config $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE)
 
 barebox-update-defconfig: barebox-savedefconfig
-	cp -f $(BAREBOX_DIR)/defconfig $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE)
+	cp -f $(BAREBOX_DIR)/$(BAREBOX_BUILD_DIR)/defconfig $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE)
 else
 barebox-update-config: ;
 barebox-update-defconfig: ;
Signature · 1 line
1.7.10.4
#2 lore raw

RFC 2/2 barebox: Add possibility to build also barebox xloader (MLO).

In reply to Marek Belisko

This add config option for user to select defconfig or custom xloader config. Barebox have xloader defconfig for:
phycard_a_xl2_xload_defconfig
pcm049_xload_defconfig
archosg9_xload_defconfig
phycard_a_l1_xload_defconfig
omap3530_beagle_xload_defconfig
panda_xload_defconfig

---
 boot/barebox/Config.in  |   28 ++++++++++++++++++++++++++++
 boot/barebox/barebox.mk |   28 ++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)
boot/barebox/Config.in +28 -0
index 95f330f..bb20542 100644
@@ -99,4 +99,32 @@ config BR2_TARGET_BAREBOX_BAREBOXENV
 	help
 	  Install bareboxenv tool in target.
 
+choice
+	prompt "Barebox xloader configuration"
+	default BR2_TARGET_BAREBOX_XLOADER_NONE
+
+config BR2_TARGET_BAREBOX_XLOADER_NONE
+	bool "None"
+
+config BR2_TARGET_BAREBOX_XLOADER_USE_DEFCONFIG
+	bool "Using defconfig"
+
+config BR2_TARGET_BAREBOX_XLOADER_USE_CUSTOM_CONFIG
+	bool "Using a custom config file"
+
+endchoice
+
+config BR2_TARGET_BAREBOX_BOARD_XLOADER_DEFCONFIG
+	string "board xloader defconfig"
+	depends on BR2_TARGET_BAREBOX_XLOADER_USE_DEFCONFIG
+	help
+	  Name of the board for which Barebox xloader should be built, without
+	  the _defconfig suffix (can be used for pandaboard, beagleboard ...).
+
+config BR2_TARGET_BAREBOX_XLOADER_CUSTOM_CONFIG_FILE
+	string "Xloader configuration file path"
+	depends on BR2_TARGET_BAREBOX_XLOADER_USE_CUSTOM_CONFIG
+	help
+	  Path to the barebox custom xloader configuration file.
+
 endif
boot/barebox/barebox.mk +28 -0
index 16110b9..199b708 100644
@@ -56,7 +56,33 @@ endif
 
 BAREBOX_BUILD_DIR = barebox
 
+ifneq ($(BR2_TARGET_BAREBOX_XLOADER_NONE),y)
+ifeq ($(BR2_TARGET_BAREBOX_XLOADER_USE_DEFCONFIG),y)
+BAREBOX_XLOADER_SOURCE_CONFIG = $(@D)/arch/$(BAREBOX_ARCH)/configs/$(call qstrip,$(BR2_TARGET_BAREBOX_BOARD_XLOADER_DEFCONFIG))_defconfig
+else ifeq ($(BR2_TARGET_BAREBOX_XLOADER_USE_CUSTOM_CONFIG),y)
+BAREBOX_XLOADER_SOURCE_CONFIG = $(BR2_TARGET_BAREBOX_XLOADER_CUSTOM_CONFIG_FILE)
+endif
+
+BAREBOX_XLOADER_BUILD_DIR = MLO
+
+define BAREBOX_XLOADER_CONFIGURE_CMDS
+	mkdir -p $(@D)/$(BAREBOX_XLOADER_BUILD_DIR)
+	cp $(BAREBOX_XLOADER_SOURCE_CONFIG) $(@D)/arch/$(BAREBOX_ARCH)/configs/buildroot_xload_defconfig
+	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) buildroot_xload_defconfig O=$(BAREBOX_XLOADER_BUILD_DIR)
+endef
+
+define BAREBOX_XLOADER_BUILD_CMDS
+	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) O=$(BAREBOX_XLOADER_BUILD_DIR)
+endef
+
+define BAREBOX_XLOADER_INSTALL_IMAGES_CMDS
+	cp $(@D)/$(BAREBOX_XLOADER_BUILD_DIR)/MLO $(BINARIES_DIR)
+endef
+
+endif
+
 define BAREBOX_CONFIGURE_CMDS
+	$(BAREBOX_XLOADER_CONFIGURE_CMDS)
 	mkdir -p $(@D)/$(BAREBOX_BUILD_DIR)
 	cp $(BAREBOX_SOURCE_CONFIG) $(@D)/arch/$(BAREBOX_ARCH)/configs/buildroot_defconfig
 	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) buildroot_defconfig O=$(BAREBOX_BUILD_DIR)
@@ -70,11 +96,13 @@ endef
 endif
 
 define BAREBOX_BUILD_CMDS
+	$(BAREBOX_XLOADER_BUILD_CMDS)
 	$(BAREBOX_BUILD_BAREBOXENV_CMDS)
 	$(MAKE) $(BAREBOX_MAKE_FLAGS) -C $(@D) O=$(BAREBOX_BUILD_DIR)
 endef
 
 define BAREBOX_INSTALL_IMAGES_CMDS
+	$(BAREBOX_XLOADER_INSTALL_IMAGES_CMDS)
 	cp $(@D)/$(BAREBOX_BUILD_DIR)/barebox.bin $(BINARIES_DIR)
 endef
 
Signature · 1 line
1.7.10.4
#3 lore raw

RFC 2/2 barebox: Add possibility to build also barebox xloader (MLO).

Dear Marek Belisko,

Quoted 9 lines · Marek Belisko

This add config option for user to select defconfig or custom xloader config. Barebox have xloader defconfig for:
phycard_a_xl2_xload_defconfig
pcm049_xload_defconfig
archosg9_xload_defconfig
phycard_a_l1_xload_defconfig
omap3530_beagle_xload_defconfig
panda_xload_defconfig

Quoted 5 lines
---
 boot/barebox/Config.in  |   28 ++++++++++++++++++++++++++++
 boot/barebox/barebox.mk |   28 ++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

This would be useful to have, but we would like to see a different implementation. Our notes were:

Allow a second Barebox build, to build the MLO/SPL. See
http://patchwork.ozlabs.org/patch/207942/ and
http://patchwork.ozlabs.org/patch/207943/. The proposed design is to have boot/barebox/ containing the common stuff, and then two separate packages boot/barebox-first/ and boot/barebox-second/ (names to be chosen). There is only one version selection, but each package allows to define the configuration to be used. Design should be a little bit like package/gcc, where we have multiple gcc builds, but share a lot of common definitions between the packages.

Since no one has submitted anything in this direction since 2.5 years, we will mark your patch as Rejected. Do not hesitate to work on this topic again, and send new patches.

Best regards,

Thomas

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

cover Add support for building barebox xloader.

In reply to Marek Belisko

ping

Quoted 17 lines · Marek Belisko

Reposting-> first time was sent to wrong mailing list.

Currently Buildroot have support to build barebox only. For some board there is possibility to build also xloader (first stage bootloader) based on barebox. Following patches add support for building barebox + xloader (aka MLO) by once if user specify configuration for xloader.

First patch move building barebox to separate directory. Second patch add support for building xloader. Both binaries are build in separate directories to avoid problems with not clean tree.

With this patches we can build complete image for e.g. pandaboard (which is my case) without building anything by hand.

Marek Belisko (2):
barebox: Build barebox in separate directory.
barebox: Add possibility to build also barebox xloader (MLO).

Quoted 7 lines
 boot/barebox/Config.in  |   28 ++++++++++++++++++++++++++++
 boot/barebox/barebox.mk |   45 ++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 66 insertions(+), 7 deletions(-)

--
1.7.10.4

Cheers,

marek

Signature · 10 lines
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com