WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: USB boot - Get the dev booted from  (Read 3680 times)

Offline Scooby

  • Newbie
  • *
  • Posts: 27
USB boot - Get the dev booted from
« on: February 12, 2013, 05:39:24 AM »
I boot TinyCore from USB,

If you have several USB sticks attached is there a way of knowing
from which you booted?

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: USB boot - Get the dev booted from
« Reply #1 on: February 12, 2013, 05:45:52 AM »
No.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: USB boot - Get the dev booted from
« Reply #2 on: February 12, 2013, 09:31:00 AM »
Hi Scooby
Actually, in this case maybe. If you have your tce directory on the stick you are booting from, and your boot loaders
config file has a statement similar to:
Code: [Select]
waitusb=5:UUID="77f3e5df-806f-480c-b6cc-905cb3132753" tce=UUID="77f3e5df-806f-480c-b6cc-905cb3132753"Then  /etc/sysconfig/tce.mount  will tell you where you booted from.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: USB boot - Get the dev booted from
« Reply #3 on: February 12, 2013, 09:41:18 AM »
That would determine the device on which tce dir is located.
Drawing any conclusions from that referring to boot device would be purely speculative.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: USB boot - Get the dev booted from
« Reply #4 on: February 12, 2013, 09:45:53 AM »
No it won't.
You cannot tell where you booted from.
The boot loader loads the kernel and initrd, and execs the kernel.
The above example could have been pxe booted, or booted from a CD.
The fact that it found a boot loader that specified the current tce directory does not mean that boot loader loaded the kernel.
You might bury bogus boot strings in the config files that you can use programatically as hints, but the fact is that the kernel
has no knowledge of how it was loaded.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: USB boot - Get the dev booted from
« Reply #5 on: February 12, 2013, 09:49:28 AM »
Hi tinypoodle
Maybe my explanation was unclear. Let me rephrase:
1. If the boot loader is located on the stick you are booting from
2. and the boot loaders config file sets tce equal to the UUID of the stick
3. Then  /etc/sysconfig/tce.mount  will indicate the boot drive

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: USB boot - Get the dev booted from
« Reply #6 on: February 12, 2013, 09:55:52 AM »
Hi gerald_clark
Yes, yes, yes, yes, and yes. :) Based on the OPs question, I presumed (maybe incorrectly) that the boot loader was
also installed on the stick, and based my answer on that particular scenario.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: USB boot - Get the dev booted from
« Reply #7 on: February 12, 2013, 09:57:26 AM »
No it does not. It only indicates the drive that holds the tce directory.
You cannot be assured that the kernel was booted from that drive, even if that drive has a bootloader.
It could have been booted from pxe, a hard drive, a CD, or another  stick.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: USB boot - Get the dev booted from
« Reply #8 on: February 12, 2013, 10:04:57 AM »
Hi gerald_clark
In general you are correct, no argument. One of the few exceptions is if you install Tinycore to a stick, tell the
boot loader to boot from the stick, and set tce equal to the UUID of the stick.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: USB boot - Get the dev booted from
« Reply #9 on: February 12, 2013, 10:14:32 AM »
And the tce directory and kernel have to be on the same partition on the stick.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: USB boot - Get the dev booted from
« Reply #10 on: February 12, 2013, 10:28:57 AM »
A few notes:

- There is no requirement for boot device to remain attached as soon as the bootloader has finished loading kernel and initrd into memory.
- There is no requirement for the kernel to have support built in for boot device.
- There is no requirement of BIOS supporting boot via USB in order to have any kind of persistence loaded over USB at boot time.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: USB boot - Get the dev booted from
« Reply #11 on: February 12, 2013, 11:07:08 AM »
There is no exception.
The kernel CANNOT tell where it was booted from.
All your examples rely on guesses based on circumstantial evidence.
The fact that you have a tce directory and a boot loader on the same USB stick does not guarantee that it was booted from that stick.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: USB boot - Get the dev booted from
« Reply #12 on: February 12, 2013, 11:17:48 AM »
There is no exception.
The kernel CANNOT tell where it was booted from.
That's why initially I had considered my Reply #1 as being sufficient...  :P
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: USB boot - Get the dev booted from
« Reply #13 on: February 12, 2013, 08:50:34 PM »
Hi Scooby
Maybe if you provide some more details of your situation and what you are trying to achieve someone can
provide you with a workable solution.

aus9

  • Guest
Re: USB boot - Get the dev booted from
« Reply #14 on: February 12, 2013, 10:33:49 PM »
If OP intends to try out various installs on different sticks can I make suggestion

if you have a hub.....always put the "booting" usb stick into (say) top left hand slot
as you boot, most sticks have an light that flashes when read (or written to) so you know thats your boot stick

It may not pass any computer test but I am simple minded...ok I am idiot
« Last Edit: February 13, 2013, 01:16:33 AM by aus9 »