* barebox extending boot-scripts @ 2022-01-05 15:20 Frank Wunderlich 2022-01-05 16:07 ` Ahmad Fatoum 0 siblings, 1 reply; 12+ messages in thread From: Frank Wunderlich @ 2022-01-05 15:20 UTC (permalink / raw) To: barebox 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 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 so maybe the dir/config-option i used is for defining variables only right? should this point to an directory or a file? 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, so if i later want to upstream one this is maybe not the right place. ./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 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 regards Frank _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: barebox extending boot-scripts 2022-01-05 15:20 barebox extending boot-scripts Frank Wunderlich @ 2022-01-05 16:07 ` Ahmad Fatoum 2022-01-05 18:13 ` Aw: " Frank Wunderlich 0 siblings, 1 reply; 12+ messages in thread From: Ahmad Fatoum @ 2022-01-05 16:07 UTC (permalink / raw) To: Frank Wunderlich, barebox 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. > 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 https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf 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. 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. To boot into the boot menu, set nv autoboot=menu. "Detect bootsources" will list boot sources known to the barebox boot command. 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 > > regards Frank > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Aw: Re: barebox extending boot-scripts 2022-01-05 16:07 ` Ahmad Fatoum @ 2022-01-05 18:13 ` Frank Wunderlich 2022-01-06 8:08 ` Sascha Hauer 0 siblings, 1 reply; 12+ messages in thread From: Frank Wunderlich @ 2022-01-05 18:13 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox Hi, > Gesendet: Mittwoch, 05. Januar 2022 um 17:07 Uhr > Von: "Ahmad Fatoum" <a.fatoum@pengutronix.de> > An: "Frank Wunderlich" <frank-w@public-files.de>, barebox@lists.infradead.org > 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 https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf 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 net 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 /mnt/sd.1/extlinux barebox@Rockchip RK3568 EVB:/mnt/sd.1/extlinux thisdir=$(pwd) barebox@Rockchip RK3568 EVB:/mnt/sd.1/extlinux echo $thisdir $(pwd) barebox@Rockchip RK3568 EVB:/mnt/sd.1/extlinux regards Frank _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: barebox extending boot-scripts 2022-01-05 18:13 ` Aw: " Frank Wunderlich @ 2022-01-06 8:08 ` Sascha Hauer 2022-01-06 12:41 ` Aw: " Frank Wunderlich 2022-01-29 10:40 ` Aw: " Frank Wunderlich 0 siblings, 2 replies; 12+ messages in thread From: Sascha Hauer @ 2022-01-06 8:08 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Ahmad Fatoum, barebox On Wed, Jan 05, 2022 at 07:13:22PM +0100, Frank Wunderlich wrote: > Hi, > > > Gesendet: Mittwoch, 05. Januar 2022 um 17:07 Uhr > > Von: "Ahmad Fatoum" <a.fatoum@pengutronix.de> > > An: "Frank Wunderlich" <frank-w@public-files.de>, barebox@lists.infradead.org > > 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 https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf 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 > net > > 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? Variables beginning with 'nv.' are stored in the environment automatically. > > 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? Normally it's described in the device tree: environment-emmc { compatible = "barebox,environment"; device-path = &environment_emmc; }; The device-path property points to a partition on the eMMC: &sdhci { ... partitions { compatible = "fixed-partitions"; environment_emmc: partition@408000 { label = "barebox-environment"; reg = <0x0 0x408000 0x0 0x8000>; }; }; }; > > > 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 It works for example with: for i in /mnt/sd.1/extlinux/Image*; do basename $i b; echo $b; done But anyway, I'm with Ahmad here, you should rather look into bootloader spec. The shell is nice to have, but it's even nicer to not have to use it. 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Aw: Re: Re: barebox extending boot-scripts 2022-01-06 8:08 ` Sascha Hauer @ 2022-01-06 12:41 ` Frank Wunderlich 2022-01-07 13:07 ` Sascha Hauer 2022-01-29 10:40 ` Aw: " Frank Wunderlich 1 sibling, 1 reply; 12+ messages in thread From: Frank Wunderlich @ 2022-01-06 12:41 UTC (permalink / raw) To: Sascha Hauer; +Cc: Ahmad Fatoum, barebox Hi, thanks for answer. tried to strip mail it a bit down ;) > Gesendet: Donnerstag, 06. Januar 2022 um 09:08 Uhr > Von: "Sascha Hauer" <sha@pengutronix.de> > On Wed, Jan 05, 2022 at 07:13:22PM +0100, Frank Wunderlich wrote: > > > > DEFAULT_ENVIRONMENT_PATH [=arch/arm/boards/rockchip-rk3568-evb/defaultenv] > > > 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. if i understand it right i need to create a dir arch/arm/boards/rockchip-rk3568-evb/defaultenv-rk3568 with dirs nv (variables) and boot (bootscripts) and add bbenv-y += defaultenv-rk3568 in arch/arm/boards/rockchip-rk3568-evb/Makefile > > > 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. is extlinux (i used in uboot and conf-file is already present) supported here? > > > See https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf for an example > > > of how to set this up. This is what I'd recommend instead of writing your own > > > scripts. i do not fully understand the bootloader spec in the pdf as config file seems to be /mnt/mmc0.4/loader/entries/stm32mp157c-dk2.conf and then boot -d mmc0.4 is run...so the path (loader/entries) seems to be fixed and all files there will be processed (which order)? how is root appended (/dev/mmcblkXpY|uuid|...) when linux-appendroot is set to true? sorry for asking dumb questions but i want to understand how to do it right and not only doing anything ;) > > > > ./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 > > net > > > > 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? do i need to propagate my own scripts somewhere to be listed in the bootmenu? in cmdline i had tried this: global.boot.default="net mmc-linux tftp-linux" boot -m which works, but how can i set this variable at compile-time? is the right way creating a file defaultenv/defaultenv-2-base/nv/boot.default (or arch/arm/boards/rockchip-rk3568-evb/defaultenv-rk3568/nv/boot.default) with the content i want? so it looks like in the pdf above ("global.variable s, these are initialized from the correspoding non-volatile nv.variable s") > > > 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? > > Variables beginning with 'nv.' are stored in the environment > automatically. > > > > > 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? > > Normally it's described in the device tree: > > environment-emmc { > compatible = "barebox,environment"; > device-path = &environment_emmc; > }; > > The device-path property points to a partition on the eMMC: > > &sdhci { > ... > partitions { > compatible = "fixed-partitions"; > > environment_emmc: partition@408000 { > label = "barebox-environment"; > reg = <0x0 0x408000 0x0 0x8000>; > }; > }; > }; thx, if i understand it right, then it's an offset/size defined in dts by reg-property. My board uses the same values which is iirc a bit above the 4M position (0x408000,4M=0x400000). As i don't have a real partition there (first partition is at 8M), so i guess it is directly written (no file, like ENV_OFFSET in uboot). The 0x8000 should be the size (32kByte like ENV_SIZE), right? > > > 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? > > It works for example with: > > for i in /mnt/sd.1/extlinux/Image*; do basename $i b; echo $b; done nice, that makes it a bit more usable like using numbers to choose i=0;for f in /mnt/sd.1/extlinux/Image*; do basename $f b; echo "$i:$b";let i++; done > But anyway, I'm with Ahmad here, you should rather look into bootloader > spec. The shell is nice to have, but it's even nicer to not have to use > it. this is for testing multiple kernels with changing filenames (very dynamic process, e.g. using 1 kernel binary with multiple dtb) and to avoid adding a bootmenu entry everytime....this is not for end-user :) and here scripting is imho the best way...this allows me to add extra params to cmdline too (like debug level,dumping offsets) without changing a distroboot config for fixed kernels i have defined an extlinux.conf for uboot, but i'm unsure if barebox can use this file too. have not found anything about extlinux/syslinux in barebox yet. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: Re: barebox extending boot-scripts 2022-01-06 12:41 ` Aw: " Frank Wunderlich @ 2022-01-07 13:07 ` Sascha Hauer 2022-01-07 16:42 ` Aw: " Frank Wunderlich 0 siblings, 1 reply; 12+ messages in thread From: Sascha Hauer @ 2022-01-07 13:07 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Ahmad Fatoum, barebox On Thu, Jan 06, 2022 at 01:41:39PM +0100, Frank Wunderlich wrote: > Hi, > thanks for answer. tried to strip mail it a bit down ;) > > Gesendet: Donnerstag, 06. Januar 2022 um 09:08 Uhr > > Von: "Sascha Hauer" <sha@pengutronix.de> > > On Wed, Jan 05, 2022 at 07:13:22PM +0100, Frank Wunderlich wrote: > > > > > > DEFAULT_ENVIRONMENT_PATH [=arch/arm/boards/rockchip-rk3568-evb/defaultenv] > > > > 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. > > if i understand it right i need to create a dir > > arch/arm/boards/rockchip-rk3568-evb/defaultenv-rk3568 Yes. > > with dirs nv (variables) and boot (bootscripts) > > and add > bbenv-y += defaultenv-rk3568 > in > arch/arm/boards/rockchip-rk3568-evb/Makefile Yes. Furthermore you have to add to the board code: defaultenv_append_directory(defaultenv_rk3568); > > > > > 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. > > is extlinux (i used in uboot and conf-file is already present) supported here? > > > > > See https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf for an example > > > > of how to set this up. This is what I'd recommend instead of writing your own > > > > scripts. > > i do not fully understand the bootloader spec in the pdf as config file seems to be > > /mnt/mmc0.4/loader/entries/stm32mp157c-dk2.conf > > and then > boot -d mmc0.4 > > is run...so the path (loader/entries) seems to be fixed and all files there will be processed (which order)? Yes. No particular order, I guess it would be the order it is on the filesystem. > how is root appended (/dev/mmcblkXpY|uuid|...) when linux-appendroot is set to true? When root is appended it is assumed to be the same fs that also has the bootloader spec file, so the rootfs also has the entry and the kernel. > > > 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? > > do i need to propagate my own scripts somewhere to be listed in the bootmenu? > > in cmdline i had tried this: > > global.boot.default="net mmc-linux tftp-linux" > boot -m > > which works, but how can i set this variable at compile-time? By creating the file defaultenv/defaultenv-2-base/nv/boot.default with the content "net mmc-linux tftp-linux". Alternatively you can also create your own board specific env overlay like discussed above using the bbenv-y approach. > > is the right way creating a file > defaultenv/defaultenv-2-base/nv/boot.default (or arch/arm/boards/rockchip-rk3568-evb/defaultenv-rk3568/nv/boot.default) > with the content i want? so it looks like in the pdf above ("global.variable s, these are initialized from the > correspoding non-volatile nv.variable s") Yes. > > &sdhci { > > ... > > partitions { > > compatible = "fixed-partitions"; > > > > environment_emmc: partition@408000 { > > label = "barebox-environment"; > > reg = <0x0 0x408000 0x0 0x8000>; > > }; > > }; > > }; > > thx, if i understand it right, then it's an offset/size defined in dts by reg-property. My board uses the same values which is iirc a bit above the 4M position (0x408000,4M=0x400000). Yes. It's the fixed partition binding normally used for raw NOR/NAND flashes. > As i don't have a real partition there (first partition is at 8M), so i guess it is directly written (no file, like ENV_OFFSET in uboot). The 0x8000 should be the size (32kByte like ENV_SIZE), right? Right. > > > > > 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? > > > > It works for example with: > > > > for i in /mnt/sd.1/extlinux/Image*; do basename $i b; echo $b; done > > nice, that makes it a bit more usable like using numbers to choose > > i=0;for f in /mnt/sd.1/extlinux/Image*; do basename $f b; echo "$i:$b";let i++; done > > > But anyway, I'm with Ahmad here, you should rather look into bootloader > > spec. The shell is nice to have, but it's even nicer to not have to use > > it. > > this is for testing multiple kernels with changing filenames (very > dynamic process, e.g. using 1 kernel binary with multiple dtb) and to > avoid adding a bootmenu entry everytime....this is not for end-user :) In that case you could also use bootm directly. > > and here scripting is imho the best way...this allows me to add extra > params to cmdline too (like debug level,dumping offsets) without > changing a distroboot config Not sure if you know already, but barebox concatenates all variables in the "global.linux.bootargs." namespace to the kernel command line, so you can easily add or remove a variable to add/remove kernel options without affecting unrelated options. > > for fixed kernels i have defined an extlinux.conf for uboot, but i'm > unsure if barebox can use this file too. have not found anything about > extlinux/syslinux in barebox yet. No, not yet. 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Aw: Re: Re: Re: barebox extending boot-scripts 2022-01-07 13:07 ` Sascha Hauer @ 2022-01-07 16:42 ` Frank Wunderlich 2022-01-10 9:42 ` Sascha Hauer 0 siblings, 1 reply; 12+ messages in thread From: Frank Wunderlich @ 2022-01-07 16:42 UTC (permalink / raw) To: Sascha Hauer; +Cc: Ahmad Fatoum, barebox Hi missed the defaultenv_append_directory(defaultenv_rk3568); in board-file...after adding that it seems to work > Gesendet: Freitag, 07. Januar 2022 um 14:07 Uhr > Von: "Sascha Hauer" <sha@pengutronix.de> > > Yes. Furthermore you have to add to the board code: > > defaultenv_append_directory(defaultenv_rk3568); maybe this is the part i've missed. i thought it were 2 ways...either link via makefile or add to boards code > > > > > 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. > > > > is extlinux (i used in uboot and conf-file is already present) supported here? > > > > > > > See https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf for an example > > > > > of how to set this up. This is what I'd recommend instead of writing your own > > > > > scripts. > > > > i do not fully understand the bootloader spec in the pdf as config file seems to be > > > > /mnt/mmc0.4/loader/entries/stm32mp157c-dk2.conf > > > > and then > > boot -d mmc0.4 > > > > is run...so the path (loader/entries) seems to be fixed and all files there will be processed (which order)? > > Yes. No particular order, I guess it would be the order it is on the > filesystem. > > > how is root appended (/dev/mmcblkXpY|uuid|...) when linux-appendroot is set to true? > > When root is appended it is assumed to be the same fs that also has the > bootloader spec file, so the rootfs also has the entry and the kernel. ok, then this is not usable for me, as i have a boot-partition (bootloader+kernel+dtb) and separate rootfs-partition > > this is for testing multiple kernels with changing filenames (very > > dynamic process, e.g. using 1 kernel binary with multiple dtb) and to > > avoid adding a bootmenu entry everytime....this is not for end-user :) > > In that case you could also use bootm directly. yes but my approach is to list the available kernels before and ask to enter the filename to not everytime look for correct commands ;) > > and here scripting is imho the best way...this allows me to add extra > > params to cmdline too (like debug level,dumping offsets) without > > changing a distroboot config > > Not sure if you know already, but barebox concatenates all variables in > the "global.linux.bootargs." namespace to the kernel command line, so > you can easily add or remove a variable to add/remove kernel options > without affecting unrelated options. i know some options from documentation like this i've used to get a earlycon for tftp global linux.bootargs.debug="earlycon=uart8250,mmio32,0xfe660000 earlyprintk" > > for fixed kernels i have defined an extlinux.conf for uboot, but i'm > > unsure if barebox can use this file too. have not found anything about > > extlinux/syslinux in barebox yet. > > No, not yet. ok, i created a bootloader-config like described in the pdf: cat /mnt/sd.1/loader/entries/linux-gz.conf title Linux GZip version 5.16 options earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 linux /extlinux/Image_5.16.gz devicetree /extlinux/dtb_5.16 initrd /rootfs.cpio.lz4 but on starting it is skipped due to devicetree mismatch boot -d sd.1 blspec: ignoring entry with incompatible devicetree "rockchip,rk3568-bpi-r2pro" blspec: ignoring entry with incompatible devicetree "rockchip,rk3568-bpi-r2pro" Nothing bootable found on 'sd.1' Nothing bootable found in barebox i use the evb whereas in linux i already have a separate dts. Can i override the compatible for the bootloader or do i need to add my board (as copy of evb first)? btw. don't you get my direct messages (regarding vop2 driver for rk3568 and the result of my barebox environment-tests)? regards Frank _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: Re: Re: barebox extending boot-scripts 2022-01-07 16:42 ` Aw: " Frank Wunderlich @ 2022-01-10 9:42 ` Sascha Hauer 2022-01-15 13:47 ` Aw: " Frank Wunderlich 0 siblings, 1 reply; 12+ messages in thread From: Sascha Hauer @ 2022-01-10 9:42 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Ahmad Fatoum, barebox On Fri, Jan 07, 2022 at 05:42:22PM +0100, Frank Wunderlich wrote: > Hi > > missed the defaultenv_append_directory(defaultenv_rk3568); in board-file...after adding that it seems to work > > > Gesendet: Freitag, 07. Januar 2022 um 14:07 Uhr > > Von: "Sascha Hauer" <sha@pengutronix.de> > > > > Yes. Furthermore you have to add to the board code: > > > > defaultenv_append_directory(defaultenv_rk3568); > > maybe this is the part i've missed. i thought it were 2 ways...either link via makefile or add to boards code > > > > > > > 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. > > > > > > is extlinux (i used in uboot and conf-file is already present) supported here? > > > > > > > > > See https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf for an example > > > > > > of how to set this up. This is what I'd recommend instead of writing your own > > > > > > scripts. > > > > > > i do not fully understand the bootloader spec in the pdf as config file seems to be > > > > > > /mnt/mmc0.4/loader/entries/stm32mp157c-dk2.conf > > > > > > and then > > > boot -d mmc0.4 > > > > > > is run...so the path (loader/entries) seems to be fixed and all files there will be processed (which order)? > > > > Yes. No particular order, I guess it would be the order it is on the > > filesystem. > > > > > how is root appended (/dev/mmcblkXpY|uuid|...) when linux-appendroot is set to true? > > > > When root is appended it is assumed to be the same fs that also has the > > bootloader spec file, so the rootfs also has the entry and the kernel. > > ok, then this is not usable for me, as i have a boot-partition > (bootloader+kernel+dtb) and separate rootfs-partition > > > > this is for testing multiple kernels with changing filenames (very > > > dynamic process, e.g. using 1 kernel binary with multiple dtb) and to > > > avoid adding a bootmenu entry everytime....this is not for end-user :) > > > > In that case you could also use bootm directly. > > yes but my approach is to list the available kernels before and ask to > enter the filename to not everytime look for correct commands ;) > > > > and here scripting is imho the best way...this allows me to add extra > > > params to cmdline too (like debug level,dumping offsets) without > > > changing a distroboot config > > > > Not sure if you know already, but barebox concatenates all variables in > > the "global.linux.bootargs." namespace to the kernel command line, so > > you can easily add or remove a variable to add/remove kernel options > > without affecting unrelated options. > > i know some options from documentation like this i've used to get a earlycon for tftp > > global linux.bootargs.debug="earlycon=uart8250,mmio32,0xfe660000 earlyprintk" > > > > for fixed kernels i have defined an extlinux.conf for uboot, but i'm > > > unsure if barebox can use this file too. have not found anything about > > > extlinux/syslinux in barebox yet. > > > > No, not yet. > > ok, i created a bootloader-config like described in the pdf: > > cat /mnt/sd.1/loader/entries/linux-gz.conf > title Linux GZip > version 5.16 > options earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 > linux /extlinux/Image_5.16.gz > devicetree /extlinux/dtb_5.16 > initrd /rootfs.cpio.lz4 > > but on starting it is skipped due to devicetree mismatch > > boot -d sd.1 > blspec: ignoring entry with incompatible devicetree "rockchip,rk3568-bpi-r2pro" > blspec: ignoring entry with incompatible devicetree "rockchip,rk3568-bpi-r2pro" > Nothing bootable found on 'sd.1' > Nothing bootable found > > in barebox i use the evb whereas in linux i already have a separate > dts. Can i override the compatible for the bootloader or do i need to > add my board (as copy of evb first)? You can overwrite the compatible using the of_property command. However, I really recommend to add a separate barebox board for your board. Sooner or later you'll have to do this anyway and it's the only way to properly add quirks for your board. > > btw. don't you get my direct messages (regarding vop2 driver for > rk3568 and the result of my barebox environment-tests)? Yes, I received them, but probably forgot to answer them because you didn't ask a question ;) Regards, 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Aw: Re: Re: Re: Re: barebox extending boot-scripts 2022-01-10 9:42 ` Sascha Hauer @ 2022-01-15 13:47 ` Frank Wunderlich 2022-01-17 8:59 ` Sascha Hauer 0 siblings, 1 reply; 12+ messages in thread From: Frank Wunderlich @ 2022-01-15 13:47 UTC (permalink / raw) To: Sascha Hauer; +Cc: Ahmad Fatoum, barebox Hi, i have now created a new barebox board as copy from evb. i can load it from tftp with bootm /mnt/tftp/barebox-rk3568-r2pro.img i can create a bootmenu with entries of loader/entries and boot it: boot -m sd.1 my bootscripts are also there, but they are not listed in $global.boot.default $ grep defaultenv arch/arm/boards/bananapi-r2-pro/Makefile bbenv-y += defaultenv-rk3568 $ grep defaultenv arch/arm/boards/bananapi-r2-pro/board.c defaultenv_append_directory(defaultenv_rk3568); $ cat arch/arm/boards/bananapi-r2-pro/defaultenv-rk3568/nv/boot.default net list-images mmc-linux tftp-linux so it looks like the env is load, but the nv is not updated regards Frank > Gesendet: Montag, 10. Januar 2022 um 10:42 Uhr > Von: "Sascha Hauer" <sha@pengutronix.de> > An: "Frank Wunderlich" <frank-w@public-files.de> > Cc: "Ahmad Fatoum" <a.fatoum@pengutronix.de>, barebox@lists.infradead.org > Betreff: Re: Re: Re: Re: barebox extending boot-scripts > > On Fri, Jan 07, 2022 at 05:42:22PM +0100, Frank Wunderlich wrote: > > Hi > > > > missed the defaultenv_append_directory(defaultenv_rk3568); in board-file...after adding that it seems to work > > > > > Gesendet: Freitag, 07. Januar 2022 um 14:07 Uhr > > > Von: "Sascha Hauer" <sha@pengutronix.de> > > > > > > Yes. Furthermore you have to add to the board code: > > > > > > defaultenv_append_directory(defaultenv_rk3568); > > > > maybe this is the part i've missed. i thought it were 2 ways...either link via makefile or add to boards code > > > > > > > > > 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. > > > > > > > > is extlinux (i used in uboot and conf-file is already present) supported here? > > > > > > > > > > > See https://elinux.org/images/9/9d/Barebox-bells-n-whistles.pdf for an example > > > > > > > of how to set this up. This is what I'd recommend instead of writing your own > > > > > > > scripts. > > > > > > > > i do not fully understand the bootloader spec in the pdf as config file seems to be > > > > > > > > /mnt/mmc0.4/loader/entries/stm32mp157c-dk2.conf > > > > > > > > and then > > > > boot -d mmc0.4 > > > > > > > > is run...so the path (loader/entries) seems to be fixed and all files there will be processed (which order)? > > > > > > Yes. No particular order, I guess it would be the order it is on the > > > filesystem. > > > > > > > how is root appended (/dev/mmcblkXpY|uuid|...) when linux-appendroot is set to true? > > > > > > When root is appended it is assumed to be the same fs that also has the > > > bootloader spec file, so the rootfs also has the entry and the kernel. > > > > ok, then this is not usable for me, as i have a boot-partition > > (bootloader+kernel+dtb) and separate rootfs-partition > > > > > > this is for testing multiple kernels with changing filenames (very > > > > dynamic process, e.g. using 1 kernel binary with multiple dtb) and to > > > > avoid adding a bootmenu entry everytime....this is not for end-user :) > > > > > > In that case you could also use bootm directly. > > > > yes but my approach is to list the available kernels before and ask to > > enter the filename to not everytime look for correct commands ;) > > > > > > and here scripting is imho the best way...this allows me to add extra > > > > params to cmdline too (like debug level,dumping offsets) without > > > > changing a distroboot config > > > > > > Not sure if you know already, but barebox concatenates all variables in > > > the "global.linux.bootargs." namespace to the kernel command line, so > > > you can easily add or remove a variable to add/remove kernel options > > > without affecting unrelated options. > > > > i know some options from documentation like this i've used to get a earlycon for tftp > > > > global linux.bootargs.debug="earlycon=uart8250,mmio32,0xfe660000 earlyprintk" > > > > > > for fixed kernels i have defined an extlinux.conf for uboot, but i'm > > > > unsure if barebox can use this file too. have not found anything about > > > > extlinux/syslinux in barebox yet. > > > > > > No, not yet. > > > > ok, i created a bootloader-config like described in the pdf: > > > > cat /mnt/sd.1/loader/entries/linux-gz.conf > > title Linux GZip > > version 5.16 > > options earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8 > > linux /extlinux/Image_5.16.gz > > devicetree /extlinux/dtb_5.16 > > initrd /rootfs.cpio.lz4 > > > > but on starting it is skipped due to devicetree mismatch > > > > boot -d sd.1 > > blspec: ignoring entry with incompatible devicetree "rockchip,rk3568-bpi-r2pro" > > blspec: ignoring entry with incompatible devicetree "rockchip,rk3568-bpi-r2pro" > > Nothing bootable found on 'sd.1' > > Nothing bootable found > > > > in barebox i use the evb whereas in linux i already have a separate > > dts. Can i override the compatible for the bootloader or do i need to > > add my board (as copy of evb first)? > > You can overwrite the compatible using the of_property command. However, > I really recommend to add a separate barebox board for your board. > Sooner or later you'll have to do this anyway and it's the only way to > properly add quirks for your board. have now added a new barebox-board, and now this seems to work, but it's booting the first entry and do not display a menu of all configs in loader/entries, is this possible? _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: Re: Re: Re: barebox extending boot-scripts 2022-01-15 13:47 ` Aw: " Frank Wunderlich @ 2022-01-17 8:59 ` Sascha Hauer 0 siblings, 0 replies; 12+ messages in thread From: Sascha Hauer @ 2022-01-17 8:59 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Ahmad Fatoum, barebox On Sat, Jan 15, 2022 at 02:47:42PM +0100, Frank Wunderlich wrote: > Hi, > > i have now created a new barebox board as copy from evb. i can load it from tftp with > > bootm /mnt/tftp/barebox-rk3568-r2pro.img > > i can create a bootmenu with entries of loader/entries and boot it: > > boot -m sd.1 > > my bootscripts are also there, but they are not listed in $global.boot.default > > $ grep defaultenv arch/arm/boards/bananapi-r2-pro/Makefile > bbenv-y += defaultenv-rk3568 > $ grep defaultenv arch/arm/boards/bananapi-r2-pro/board.c > defaultenv_append_directory(defaultenv_rk3568); > $ cat arch/arm/boards/bananapi-r2-pro/defaultenv-rk3568/nv/boot.default > net list-images mmc-linux tftp-linux So an "echo $global.boot.default" shows something different, right? Could it be that you have overwritten this variable in your persistent env? In that case try a "saveenv -z" which invalidates the persistent env. 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Aw: Re: Re: barebox extending boot-scripts 2022-01-06 8:08 ` Sascha Hauer 2022-01-06 12:41 ` Aw: " Frank Wunderlich @ 2022-01-29 10:40 ` Frank Wunderlich 2022-01-31 11:03 ` Sascha Hauer 1 sibling, 1 reply; 12+ messages in thread From: Frank Wunderlich @ 2022-01-29 10:40 UTC (permalink / raw) To: Sascha Hauer; +Cc: Ahmad Fatoum, barebox Hi, > Gesendet: Donnerstag, 06. Januar 2022 um 09:08 Uhr > Von: "Sascha Hauer" <sha@pengutronix.de> > It works for example with: > > for i in /mnt/sd.1/extlinux/Image*; do basename $i b; echo $b; done this works with full path, but not if using a var for dir var barebox@BPI R2PRO:/ i=0;for f in /mnt/sd.1/extlinux/Image*; do basename $f b; echo "$i:$b";let i++; done 0:Image_5.16 1:Image_5.16-next.gz 2:Image_5.16.gz 3:Image_5.16.gz.bak 4:Image_5.16_q64 5:Image_bpi barebox@BPI R2PRO:/ imgdir=/mnt/sd.1/extlinux/ barebox@BPI R2PRO:/ i=0;for f in $imgdir/Image*; do basename $f b; echo "$i:$b";let i++; done basename - strip directory and suffix from filenames Usage: basename PATH VAR Remove directory part from the PATH and store result into variable VAR. 0:Image_bpi barebox@BPI R2PRO:/ any idea how to get it working with variable path? i can do a cd before and drop the basename cd $imgdir for f in Image*; do echo $f;done Image_5.16 Image_5.16-next.gz Image_5.16.gz Image_5.16.gz.bak Image_5.16_q64 Image_bpi but then i need to restore the path again (something like prevdir=$(pwd);cd $prevdir) if script fails regards Frank _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: Re: barebox extending boot-scripts 2022-01-29 10:40 ` Aw: " Frank Wunderlich @ 2022-01-31 11:03 ` Sascha Hauer 0 siblings, 0 replies; 12+ messages in thread From: Sascha Hauer @ 2022-01-31 11:03 UTC (permalink / raw) To: Frank Wunderlich; +Cc: Ahmad Fatoum, barebox Hi Frank, On Sat, Jan 29, 2022 at 11:40:08AM +0100, Frank Wunderlich wrote: > Hi, > > Gesendet: Donnerstag, 06. Januar 2022 um 09:08 Uhr > > Von: "Sascha Hauer" <sha@pengutronix.de> > > > It works for example with: > > > > for i in /mnt/sd.1/extlinux/Image*; do basename $i b; echo $b; done > > this works with full path, but not if using a var for dir var > > barebox@BPI R2PRO:/ i=0;for f in /mnt/sd.1/extlinux/Image*; do basename $f b; echo "$i:$b";let i++; done > 0:Image_5.16 > 1:Image_5.16-next.gz > 2:Image_5.16.gz > 3:Image_5.16.gz.bak > 4:Image_5.16_q64 > 5:Image_bpi > barebox@BPI R2PRO:/ imgdir=/mnt/sd.1/extlinux/ > barebox@BPI R2PRO:/ i=0;for f in $imgdir/Image*; do basename $f b; echo "$i:$b";let i++; done You've hit yet another hush bug. Normally when you do a # foo="bar baz" # for i in $foo; echo $i; done bar baz $foo expands to two words. This works as expected. This also works with: # for i in *; do echo $i; done dev env foo mnt tmp Using a combination of glob pattern and variable however does not work: # foo="*" # for i in $foo; do echo $i; done dev env foo mnt tmp hush inserts the expanded glob pattern of "*" as a single word into the parsing data, so i doesn't contain the separated words, but instead "dev env foo mnt tmp" at once. There are many bugs like this in hush and we've fixed several of them, possibly inserting other bugs along the way. I've starred on the code for a long time over the years and still don't fully understand it. When changing things I'm often not sure about its implications. To put it shortly: hush is broken beyond repair. 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-01-31 11:04 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-01-05 15:20 barebox extending boot-scripts Frank Wunderlich 2022-01-05 16:07 ` Ahmad Fatoum 2022-01-05 18:13 ` Aw: " Frank Wunderlich 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox