Support building barebox with an auxiliary config
v6 cover Support building barebox with an auxiliary config
This patch-set adds support for building barebox with an auxiliary config. 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 contain the common stuff.
2. Move the non-shared parts to boot/barebox/barebox and duplicate it in boot/barebox/barebox-aux.
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:
v6: Review rework based on feedback from Thomas Pettazoni:
- Second config build renamed to auxiliary build.
- Primary package build moved to boot/barebox/barebox to keep things symmetric.
- Dropped already merged parts of series.
v5: Review rework based on feedback from Arnout Vandecappelle, Yegor Yefremov
and Thomas Petazzoni:
- Dropped support to rename output/images (same can be achieved with genimage)
- Simplified barebox INSTALL_IMAGE_CMDS
- Simplified KConfig option naming
- Appends test defconfig to last commit message
Improvements to the BBB barebox test config:
- Latest kernel and headers
- Tunes barebox.env to boot from eMMC/SD
- Use genimage to generate a full sdcard.img
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 (3):
barebox: prepare for auxiliarry build
barebox: support auxiliary config build
beaglebone: adds barebox bootloader defconfig
board/beaglebone/barebox/barebox.env/boot/sd | 11 ++++ board/beaglebone/barebox/barebox.env/config-board | 4 ++ board/beaglebone/barebox/genimage.cfg | 32 +++++++++++ board/beaglebone/barebox/post-image.sh | 17 ++++++ boot/barebox/Config.in | 70 ++++------------------- boot/barebox/barebox-aux/Config.in | 60 +++++++++++++++++++ boot/barebox/barebox-aux/barebox-aux.hash | 1 + boot/barebox/barebox-aux/barebox-aux.mk | 8 +++ boot/barebox/barebox.mk | 4 +- boot/barebox/barebox/Config.in | 65 +++++++++++++++++++++ boot/barebox/barebox/barebox.hash | 1 + boot/barebox/barebox/barebox.mk | 8 +++ configs/beaglebone_barebox_defconfig | 43 ++++++++++++++ 13 files changed, 262 insertions(+), 62 deletions(-) create mode 100644 board/beaglebone/barebox/barebox.env/boot/sd create mode 100644 board/beaglebone/barebox/barebox.env/config-board create mode 100644 board/beaglebone/barebox/genimage.cfg create mode 100755 board/beaglebone/barebox/post-image.sh create mode 100644 boot/barebox/barebox-aux/Config.in create mode 120000 boot/barebox/barebox-aux/barebox-aux.hash create mode 100644 boot/barebox/barebox-aux/barebox-aux.mk create mode 100644 boot/barebox/barebox/Config.in create mode 120000 boot/barebox/barebox/barebox.hash create mode 100644 boot/barebox/barebox/barebox.mk create mode 100644 configs/beaglebone_barebox_defconfig
Signature · 1 line
2.5.0
PATCH v6 1/3 barebox: prepare for auxiliarry build
No functional changes. In preparation for the auxiliary barebox build, boot/barebox is split into two parts:
1. boot/barebox:
- The source and patch specification which are to be shared between the barebox and barebox-aux packages.
- The barebox-package function and build logic.
2. boot/barebox/barebox:
- The package configuration, fragments, barebox env, etc.
- The actual barebox package make instantiation.
--- boot/barebox/Config.in | 67 +-------------------------------------- boot/barebox/barebox.mk | 3 +- boot/barebox/barebox/Config.in | 65 +++++++++++++++++++++++++++++++++++++ boot/barebox/barebox/barebox.hash | 1 + boot/barebox/barebox/barebox.mk | 8 +++++ 5 files changed, 76 insertions(+), 68 deletions(-) create mode 100644 boot/barebox/barebox/Config.in create mode 120000 boot/barebox/barebox/barebox.hash create mode 100644 boot/barebox/barebox/barebox.mk
boot/barebox/Config.in +1 -66
@@ -64,71 +64,6 @@ config BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION endif - -choice - prompt "Barebox configuration" - default BR2_TARGET_BAREBOX_USE_DEFCONFIG - -config BR2_TARGET_BAREBOX_USE_DEFCONFIG - bool "Using a defconfig" - -config BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG - bool "Using a custom config file" - -endchoice - -config BR2_TARGET_BAREBOX_BOARD_DEFCONFIG - string "board defconfig" - depends on BR2_TARGET_BAREBOX_USE_DEFCONFIG - help - Name of the board for which Barebox should be built, without - the _defconfig suffix. - - -config BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE - string "Configuration file path" - depends on BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG - help - Path to the barebox configuration file - -config BR2_TARGET_BAREBOX_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_IMAGE_FILE - string "Image filename" - help - Name of the generated barebox image, which will be copied to - the images directory. - - If left empty, defaults to: - - barebox.bin for barebox versions older than 2012.10. - - barebox-flash-image for later versions. - -config BR2_TARGET_BAREBOX_BAREBOXENV - bool "bareboxenv tool in target" - help - Install bareboxenv tool in target. - -config BR2_TARGET_BAREBOX_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_CUSTOM_ENV_PATH - string "Environment path" - depends on BR2_TARGET_BAREBOX_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. +source boot/barebox/barebox/Config.in endif
boot/barebox/barebox.mk +1 -2
@@ -142,5 +142,4 @@ endef barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname))) -# instantiate this barebox package -$(eval $(barebox-package)) +include boot/barebox/barebox/barebox.mk
boot/barebox/barebox/Config.in new file +65 -0
65 lines not on this page · raw message
boot/barebox/barebox/barebox.hash new file +1 -0
@@ -0,0 +1 @@ +../barebox.hash
boot/barebox/barebox/barebox.mk new file +8 -0
@@ -0,0 +1,8 @@ +################################################################################ +# +# barebox +# +################################################################################ + +# Instantiate the barebox package +$(eval $(barebox-package))
Signature · 1 line
2.5.0
Thomas Petazzoni
AppliedPATCH v6 1/3 barebox: prepare for auxiliarry build
Hello,
Quoted 11 lines · Pieter Smith
No functional changes. In preparation for the auxiliary barebox build, boot/barebox is split into two parts:
1. boot/barebox:
- The source and patch specification which are to be shared between the barebox and barebox-aux packages.
- The barebox-package function and build logic.
2. boot/barebox/barebox:
- The package configuration, fragments, barebox env, etc.
- The actual barebox package make instantiation.Signed-off-by Pieter Smith <[email protected]>
Quoted 10 lines
--- boot/barebox/Config.in | 67 +-------------------------------------- boot/barebox/barebox.mk | 3 +- boot/barebox/barebox/Config.in | 65 +++++++++++++++++++++++++++++++++++++ boot/barebox/barebox/barebox.hash | 1 + boot/barebox/barebox/barebox.mk | 8 +++++ 5 files changed, 76 insertions(+), 68 deletions(-) create mode 100644 boot/barebox/barebox/Config.in create mode 120000 boot/barebox/barebox/barebox.hash create mode 100644 boot/barebox/barebox/barebox.mk
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v6 1/3 barebox: prepare for auxiliarry build
Hi Thomas,
Quoted 25 lines · Thomas Petazzoni
Hello,
Quoted 11 lines · Pieter Smith
No functional changes. In preparation for the auxiliary barebox build, boot/barebox is split into two parts:
1. boot/barebox:
- The source and patch specification which are to be shared between the barebox and barebox-aux packages.
- The barebox-package function and build logic.
2. boot/barebox/barebox:
- The package configuration, fragments, barebox env, etc.
- The actual barebox package make instantiation.Signed-off-by Pieter Smith <[email protected]>Quoted 10 lines
--- boot/barebox/Config.in | 67 +-------------------------------------- boot/barebox/barebox.mk | 3 +- boot/barebox/barebox/Config.in | 65 +++++++++++++++++++++++++++++++++++++ boot/barebox/barebox/barebox.hash | 1 + boot/barebox/barebox/barebox.mk | 8 +++++ 5 files changed, 76 insertions(+), 68 deletions(-) create mode 100644 boot/barebox/barebox/Config.in create mode 120000 boot/barebox/barebox/barebox.hash create mode 100644 boot/barebox/barebox/barebox.mk
Quoted 1 line
Applied to master, thanks.
Thanks as well.
Quoted 5 lines
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Regards,
Pieter
PATCH v6 2/3 barebox: support auxiliary config build
In reply to Pieter SmithAdds support to build barebox with an auxiliary 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.
Tested with the following defconfig:
# 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_REMOUNT_ROOTFS_RW=y
# filesystem BR2_PACKAGE_AM33X_CM3=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y
# bootloader BR2_TARGET_BAREBOX=y BR2_TARGET_BAREBOX_BOARD_DEFCONFIG="am335x" BR2_TARGET_BAREBOX_IMAGE_FILE="images/barebox-am33xx-beaglebone.img" BR2_TARGET_BAREBOX_CUSTOM_ENV=y BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH="board/beaglebone/barebox/barebox.env" BR2_TARGET_BAREBOX_AUX=y BR2_TARGET_BAREBOX_AUX_BOARD_DEFCONFIG="am335x_mlo" BR2_TARGET_BAREBOX_AUX_IMAGE_FILE="images/barebox-am33xx-beaglebone-mlo.img"
# kernel BR2_LINUX_KERNEL=y 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
--- boot/barebox/Config.in | 15 ++++++++ boot/barebox/barebox-aux/Config.in | 60 +++++++++++++++++++++++++++++++ boot/barebox/barebox-aux/barebox-aux.hash | 1 + boot/barebox/barebox-aux/barebox-aux.mk | 8 +++++ boot/barebox/barebox.mk | 1 + 5 files changed, 85 insertions(+) create mode 100644 boot/barebox/barebox-aux/Config.in create mode 120000 boot/barebox/barebox-aux/barebox-aux.hash create mode 100644 boot/barebox/barebox-aux/barebox-aux.mk
boot/barebox/Config.in +15 -0
@@ -66,4 +66,19 @@ endif source boot/barebox/barebox/Config.in +menuconfig BR2_TARGET_BAREBOX_AUX + bool "Build barebox with an auxiliary config" + help + Build barebox with an auxiliary 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_AUX + +source boot/barebox/barebox-aux/Config.in + +endif + endif
boot/barebox/barebox-aux/Config.in new file +60 -0
60 lines not on this page · raw message
boot/barebox/barebox-aux/barebox-aux.hash new file +1 -0
@@ -0,0 +1 @@ +../barebox.hash
boot/barebox/barebox-aux/barebox-aux.mk new file +8 -0
@@ -0,0 +1,8 @@ +################################################################################ +# +# barebox-aux +# +################################################################################ + +# Instantiate the auxiliary barebox package +$(eval $(barebox-package))
boot/barebox/barebox.mk +1 -0
@@ -143,3 +143,4 @@ endef barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname))) include boot/barebox/barebox/barebox.mk +include boot/barebox/barebox-aux/barebox-aux.mk
Signature · 1 line
2.5.0
Thomas Petazzoni
AppliedPATCH v6 2/3 barebox: support auxiliary config build
Hello,
Quoted 46 lines · Pieter Smith
Adds support to build barebox with an auxiliary 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_defconfigbuilds the full barebox bootloader with device tree, and
-am335x_mlo_defconfigbuilds the smaller MLO bootloader that loads the full barebox bootloader from the eMMC or SD card.Tested with the following defconfig:
# 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_REMOUNT_ROOTFS_RW=y# filesystem BR2_PACKAGE_AM33X_CM3=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y# bootloader BR2_TARGET_BAREBOX=y BR2_TARGET_BAREBOX_BOARD_DEFCONFIG="am335x" BR2_TARGET_BAREBOX_IMAGE_FILE="images/barebox-am33xx-beaglebone.img" BR2_TARGET_BAREBOX_CUSTOM_ENV=y BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH="board/beaglebone/barebox/barebox.env" BR2_TARGET_BAREBOX_AUX=y BR2_TARGET_BAREBOX_AUX_BOARD_DEFCONFIG="am335x_mlo" BR2_TARGET_BAREBOX_AUX_IMAGE_FILE="images/barebox-am33xx-beaglebone-mlo.img"# kernel BR2_LINUX_KERNEL=y 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 setSigned-off-by Pieter Smith <[email protected]>
Quoted 10 lines
--- boot/barebox/Config.in | 15 ++++++++ boot/barebox/barebox-aux/Config.in | 60 +++++++++++++++++++++++++++++++ boot/barebox/barebox-aux/barebox-aux.hash | 1 + boot/barebox/barebox-aux/barebox-aux.mk | 8 +++++ boot/barebox/barebox.mk | 1 + 5 files changed, 85 insertions(+) create mode 100644 boot/barebox/barebox-aux/Config.in create mode 120000 boot/barebox/barebox-aux/barebox-aux.hash create mode 100644 boot/barebox/barebox-aux/barebox-aux.mk
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v6 2/3 barebox: support auxiliary config build
Hi Thomas,
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 9 lines · Pieter Smith
Adds support to build barebox with an auxiliary 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_defconfigbuilds the full barebox bootloader with device tree, and
-am335x_mlo_defconfigbuilds the smaller MLO bootloader that loads the full barebox bootloader from the eMMC or SD card.
[snip]
Quoted 1 line
Applied to master, thanks.
Thanks as well.
Quoted 5 lines
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
- Pieter
PATCH v6 3/3 beaglebone: adds barebox bootloader defconfig
In reply to Pieter Smith* Builds the barebox MLO and bootloader.
* Generates a bootable SD card image with boot and rootfs partitions.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.
--- board/beaglebone/barebox/barebox.env/boot/sd | 11 ++++++ board/beaglebone/barebox/barebox.env/config-board | 4 +++ board/beaglebone/barebox/genimage.cfg | 32 +++++++++++++++++ board/beaglebone/barebox/post-image.sh | 17 +++++++++ configs/beaglebone_barebox_defconfig | 43 +++++++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 board/beaglebone/barebox/barebox.env/boot/sd create mode 100644 board/beaglebone/barebox/barebox.env/config-board create mode 100644 board/beaglebone/barebox/genimage.cfg create mode 100755 board/beaglebone/barebox/post-image.sh create mode 100644 configs/beaglebone_barebox_defconfig
board/beaglebone/barebox/barebox.env/boot/sd new file +11 -0
@@ -0,0 +1,11 @@ +#!/bin/sh + +global.bootm.image=/boot/zImage + +# Default to using the barebox built-in dtb +# global.bootm.oftree=/boot/oftree + +# No initrd +# global.bootm.initrd=<path to initrd> + +global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
board/beaglebone/barebox/barebox.env/config-board new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh + +global.boot.default=sd +
board/beaglebone/barebox/genimage.cfg new file +32 -0
@@ -0,0 +1,32 @@ +image boot.vfat { + vfat { + file MLO { + image = "barebox-am33xx-beaglebone-mlo.img" + } + file barebox.bin { + image = "barebox-am33xx-beaglebone.img" + } + files = { + "barebox.env", + "zImage" + } + } + size = 32M +} + +image sdcard.img { + hdimage { + } + + partition boot { + partition-type = 0xC + in-partition-table = "yes" + bootable = "true" + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext4" + } +}
board/beaglebone/barebox/post-image.sh new file +17 -0
@@ -0,0 +1,17 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" +GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +rm -rf "${GENIMAGE_TMP}" + +genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}" + +exit $? +
configs/beaglebone_barebox_defconfig new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v6 3/3 beaglebone: adds barebox bootloader defconfig
Hello,
Quoted 6 lines · Pieter Smith
* Builds the barebox MLO and bootloader.
* Generates a bootable SD card image with boot and rootfs partitions.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.Signed-off-by Pieter Smith <[email protected]>
As we discussed, I've marked this one as rejected in patchwork. I don't think it's worth hacving a separate defconfig for the BeagleBone, whose only difference is to use Barebox instead of U-Boot.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v6 3/3 beaglebone: adds barebox bootloader defconfig
Hi Thomas,
Quoted 8 lines · Thomas Petazzoni
Hello,
Quoted 5 lines · Pieter Smith
* Builds the barebox MLO and bootloader.
* Generates a bootable SD card image with boot and rootfs partitions.
* Barebox integrates a perfectly good device-tree for the bbb, so no dtb is being generated with the kernel.
Quoted 5 lines
Quoted 1 line
Signed-off-by Pieter Smith <[email protected]>As we discussed, I've marked this one as rejected in patchwork. I don't think it's worth hacving a separate defconfig for the BeagleBone, whose only difference is to use Barebox instead of U-Boot.
Understood. Hopefully people can find it back in the mail archives. ;-)
Quoted 5 lines
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
- Pieter
v6 cover Support building barebox with an auxiliary config
In reply to Pieter SmithHello,
Quoted 5 lines · Pieter Smith
Revision history:
v6: Review rework based on feedback from Thomas Pettazoni:
- Second config build renamed to auxiliary build.
- Primary package build moved to boot/barebox/barebox to keep things symmetric.
- Dropped already merged parts of series.
Thanks for this new version, looks good to me! I'll wait for Arnout to comment and see if he has objections to this way of doing things.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
v6 cover Support building barebox with an auxiliary config
Hi Thomas,
Quoted 4 lines · Thomas Petazzoni
Hello,
On Sun, 24 Apr 2016 23:15:22 +0200, Pieter Smith wrote:
Quoted 8 lines
Quoted 5 lines
Revision history:
v6: Review rework based on feedback from Thomas Pettazoni:
- Second config build renamed to auxiliary build.
- Primary package build moved to boot/barebox/barebox to keep things symmetric.
- Dropped already merged parts of series.Thanks for this new version, looks good to me! I'll wait for Arnout to comment and see if he has objections to this way of doing things.
A pleasure! I hope it holds up. I will be a little short on time the coming month.
[snip]
- Pieter