On Sat, 2 Apr 2005, Tracy R Reed wrote:

Making root filesystems for UML to boot off of is a royal pain. I am
surprised it has not gotten any easier. In the past I have installed an
empty HD just like I wanted it and then copied the fs onto my uml host
computer and it was a real time waster. It seems like there should be
some sort of way to launch a UML kernel pointed at a distro install disk
and go straight into a text based install. I know Gentoo can do this:

Here's one of the scripts I use. It works quite well.

#!/bin/sh -x

/bin/rm root_fs
dd if=/dev/zero of=root_fs bs=1024 count=1 seek=3M
mkfs.ext2 -j -F -v -q root_fs
mount -o loop root_fs mnt

rm swap
dd if=/dev/zero of=swap bs=1024K count=128
mkswap swap

yum -y -d 0  --installroot=`pwd`/mnt install rpm
yum -y -d 0  --installroot=`pwd`/mnt install yum
# yum -y -d 0  --installroot=`pwd`/mnt install filesystem

cp /etc/resolv.conf mnt/etc/resolv.conf
cp /etc/yum.conf mnt/etc/yum.conf

cat >>mnt/etc/fstab <<__END__
/dev/ubd0       /               ext3    defaults        1 1
none            /proc           proc    defaults        0 0
none            /dev/pts        devpts  defaults        0 0
none            /dev/shm        tmpfs   defaults        0 0
/dev/ubd7       swap            swap    defaults        0 0
__END__

chroot mnt /bin/sh -x <<__END__

mount -t proc /proc proc

for i in 0 1 2 3 4 5 6 7; do mknod /dev/ubd\$i b 98 \$[ \$i * 16 ]; done

yum -y -d 0 install passwd ruby lynx vim-minimal \
        openssh-server openssh  man man-pages \
        postfix

yum clean all
yum clean headers

echo "abcdefg" | passwd --stdin root

umount /proc
__END__

for f in sysconfig/network hosts sysconfig/network-scripts/ifcfg-eth0
do
        cat /etc/$f | sed s/peaseblossom/mustardseed/g | \
        sed s/65.70.204.73/65.70.204.69/ >>mnt/etc/$f
done

mkdir mnt/root/.ssh
cat ~/.ssh/id*pub >>mnt/root/.ssh/authorized_keys
chmod -R 600 mnt/root/.ssh

umount mnt

-- Matt
Nothing great was ever accomplished without _passion_



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to