On Fri, Sep 08, 2006 at 06:18:01PM +0200, Eric Spakman wrote:
> I'd be interested to know how much adding traceroute to busybox does 
> with the size of the initrds.

With traceroute:

-rwxr-xr-x  1 root root 272952 2006-09-08 00:52 busybox

Without:

-rwsr-xr-x  1 root root 266136 Sep  4  2006 /bin/busybox

Speaking of busybox, I noticed that you're linking busybox to its linked
commands with symbolic links instead of hardlinks.  Using hardlinks
should be more memory and space efficient *if* using a symbolic link
takes up an inode in the filesystem in memory/on disk.  Unfortunately,
my memory is too foggy to remember exactly which filesystems symbolic
links take inodes in vs directory entries.

> Having argument processing is indeed nice, but automatically finding 
> boot media is not really necessary in my opinion. It doesn't need to 
> be a fully automatic process. If you just mount the device and 
> something like 'loadmod /mnt/Bering-uClibc-2.4.33.tar.gz' it should 
> be enough for a start.

OK, then you're welcome to add this to the distribution. :-)
Feel free to bang on it.


#!/bin/sh
#
# Build /lib/modules based upon the contents of /etc/modules and a
# defined modules repository.
#
# Copyright (c) Paul Traina 2006, GPL v2
#
MODLIST=/etc/modules
MODREPO=/mnt/modules.tgz
LIBMOD=/lib/modules

##########################################################################
progname=`basename $0`

usage() {
    cat >&2 <<-EOF
        Usage: $progname [ -m modules ] [ -f modules.tar.gz ] [ -l module-dir ]

        Defaults:
            -m $MODLIST
            -f $MODREPO
            -l $LIBMOD

        Extract kernel modules from $MODREPO into $LIBMOD
        based upon the contents of $MODLIST.
EOF
}

args=`getopt -a -o hm:f:l: -n "$progname" -- "$@"`
if [ $? != 0 ] ; then
    usage
    exit 1
fi

eval set -- "$args"
while true ; do
    case "$1" in
        -h) usage;                      exit 0  ;;
        -m) MODLIST="$2";               shift 2 ;;
        -f) MODREPO="$2";               shift 2 ;;
        -l) LIBMOD="$2";                shift 2 ;;
        --) shift;                      break   ;;
        *)  echo >&2 "Internal error";  exit 1  ;;
    esac
done

if [ ! -f $MODLIST ] ; then
    echo >&2 "$progname: module list $MODLIST not found"
    exit 1
fi

if [ ! -f $MODREPO ] ; then
    echo >&2 "$progname: module repository $MODREPO not found"
    exit 1
fi

if [ ! -d $LIBMOD ] ; then
    echo >&2 "$progname: module directory $LIBMOD not found"
    exit 1
fi

##########################################################################

MODLIST=/tmp/build-modules-list.$$
MODTEMP=/tmp/build-modules-extract.$$

for mod in $modules ; do
   if [ ! -f $LIBMOD/${mod}.o ] ; then
       missing="${mod}.o ${missing}"
   fi 
done

# Nothing missing...
if [ -z "$missing" ] ; then
    exit 0
fi 

echo "Missing kernel modules: ${missing}"

#
# get absolute path of all modules in tarfile first (sigh)
#
trap "rm -f $MODLIST" 0 1 2
tar tzf $MODREPO > $MODLIST

for mod in $missing ; do
    findmod="`grep -F ${mod} $MODLIST` ${findmod}"
done    

rm -f $MODLIST
trap '' 0 1 2

#
# Now do the actual module extraction to a temporary area and then
# move the modules to /lib/modules
#
trap "rm -rf $MODTEMP" 0 1 2
mkdir $MODTEMP

tar xzf $MODREPO -C $MODTEMP $findmod

echo
echo -n "Installing modules:"
for mod in $findmod ; do
    echo -n " `basename $mod .o`"
    mv $MODTEMP/$mod $LIBMOD/`basename $mod`
done
echo

rm -rf $MODTEMP
trap '' 0 1 2

exit 0
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
leaf-devel mailing list
leaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to