WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Portable Tinycore on CoLinux.  (Read 4923 times)

Offline ok-man

  • Newbie
  • *
  • Posts: 6
Portable Tinycore on CoLinux.
« on: January 13, 2012, 08:10:43 AM »
I've seen a few posts about this and one asking if the latest TinyCore runs in CoLinux.  I've just tried it today and it works splendidly.  As usual with Co-Linux, networking can be a pain.  There are two problems.
1.  CoLinux doesn't have a /dev/rtc clock device.
2.  Tinycore vandalizes my DISPLAY varialble.

I used work-arounds to fix these.  I did NOT modify the core.gz.  Upgrading should be easy.

As the purpose of CoLinux is to run with windoze, I've tried to do the work in the OS it is relevant to.
The method below worked for me.

Tinycore does not boot.
=======================
This is because of a dodgy loop in /etc/init.d/tc-config...
while [ ! -e /dev/rtc ]; do usleep 50000; done
As this device will never exist in colinux then we will be stuck forever.
The trick is to fake it.  The colinux initrd.gz does not have cpio so you need a working linux with cpio (like a working tinycore).  Sorry about the chicken and egg.

C:\> colinux-daemon.exe -t nt cocon=150x50 cofs0="." mem=512 kernel=vmlinux initrd="tinyco.gz" root=/dev/ram0 syslog embed nozswap norestore

# make the file
mkdir dev
touch dev/rtc
echo "dev/rtc"|cpio -o -H newc > clockfix
gzip clockfix
# get it onto your winzose OS
sudo mkdir /mnt/cofs0
sudo mount -t cofs /dev/cofs0 /mnt/cofs0
sudo cp clockfix.gz /mnt/cofs0/

You can then add this to the core.gz file.  (Keep the clockfix.gz file.  If there are updates to core.gz it is easy to patch it for use with co-linux.)

C:\> copy /B clockfix.gz + core.gz tinyco.gz

You now have a Tinycore that will boot in CoLinux
« Last Edit: January 13, 2012, 08:56:27 AM by ok-man »

Offline ok-man

  • Newbie
  • *
  • Posts: 6
Re: Portable Tinycore on CoLinux.
« Reply #1 on: January 13, 2012, 08:31:11 AM »
Once you have this basic system you need to clean it up a bit.  I just pulled the extentions off the cd image.  A quick note about CoLinux disks...
cobd? is a CoLinux block device.  Like hda.  Except it has an odd device number (117 i think).  It is not automatically found in rebuildfstab.
sda / sdb are blockdevices with a standard name.
cofs? is a CoLinux link to your Windoze disks.  They are handy but a bit slow.  I've tried to store extentions through this bit I can't get them to work.

Initial Setup.
==============
Make some disks.  Get the modules in.  It's easiest to do this all as root.

C:\> colinux-daemon.exe -t nt cocon=150x50 sda="Optional.ext3" cobd0="swap.1G" sdb="tinycore-current.iso" cofs0="." eth0=ndis-bridge,"Local Area Connection" eth1=ndis-bridge,"VMware Network Adapter VMnet1" mem=256 kernel=vmlinux initrd="tinyco.gz" root=/dev/ram0 syslog embed nozswap norestore

sudo su
mkdir /mnt/cofs0
mkdir /mnt/cobd0
mkdir /mnt/sda
mount -t iso9660 /dev/sdb /mnt/sdb
mount -t cofs /dev/cofs0 /mnt/cofs0

#Make a bit of swap (this will take a while)
dd if=/dev/zero of=/mnt/cofs0/swap.1G bs=1048576 count=1000
mkswap /dev/cobd0
swapon /dev/cobd0

#Make a disk image to store stuff on (this will take a while too)
dd if=/dev/zero of=/mnt/cofs0/Optional.ext3 bs=1048576 count=1000
mke2fs -j /dev/sda
mount -t ext3 /dev/sda /mnt/sda

#Copy the basic stuff
cp -r /mnt/sdb/cde/ /mnt/sda/tce/

#Extract the CoLinux kernel modules (from your Windoze drive)
tar -xf /mnt/cofs0/vmlinux-modules.tar.gz

#Pack them in a useful format
find lib -print | cpio -o -H newc > modules
gzip modules

#Get them back to Windoze
cp modules.gz /mnt/cofs0/

#Now you can merge your clockfix, Tinycore and the CoLinux modules together...
C:\> copy /B clockfix.gz + core.gz + modules.gz tinyco.gz

Note:    If the network is down, you won't get X to work.  I've got a VMWare setup on my machine, I use the VM network for my X as this is always connected.  You can add the M$ loopback adapter and get the same result.

Offline ok-man

  • Newbie
  • *
  • Posts: 6
Re: Portable Tinycore on CoLinux.
« Reply #2 on: January 13, 2012, 08:37:52 AM »
waitforX Gets a bit upset.  You can avoid this problem by making your own.  As I said before, Tinycore vandalizez my DISPLAY variable.  You'll see in the start script I've added my own kernel parameter to pass this in.  I don't know if this is bad form but it works for me.  I extract and use this value in .xsession.


Final Setup.
============

C:\> colinux-daemon.exe -t nt cocon=150x50 sda="Optional.ext3" cobd0="swap.1G" cofs0="." eth0=ndis-bridge,"Local Area Connection" eth1=ndis-bridge,"VMware Network Adapter VMnet1" mem=256 kernel=vmlinux initrd="tinyco.gz" root=/dev/ram0 DISPLAY=192.168.238.1:0.0 tce=sda home=sda syslog embed nozswap norestore

echo sleep 2 > ~/.local/bin/waitforX
chmod 700 ~/.local/bin/waitforX

vi .xsession
KernDisp=`awk -F 'DISPLAY=' '{ split($2,disp," "); print disp[1] }' /proc/cmdline`
if [ "$KernDisp" != "" ] ; then
   export DISPLAY=$KernDisp
fi
echo "Connecting to '$KernDisp'"
:wq

Offline ok-man

  • Newbie
  • *
  • Posts: 6
Re: Portable Tinycore on CoLinux.
« Reply #3 on: January 13, 2012, 08:48:00 AM »
The final note if running CoLinux from a usb stick.  You need to have admin rights on the PC you run this on.  When you install CoLinux on a PC it installs a driver also.  If you copy the CoLinux files (about 5M) to a USB stick and plug it into another PC the driver will not be installed.  You'll also need an Xserver (ming works for me).

The solution is to install the driver (linux.sys) and remove if required.

C:\> colinux-daemon --install-driver
Run your stuff
C:\> colinux-daemon --remove-driver

I think the only CoLinux files you need are...
colinux-console-nt.exe
colinux-daemon.exe
colinux-ndis-net-daemon.exe
vmlinux
linux.sys