Welcome! Log In Create A New Profile

Advanced

Multi purpose uBoot

Posted by balanga 
Multi purpose uBoot
March 02, 2019 02:46AM
Is there a single uBoot which I can use to boot Debian, ArchLinux, OpenWrt and FreeBSD?

I would like to have this range of options if possible. I understand the special edition

uboot.2017.05-tld-2.goflexhome.mtd0.kwb

can be used to boot FreeBSD using bootelf, but can I use this uBoot for the other three?
Re: Multi purpose uBoot
March 02, 2019 03:48AM
balanga Wrote:
-------------------------------------------------------
> Is there a single uBoot which I can use to boot
> Debian, ArchLinux, OpenWrt and FreeBSD?
>
> I would like to have this range of options if
> possible. I understand the special edition
>
> uboot.2017.05-tld-2.goflexhome.mtd0.kwb
>
> can be used to boot FreeBSD using bootelf, but can
> I use this uBoot for the other three?

Yes. That special edition uboot.2017.05-tld-2.goflexhome.mtd0.kwb can boot all these 4 distros.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Multi purpose uBoot
March 03, 2019 12:52AM
If changing from 2017.07-tld-1 to 2017.05-tld-2 is there anything in particular to watch out for? ie environment changes. I guess any OS specific requirements should be changed in /boot/uEnv.txt...

Is the uBoot change basically done via

nandwrite /dev/mtd0 uboot.2017.05-tld-2.goflexhome.mtd0.kwb

and the environment set from rwt

uboot.2016.05-tld-1.environment.bodhi.tar

?l

As for the environment, are any existing variables which are not overwritten left in the environment?
Re: Multi purpose uBoot
March 03, 2019 02:30AM
balanga Wrote:
-------------------------------------------------------
> If changing from 2017.07-tld-1 to 2017.05-tld-2 is
> there anything in particular to watch out for? ie
> environment changes. I guess any OS specific
> requirements should be changed in
> /boot/uEnv.txt...

Some u-boot envs must be changed to boot a specific distro. And they should be doable in uEnv.txt.

>
> Is the uBoot change basically done via
>
> nandwrite /dev/mtd0
> uboot.2017.05-tld-2.goflexhome.mtd0.kwb
>
> and the environment set from rwt
>
> uboot.2016.05-tld-1.environment.bodhi.tar
>
> ?l

Those 2 images must be flashed to complete the installation.

> As for the environment, are any existing variables
> which are not overwritten left in the environment?

When you flash the default envs image in the tarball uboot.2016.05-tld-1.environment.bodhi.tar, all old envs are gone and replaced by the new envs in the image.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Multi purpose uBoot
March 11, 2019 11:03AM
bodhi,

With lots of help from yourself I now have a GoFlex Home which has u-boot uboot.2017.05-tld-2.goflexhome.mtd0.kwb installed in flash. OpenWrt is also installed in flash and boots OK. Debian also boots up from USB, but I haven't yet managed to get ArchLinux to boot.

The envs (uboot.2016.05-tld-1.environment.bodhi.tar) have not yet been flashed and after comparing those variables with the current environment,oe I've noticed some differences and am concerned that flashing might break something.

These are my current envs:-
arcNumber=3338
bootcmd_exec=if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_a
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_lede
bootcmd_lede=run set_bootargs_lede; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-goflexhome.dtb
ethact=egiga0
ethaddr=00:10:75:28:cc:00
fileaddr=800000
filesize=3e0000
if_netconsole=ping $serverip
ipaddr=192.168.1.21
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb_addr=0x1c00000
load_initrd_addr=0x1100000
load_uimage_addr=0x800000
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
mainlineLinux=yes
mtddevname=rootfs
mtddevnum=2
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)
nc_ready=1
ncip=192.168.1.2
partition=nand0,0
preboot=run preboot_nc
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_net
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if t
serverip=192.168.1.2
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
set_bootargs_lede=setenv bootargs console=ttyS0,115200 $mtdparts
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=nc
stdin=nc
stdout=nc
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15


I have some variables such as:

fileaddr=800000
filesize=3e0000

mtddevname=rootfs
mtddevnum=2

which do no exist

and others such as mtdparts among others which are different, so am concerned that OpenWrt might not boot if these are changed.

I await your advice on flashing the envars...
Re: Multi purpose uBoot
March 11, 2019 04:11PM
balanga,

