Installing UML using Slackware
The previous post has the details of loading Slackware in the slackware.img file specified by /dev/ubd1 in the initial command line:
#linux ubd0=initrd ubd1=slackware.img ubd2r=/dev/cdrom devfs=nomount rw
slackware.img file was created using the following command:
#dd if=/dev/zero of=slackware.img bs=1M count=1 seek=4000
I followed the following initial instructions from the other howto:
--------------------------------------------------------------------------------------------
Instructions for Installing Slackware 10.1/10.2 under UML:
Aims:
- Do as little as possible as root (not even mount -o loop...).
- Don't use a downloaded image as the base, just the slackware CD.
- Run Slackware installer to select packages/system config.
Prerequisites
- A Linux kernel. I've tried with 2.6.12.1 and 2.6.13.1 so far.
- UML Utilities. I'm using 20040406 (from
http://sourceforge.net/project/showfiles.php?group_id=429)
- One or both of the slackware CDs, (ISO images will do).
Description:
First unpack and build the UML utilities. No ./configure, just type make, and make sure the port-helper utility is put somewhere in your path.
tar -jxvf uml_utilities_20040406.tar.bz2
cd tools
make
cp port-helper/port-helper /usr/local/bin
You probably also want tunctl, but that's for a future HOWTO.
Next you need to configure your kernel. You don't need to be root to do this, (in fact it's better if you don't do it in /usr/src/linux). I used kernel 2.6.12.1 mostly with defaults, but make sure you have iso9660 and ext2 compiled in. We need ext2 for the initial ram drive and iso9660 for reading the install CD/image. You should also compile in your favourite file system driver, whichever one you normally select in the Slackware install menu (Reiserfs for me):
wgethttp://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.12.1.tar.bz2
tar -jxf linux-2.6.12.1.tar.bz2
cd linux-2.6.12.1
make menuconfig ARCH=um
make linux ARCH=um
That should give you a linux executable called 'linux'. Go on - run it. It should just complain about the fact that it's missing a root file system. You might need to kill it from another terminal.
Mount the first slackware CD, then copy the installation root fs:
mount /mnt/cdrom
cp /mnt/cdrom/isolinux/initrd.img initrd.gz
gzip -d initrd.gz
chmod 666 initrd
umount /mnt/cdrom
Don't forget to unmount the CD, because UML needs direct access to /dev/cdrom.
Next we need the target file system, created by dd (this is a sparse file, of course):
dd if=/dev/zero of=slackware.img bs=1M count=1 seek=4000
Now, run the linux executable using the Slackware initial ramdrive as root. Make sure you do this in an Xterm, and as a user who has access to the X server, because this will try to throw up some Xterm consoles (unless you foolishly disabled them in the kernel config).
linux mem=128M ubd0=initrd ubd1=slackware.img ubd2r=/dev/cdrom rw
Note: If you want to install both CDs of software then you need to specify a 'real' CD device (/dev/cdrom) instead of an ISO image file. This is because you can't really 'eject' an ISO image, and that is required for the install.
--------------------------------------------------------------------------------------------Followed the hack for setting up devices in /dev of initrd image first, and then changing the /sbin/probe file of initrd image from outside, and then installing Slackware in slackware.img.
Next I had to create the devices hda, hdb, hdc etc. in the slackware.img OS.. did not know how to do that.. every time i gave the command line:
#linux ubd1=slackware.img ubd2r=/dev/cdrom devfs=nomount root=/dev/ubdb1
it would complain saying that fsck could not find a valid filesystem in /dev/hdb1. And it would give the prompt for root to log in and do the fsck manually..
Then it occured to me that I could use that prompt and create the devices that I wanted. So, this is what I did:
root@(none):/dev# rm hda hdb hdc
rm: cannot remove `hda': Read-only file system
rm: cannot remove `hdb': Read-only file system
rm: cannot remove `hdc': Read-only file system
root@(none):/dev# whoami
root
root@(none):/dev# rm -f hda
rm: cannot remove `hda': Read-only file system
root@(none):/dev# rmdir hda
rmdir: `hda': Read-only file system
(ha.. had to remount / as a rw filesystem)
root@(none):/# mount -o remount,rw /
root@(none):/# mount
/dev/hdb1 on / type ext2 (rw)
root@(none):/# cd dev
root@(none):/dev# rm hda hdb hdc
root@(none):/dev# mknod hda b 98 0
root@(none):/dev# mknod hda1 b 98 1
mknod: `hda1': File exists
root@(none):/dev# rm hda1 hda2 hdb1 hdb2 hdc1 hdc2
root@(none):/dev# mknod hda1 b 98 1
root@(none):/dev# mknod hda2 b 98 2
root@(none):/dev# mknod hdb b 98 16
root@(none):/dev# mknod hdb1 b 98 17
root@(none):/dev# mknod hdb2 b 98 18
root@(none):/dev# mknod hdc b 98 32
root@(none):/dev# mknod hdc1 b 98 33
root@(none):/dev# mknod hdc2 b 98 34
root@(none):/dev# (Ctrl+D)logout
Unmounting file systems.
Rebooting system.
Restarting system.
...
Now it has created multiple virtual consoles. I went ahead and mounted /dev/hdb2 in /srcDisk.. and it is working fine now.
0 Comments:
Post a Comment
<< Home