coLinux
Rpmohn (talk | contribs)
No edit summary
Rpmohn (talk | contribs)
No edit summary
Line 84: Line 84:
 
</pre>
 
</pre>
   
  +
== Configure your new root image ==
== Remaining Procedures ==
 
 
<pre>chroot /mnt/gentoo /bin/bash
 
<pre>chroot /mnt/gentoo /bin/bash
 
env-update && source /etc/profile
 
env-update && source /etc/profile
Line 115: Line 115:
 
ln -s /usr/bin/loadkeys /bin/loadkeys
 
ln -s /usr/bin/loadkeys /bin/loadkeys
 
exit
 
exit
halt
+
halt</pre>
   
 
== Remaining Procedures ==
#Now, back in windows
+
<pre>#Now, back in windows
   
 
edit config/Portable_Gentoo.conf
 
edit config/Portable_Gentoo.conf

Revision as of 01:19, 16 May 2009

Introduction

Please note that this is still a work in progress. I tried updating the original 2006 image and ran into nothing but grief. So here's a quick and dirty on the steps I took to build my own 2008 Portable Gentoo. Enjoy!

Create Directory Structure

Create the following directory structure:

...\Portable_Gentoo
...\Portable_Gentoo\gentoo
...\Portable_Gentoo\share

Download and Unpack Installation Files

Download the following files

Unpack files as follows

  • Extract the following files from Portable_Ubuntu.exe to your Portable_Gentoo directory using 7zip:
The entire pulseaudio subdirectory
The entire Xming subdirectory tree
portable_ubuntu.bat
run_portable_ubuntu.bat
TrayRun.exe
  • Extract the following files from the coLinux self-installing binary to your Portable_Gentoo directory using 7zip:
colinux-console-nt.exe
colinux-daemon.exe
colinux-net-daemon.exe
colinux-slirp-net-daemon.exe
example.conf
initrd.gz
linux.sys
vmlinux
vmlinux-modules.tar.gz
  • Copy these two files to your share subdirectory:
vmlinux
vmlinux-modules.tar.gz
  • Also, copy the file example.conf to your gentoo subdirectory and rename it to gentoo.conf.
  • Extract the file gentoo-root from the Gentoo-colinux file to your gentoo subdirectory using 7zip.
  • Move the Gentoo stage3 and portage files to your gentoo subdirectory.

Run the initial version of coLinux

  • Create an empty container for your new root file system with the following command. The example creates a 10G (10,737,418,240) file, but you can run it with as small a file as 2G (2,147,483,648).
fsutil file createnew Portable_Gentoo\gentoo\2008_root_fs 10737418240
  • Edit the file gentoo.conf as follows:
    • Change cobd0="c:\coLinux\root_fs" to cobd0=gentoo\gentoo-root.
    • Add the line cobd3=gentoo\2008_root_fs.
    • Set a maximum memory, mem=256 is probably the lowest you'll want to set it to.
    • Enable eth0 by uncommenting eth0=slirp
    • Add the line exec0="Xming\Xming.exe :0 -notrayicon +bs -wm -auth Xauthority -clipboard -multiwindow -dpi 100 -xkblayout us" (change the xkblayout to your liking ;-)
    • Setup two shares with the lines cofs0=gentoo and cofs1=share.
  • Rename the file portable_ubuntu.bat to portable_gentoo.bat and edit it so that the line is colinux-daemon @gentoo\gentoo.conf cobd1=%temp%\swap.img cobd2=%temp%\temp.img -t nt.
  • Rename the file run_portable_ubuntu.bat to run_portable_gentoo.bat and edit the first line to be start trayrun.exe cmd /c portable_gentoo.bat.
  • Now go ahead and run the run_portable_gentoo.bat batch file to launch the initial version of Gentoo coLinux!

Prepare for chroot

Run the following commands. You could put it in a script, but it's probably better to run each command individually and confirm success.

cd /
mkdir config share
mount -t cofs -o user,dmask=0777,fmask=0666 cofs0 /config
mount -t cofs -o user,dmask=0777,fmask=0666 cofs1 /share

mke2fs /dev/cobd3
dd if=/dev/zero of=/dev/cobd3 bs=1M    # Fill the HDD with 0's. This speeds up future writes?
mke2fs -j /dev/cobd3
mount /dev/cobd3 /mnt/gentoo
mkdir /mnt/gentoo/dev
mount -o bind /dev /mnt/gentoo/dev

cd /mnt/gentoo
mkdir config share
tar xjpf /gentoo/stage3*.tar.bz2

cd /mnt/gentoo/usr
tar xjf /share/portage-latest.tar.bz2

cd /
cp -L /etc/resolv.conf /mnt/gentoo/etc/
cp /etc/conf.d/net /mnt/gentoo/etc/conf.d/net
cp -L /share/vmlinux /mnt/gentoo/boot/kernel
cp -L /etc/make.conf /mnt/gentoo/etc/make.conf
mount -t proc proc /mnt/gentoo/proc

Configure your new root image

chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile
#Set this to your timezone
cp /usr/share/zoneinfo/America/New_York /etc/localtime
cd /etc
#Set these to your chosen hostname
echo "127.0.0.1 colinux localhost" > hosts
sed -i -e 's/HOSTNAME.*/HOSTNAME="colinux"/' conf.d/hostname
hostname colinux
rc-update add net.eth0 default

echo '/dev/cobd0              /               ext3            noatime         0 1' > /etc/fstab
echo '/dev/cobd1              none            swap            sw              0 0' >> /etc/fstab
echo 'proc                    /proc           proc            defaults        0 0' >> /etc/fstab
echo 'shm                     /dev/shm        tmpfs           nodev,nosuid,noexec        0 0' >> /etc/fstab
echo '#cofs0                   /config cofs    user,dmask=0777,fmask=0666      0 0' >> /etc/fstab
echo 'cofs1                   /share  cofs    user,dmask=0777,fmask=0666      0 0' >> /etc/fstab

#Set your root's password
passwd root
#Fix the console font error
mv /bin/setfont /bin/setfont.old
echo '#!/bin/bash' > /bin/setfont
echo 'if ! uname -r | grep -q -e "-co-"' >> /bin/setfont
echo 'then' >> /bin/setfont
echo '	/bin/setfont.old $@' >> /bin/setfont
echo 'fi' >> /bin/setfont
chmod +x /bin/setfont
ln -s /usr/bin/loadkeys /bin/loadkeys
exit
halt

Remaining Procedures

#Now, back in windows

edit config/Portable_Gentoo.conf
--- cobd0=images\gentoo-root
--- cobd3=images\2008_root_fs
+++ cobd0=images\2008_root_fs

#Run Portable_Gentoo
emerge mirrorselect
#Grab the fastest 5 servers
mirrorselect -s5
emerge --sync
emerge portage
emerge htop lynx sys-devel/libtool net-libs/gnutls
/etc/init.d/sshd start
rc-update add sshd default
#This'll take some time:
USE="consolekit" emerge sys-auth/pambase
#And this took near a day, though, in fairness, I had 4 devenv.exe's, an RDP, iTunes, and 5 other programs running
USE="X" emerge sys-apps/dbus gnome-panel
#Fix dependencies for gnome-panel
emerge gentoolkit
revdep-rebuild


#This fixes a circular dependency when installing xorg-x11
emerge --nodeps virtual/glu
emerge xorg-x11
emerge x11-terms/xterm
#First time use requires a UUID
dbus-uuidgen --ensure
/etc/init.d/dbus start
rc-update add dbus default

#because white is so harsh on the eyes
echo 'XTerm*background:   black' >> ~/.Xdefaults
echo 'XTerm*foreground:   white' >> ~/.Xdefaults
echo 'XTerm*highlightColor:  red' >> ~/.Xdefaults

#FINALLY! Launch the panel!
export DISPLAY=10.0.2.2:0.0
gnome-panel &

#Add a file browser
emerge nautilus

emerge --update world