Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: grisxa on September 21, 2010, 07:22:18 AM

Title: Boot CD detection by label
Post by: grisxa 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).
Title: Re: Boot CD detection by label
Post by: curaga 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".
Title: Re: Boot CD detection by label
Post by: roberts 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.
Title: Re: Boot CD detection by label
Post by: grisxa 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.)
Title: Re: Boot CD detection by label
Post by: grisxa 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).
Title: Re: Boot CD detection by label
Post by: curaga 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.
Title: Re: Boot CD detection by label
Post by: gerald_clark on September 22, 2010, 09:31:04 AM
&> works fine in ash.  Just be sure there is no space between th '&' and the '>'.
Title: Re: Boot CD detection by label
Post by: curaga on September 22, 2010, 09:56:20 AM
I stand corrected. :)