Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: frimical on July 12, 2009, 05:08:40 PM

Title: how to know UUID of the media from where initrd/tinycore.gz was booted?
Post by: frimical on July 12, 2009, 05:08:40 PM
hello,

I'd like to make my boot scripts guess from which media (either getting the UUID or  LABEL) the kernel and "tinycore.gz" was residing on and was copied from. Is there a way (command) that helps to know this?

thanks for the help.
Title: Re: how to know UUID of the media from where initrd/tinycore.gz was booted?
Post by: spillz on July 12, 2009, 06:49:51 PM
blkid?
Title: Re: how to know UUID of the media from where initrd/tinycore.gz was booted?
Post by: helander on July 12, 2009, 09:01:12 PM
I'd like to make my boot scripts guess from which media (either getting the UUID or  LABEL) the kernel and "tinycore.gz" was residing on and was copied from. Is there a way (command) that helps to know this?

Unfortunately, as far as I know, there is no method that could give you the media with 100% probability.
The reason is that the kernel (and tinycore.gz) are loaded by the boot loader and the boot loader has its own perception of devices, so even it could pass the information along to the kernel, the kernel would not know what to do with it.

But if guessing is good enough here are some alternatives:

   Most boot loaders automatically passes the variable BOOT_IMAGE to the kernel. The value of BOOT_IMAGE is the
   path to the kernel image, e.g. /boot/bzImage. Some boot loaders do not automatically provide this variable, e.g. legacy
   grub (grub2 provides it) so then you have to specify it on your boot command line, but then you could as well insert
   your own variable with UUID or LABEL.
 
   When you know the name of the kernel image you could search thru your partitions and see which one has the file. 
   The  risk is that you have a file with this path in more than one partition and then you do not know which the correct
   one is.

   There are some other tricks that could be used to find the right one among many.
 

/Lars


Title: Re: how to know UUID of the media from where initrd/tinycore.gz was booted?
Post by: Lee on July 13, 2009, 01:46:25 PM
You can make up boot codes ("cheat codes") of your own:

I regularly use something like

Code: [Select]
... waitusb=5 osboot=greenfob osopt=tc2.2rc1_clean ...
Where I can tell pretty easily that I booted from my little green USB key and the selection from the grub menu was for "Tiny Core 2.2 rc1 clean" (my selection for "base norestore nolocal")

There's no reason why you couldn't include something with the UUID of the boot device.  If you are already specifying, for instance, that your tce directory is on a particular device by UUID, maybe you could just check that boot code.