mbox series

[v2,0/9] Add barebox bootloader support (and testing)

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

Message

Enrico Jörns March 31, 2023, 10:40 a.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.

v2:
  * set myself as maintainer in maintainers.inc
  * move doc from documentation.conf to recipe
  * update to barebox v2023.03 (including fixes for musl, etc.)
  * set standard configs for qemu machines to allow building them
  * add better efi dir support in barebox recipe
  * enable testing bootloaders in oeqa
  * add test cases for barebox (and u-boot)

Enrico Jorns (7):
  barebox: set default BAREBOX_CONFIG for qemu machines
  oeqa/utils/qemurunner: support ignoring vt100 escape sequences
  oeqa/utils/qemurunner: simplify output parsing and make
    crlf-compatible
  oeqa/utils/commands: document runqemu context manager
  oeqa: support passing custom boot patterns to runqemu
  oeqa/selftest/cases: add barebox tests
  oeqa/selftest/cases: add basic u-boot test

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

 meta/conf/distro/include/maintainers.inc      |   2 +
 meta/lib/oeqa/selftest/cases/barebox.py       |  72 +++++++++
 meta/lib/oeqa/selftest/cases/uboot.py         |  40 +++++
 meta/lib/oeqa/targetcontrol.py                |   5 +-
 meta/lib/oeqa/utils/commands.py               |  22 ++-
 meta/lib/oeqa/utils/qemurunner.py             |  37 +++--
 .../barebox/barebox-tools_2023.03.0.bb        |  56 +++++++
 meta/recipes-bsp/barebox/barebox.inc          | 138 ++++++++++++++++++
 meta/recipes-bsp/barebox/barebox_2023.03.0.bb |   3 +
 9 files changed, 351 insertions(+), 24 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-tools_2023.03.0.bb
 create mode 100644 meta/recipes-bsp/barebox/barebox.inc
 create mode 100644 meta/recipes-bsp/barebox/barebox_2023.03.0.bb

Comments

Alexander Kanavin March 31, 2023, 2:03 p.m. UTC | #1
On Fri, 31 Mar 2023 at 12:40, Enrico Jorns <ejo@pengutronix.de> wrote:
> v2:
>   * set myself as maintainer in maintainers.inc
>   * move doc from documentation.conf to recipe
>   * update to barebox v2023.03 (including fixes for musl, etc.)
>   * set standard configs for qemu machines to allow building them
>   * add better efi dir support in barebox recipe
>   * enable testing bootloaders in oeqa
>   * add test cases for barebox (and u-boot)

Thanks for persevering with this! The patchset is mostly fine (I'll
write a couple comments now), and just needs to get a verdict from the
autobuilder.

Alex
Richard Purdie April 3, 2023, 3:49 p.m. UTC | #2
On Fri, 2023-03-31 at 12:40 +0200, Enrico Jorns wrote:
> 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.
> 
> v2:
>   * set myself as maintainer in maintainers.inc
>   * move doc from documentation.conf to recipe
>   * update to barebox v2023.03 (including fixes for musl, etc.)
>   * set standard configs for qemu machines to allow building them
>   * add better efi dir support in barebox recipe
>   * enable testing bootloaders in oeqa
>   * add test cases for barebox (and u-boot)
> 
> Enrico Jorns (7):
>   barebox: set default BAREBOX_CONFIG for qemu machines
>   oeqa/utils/qemurunner: support ignoring vt100 escape sequences
>   oeqa/utils/qemurunner: simplify output parsing and make
>     crlf-compatible
>   oeqa/utils/commands: document runqemu context manager
>   oeqa: support passing custom boot patterns to runqemu
>   oeqa/selftest/cases: add barebox tests
>   oeqa/selftest/cases: add basic u-boot test
> 
> Marco Felsch (2):
>   barebox: add initial support
>   barebox-tools: add initial barebox tools support

Testing on the autobuilder did trigger a few issues:

on musl:

https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5023
https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/6932

and some failing oe-selftests:

https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/4971
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5023
[there were more but look similar]

Cheers,

Richard
Enrico Jörns April 3, 2023, 9:20 p.m. UTC | #3
Hi Richard,

Am Montag, dem 03.04.2023 um 16:49 +0100 schrieb Richard Purdie:
> On Fri, 2023-03-31 at 12:40 +0200, Enrico Jorns wrote:
> > 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.
> > 
> > v2:
> >   * set myself as maintainer in maintainers.inc
> >   * move doc from documentation.conf to recipe
> >   * update to barebox v2023.03 (including fixes for musl, etc.)
> >   * set standard configs for qemu machines to allow building them
> >   * add better efi dir support in barebox recipe
> >   * enable testing bootloaders in oeqa
> >   * add test cases for barebox (and u-boot)
> > 
> > Enrico Jorns (7):
> >   barebox: set default BAREBOX_CONFIG for qemu machines
> >   oeqa/utils/qemurunner: support ignoring vt100 escape sequences
> >   oeqa/utils/qemurunner: simplify output parsing and make
> >     crlf-compatible
> >   oeqa/utils/commands: document runqemu context manager
> >   oeqa: support passing custom boot patterns to runqemu
> >   oeqa/selftest/cases: add barebox tests
> >   oeqa/selftest/cases: add basic u-boot test
> > 
> > Marco Felsch (2):
> >   barebox: add initial support
> >   barebox-tools: add initial barebox tools support
> 
> Testing on the autobuilder did trigger a few issues:
> 
> on musl:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5023
> https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/6932
> 
> and some failing oe-selftests:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/4971
> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5023
> [there were more but look similar]

thank you for the autobuilder logs!

I fear we are running into a conceptional issue that I already feared we could run into (but did not
test for yet).

If I traced this down correctly, then the 'issue' is:

| NOTE: Multiple providers are available for virtual/bootloader (barebox, u-boot)
| Consider defining a PREFERRED_PROVIDER entry to match virtual/bootloader

The fitimage tests building "virtual/bootloader", silently assuming this is equal to u-boot (which
it actually was so far).

Now, the quick fix for this would be to properly set the correct PREFERRED_PROVIDER here, but I
could imagine that we run into similar issues in other builds, too.

Do you have a good solution for this at hand? Like defining a standard preferred provider for
virtual/bootloader?

I guess one could argue possibly that the mechanism does exactly what it is meant for. And a few
machines (like beaglebone-yocto or qemuloongarch) actually set the PREFERRED_PROVIDER, but not all
and this might lead to silently switching the bootloader (like in our tests).

I hope you have a better overview on the topic than I have and could give me a hint on how you would
like to see this being resolved?

Thanks in advance and best regards

Enrico


