hey check out my crappy iso :)

Thomas Krennwallner technik at e-moritz.at
Fri Apr 27 00:26:06 PDT 2001


On Fri, Apr 27, 2001 at 02:47:48AM +0000, the boisterous Bryan Dumm <bdumm at bobby.bcpub.com> wrote:
> tear it apart? :) mount doesn't work why?

I know without ever testing it (I had the same problem) ;-)
After ramdisk creation I do a

    echo > /etc/mtab
    mount -o remount,rw /proc
    for mnt in $MNT; do
      mount -o remount,rw $mnt
    done
    mount -o remount,ro /

to update /etc/mtab. (mount, df, ... needs this file to work proper).

This could be easier if there is a symlink from /etc/mtab -> /proc/mounts
but not tested yet.

> many dirs are /ramfiles.

In my setup I had only /var, /tmp, /dev and /etc for f*$%§ mtab (/proc/mounts
should help).

what do you think of that:


/etc/sysconfig/ramdisks
#begin
RAMDISKS="_0 _1 _2 _3"

RAMDISK_0=/etc
RDSIZE_0=512

RAMDISK_1=/var
RDSIZE_1=4096

RAMDISK_2=/tmp
RDSIZE_2=512

RAMDISK_3=/dev
RDSIZE_3=3072
#end

and


/etc/init.d/mountfs
#start
.
.
.
#
# initializes a new ramdisk and cp the files from the directory to the ramdisk
# and finally mounts the ramdisk over the directory
#
# $1 .. ramdevice
# $2 .. size
# $3 .. directory
#
setup_ramdisk () {
        dd if=/dev/zero of=$1 bs=1k count=$2 > /dev/null 2> /dev/null
        mke2fs -vm0 -i 1024 $1 $2 > /dev/null 2> /dev/null
        mount -n -t ext2 $1 $TMPMNT
        cp -a $3/* $TMPMNT > /dev/null 2> /dev/null
        umount $TMPMNT
        mount -n -t ext2 $1 $3
        # for remounting
        echo "$1 $3 ext2 defaults 0 0" >> /etc/fstab
        return 0
}
.
.
.
  start)
    echo -n "Mounting procfs ..."
    mount -n -t proc proc /proc
    evaluate_retval

    declare -i rdnum=1

    for I in $RAMDISKS; do
      eval RAMDISK=\$RAMDISK$I
      eval RDSIZE=\$RDSIZE$I

      echo -n "Create ramdisk for $RAMDISK ..."
      setup_ramdisk /dev/ram$rdnum $RDSIZE $RAMDISK
      evaluate_retval
      ((rdnum++))
      MNT="`echo $MNT` $RAMDISK"
    done

   # remounting stuff
.
.
.
#end

> Question to ask. I wanna make a complete 
> initrd.gz in perl. I have knowledge or know
> of folks to make it possible i think, but curious
> on ideas, pointers? You mention those other 
> languages ;) just curious on your thoughts.

It's very hard to setup a scripting language in an initrd. All those dynamic
loaded libraries and "aargl" sh. I first try with an initrd was with a shell
but I always got strange behaviour (seems that I forgot some config files or
stuff). So I decided to put only /linuxrc (statically linked) and
/sbin/insmod (with symlinks to modprobe, rmmod, depmod, ..., also statically)
on my initrd. And It worked right out of the box. 

> btw, would luv to see either of those languages
> as a backend to alfs. Taking apart our alfs model
> should not be too hard... It's just XML parsing code
> doing admin things, with a structure of sorts. Suggestions 
> on improvements welcomed. 

I can say that Python was the first scripting language with xml support.
Just love python and don't have too much experience with perl.
C and xml can be complicated in terms of simpliness but I think if there
is a C program in alfs, the only one should be the linuxrc (but even that
don't have to).

so long
Thomas

-- 
  ___
_/___\    Thomas Krennwallner <technik at e-moritz dot at>
 ( ^ >    Fingerprint: 7B58 6ED2 676F 75D8 4DD1  5A83 DC68 E62F 85F3 D58F
 /   \    Phone: +43 2252 810810 18
(__\/_)_

E. Moritz GmbH
office at e-moritz.at
http://www.e-moritz.at/

-- 
Unsubscribe: send email to alfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message




More information about the alfs-discuss mailing list