How to boot Barebox bootloader from SD Card

Hello,

my goal is to boot the Barebox bootloader from a SD Card.

According to the Barebox documentation an “internal boot mode” for the i.MX6 exists and the barebox image “can be directly written to a SD Card” (4.12. Freescale i.MX — barebox 2021.06.0 documentation).

However, I found postst in the forum saying that “Technically one can not really boot any of our modules from an SD card” (How to boot from SDcard using Aster carrier board - Toradex Community).

Is booting Barebox from SD Card and then booting a linux image also from SD Card even possible with the Carrier board?

Does anyone have experience on booting Barebox from SD Card?

Thanks and best regards

hi @Kaisan

Welcome to the Toradex Community!

my goal is to boot the Barebox bootloader from a SD Card.

What is you Use-Case? Did you try using U-Boot?

However, I found postst in the forum saying that “Technically one can not really boot any of our modules from an SD card”

Yeah, that’s true for the Toradex Module, since they are usually fused to boot from Non-Volatile Memory on the module.

Is booting Barebox from SD Card and then booting a linux image also from SD Card even possible with the Carrier board?

Does anyone have experience on booting Barebox from SD Card?

It should be possible, but however we don’t have any experience doing that. Pengutronix seems to have ported Barebox on Colibri T20 of Toradex. You can have a look here, this might give you some indications, if you want to port Barebox to Colibri iMX6.

Best regards,
Jaski

I am using Apalis T30, and we are doing dual boot WEC/Linux. We are using the WEC partitions to chainload E-boot->U-boot, which then uses distroboot to search for boot media on uSD and USB stick. You can customize the boot.scr for what boot media you want to search. We also use this to load a splash screen while the image is starting up.

If you didn’t plan on using the embedded flash, that sort of approach could work I think? I’m not positive, but I bet distroboot could be used to chainload barebox. You wouldn’t necessarily have to use WEC partitions. I think just standard U-boot could probably do this?

Is booting Barebox from SD Card and then booting a linux image also from SD Card even possible with the Carrier board?

No, as mention on this very forum before, our modules exclusively boot from their on-module storage. However, one may chain boot e.g. using the bmode U-Boot command or even using a DCD wrapper of sorts.

Does anyone have experience on booting Barebox from SD Card?

Not really, no. You would really first need a proper port of Barebox to our hardware aka what is usually called a board support package aka BSP.

Is my concept realistic with the Aster Carrier Board?

I guess using Aster vs. some other carrier board is the least of your problems.

The main problem I see is how does Barebox know where the GPIOs are on the Aster Carrier board. Normally this is passed on with the device tree file, but Barebox is going to use the one for iMX6 (e.g. imx6q.dtsi?)

No, you will need a proper BSP for your hardware.

And also how can I boot my Barebox image with U-Boot?

That would be the chain booting.

Hi Jaski,

thank you for your answer.

My Use-Case is to realize the communication of the board to a Hardware Security Module over SPI in the Barebox bootloader. It’s not that I don’t want to use U-Boot, but the requirement is to use Barebox.

Therefore my goal is to somehow boot my Barebox image and communicate over SPI while I’m in the Barebox environment.

My plan right now is to make U-Boot boot my Barebox image first (documented here). And while I’m in the Barebox environment, I want to use the Pins on the Aster Carrier Board to communicate with an external hardware module over SPI.

Is my concept realistic with the Aster Carrier Board? The main problem I see is how does Barebox know where the GPIOs are on the Aster Carrier board. Normally this is passed on with the device tree file, but Barebox is going to use the one for iMX6 (e.g. imx6q.dtsi?)

And also how can I boot my Barebox image with U-Boot?

Thanks and kind Regards,

Kai