> Cheers,
> 
> Richard
> 
>
Khem Raj April 4, 2023, 2:33 a.m. UTC | #4
On Mon, Apr 3, 2023 at 2:20 PM Enrico Jörns <ejo@pengutronix.de> wrote:
>
> Hi Richard,
>
> Am Montag, dem 03.04.2023 um 16:49 +0100 schrieb Richard Purdie:
> > On Fri, 2023-03-31 at 12:40 +0200, Enrico Jorns wrote:
> > > 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.
> > >
> > > v2:
> > >   * set myself as maintainer in maintainers.inc
> > >   * move doc from documentation.conf to recipe
> > >   * update to barebox v2023.03 (including fixes for musl, etc.)
> > >   * set standard configs for qemu machines to allow building them
> > >   * add better efi dir support in barebox recipe
> > >   * enable testing bootloaders in oeqa
> > >   * add test cases for barebox (and u-boot)
> > >
> > > Enrico Jorns (7):
> > >   barebox: set default BAREBOX_CONFIG for qemu machines
> > >   oeqa/utils/qemurunner: support ignoring vt100 escape sequences
> > >   oeqa/utils/qemurunner: simplify output parsing and make
> > >     crlf-compatible
> > >   oeqa/utils/commands: document runqemu context manager
> > >   oeqa: support passing custom boot patterns to runqemu
> > >   oeqa/selftest/cases: add barebox tests
> > >   oeqa/selftest/cases: add basic u-boot test
> > >
> > > Marco Felsch (2):
> > >   barebox: add initial support
> > >   barebox-tools: add initial barebox tools support
> >
> > Testing on the autobuilder did trigger a few issues:
> >
> > on musl:
> >
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5023
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/6932
> >
> > and some failing oe-selftests:
> >
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/4971
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5023
> > [there were more but look similar]
>
> thank you for the autobuilder logs!
>
> I fear we are running into a conceptional issue that I already feared we could run into (but did not
> test for yet).
>
> If I traced this down correctly, then the 'issue' is:
>
> | NOTE: Multiple providers are available for virtual/bootloader (barebox, u-boot)
> | Consider defining a PREFERRED_PROVIDER entry to match virtual/bootloader
>
> The fitimage tests building "virtual/bootloader", silently assuming this is equal to u-boot (which
> it actually was so far).
>
> Now, the quick fix for this would be to properly set the correct PREFERRED_PROVIDER here, but I
> could imagine that we run into similar issues in other builds, too.
>
> Do you have a good solution for this at hand? Like defining a standard preferred provider for
> virtual/bootloader?
>
> I guess one could argue possibly that the mechanism does exactly what it is meant for. And a few
> machines (like beaglebone-yocto or qemuloongarch) actually set the PREFERRED_PROVIDER, but not all
> and this might lead to silently switching the bootloader (like in our tests).
>
> I hope you have a better overview on the topic than I have and could give me a hint on how you would
> like to see this being resolved?

I see that it fails to build with clang
https://errors.yoctoproject.org/Errors/Details/699467/

is it buildable with clang ? if not we can pin it to use gcc always in
meta-clang but I want to make sure first.


>
> Thanks in advance and best regards
>
> Enrico
>
>
> > Cheers,
> >
> > Richard
> >
> >
>
> --
> Pengutronix e.K.                           | Enrico Jörns                |
> Embedded Linux Consulting & Support        | https://www.pengutronix.de/ |
> Steuerwalder Str. 21                       | Phone: +49-5121-206917-180  |
> 31137 Hildesheim, Germany                  | Fax:   +49-5121-206917-9    |
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#179655): https://lists.openembedded.org/g/openembedded-core/message/179655
> Mute This Topic: https://lists.openembedded.org/mt/97970644/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Enrico Jörns April 4, 2023, 11:13 a.m. UTC | #5
Hi Khem,

> Am Montag, dem 03.04.2023 um 19:33 -0700 schrieb Khem Raj:


> [...]

> I see that it fails to build with clang
> https://errors.yoctoproject.org/Errors/Details/699467/

thanks for testing this!

> is it buildable with clang ? if not we can pin it to use gcc always in
> meta-clang but I want to make sure first.

barebox itself is unfortunately not buildable with clang since on some architectures like ARM32 it
uses GCC extensions that are not implemented by clang.

The barebox-tools however that are built for 'sandbox' should be buildable with clang.
It's just that when passing CROSS_COMPILE, barebox cannot guess if it has to append 'clang' or 'gcc'
suffix. The kernel seems to have an explicit handling for this by checking for "ifneq ($(LLVM),)"
and plugging together CC differently.

With barebox we could however still override the Makefile's default "CC = $(CROSS_COMPILE)gcc" when
passing CC explicitly to EXTRA_OEMAKE. We have just successfully tested this patch:

--- a/meta/recipes-bsp/barebox/barebox-tools_2023.03.0.bb
+++ b/meta/recipes-bsp/barebox/barebox-tools_2023.03.0.bb
@@ -18,6 +18,8 @@ EXTRA_OEMAKE = " \
   ARCH=sandbox \
   CROSS_COMPILE=${TARGET_PREFIX} -C ${S} O=${B} \
   CROSS_PKG_CONFIG=pkg-config \
+  CC='${CC}' \
+  LD='${LD}' \
   "


If that looks fine for you, I could add it to the recipe.


Best regards, Enrico

> 
> > 
> > Thanks in advance and best regards
> > 
> > Enrico
> > 
> > 
> > > Cheers,
> > > 
> > > Richard
> > > 
> > > 
> > 
> > --
> > Pengutronix e.K.                           | Enrico Jörns                |
> > Embedded Linux Consulting & Support        | https://www.pengutronix.de/ |
> > Steuerwalder Str. 21                       | Phone: +49-5121-206917-180  |
> > 31137 Hildesheim, Germany                  | Fax:   +49-5121-206917-9    |
> > 
> > 
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#179655): https://lists.openembedded.org/g/openembedded-core/message/179655
> > Mute This Topic: https://lists.openembedded.org/mt/97970644/1997914
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> > 
>
Khem Raj April 4, 2023, 4:11 p.m. UTC | #6
On Tue, Apr 4, 2023 at 4:13 AM Enrico Jörns <ejo@pengutronix.de> wrote:
>
> Hi Khem,
>
> > Am Montag, dem 03.04.2023 um 19:33 -0700 schrieb Khem Raj:
>
>
> > [...]
>
> > I see that it fails to build with clang
> > https://errors.yoctoproject.org/Errors/Details/699467/
>
> thanks for testing this!
>
> > is it buildable with clang ? if not we can pin it to use gcc always in
> > meta-clang but I want to make sure first.
>
> barebox itself is unfortunately not buildable with clang since on some architectures like ARM32 it
> uses GCC extensions that are not implemented by clang.
>
> The barebox-tools however that are built for 'sandbox' should be buildable with clang.
> It's just that when passing CROSS_COMPILE, barebox cannot guess if it has to append 'clang' or 'gcc'
> suffix. The kernel seems to have an explicit handling for this by checking for "ifneq ($(LLVM),)"
> and plugging together CC differently.
>
> With barebox we could however still override the Makefile's default "CC = $(CROSS_COMPILE)gcc" when
> passing CC explicitly to EXTRA_OEMAKE. We have just successfully tested this patch:
>
> --- a/meta/recipes-bsp/barebox/barebox-tools_2023.03.0.bb
> +++ b/meta/recipes-bsp/barebox/barebox-tools_2023.03.0.bb
> @@ -18,6 +18,8 @@ EXTRA_OEMAKE = " \
>    ARCH=sandbox \
>    CROSS_COMPILE=${TARGET_PREFIX} -C ${S} O=${B} \
>    CROSS_PKG_CONFIG=pkg-config \
> +  CC='${CC}' \
> +  LD='${LD}' \
>    "
>
>
> If that looks fine for you, I could add it to the recipe.
>

yeah I was testing one with CC alone and that worked too but also
containing LD is good, so please include above
changes in next patchset

>
> Best regards, Enrico
>
> >
> > >
> > > Thanks in advance and best regards
> > >
> > > Enrico
> > >
> > >
> > > > Cheers,
> > > >
> > > > Richard
> > > >
> > > >
> > >
> > > --
> > > Pengutronix e.K.                           | Enrico Jörns                |
> > > Embedded Linux Consulting & Support        | https://www.pengutronix.de/ |
> > > Steuerwalder Str. 21                       | Phone: +49-5121-206917-180  |
> > > 31137 Hildesheim, Germany                  | Fax:   +49-5121-206917-9    |
> > >
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > View/Reply Online (#179655): https://lists.openembedded.org/g/openembedded-core/message/179655
> > > Mute This Topic: https://lists.openembedded.org/mt/97970644/1997914
> > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > >
> >
>
> --
> Pengutronix e.K.                           | Enrico Jörns                |
> Embedded Linux Consulting & Support        | https://www.pengutronix.de/ |
> Steuerwalder Str. 21                       | Phone: +49-5121-206917-180  |
> 31137 Hildesheim, Germany                  | Fax:   +49-5121-206917-9    |
>