USB Flash rootfs prep!

Cristian Axenie cristian.axenie at gmail.com
Sat Nov 15 22:15:07 EST 2008


On Sat, Nov 15, 2008 at 12:40 PM, Nicholas Mc Guire <hofrat at hofr.at> wrote:

> > >
> > > did you check that it is actually a valid character device (c 5 1) ?
> > > it can easaly happend during copying of a tree into your image that
> > > they become regular files.
> > >
> > > hofrat
> > >
> > I think that you are right, butr how can I test this validity??
> >
> just check with ls -l that the device file is actually still a character
> device with the right major/minor number.
>
> crw--w--w-    1 root     tty        5,   1 Nov 13 22:18 /mnt/dev/console
>
> modes and date of course may be diferent.
>
> hofrat
>

I mount my ext2.img and run ls -l and I get

crw-r----- 1 root root   5,   1 2008-11-15 02:24 console

I think is not ok ?!


Now regarding some steps in the creation of the rootfs:

use "tmpfs" for cases where a writable file system is needed and add the
following lines to the /etc/rc.sh script:

# mount TMPFS because root-fs is readonly
/bin/mount -t tmpfs -o size=2M tmpfs /tmpfs

create the same symbolic links for device files that must be placed in a
writable filesystem:  dev/ptyp0 → /tmpfs/dev/ptyp0     dev/ttyp0 →
/tmpfs/dev/ttyp0
 dev/ptyp1 → /tmpfs/dev/ptyp1     dev/ttyp1 → /tmpfs/dev/ttyp1
dev/ptyp2 → /tmpfs/dev/ptyp2
    dev/ttyp2 → /tmpfs/dev/ttyp2  dev/ptyp3 → /tmpfs/dev/ptyp3     dev/ttyp3
→ /tmpfs/dev/ttyp3  dev/ptyp4 → /tmpfs/dev/ptyp4     dev/ttyp4 →
/tmpfs/dev/ttyp4
 dev/ptyp5 → /tmpfs/dev/ptyp5     dev/ttyp5 → /tmpfs/dev/ttyp5
dev/ptyp6 → /tmpfs/dev/ptyp6
    dev/ttyp6 → /tmpfs/dev/ttyp6  dev/ptyp7 → /tmpfs/dev/ptyp7     dev/ttyp7
→ /tmpfs/dev/ttyp7  dev/ptyp8 → /tmpfs/dev/ptyp8     dev/ttyp8 →
/tmpfs/dev/ttyp8
 dev/ptyp9 → /tmpfs/dev/ptyp9     dev/ttyp9 → /tmpfs/dev/ttyp9
dev/ptypa → /tmpfs/dev/ptypa
    dev/ttypa → /tmpfs/dev/ttypa  dev/ptypb → /tmpfs/dev/ptypb     dev/ttypb
→ /tmpfs/dev/ttypb  dev/ptypc → /tmpfs/dev/ptypc     dev/ttypc →
/tmpfs/dev/ttypc
 dev/ptypd → /tmpfs/dev/ptypd     dev/ttypd → /tmpfs/dev/ttypd
dev/ptype → /tmpfs/dev/ptype
    dev/ttype → /tmpfs/dev/ttype  dev/ptypf → /tmpfs/dev/ptypf     dev/ttypf
→ /tmpfs/dev/ttypf  tmp → /tmpfs/tmp     var → /tmpfs/var  dev/log →
/var/log/log
         In case you use dhclient also:  etc/dhclient.conf →
/tmpfs/var/lib/dhclient.conf
    etc/resolv.conf → /tmpfs/var/lib/resolv.conf
Shall I create the symlinks manually?
Is rc.sh executed ??

I,ve created a tmpfs directory in my rootfs directory and even if I mount it
on my host it's not populateed.
  place the corresponding directories and device files in the tmpfs file
system, the following code is added to the /etc/rc.sh script:

mkdir -p /tmpfs/tmp /tmpfs/dev \
         /tmpfs/var/lib/dhcp /tmpfs/var/lock /tmpfs/var/run

while read name minor
do
        mknod /tmpfs/dev/ptyp$name c 2 $minor
        mknod /tmpfs/dev/ttyp$name c 3 $minor
done <<__EOD__
0  0
1  1
2  2
3  3
4  4
5  5
6  6
7  7
8  8
9  9
a 10
b 11
c 12
d 13
e 14
f 15
__EOD__
chmod 0666 /tmpfs/dev/*



Cristian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20081115/a79cc9b9/attachment-0001.htm>


More information about the Linuxppc-embedded mailing list