Hi, Is it possible to know (and pass it as a kernel argument) from which device syslinux booted from? My case is: I have a USB stick with a custom linux installation. Syslinux boots from it, load kernel and initrd. My initrd scans all blocks devices looking for a valid root device and use it when it is found. The problem is that sometimes I have another USB stick on the same computer wich has too a valid root device, but I don't want to boot from it, I want to boot from the root device of the USB stick used to boot. Is it possible to do this? Thanks
Geert Stappers
2014-Sep-26 16:48 UTC
[syslinux] Determine from which device syslinux booted from
On Fri, Sep 26, 2014 at 01:16:06PM -0300, Renato wrote:> Hi, > > Is it possible to know (and pass it as a kernel argument) from which device > syslinux booted from? > > My case is: > > I have a USB stick with a custom linux installation. Syslinux boots from > it, load kernel and initrd. My initrd scans all blocks devices looking for > a valid root device and use it when it is found. > > The problem is that sometimes I have another USB stick on the same computer > wich has too a valid root device, but I don't want to boot from it, I want > to boot from the root device of the USB stick used to boot. > > Is it possible to do this?Could be. What about using a disklabel on your own USBstick that your initrd scans for? Further reading: manual pages of Linux commands 'blkid' and 'e2label' Hope this helps Groeten Geert Stappers -- Leven en laten leven
Alexey Orishko
2014-Sep-26 18:42 UTC
[syslinux] Determine from which device syslinux booted from
On Fri, Sep 26, 2014 at 6:16 PM, Renato <renatoriolino at gmail.com> wrote:> > The problem is that sometimes I have another USB stick on the same computer > wich has too a valid root device, but I don't want to boot from it, I want > to boot from the root device of the USB stick used to boot.Use GPT partition on USB stick and your problem is solved without need to know the name of boot device. All this comes to stating partuuid in linux kernel boot parameters in syslinux config file. By the way, you can get rid of initrd as well. All works fine on my custom linux build. Cheers, Alexey
Unfortunately I can't use GPT partitions because the usb stick are created by non-technical users and lots of them are still using xp 32 bits. Thanks 2014-09-26 15:42 GMT-03:00 Alexey Orishko <alexey.orishko at gmail.com>:> On Fri, Sep 26, 2014 at 6:16 PM, Renato <renatoriolino at gmail.com> wrote: > > > > The problem is that sometimes I have another USB stick on the same > computer > > wich has too a valid root device, but I don't want to boot from it, I > want > > to boot from the root device of the USB stick used to boot. > > Use GPT partition on USB stick and your problem is solved without need > to know the name of boot device. > All this comes to stating partuuid in linux kernel boot parameters in > syslinux config file. > By the way, you can get rid of initrd as well. All works fine on my > custom linux build. > > Cheers, > Alexey >
H. Peter Anvin
2014-Oct-03 16:20 UTC
[syslinux] Determine from which device syslinux booted from
On 09/26/2014 09:16 AM, Renato wrote:> Hi, > > Is it possible to know (and pass it as a kernel argument) from which device > syslinux booted from? > > My case is: > > I have a USB stick with a custom linux installation. Syslinux boots from > it, load kernel and initrd. My initrd scans all blocks devices looking for > a valid root device and use it when it is found. > > The problem is that sometimes I have another USB stick on the same computer > wich has too a valid root device, but I don't want to boot from it, I want > to boot from the root device of the USB stick used to boot. > > Is it possible to do this? >The problem is that mapping from BIOS drives to something like USB sticks is pretty much arbitrary, and isn't helpful once the operating system boots. What we might be able to do is to extract the filesystem identifier for the filesystems which have them; this requires changes to each filesystem of course. This is in addition to the option of using GPT and UUIDs. -hpa