> I have some variables such as:
>
> fileaddr=800000
> filesize=3e0000
>
> mtddevname=rootfs
> mtddevnum=2
>
> which do no exist
>
> and others such as mtdparts among others which are
> different, so am concerned that OpenWrt might not
> boot if these are changed.
>

fileaddr and filesize should be something created by u-boot.

mtddevnam and mtddevnum must be from OpenWrt.

Since you have serial console, you don't need to worry about it's not booting. You can always adjust the envs, with one exception: the preboot env. So as long as you don't change preboot to some thing bad then you can always fix the envs.

Furthermore, and if you cannot fix something that you have messed up really bad, just kwboot back in and fix them.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Multi purpose uBoot
March 11, 2019 04:17PM
bodhi,

balanga Wrote:
-------------------------------------------------------
> bodhi,
>
> With lots of help from yourself I now have a
> GoFlex Home which has u-boot
> uboot.2017.05-tld-2.goflexhome.mtd0.kwb installed
> in flash. OpenWrt is also installed in flash and
> boots OK. Debian also boots up from USB, but I
> haven't yet managed to get ArchLinux to boot.

Just to let you know I managed to get ArchLinux to boot thanks to your advice in

https://forum.doozan.com/read.php?3,56939

Now I wonder if it's possible to boot either from the same USB stick :)...

Is it possible to have an autoboot countdown which has press a key (F1) for ArchLinux or default to Debian?

Enquiring minds need to know :)
Re: Multi purpose uBoot
March 11, 2019 04:35PM
balanga,

> > With lots of help from yourself I now have a
> > GoFlex Home which has u-boot
> > uboot.2017.05-tld-2.goflexhome.mtd0.kwb
> installed
> > in flash. OpenWrt is also installed in flash
> and
> > boots OK. Debian also boots up from USB, but I
> > haven't yet managed to get ArchLinux to boot.
>
> Just to let you know I managed to get ArchLinux to
> boot thanks to your advice in
>
> https://forum.doozan.com/read.php?3,56939
>
> Now I wonder if it's possible to boot either from
> the same USB stick :)...

Of course it is possible! With envs adjustment to look for the kernel and rootfs in the correct partition. Basically you will have 2 partitions each houses a different rootfs.

It is best to play with these settings in uEnv.txt. You can play all you want in this script.


> Is it possible to have an autoboot countdown which
> has press a key (F1) for ArchLinux or default to
> Debian?
>

It is possible to plug in a keyboard to interact with u-boot. If that's what you are thinking. But there is no display, so it has to done blindly.

There is a web server patch for u-boot. But I have not looked into incorporate that, don't know if and when I will try.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Multi purpose uBoot
March 11, 2019 05:52PM
bodi,

bodhi Wrote:
-------------------------------------------------------
> balanga,
> >
> > Now I wonder if it's possible to boot either
> from
> > the same USB stick :)...
>
> Of course it is possible! With envs adjustment to
> look for the kernel and rootfs in the correct
> partition. Basically you will have 2 partitions
> each houses a different rootfs.
>
> It is best to play with these settings in
> uEnv.txt. You can play all you want in this
> script.

Maybe have three partitions, one for Debian rootfs, one for Arch Linux rootfs, and one just for a /boot/uEnv.txt which could be amended to point at either of the rootfs's..

Just thinking out loud here... don't know if this is feasible...

> > Is it possible to have an autoboot countdown
> which
> > has press a key (F1) for ArchLinux or default
> to
> > Debian?
> >
>
> It is possible to plug in a keyboard to interact
> with u-boot. If that's what you are thinking. But
> there is no display, so it has to done blindly.
>
> There is a web server patch for u-boot. But I have
> not looked into incorporate that, don't know if
> and when I will try.

Wow - a web server for u-boot? !!!! How is that possible?
Re: Multi purpose uBoot
March 11, 2019 06:10PM
> rootfs, one for Arch Linux rootfs, and one just
> for a /boot/uEnv.txt which could be amended to
> point at either of the rootfs's..

The envs will be quite complicate if it is smart enough to boot in various configuration. It will be simple with fixed partition number. Ie. uEnv.txt is on 1:1, Debian is on 1:2, Arch is on 1:3.

You should aim for the simple configuration first.

> Wow - a web server for u-boot? !!!! How is that
> possible?

Simple webserver is very small. Providing http protocol is also small piece of code. But this might bump the uboot size to a large number, so I tabled it for a rainy day :)

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: