mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Frank Wunderlich <>
To: Ahmad Fatoum <>
Subject: Aw: Re: barebox extending boot-scripts
Date: Wed, 5 Jan 2022 19:13:22 +0100	[thread overview]
Message-ID: <trinity-48d6bfb8-862a-4bdf-9146-e208983a61b5-1641406402672@3c-app-gmx-bs58> (raw)
In-Reply-To: <>


> Gesendet: Mittwoch, 05. Januar 2022 um 17:07 Uhr
> Von: "Ahmad Fatoum" <>
> An: "Frank Wunderlich" <>,
> Betreff: Re: barebox extending boot-scripts
> Hi,
> On 05.01.22 16:20, Frank Wunderlich wrote:
> > Hi,
> >
> > i'm making my first steps and try to add more boot-scripts (to land in /env/boot)
> >
> > i added a scipt in
> >
> > arch/arm/boards/rockchip-rk3568-evb/defaultenv/mmc-linux
> This should be defaultenv/boot/mmc-linux instead.
> > and set
> >
> > DEFAULT_ENVIRONMENT_PATH [=arch/arm/boards/rockchip-rk3568-evb/defaultenv]
> >
> > but if i boot the board /env/boot only contains the 2 default scripts
> >
> > barebox@Rockchip RK3568 EVB:/ ls /env/boot/
> > bnet    net
> Try ls -R /env, you should see mmc-linux at top-level with your
> current setup.
> > so maybe the dir/config-option i used is for defining variables only right?
> Top level is only meant for directories. There are directories for the different
> stuff, e.g. variables go into /env/nv/
> > should this point to an directory or a file?
> The config option is meant for use with external build systems, e.g. buildroot
> or PTXdist. For boards in-tree, you can add bbenv-y in the Makefile and call
>   // assuming directory is called defaultenv-myboard
>   defaultenv_append_directory(defaultenv_myboard);
> in the board code, see e.g. arch/arm/boards/embest-marsboard for an example.
> The reason for avoiding the config option for in-tree boards is that a single barebox
> configuration can build multiple boards in one go:
> extreme case: imx_v7_defconfig, which builds marsboard also builds more than 100 other images.
> The config option is global, but by explicitly calling defaultenv_append_directory,
> you can have board-specific environments.

will try this approach, thanks

> > i see this file which looks like the source of it
> >
> > ./defaultenv/defaultenv-2-base/boot/net
> >
> > I've put them there and they appear, but this is not board specific
> Ye, you can use this for debugging, but stuff upstreamed there must be generally
> applicable.
> > so if i later want to upstream one this is maybe not the right place.
> Boot scripts for publicly available evaluation kits are often not good candidates
> for upstreaming, because everybody using the EVKs has different thoughts on how to
> boot. The best way would be to use bootloader spec. It's one or more files you
> place at a known location that describe where your kernel and device tree are and
> what command line arguments to use and barebox can then automatically generate
> boot entries from all available bootloader spec files.
> See for an example
> of how to set this up. This is what I'd recommend instead of writing your own
> scripts.
> > ./defaultenv/defaultenv-2-menu/menu/10-boot-all/net
> >
> > seems to be a menu entry, but have not yet figured out how i can define one to add my scripts too
> >
> > have not found anything for it in the documentation yet
> The default boot menu is populated with the boot entries extracted from
> the contents of $global.boot.default.

currently only net is listed there

barebox@Rockchip RK3568 EVB:/ echo $global.boot.default

but in /env/boot i have my 2 new scripts

barebox@Rockchip RK3568 EVB:/ ls /env/boot
bnet          mmc-linux     net           tftp-linux

> boot -m will display that menu. It will also include all bootloader spec files.
> If that suffices, you won't need to create your own menu. If you want though,
> check the help text of the menutree command.

needed to add this option, and now it prints only "net" and "back",not my own scripts ;(

do i need my scripts to ./defaultenv/defaultenv-2-menu/menu/10-boot-all/ too?

> To boot into the boot menu, set nv autoboot=menu. "Detect bootsources" will
> list boot sources known to the barebox boot command.

is this stored anywhere so that is persistent on next reboot?

btw. how does saveenv exactly work (which part/filename/offset is used)? sasha told me that device will be enumerated to the current boot device, but where on this device is the env stored?

> See magicvar for a listing of all magic variables, or refer to the documentation.
> > btw. is there a way to use ls with wildcard without printing the path?
> >
> > ls /mnt/sd.1/extlinux/
> > Image_5.16            Image_5.16-next.gz    Image_5.16.gz
> >
> > ls /mnt/sd.1/extlinux/Image*
> > /mnt/sd.1/extlinux/Image_5.16
> > /mnt/sd.1/extlinux/Image_5.16-next.gz
> > /mnt/sd.1/extlinux/Image_5.16.gz
> >
> > i want to list only files matching Image*, but without path....number of columns does not matter
> Yes, cd /mnt/sd.1/extlinux
> Cheers,
> Ahmad

mhm, simple ;) can i store the active directory to restore it after script was run (if needed, e.g. on error booting)?

pwd shows current directory, but i cannot put it into an var...the bash approach does not work

barebox@Rockchip RK3568 EVB:/mnt/sd.1/extlinux pwd
barebox@Rockchip RK3568 EVB:/mnt/sd.1/extlinux thisdir=$(pwd)
barebox@Rockchip RK3568 EVB:/mnt/sd.1/extlinux echo $thisdir
barebox@Rockchip RK3568 EVB:/mnt/sd.1/extlinux

regards Frank

barebox mailing list

  reply	other threads:[~2022-01-05 18:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 15:20 Frank Wunderlich
2022-01-05 16:07 ` Ahmad Fatoum
2022-01-05 18:13   ` Frank Wunderlich [this message]
2022-01-06  8:08     ` Sascha Hauer
2022-01-06 12:41       ` Aw: " Frank Wunderlich
2022-01-07 13:07         ` Sascha Hauer
2022-01-07 16:42           ` Aw: " Frank Wunderlich
2022-01-10  9:42             ` Sascha Hauer
2022-01-15 13:47               ` Aw: " Frank Wunderlich
2022-01-17  8:59                 ` Sascha Hauer
2022-01-29 10:40       ` Aw: " Frank Wunderlich
2022-01-31 11:03         ` Sascha Hauer

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-48d6bfb8-862a-4bdf-9146-e208983a61b5-1641406402672@3c-app-gmx-bs58 \ \ \ \

* 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