How can I boot the linux rootfs from u-boot passing rootfs partition by label ?

I'm using u-boot as bootloader and the card is a RedPitaya. The linux is a customized Linux based on the stable ubuntu image available for the card.

U-boot is flashed in the sd card's first partition with the linux kernel and the device tree. I'm trying to boot the root file system on an external usb HDD

I precise that I can boot the HDD if I use the "classic" /dev/sdxn naming convention.

I already tried with the following parameters but they both failed :

console=ttyPS0,115200 root=/dev/disk/by-label/ROOTFS rw rootfstype=ext4 earlyprintk rootwait isolcpus=1

console=ttyPS0,115200 root=LABEL=ROOTFS rw rootfstype=ext4 earlyprintk rootwait isolcpus=1

From what I understood doing researchs, /dev/disk/by-label is populated by udev so it's not available in u-boot when passing the boot arguments to the linux kernel.

Also I found out that the functionality to boot from label is not integrated to linux kernel as you can see in this file do_mounts.c just before dev_t name_to_dev_t(const char *name) function definition.

So from now I would like to find a way to boot the partition labelled as ROOTFS on the external usb HDD.

I see two different solutions there :

1 - Integrate the by-label boot functionality in the linux kernel by adding something like

if (strncmp(name, "LABEL=", 6) == 0) {
        name += 6;
        res = devt_from_label(name);
        if (!res)
            goto fail;
        goto done;

into do_mounts.c and implement the function devt_from_label.

2 - Use a small rootfs on the sd card's second partition to resolve the device name from its label and relaunch the kernel boot with the replaced device name.

What do you think about it ? Which one would be the "simpliest" to implement ?

Maybe I'm forgetting something important or someone already suceed to do the same thing.

Anyway, I would be glad to have some help to achieve it


The problem is that LABEL and UUID handling is not done by the Linux Kernel but is done via an initramfs, which you would need to provide as well. If you want to bypass that you need to use PARTUUID which is something that via the part command, U-Boot can determine for you and pass along.

  • Hi, I tried with PARTUUID boot and it worked well. However I'm still wondering for a way to boot from LABEL. I'll take a look on how to do it with an initramfs. Thx – Arkaik Nov 23 '17 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.