WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Boot CD detection by label  (Read 2610 times)

Offline grisxa

  • Newbie
  • *
  • Posts: 27
Boot CD detection by label
« on: September 21, 2010, 07:22:18 AM »
Hello!

I've found a bug (you may call it mis-feature :) ).
When I boot from CD after TCL has been installed on HDD, system mounts tce folder from that HDD ignoring the same folder on CD.

So I've decided to specify it with boot option 'tce=LABEL=TinyCore/tce'. This volume label ('TinyCore') is created with mkisofs option -V while remastering image.

But such trick doesn't work! As I can see, /sbin/blkid is responsible for disk detection and it checks /etc/blkid.tab cache file which, in turn, doesn't contain records for my CD yet. I don't know why it was not found on cache creation, but if I rebuild it later in find_mountpoint() function, all goes well.

Test case (QEMU with tinycore_3.0.iso as CDROM):
$ /sbin/blkid -lt LABEL=TinyCore -o device
[empty]

$ sudo /sbin/blkid -w /etc/blkid.tab /dev/hd? /dev/sd?
$ /sbin/blkid -lt LABEL=TinyCore -o device
/dev/hdc

Maybe it's a good idea to insert somewhere this blkid -w command? (See my patch).

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10963
Re: Boot CD detection by label
« Reply #1 on: September 21, 2010, 08:23:46 AM »
I wouldn't add a call like that, probing a cd drive can take up several seconds. It's especially bad that the patch would add it to find_mountpoint, which can be called many times.

However, if it's the only cd drive, /dev/cdrom should point to it. Try the attached patch, with it you should be able to use "tce=cdrom" or "tce=cdrom/dir".
The only barriers that can stop you are the ones you create yourself.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Boot CD detection by label
« Reply #2 on: September 21, 2010, 09:35:57 AM »
I would not advise to point tce directory to a read only device as many other parts of Tiny Core will be  disabled. There are already published means to store and load extensions from cdroms whilst maintaing the availability of a useful tce directory.
10+ Years Contributing to Linux Open Source Projects.

Offline grisxa

  • Newbie
  • *
  • Posts: 27
Re: Boot CD detection by label
« Reply #3 on: September 22, 2010, 12:57:59 AM »
I would not advise to point tce directory to a read only device as many other parts of Tiny Core will be  disabled. There are already published means to store and load extensions from cdroms whilst maintaing the availability of a useful tce directory.
My goal is to load extensions from CD only, because system on HDD sometimes can get broken.
So I would like to avoid mounting tce folder from HDD.
(It's for remastered image of course.)

Offline grisxa

  • Newbie
  • *
  • Posts: 27
Re: Boot CD detection by label
« Reply #4 on: September 22, 2010, 05:50:29 AM »
However, if it's the only cd drive, /dev/cdrom should point to it. Try the attached patch, with it you should be able to use "tce=cdrom" or "tce=cdrom/dir".
Thanks, but actually I make a hybrid ISO, which also could be saved on the USB flash.

As I can see, /sbin/blkid is responsible for disk detection and it checks /etc/blkid.tab cache file which, in turn, doesn't contain records for my CD yet. I don't know why it was not found on cache creation, but if I rebuild it later in find_mountpoint() function, all goes well.
After some debugging I've found that initial blkid cache is created (and later is updated) by /usr/sbin/fstype call from /usr/sbin/rebuildfstab with command 'blkid $1'. But fstype is not called for CDROM devices! So my new suggession is to call blkid "$DEVROOT/$DEVNAME" in rebuildfstab just to fill blkid cache with CDROM entry (see patch).

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10963
Re: Boot CD detection by label
« Reply #5 on: September 22, 2010, 09:17:33 AM »
Ash does not support &> IIRC, that's a bash addon. Ash would treat that as & >, background and redirect.
The only barriers that can stop you are the ones you create yourself.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Boot CD detection by label
« Reply #6 on: September 22, 2010, 09:31:04 AM »
&> works fine in ash.  Just be sure there is no space between th '&' and the '>'.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10963
Re: Boot CD detection by label
« Reply #7 on: September 22, 2010, 09:56:20 AM »
I stand corrected. :)
The only barriers that can stop you are the ones you create yourself.