Compiled in boot environment and dtbo files

Sascha Hauer sha at pengutronix.de
Wed Jun 16 05:34:03 PDT 2021


Hey Konsti,

On Wed, Jun 16, 2021 at 10:10:55AM +0200, Konstantin Kletschke wrote:
> Dear community,
> 
> actually I wonder how to prepare a reset/boot up default boot environment compiled in.
> 
> Is it correct, that my 1st task to achieve this is to add a new file in defaultenv/defaultenv-2-base/boot
> like “insidem2m” for example? I managed to modify the existing “sd” entry to be able to boot

defaultenv/defaultenv-2-base/boot is the generic place used for all
boards. As you are using the beaglebone you should rather manipulate
arch/arm/boards/beaglebone/defaultenv-beaglebone/. This directory is
added with defaultenv_append_directory(defaultenv_beaglebone) to the
environment once we actually know we are running on the beaglebone.

> and persist this, thats how my new entry should look:
> 
> #!/bin/sh
> 
> global.bootm.image=/boot/uImage
> global.bootm.oftree=/boot/am335x-boneblack.dtb
> global.linux.bootargs.dyn.root="cape_enable=capemgr.enable_partno=BB-UART1,BB-UART4 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait”
> 

You could do it that way. I suggest using
https://systemd.io/BOOT_LOADER_SPECIFICATION/. With that you can put
Kernel and device tree into the rootfs and start the whole thing with
"boot emmc".

> 
> 
> I can edit and modify those file and persist them, where is this saved? In my case it looks modified stuff shows
> up in barebox.env in my /boot.

Yes. Where this is stored depends on the board. In case of the
beaglebone there's a FAT on the eMMC anyway, so we use that to store the
environment. The environment is a binary file, it's like that because
normally you don't have a FS available.

> 
> Especially my question is, when I add a boot entry compiled in, the boot.default variable should get this entry
> and this must be reset/default compiled-in, how is this done?

During runtime that would be "nv boot.default=insidem2m; saveenv".
When you want to make that the default create a file
arch/arm/boards/beaglebone/defaultenv-beaglebone/nv/boot.default with
the content "insidem2m"

> 
> My second issue is, currently I need to apply two dtbo files to the kernel booting, how do I do this in barebox?

The command for this would be

mount mmc1.1
of_overlay /mnt/mmc1.1/lib/firmware/BB-UART1-00A0.dtbo
of_overlay /mnt/mmc1.1/lib/firmware/BB-UART4-00A0.dtbo

This assumes you have your rootfs on the second eMMC partition. Replace
mmc1.1 with something else when your rootfs is elsewhere.

We are currently working on more convenience around loading overlays,
something to automatically load desired overlays from a known place in
the rootfs when booting with bootloaderspec, but we are not there yet.

> 
> in uEnv.txt, I did not find a pendant in the barebox world yet. The capemgr/slot kernel commandline stuff is
> deprecated, right?

I don't know, I haven't followed what happened to the capemgr stuff.

Sascha

-- 
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 |



More information about the barebox mailing list