mbox series

[v5,0/7] Add barebox bootloader support (and testing)

Message ID 20240910184143.2820792-1-ejo@pengutronix.de
Headers show
Series Add barebox bootloader support (and testing) | expand

Message

Enrico Jörns Sept. 10, 2024, 6:41 p.m. UTC
This adds support for the barebox bootloader (and tools) to oe-core.

In order to have proper testing, this extends oe-selftest to allow
basic testing of bootloaders. While at it, cover both barebox and u-boot.

v5:

* move common recipe data into barebox-common.inc
* Add proper DESCRIPTION

Enrico Jorns (5):
  barebox: set default BAREBOX_CONFIG for qemu machines
  oeqa/utils/qemurunner: support ignoring vt100 escape sequences
  oeqa: support passing custom boot patterns to runqemu
  oeqa/selftest/cases: add basic u-boot test
  oeqa/selftest/cases: add basic barebox tests

Marco Felsch (2):
  barebox: add initial support
  barebox-tools: add initial barebox tools support

 meta/conf/distro/include/maintainers.inc      |   2 +
 meta/conf/machine/qemuarm.conf                |   1 +
 meta/conf/machine/qemuarm64.conf              |   1 +
 meta/conf/machine/qemux86-64.conf             |   1 +
 meta/lib/oeqa/selftest/cases/barebox.py       |  43 ++++++
 meta/lib/oeqa/selftest/cases/uboot.py         |  42 +++++
 meta/lib/oeqa/targetcontrol.py                |   5 +-
 meta/lib/oeqa/utils/commands.py               |   5 +-
 meta/lib/oeqa/utils/qemurunner.py             |   6 +-
 meta/recipes-bsp/barebox/barebox-common.inc   |  18 +++
 .../barebox/barebox-tools_2024.08.0.bb        |  52 +++++++
 meta/recipes-bsp/barebox/barebox.inc          | 145 ++++++++++++++++++
 meta/recipes-bsp/barebox/barebox_2024.08.0.bb |   3 +
 13 files changed, 318 insertions(+), 6 deletions(-)
 create mode 100644 meta/lib/oeqa/selftest/cases/barebox.py
 create mode 100644 meta/lib/oeqa/selftest/cases/uboot.py
 create mode 100644 meta/recipes-bsp/barebox/barebox-common.inc
 create mode 100644 meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
 create mode 100644 meta/recipes-bsp/barebox/barebox.inc
 create mode 100644 meta/recipes-bsp/barebox/barebox_2024.08.0.bb

Comments

Enrico Jörns Sept. 11, 2024, 9:42 a.m. UTC | #1
Am Dienstag, dem 10.09.2024 um 20:41 +0200 schrieb Enrico Jörns:
> +
> +do_configure() {
> +        if [ -e ${WORKDIR}/defconfig ]; then
> +                cp ${WORKDIR}/defconfig ${B}/.config

Just noted in other tests against actual BSPs that this check is not yet adapted to UNPACKDIR.

Will send a v6.

Regards, Enrico

> +        else
> +                if [ -n "${BAREBOX_CONFIG}" ]; then
> +                        oe_runmake ${BAREBOX_CONFIG}
> +                else
> +                        bbfatal "No defconfig given. Either add file 'file://defconfig' to
> SRC_URI or set BAREBOX_CONFIG"
> +                fi
> +        fi
> +
> +        ${S}/scripts/kconfig/merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
> +        cml1_do_configure
> +}
> +
> +BAREBOX_ENV_DIR[doc] = "Overlay the barebox built-in environment with the environment provided by
> the BSP if specified."
> +BAREBOX_ENV_DIR ??= "${WORKDIR}/env/"
> +
> +do_compile () {
> +        export userccflags="${TARGET_LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
> +        unset LDFLAGS
> +        unset CFLAGS
> +        unset CPPFLAGS
> +        unset CXXFLAGS
> +        unset MACHINE
> +
> +        if [ -d ${BAREBOX_ENV_DIR} ]; then
> +                BAREBOX_DEFAULT_ENV="$(grep ^CONFIG_DEFAULT_ENVIRONMENT_PATH .config | cut -d '='
> -f 2 | tr -d '"')"
> +                oe_runmake CONFIG_DEFAULT_ENVIRONMENT_PATH="\"${BAREBOX_DEFAULT_ENV}
> ${BAREBOX_ENV_DIR}\""
> +        else
> +                oe_runmake
> +        fi
> +}
> +
> +BAREBOX_BINARY[doc] = "Specify the barebox binary to install. If not specified all barebox
> artifacts are installed."
> +BAREBOX_BINARY ??= "${@'barebox.efi' if d.getVar('EFI_PROVIDER') == 'barebox' else ''}"
> +BAREBOX_SUFFIX[doc] = "Specify the suffix for ${BAREBOX_IMAGE}."
> +BAREBOX_SUFFIX ??= "img"
> +BAREBOX_IMAGE[doc] = "A unique barebox image name. Unused if ${BAREBOX_BINARY} is not set."
> +BAREBOX_IMAGE_DEFAULT ?= "${PN}-${MACHINE}-${PV}-${PR}.${BAREBOX_SUFFIX}"
> +BAREBOX_IMAGE ?= "${@'${EFI_BOOT_IMAGE}' if d.getVar('EFI_PROVIDER') == 'barebox' else
> '${BAREBOX_IMAGE_DEFAULT}'}"
> +
> +BAREBOX_INSTALL_PATH ?= "${@'${EFI_FILES_PATH}' if d.getVar('EFI_PROVIDER') == 'barebox' else
> '/boot'}"
> +
> +do_install () {
> +        if [ -n "${BAREBOX_BINARY}" ]; then
> +
> +                BAREBOX_BIN=${B}/${BAREBOX_BINARY}
> +                if [ ! -f "${BAREBOX_BIN}" ]; then
> +                        BAREBOX_BIN=${B}/images/${BAREBOX_BINARY}
> +                fi
> +                if [ ! -f "${BAREBOX_BIN}" ]; then
> +                        bbfatal "Failed to locate ${BAREBOX_BINARY}"
> +                fi
> +
> +                install -D -m 644 ${BAREBOX_BIN} ${D}${BAREBOX_INSTALL_PATH}/${BAREBOX_IMAGE}
> +                ln -sf ${BAREBOX_IMAGE} ${D}${BAREBOX_INSTALL_PATH}/${BAREBOX_BINARY}
> +        else
> +                install -d ${D}${BAREBOX_INSTALL_PATH}/
> +                for image in $(cat ${B}/barebox-flash-images); do
> +                        install -m 644 ${B}/${image} ${D}${BAREBOX_INSTALL_PATH}/
> +                done
> +        fi
> +}
> +FILES:${PN} = "${BAREBOX_INSTALL_PATH}"
> +
> +do_deploy () {
> +        if [ -n "${BAREBOX_BINARY}" ]; then
> +
> +                BAREBOX_BIN=${B}/${BAREBOX_BINARY}
> +                if [ ! -f "${BAREBOX_BIN}" ]; then
> +                        BAREBOX_BIN=${B}/images/${BAREBOX_BINARY}
> +                fi
> +
> +                install -D -m 644 ${BAREBOX_BIN} ${DEPLOYDIR}/${BAREBOX_IMAGE}
> +                ln -sf ${BAREBOX_IMAGE} ${DEPLOYDIR}/${BAREBOX_BINARY}
> +        else
> +                for image in $(cat ${B}/barebox-flash-images); do
> +                        cp ${B}/${image} ${DEPLOYDIR}
> +                done
> +        fi
> +}
> +addtask deploy after do_compile
> diff --git a/meta/recipes-bsp/barebox/barebox_2024.08.0.bb b/meta/recipes-
> bsp/barebox/barebox_2024.08.0.bb
> new file mode 100644
> index 0000000000..1a7bbbccaa
> --- /dev/null
> +++ b/meta/recipes-bsp/barebox/barebox_2024.08.0.bb
> @@ -0,0 +1,3 @@
> +require barebox.inc
> +
> +SRC_URI[sha256sum] = "b08a762da8d63dd18b4f2d9f5d0a8da001b6e608d1b3eff6dcebc6a2e575d535"
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#204367): https://lists.openembedded.org/g/openembedded-core/message/204367
> Mute This Topic: https://lists.openembedded.org/mt/108380782/3616721
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ejo@pengutronix.de]
> -=-=-=-=-=-=-=-=-=-=-=-
>