Wikia

coLinux

UbuntuBase

Talk0
235pages on
this wiki

This script and work was based on Cobootstrap for Debian. The following procedure assumes you have a running Ubuntu/Debian system to create the image. Access to the internet to download the base system install packages is required. From your Ubuntu/Debian system:

Install the debootstrap utility

sudo apt-get install debootstrap

Save the above script into /tmp/cobootstrap, edit the UBUNTU_VERSION and CO_SIZE to your needs.

#!/bin/sh
# cobootstrap.sh: Build a colinux-ubuntu image. Works on top of debootstrap
# (c) Thomas Fritzsche
# Adapted to Ubuntu by Joao Pinto
#
# The size must be enough to download all the packages into the apt cache
# and install them
UBUNTU_VERSION=feisty
CO_SIZE=1000000
CO_WD=`pwd`
cd `dirname $0`
CO_ROOT=`pwd`
cd $CO_ROOT
CO_IMAGE=./image
CO_LOG=$CO_ROOT/log
cp /dev/null $CO_LOG >> $CO_LOG 2>&1

CO_MOUNT=$CO_ROOT/mnt

echo "Creating the empty image file (may take a while)"
dd bs=1k count=$CO_SIZE if=/dev/zero of=$CO_IMAGE
echo Done
mkfs.ext3 -J size=4 -F -m 0 $CO_IMAGE
if ! test -f $CO_MOUNT ; then
  mkdir -p $CO_MOUNT
fi
mount -o loop -t ext3 $CO_IMAGE $CO_MOUNT
mkdir -p /tmp/apt_cache
mkdir -p $CO_MOUNT/var/cache/apt/archives/partial
mount --bind /tmp/apt_cache $CO_MOUNT/var/cache/apt/archives/

debootstrap --verbose --include=ssh --exclude=pcmcia-cs \
   --arch i386 $UBUNTU_VERSION $CO_MOUNT http://archive.ubuntu.com/ubuntu/

for i in 0 1 2 3 4
do
  if ! test -f $CO_MOUNT/dev/cobd$i ; then
    mknod $CO_MOUNT/dev/cobd$i b 117 $i >> $CO_LOG 2>&1
  fi
done

CO_APT=$CO_MOUNT/etc/apt/sources.list
echo "deb http://archive.ubuntu.com/ubuntu ${UBUNTU_VERSION} main restricted uni
verse multiverse" \
    > $CO_APT
echo "deb http://archive.ubuntu.com/ubuntu ${UBUNTU_VERSION}-updates main restri
cted universe multiverse" \
    >> $CO_APT


CO_HOSTS=$CO_MOUNT/etc/hosts
echo "127.0.0.1     localhost colinux" > $CO_HOSTS
CO_HOSTNAME=$CO_MOUNT/etc/hostname
echo "colinux" > $CO_HOSTNAME

CO_INTERFACES=$CO_MOUNT/etc/network/interfaces
echo "auto lo " > $CO_INTERFACES
echo "iface lo inet loopback" >> $CO_INTERFACES
echo "auto eth0" >> $CO_INTERFACES
echo "iface eth0 inet dhcp" >> $CO_INTERFACES

CO_FSTAB=$CO_MOUNT/etc/fstab
echo  "/dev/cobd0 / ext3 defaults 0 1" > $CO_FSTAB
#echo "/dev/cobd1 none swap sw 0 0" >> $CO_FSTAB
echo "proc /proc proc defaults 0 0" >> $CO_FSTAB

chroot $CO_MOUNT apt-get update
chroot $CO_MOUNT apt-get autoclean
chroot $CO_MOUNT passwd -d root

umount $CO_MOUNT/var/cache/apt/archives
umount $CO_MOUNT
echo Compressing image
gzip image
ls -la image.gz
exit 0

Then run:

cd /tmp
 sudo sh cobootstrap

You will get an image.gz that you can decompress and use with colinux.
NOTE: The eth0 is setup to DCHP assuming you will be using slirp for the eth0 network.

Around Wikia's network

Random Wiki