Welcome! Log In Create A New Profile

Advanced

Multiboot on Dockstar with Uboot

Posted by sambul14 
Multiboot on Dockstar with Uboot
August 26, 2012 03:15PM
Is it possible to setup Uboot to offer a multiboot list at startup? I want to boot either from original Pogo filesystem on NAND or DebianSqueeze or ArcLinux on USB Thumb without removing the Thumb from Dockstar.

The thread U-Boot environment variables for SheevaPlug multi-boot version is a jam suggesting several methods to set it up on Sheeva. Can the same thing be applied to Dockstar? Anyone wants to write up a detail HowTo and config examples?

If it seems difficult to accomplish, can someone explain why exactly, and what's so different in SheevaPlug in that respect to allow multiboot?



Edited 1 time(s). Last edit at 08/26/2012 03:16PM by sambul14.
Re: Multiboot on Dockstar with Uboot
August 26, 2012 04:24PM
Assuming you have multiboot , a menu would be presented and wait for input, you have to select which system to boot anyway. So what is the benefit of not having to physically remove the USB stick? is there a use-case that you can describe?
Re: Multiboot on Dockstar with Uboot
August 26, 2012 10:38PM
As I use multiboot daily on a PC, its obvious. Multiple service and test images can be booted one after another to accomplish certain tasks or test a new program compatibility and features, or OS release. Many people boot their plug computer from an attached hard drive rather than USB thumb. In this case several partitions can be chosen from to boot the next time. You can test and quickly repair a broken system. Multiboot offers a number of advantages over physically replacing hardware each time. Not to mention, your plug computer isn't always within your rich, but may be hidden somewhere.

Its also an interesting challenge for developers. There are several popular forums devoted to multiboot. Just a couple day ago I wanted to test a new OS release, but free space was only available on the 3rd partition of USB HD. In multiboot I could easily select what drive to boot from each time. Without it I had to upgrade my working Thumb to the new OS or write a new Uboot config each time to NAND risking to fail the Dockstar.

Don't forget, in multiboot systems there is always a default choice to boot, and you can configure, whether and how long the system should wait for your input before completing boot sequence, or bypass the multiboot menu altogether.



Edited 3 time(s). Last edit at 08/27/2012 12:55AM by sambul14.
Re: Multiboot on Dockstar with Uboot
August 28, 2012 07:26PM
I wanted to test Debian Squeeze with Dockstar, but my USB Thumb is occupied with ArchLinux now. I can format and install it to the 3rd partition of USB HD in enclosure formatted as EXT2. How should I modify Uboot environment to allow boot from that partition?



Edited 1 time(s). Last edit at 08/31/2012 06:13PM by sambul14.
Re: Multiboot on Dockstar with Uboot
August 31, 2012 06:00PM
Just some suggestion and random thought on multiboot. Let's dissect this envs listing from a GoFlex Net. Basically, we see 5 relevant parts:

1. USB Boot
2. SATA Boot
3. Netconsole
4. Rootfs label
5. bootcmd

To tell UBoot to boot from a correct partition, a rootfs label is the most elegant way. It can be used to set each boot partition to a label and tell UBoot to find it.

To create several boot options, use the example for USB vs. SATA. So they have to be hard coded in UBoot envs. We can set the boot priority in the bootcmd env (in this setup, USB is higher than SATA).

One easy way to control boot sequence is to use "ping $serverip". IOW, if a specific netconsole server is running then UBoot will act in a corresponding way! so it's possible not to have to interact with UBoot directly.


# fw_printenv
ethact=egiga0
bootdelay=3
baudrate=115200
mainlineLinux=yes
console=ttyS0,115200
led_init=green blinking
led_exit=green off
led_error=orange blinking
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
partition=nand0,2
stdin=serial
stdout=serial
stderr=serial
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
force_rescue=0
force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi
ubifs_mtd=3
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi
usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done
usb_scan_list=1 2 3 4
usb_scan_1=usb=0:1 dev=sda1
usb_scan_2=usb=1:1 dev=sdb1
usb_scan_3=usb=2:1 dev=sdc1
usb_scan_4=usb=3:1 dev=sdd1
usb_device=0:1
usb_root=/dev/sda1
usb_rootdelay=10


1.
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi


ethaddr=xx:xx:xx:xx:xx:xx
arcNumber=3089
rescue_installed=1


3.
serverip=192.168.0.220
ipaddr=192.168.0.224
if_netconsole=ping $serverip
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
preboot=run if_netconsole start_netconsole


4.
usb_init=run usb_scan; setenv usb_root LABEL=rootfs


2.
sata_boot=ide reset; mw 0x800000 0 1; ext2load ide 0:1 0x800000 /boot/uImage; if ext2load ide 0:1 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
sata_bootcmd=run usb_set_bootargs; run sata_boot

5.
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run sata_bootcmd; run rescue_bootcmd; run pogo_bootcmd; reset
usb_rootfstype=ext3
Re: Multiboot on Dockstar with Uboot
August 31, 2012 07:30PM
Interesting idea to control boot by starting Netconsole on a PC with a different LAN device (alias) IP. Its not available to Windows fans though, if a single LAN device is present. But its not very intuitive for an ordinary user. :)

Where in your above code is the switch? What label do you use for the SATA bootable partition?



Edited 1 time(s). Last edit at 08/31/2012 09:40PM by sambul14.
Re: Multiboot on Dockstar with Uboot
August 31, 2012 07:52PM
Just a thought to show what is possible :-) a variable contains true/false after a certain condition is met. So that could be used in the bootcmd.

No I did not use different label for SATA partition, since I only want to boot exclusively when a drive is attached. iIf USB drive is attached, I only want to boot from there using a SATA drive that does not have "rootfs" label. (note that usb_set_bootargs also used in sata boot)

However, if the usb boot logic is replicated, you could specified as many partition as you want. The bootcmd can be specified to go through each of the booting parts.

For example, in the script below, if there is a uInitrd then the usb_boot command is "bootm 0x800000 0x1100000", if there is no uInitrd then it is set to "bootm 0x800000" (only uImage is used). You can have similar conditions inside the script that the variable bootcmd contains.


usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
Re: Multiboot on Dockstar with Uboot
August 31, 2012 09:49PM
I got it. Are definitions of uImage and uInitrd posted around? What each file is (for)?
Re: Multiboot on Dockstar with Uboot
August 31, 2012 10:23PM
You could find the definition easily, google for UBoot, uImage, uInitrd. Basically, uImage is the kernel image that UBoot expects to find, uInitrd is the ram disk image. Debian uImage is built to work with UBoot. uInitrd contains the initial roofts (not the real one), which usually contain drivers that are needed at boot time. The rest of the drivers are loaded as modules later (I've simplified a lot to describe these, you can see the full description on many websites).
Re: Multiboot on Dockstar with Uboot
September 01, 2012 12:00AM
If that's the case, how Uboot can boot the system without uInitrd (since you put that condition in the sample above)? Nothing about Uboot inner working is easily found on the web in a form anyone can consume. :) Especially when it comes to Plug devices.



Edited 1 time(s). Last edit at 09/01/2012 12:02AM by sambul14.
Re: Multiboot on Dockstar with Uboot
September 01, 2012 12:18AM
It does not need to since the bootm has no second parameter.
Author:

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: