WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: how to know UUID of the media from where initrd/tinycore.gz was booted?  (Read 2194 times)

Offline frimical

  • Jr. Member
  • **
  • Posts: 75
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.

Offline spillz

  • Newbie
  • *
  • Posts: 29
blkid?

Offline helander

  • Full Member
  • ***
  • Posts: 183
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



Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
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.
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar