Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Building My Own Boot CD - compressloop loop
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
tomslounge
n00b
n00b


Joined: 29 Apr 2004
Posts: 2
Location: Miami

PostPosted: Thu Apr 29, 2004 2:23 pm    Post subject: Building My Own Boot CD - compressloop loop Reply with quote

Reference for this discussion:
http://www.gentoo.org/proj/en/releng/gcloop/#doc_chap5

I have a feeling the person who wrote this doc also writes man pages with examples that do not work.

OK - Goal - custom building a bootable CD for non-profit educational institution

I've scoured the net for detailed information regarding the science of transferring system from initrd.gz (SYSLINUX or ISOLINUX) to a mounted /cdrom which then becomes the root file system.

I followed a trail from Paul's Boot CD
http://www.geocities.com/potato.geo/bootlinuxcd.html (when it works)
back to alll things Gentoo - it seems a few mini-distros with no real purpose in life have adopted cloop, but finding the exact incantation to use these modules seems like a mystery science.

I built me a RHAT 9.0 system as the base build. Why - because it was simple and easier to do than installing Gentoo. I sepnt days building up a Gentoo system, and major problems - too impatient.

I've got it running with all the module support as outlined in the Gentoo docs, and am able to successfully load compressloop.ko, and I have experimented with the instructions as follows - reprinted here with my ignorant questions:

This part is straightforward and simple enuf:
dd if=/dev/zero of=/tmp/image bs=1M count=700
mke2fs /tmp/image


But here's where the wheels fall off... where did we get /tmp/myimage?

mount -o loop /tmp/myimage /mnt/data

Did you mean /tmp/image or really /tmp/myimage?
Why?

cp -pr /tmp/mydata /mnt/data

By /tmp/mydata, you imply an example, i.e some root tree or does it have to be /tmp/mydata, and where did we get /tmp/mydata .

umount /mnt/data

Why did we unmount /tmp/data?

This does indeed work ...

compress_gcloop_ucl -c 10 -b 131072 /tmp/image /tmp/image.ucl

I guess it would be helpful to see a real example.

I have a build environment that is on a drive, which everything under /build.

Here's what I did to try and verbose the script a bit - and perhaps someone can help me understand where I'm screwing it up.

---------------------------

SOURCE=/build/root
RAMBUILD=/mnt/rootbuild
ROOTFS=/build/cdimage/rootfs.ucl
TMPIMG=/tmp/image
umount $RAMBUILD
#
echo " Clearing loop devices - ignore errors ..."
losetup -d /mnt/loop0
losetup -d /mnt/loop1
#
echo " Making directory /mnt/rootbuild for mount point..."
mkdir -p /mnt/rootbuild
#
echo " Using dd and /dev/zero to create a blank ram drive ... "
# Currently only need 80mb for a modified Paul BootCD root tree
dd if=/dev/zero of=$TMPIMG bs=1M count=80
echo " Formating the blank slug ..."
mke2fs -q $TMPIMG
#
echo " Mounting $TMPIMG loop device on $RAMBUILD ..."
mount -o loop $TMPIMG $RAMBUILD
echo $TMPIMG is now mounted on $RAMBUILD and ready for loading ...
#mount
#
echo " Copying from $SOURCE into $RAMBUILD ... "
cd $SOURCE
cp -prv * $RAMBUILD
df -h
#
echo " Unmounting $RAMBUILD ... but leaving new data in the $TMPIMG.loop file ..."
umount $RAMBUILD
#
echo "Compressing $TMPIMG and creating $ROOTFS ... "
compressloop_ucl -c 10 -b 131072 $TMPIMG $ROOTFS

----------------

After that comes trying to understand what is happening at boot time. I noticed Paul's Boot CD hands off control to init, and he uncompresses an 8mb file system using standard gzip extraction, but obviously this won't work using the ucl compression tools.

I built a script to mount a ucl image based upon your docs, and I get an error about specifying the proper file system type when I use your steps:

This is easy enough ...
mkdir /mnt/image
modprobe compressloop

Now this is cryptic enough, using some kind of shortcuts I do not understand with the echo statement. I understand the options, but not sure why encryption would be needed to do a simple mount of the image.

echo " "|losetup -E 19 -e ucl-0 -p0 /dev/loop0 /mnt/cdrom/image.ucl


This does not work without a file system type, i.e "-t ext2" or somthing, which didn't work either.

mount -o ro /dev/loop0 /mnt/image/

I built yet another script to test with to no avail:

-------------------

PATH=/bin:/usr/bin;export PATH
READUCL=/mnt/ucl
UCL=/build/cdimage/rootfs.ucl

echo "Make mountpoint $READUCL ..."
mkdir -p $READUCL

echo " Anal probe ... "
/sbin/insmod /lib/modules/2.6.5/kernel/drivers/block/compressloop.ko
/sbin/insmod /lib/modules/2.6.5/kernel/drivers/block/loop.ko

#/sbin/lsmod
echo " Woah ... "
echo " "|/sbin/losetup -E 19 -e ucl-0 -p0 /dev/loop0 $UCL
echo " Mounting the loop'd $UCL on $READUCL ..."
mount -t ext2 $UCL $READUCL
mount

--------------------------

What I need to know is how to make the image in simple steps, how to hand off from initrd.gz at boot to the ucl image.

Again, I'm building this CD for a school where they want to be able to insert CD, come up into X with specific apps, no toys or the ability to screw up the system - which is why I like the bootable CD concept.

Any help is greatfully appreciated.

I also tried modifying the Pauls' Boot CD to use the new ucl tools to no avail.

----------------------------------------

PATH=/bin:/usr/bin;export PATH
echo "System init"
mount -t proc none /proc
mount -o remount,rw /
echo "Find the extras on the CD and mount it"
if [ -r /dev/cdrom ] ; then
mount -t iso9660 /dev/cdrom /cdrom
fi
cd /

umount /initrd
freeramdisk /dev/ram0

# mkdir /mnt/image
# modprobe compressloop

echo " "|losetup -E 19 -e ucl-0 -p0 /dev/loop0 /mnt/cdrom/rootfs.ucl
mount -o ro /dev/loop0 /

echo "Running ldconfig"
ldconfig
#
CONFIG=/cdrom/config
# Check for auto config files
if [ -f $CONFIG/networkcard ];then
cfgcard `cat $CONFIG/networkcard`
fi
if [ -f $CONFIG/network ];then
cfglan `cat $CONFIG/network`
fi

--------------------


TIA!

tom
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum