From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159]) by ozlabs.org (Postfix) with ESMTP id BB03BDDDFF for ; Sat, 15 Nov 2008 22:15:10 +1100 (EST) Received: by fg-out-1718.google.com with SMTP id d23so1462569fga.39 for ; Sat, 15 Nov 2008 03:15:08 -0800 (PST) Message-ID: <9c789a000811150315u3e390a49gf8fa16c16adfbf51@mail.gmail.com> Date: Sat, 15 Nov 2008 13:15:07 +0200 From: "Cristian Axenie" To: "Nicholas Mc Guire" , linuxppc-embedded@ozlabs.org, "Joachim Foerster" Subject: Re: USB Flash rootfs prep! In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_17152_3586432.1226747707870" References: <9c789a000811141705k245e4447k8a9be8e4f180c3f8@mail.gmail.com> <1226737139.17218.14.camel@md40100b.ft> <9c789a000811150112q3088a044ub8b38489b2119a60@mail.gmail.com> <9c789a000811150112i484baa39y846bbf38ed6e1bb8@mail.gmail.com> <9c789a000811150217o3c08e94ar3f99eda848822e62@mail.gmail.com> List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , ------=_Part_17152_3586432.1226747707870 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sat, Nov 15, 2008 at 12:40 PM, Nicholas Mc Guire 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 ------=_Part_17152_3586432.1226747707870 Content-Type: text/html; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Content-Disposition: inline

On Sat, Nov 15, 2008 at 12:40 PM, Nicholas Mc Guire <hofrat@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

------=_Part_17152_3586432.1226747707870--