initrd to boot Linux from USB flash drives

AmigaOne X1000 platform specific issues related to Linux only.

initrd to boot Linux from USB flash drives

Postby xeno74 » Thu Oct 29, 2015 11:56 pm

Hi All,

Stanglnator posted in the os4welt forum, that it is possible to boot a Linux distribution from a USB flash drive independent of the Linux device names like sdf1, sdg1 etc.

The problem is, that Linux doesn't always give the partitions on the USB flash drives the same device names. Sometimes the partition's name is sdf1 or sdg1 etc. Thereby it isn't possible to set up a CFE entry for a Linux distribution on a USB stick because of the changing partition names.

The solution is to use UUID (universally unique identifier). It can be used to identify a file system (partition) in a clearly independent form.

With cat /etc/fstab and ls -l /dev/disk/by-uuid you can figure out the UUID of the Linux partition.

You need an initial ramdisk (initrd) to boot a Linux system from a partition identify by UUID.

I created an initrd for the longterm kernel 4.1.12 yesterday.

Download: initrd.img-4.1.12

I will add an initrd to every new kernel. :-)

With the following commands you can boot the Linux system from a partition identify by UUID:


  1. Code: Select all
    CFE> ramdisk -z -addr=0x24000000 -fatfs cf0:initrd.img-4.1.12

  2. Code: Select all
    CFE> setenv bootargs "root=UUID=<a-very-large-number>"


    For example:

    Code: Select all
    CFE> setenv bootargs "root=UUID=2d781b26-0285-421a-b9d0-d4a0d3b55680"

  3. Code: Select all
    CFE> boot -elf -noints -fatfs cf0:vmlinux-4.1

Thanks to Stanglnator for this really interesting solution!

Cheers,

Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
 
Posts: 3176
Joined: Fri Mar 23, 2012 8:58 am

Re: initrd to boot Linux from USB flash drives

Postby zappa2009 » Fri Oct 30, 2015 2:10 am

Nice.

An other Method is
Code: Select all
sudo blkid


It lists all Devices with an UUID and PARTUUID and FS-Type that will be found.

Code: Select all
e@e:~$ sudo blkid
/dev/sda1: UUID="9CEEA6B7EEA6895A" TYPE="ntfs" PARTUUID="000436df-01"
/dev/sda2: UUID="95a0507f-bcbe-4eaf-901f-5a687e97d5e6" TYPE="ext4" PARTUUID="000436df-02"
/dev/sda3: UUID="91ff2d24-d277-4ef0-b3e1-717f322386bc" TYPE="swap" PARTUUID="000436df-03"
/dev/sdb1: UUID="d5dffc46-e96f-43cf-8957-13d95873c49f" TYPE="ext4" PARTUUID="000d379a-01"
 
X1000 RadeonHD5450 4GB (2x2GB) DDR2-PC2-8500 Kingston HyperX 5-5-5-5-15 OS4.1.6 & Lubuntu13.04/mintppc11 with Kernel 3.8.7/3.9
User avatar
zappa2009
 
Posts: 230
Joined: Tue Jun 21, 2011 1:17 pm

Re: initrd to boot Linux from USB flash drives

Postby xeno74 » Fri Oct 30, 2015 8:19 am

Thanks a lot!
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
 
Posts: 3176
Joined: Fri Mar 23, 2012 8:58 am

Re: initrd to boot Linux from USB flash drives

Postby zappa2009 » Sat Oct 31, 2015 12:38 am

Hi again.

with the initrd.img-4.1.12 you can use LABEL instead of UUID as bootargs for the Kernel.

Code: Select all
setenv bootargs "root=LABEL=fedora17"


In my case is this the LABEL of my fedora17 installation on a USB stick.
And I rename the /etc/fstab on the Linux from UUID to LABEL. On my Stick i do this
Code: Select all
LABEL=fedora17 /  ext4 defaults 1 1


You can set this with Gparted , just make sure the partition is umount. Can be done with a RMB on the Partition and select umount.
X1000 RadeonHD5450 4GB (2x2GB) DDR2-PC2-8500 Kingston HyperX 5-5-5-5-15 OS4.1.6 & Lubuntu13.04/mintppc11 with Kernel 3.8.7/3.9
User avatar
zappa2009
 
Posts: 230
Joined: Tue Jun 21, 2011 1:17 pm

Re: initrd to boot Linux from USB flash drives

Postby xeno74 » Sat Oct 31, 2015 7:27 am

zappa2009 wrote:Hi again.

with the initrd.img-4.1.12 you can use LABEL instead of UUID as bootargs for the Kernel.

Code: Select all
setenv bootargs "root=LABEL=fedora17"


In my case is this the LABEL of my fedora17 installation on a USB stick.
And I rename the /etc/fstab on the Linux from UUID to LABEL. On my Stick i do this
Code: Select all
LABEL=fedora17 /  ext4 defaults 1 1


You can set this with Gparted , just make sure the partition is umount. Can be done with a RMB on the Partition and select umount.


Fantastic! Thank you for the hint! :-)
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
 
Posts: 3176
Joined: Fri Mar 23, 2012 8:58 am


Return to Platform: AmigaOne X1000 - Linux Only

Who is online

Users browsing this forum: No registered users and 5 guests