From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: "Michał Kruszewski" <mkru@protonmail.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>,
Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: Re: Compiling barebox without PBL and using dts from Linux dts upstream for Zynq SoC
Date: Thu, 26 Mar 2026 15:07:27 +0100 [thread overview]
Message-ID: <85359e8c-33a0-46d4-8f3c-df0250af1e9e@pengutronix.de> (raw)
In-Reply-To: <uQ0wdkwojjz9oEqfuP5-wjYVdqShnu7Gb_zBE2IF0Nam7xR4HVUhENT8jTlVwnpDeG0NPB-ACdZSShnYWT_nLatBEhXq6pJ6YfEpBkxOqZs=@protonmail.com>
Hello Michał,
On 3/26/26 11:35 AM, Michał Kruszewski wrote:
>> A zynq_defconfig build will report at the end the generated images:
>>
>> images built:
>> barebox-avnet-zedboard.img
>> barebox-dt-2nd.img
>> Is images/barebox-avnet-zedboard.img the image you used?
>
> All I did was:
> make zynq_defconfig
> make
>
> I used neither images/barebox-avnet-zedboard.img nor images/barebox-dt-2nd.img.
> I used barebox file.
> Why?
> Because I use Vivado bootbin progam to generate the boot.bin file.
> bootbin requires that the second stage bootloader is provided in the ELF format.
The images meant for end user use are printed at the end of the
make invocation.
> When I use u-boot.elf everything works correctly.
The "barebox" file is not even stripped. It's not meant for direct use,
it's just an intermediary step before being linked into the PBL or for
use with gdb.
That said, we can have barebox generate a stripped ELF suitable for
use by Vivado bootbin if needed, once we know what's needed.
>> This is the line that does it for the Zynq Zedboard:
>
>> barebox_arm_entry(0, SZ_512M, __dtb_z_zynq_zed_start);
>
>> This function takes care to extract barebox and invoke it
>> with these arguments.
>
> So the compiled device tree is placed into the final image, isn't it?
Yes, the compiled device tree is shipped as part of the prebootloader.
>> barebox generates bootloader images for boards, so you must have
>> either used an image for an existing board or some intermediate build
>> artifact, hence my question above.
>
> What is an "intermediate build artifact"?
Roughly, the build system does something like this:
common/version.c -> common/version.o -> common/built-in.a
-> barebox -> vmbarebox -> build/images/start_avnet_zedboard.pbl
-> build/images/start_avnet_zedboard.pblb
-> barebox-avnet-zedboard.img
Everything except the first source file and the final image are
intermediate artifacts that are not meant to be used directly.
> How to use it instead a board image?
Try using build/images/start_avnet_zedboard.pbl
and if that works, we can have barebox generate a proper
stripped ELF with a normal name (e.g. barebox-avnet-zedboard.elf).
>> I am asking to clarify what you did. Your original email didn't
>> elaborate what you did, only what you thought was the problem.
>
> All I did was:
> make zynq_defconfig
> make
> I used the generated barebox elf file for Vivado bootbin.
> I replaced u-boot.elf with barebox.
> I did not expect the Linux to start.
> However, I did expect the barebox to start.
For ARM, the images in images/ are what actually should be used.
>> Yes, of course. Just add a new ENTRY_FUNCTION(_WITHSTACK) that does
>> only the parts you are interested in and reference it in
>> images/Makefile.zynq.
>
> Is there any tutorial/documentation on that?
https://www.barebox.org/doc/latest/devel/porting.html#porting-to-a-new-board
> I thought that maybe there is a simple CONFIG for that.
I got this feedback three times in the last few months and I agree we
should do something about this.
The usual model so far could be summarized as:
- barebox has one or more DTs embedded and you have some early low level
init that's board-specific anyway (e.g. RAM settings), so you wouldn't
change one of the DTs to something completely different anyway
- You have a bootloader that can boot Linux directly and want it to
start barebox, so you use the barebox-dt-2nd.img which accept an
external device tree
- If you have a UEFI already there, you can boot barebox-dt-2nd.img also
via EFI without a device tree if you enable the correct options in Kconfig
Your use case is in the middle, the device tree might be the only
thing you need to change, but it still needs to be linked into barebox
and there's no easy way for doing it from outside (yet).
Once you have something that works, I am sure we can find some way to
make it easier to extend to arbitrary device trees.
Cheers,
Ahmad
>
>
> Regards,
> Michał Kruszewski
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-03-26 14:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 7:29 Michał Kruszewski
2026-03-26 8:19 ` Ahmad Fatoum
2026-03-26 9:06 ` Michał Kruszewski
2026-03-26 9:28 ` Ahmad Fatoum
2026-03-26 10:35 ` Michał Kruszewski
2026-03-26 14:07 ` Ahmad Fatoum [this message]
2026-03-27 10:37 ` Michał Kruszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85359e8c-33a0-46d4-8f3c-df0250af1e9e@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=eagle.alexander923@gmail.com \
--cc=mkru@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox