CDlinux 0.6.2 Configuration and Software Installation

This is the second diary of CDlinux 0.6.2 Usage Summary diaries series, the previous is: CDlinux 0.6.2 Installation, and the next will be: CDlinux 0.6.2 Practice.

In this diary, I will according to my experience, introduce: How to configure CDlinux fit your own hardware environment; How to use swap partitions (or swap files) in CDlinux; How to add your own softwares into CDlinux; How to keep your variable data in CDlinux and how to make modules and packages in CDlinux (Note, CDlinux 0.9.0 had been released when I write this diaries series, and it had been added the function to persist user data and hardware config), etc..

Infact, we can configure system and add softwares in CDlinux 0.6.2 in same ways , there are three ways I known, include: prepare your initial config file and packages data, operate these data with a shell script file, load these data into their proper location into running system; Compress these config data and packages data into some packages can be used in CDlinux; Compress these config data and packages data into some modules can be used in CDlinux. I feel the first way has the best flexibility, and I am using this way. So, the most party of this diary I will introduce it under such an environment: has installed CDlinux 0.6.2 Standard version into hard disk and using shell script to configure system and add my own softwares. This way is proper for any Linux distribution but it seems I haven’t found it on the offical website of CDlinux. The way of configuring system with shell script can be found in Damn Small Linux(DSL). For example, the FAQ in DSL: How can I enter and save my static IP settings?. And, I will introduce how to make a module and package briefly at the end of this diary.

1, System hardware configure
Infact, the ability of detecting hardwares of CDlinux is very powerful, such as the support to software raid has been compiled into kernel, just as the indroduction in its homepage below:

CDlinux can automaticly detect on which device it is installed. It can be installed on, and boot from CD, DoC, Flash, HD, or MD drive, via ATA, SATA, SCSI, USB, or IEEE1394 bus.

CDlinux can be installed on many kinds of file systems. You can install it on ext2, ext3, jfs, reiserfs, xfs, isofs, udf, as well as hfs, hfsplus, fat, ntfs, etc., as long as the Linux kernel supports them. CDlinux will figure it out automaticly.

But, it isn’t possible to include all in an OS, just as my old Celeron CPU PC with old style two key series port mouse, and the monitor need work at 800×600 resolution with the refresh rate at 75HZ; And, there isn’t vmware display driver when I run CDlinux in Vmware virtual machine, so I have to replace it with “vesa” display driver. I will explain how to configure the hardwares environment above using shell script below.

I installed CDlinux into hard disk. The partition I installed CDlinux into it is the first partition of my first hard disk, it is a Windows FAT32 partition ( “C:” partition in Windows and “/dev/sda1” in CDlinux), the directories structure is “/CDlinux/CDlinux/bzImage”. Create a shell script file “/CDlinux/CDlinux/local/run.sh” at first. The config script will be written into this “run.sh” file. And, copy Xorg Xserver config file “/etc/X11/xorg.conf” into the same directory in a running CDlinux, it is: /CDlinux/CDlinux/local/xorg.conf .

CDlinux can’t recognize my old two keys series mouse, there is no “series port” device in it yet, so generate a series port device at first like this : mknod /dev/ttyS0 c 4 64 . Then, configure series mouse in xorg.conf like below:


Section "InputDevice"
Identifier "GenericMouse"
Driver "mouse"
Option "Protocol" "Microsoft"
Option "Device" "/dev/ttyS0"
Option "Emulate3Buttons" "Yes"
EndSection

Modify “xorg.conf” to make monitor work at 800x600x16@75HZ, the related section in “xorg.conf” like below:

Section "Monitor"
#DisplaySize 280 210 # mm
Identifier "Monitor0"
VendorName "GSM"
ModelName "3abd"
Option "DPMS"
HorizSync 29-50
VertRefresh 56-75
EndSection


Section "Screen"
DefaultDepth 16
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Modes "800x600"
Depth 16
EndSubSection
EndSection

Change “Driver” parameter in “Device” section in “xorg.conf” into “vesa” to let CDlinux use vesa driver in Vmware virtual machine.

You need modify some parameters according to your own environment.

2, Use swap partition (or swap file)
You must use swap partition (or swap file) when hasn’t enough physical memory to run CDlinux. I heard the dispathing arithmetic will be optimized when using swap partition (or swap file) even you have enough physical in Linux (I haven’t confirmed this). In common case, it will use swap partition automatically when you run CDlinux in a system which has Linux with swap partition pre-installed. But, I have ever run into the case it can’t use the swap partion in virtual hard disk automatically when I run CDlinux ISO image in Vmware virtual machine. In this case, add one line into “run.sh” like this: swapon /dev/sdaX (“/dev/sdaX” is your swap partition).

But, if there isn’t a swap partition in system, the convenient way is using swap file. There is a “pagefile.sys” swap page file in Windows, but, I found I can’t use “swapon” command to use it as a swap file, so I added two lines in shell script file to use it as a linux swap file like below:

mkswap $SWAPPATH/pagefile.sys
swapon $SWAPPATH/pagefile.sys

$SWAPPATH indicates the location of swap file, you can indicate CDlinux installation path prefix and swap file path prefix like below:

CDLPATH=/media/sda1/CDlinux
SWAPPATH=/media/sda5

Additionally, I suggest you make a swap file when install CDlinux, you can use it when there isn’t swap partition or swap file in system (even you install CDlinux into a USB disk). I made a 128M swap file in “/media/sda1/CDlinux” when I installed CDlinux, the commands to do this like below:

dd if=/dev/zero of=/media/sda1/CDlinux/swapfile bs=1024 count=131072
mkswap /media/sda1/CDlinux/swapfile

Then use this swap file in shell script file:

swapon $CDLPATH/swapfile

$CDLPATH is installation path prefix of CDlinux defined above.

Additionally, I found the swaps’ priority decided by the order of it be defined in shell script file, you can view the priority of swaps with command “cat /proc/swaps”. So, put the faster swap partition (or swap file) before slower one.

3, Add softwares
As examples, I will introduce add “resize_reiserfs” command for resizing a reiserfs file system and update Wubi code table file “wbx.mb” of Fcitx chinese input method software. Before this, please read the FAQ of CDlinux: I want to compile packages for CDlinux, which distro should I use? . We can see we can use the packages in Slackware 11 or LFS 6.1.1 in CDlinux 0.6.2. But, I think it isn’t an absolute principle, you can try other distribution’s packages too.

I don’t know why did CDlinux 0.6.2 miss “resize_reiserfs” command when there are almost all other commands for Reiserfs file sytem in it. Search the package which include “resize_reiserfs” file in Slackware-11.0 in page Search Slackware Packages. And download this package reiserfsprogs-3.6.19-i486-1. Then, execute “tar xfvz” to extract the downloaded file, copy “resize_reiserfs” file in it into $CDLPATH/CDlinux/local/sbin/resize_reiserfs for ready to use. Then, add several lines in our shell script file like below:

cp $CDLPATH/CDlinux/local/sbin/resize_reiserfs /sbin/resize_reiserfs
chmod 755 /sbin/resize_reiserfs

You can’t input Chinese words and expressions but only single Chinese character with Fcitx chinese input method software in CDlinux when boot system with “zh_CN.UTF-8” locale supported, so I need replace its Wubi code table file “/usr/share/fcitx/data/wbx.mb” with inputing Chinese words and expressions supported.

You can download fcitx_3.4.99+svn163-0ubuntu1_i386.deb from Ubuntu repository. The repository mirror in TaiWan is fast for my location (SiChuan Province, China). You can choose a faster one for youself. Then, extract deb file with command “ar x fcitx*”, next, extract “data.tar.gz” with command “tar xfvz data.tar.gz”. Copy extracted “./usr/share/fcitx/data/wbx.mb” into “$CDLPATH/CDlinux/local/wbx.mb” for ready to use. Add two lines into script file “run.sh” to replace Wubi code table file “wbx.mb” with new one like below:

rm /usr/share/fcitx/data/wbx.mb
cp $CDLPATH/CDlinux/local/wbx.mb /usr/share/fcitx/data/wbx.mb

.

4, Keep your varible data
From my known, CDlinux offical hasn’t provide a way to keep your variable data until in 0.6.2 version. I borrow ideas of keeping variable data from Puppy Linux. Make a loop device file first, format this loop device file into a file system, then keep data in this file system. I need add F-PROT Antivirus into CDlinux 0.6.2, the virus library need update regularly. If I install it into a windows FAT32 file system, it can’t keep Linux attribute of files, It seems I can’t install it into such a file system successfully. I decided install this Antivirus tool into a Linux file system in loop device. Below is the steps I create a 100M loop device file and format it into ext2 file system and mount this file system under “/mnt/save” (executed in Ubuntu 6.06):

dd if=/dev/zero of=~/save.img bs=1K count=102400
sudo losetup /dev/loop0 save.img
sudo mkfs.ext2 /dev/loop0
sudo mkdir /mnt/save
sudo mount -t ext2 -o loop save.img /mnt/save

Downloaded F-PROT Antivirus for Linux, then extracted it into the file system in loop device created above:

sudo tar xfvz fp* -C /mnt/save
sudo mkdir /mnt/save/usr/bin -p
sudo mkdir /mnt/save/usr/man

It asked me where did I install some symbol links for F-prot, so I created such as “/mnt/savbe/usr/” directories above, I installed these symbol links (such as the symbol link to “fpscan”) into “/mnt/save/usr” directory. (Please note: “/mnt/save” is the mount point of the loop device above.)

Maybe, you will ask me why don’t install F-prot under CDlinux, because install F-prot need execute *.pl installation file “install-f-prot.pl”, there is no Perl to execute this installation file in CDlinux 0.6.2 Standard version I use. I was unwilling to add Perl into CDlinux in this point.

In this way, install F-prot into loop device file. Then you can copy this loop device file into the file system CDlinux installed into. You can mount this loop device file and execute F-prot in it. Below is the scripts I mount file system in loop device file and update virus library automatically:

mkdir /mnt/save
mount -o loop $CDLPATH/CDlinux/local/save.img /mnt/save

ln -s /mnt/save/apps/f-prot/f-prot.conf /etc/f-prot.conf
ln -s /mnt/save/apps/f-prot/fpscan /usr/bin/fpscan
cd /mnt/save/apps/f-prot
./fpupdate &

You can find this loop device file can keep you variable data indeed.

Below is the shell script file “run.sh” I finished at last (ony for refering):

#!/bin/bash

#the path prefixs of CDlinux installation and the page file of Windows (used as the swap file in CDlinux)
CDLPATH=/media/sda1/CDlinux
SWAPPATH=/media/sda5

#format swap file and use swap file
mkswap $SWAPPATH/pagefile.sys
swapon $SWAPPATH/pagefile.sys
swapon $CDLPATH/swapfile

#generate series mouse device file
mknod /dev/ttyS0 c 4 64

#add “resize_reiserfs” for resizing Reiserfs file system
cp $CDLPATH/CDlinux/local/sbin/resize_reiserfs /sbin/resize_reiserfs
chmod 755 /sbin/resize_reiserfs

#replace xorg.conf with customized one
cp $CDLPATH/CDlinux/local/xorg.conf /etc/X11/xorg.conf

#replace Wubi code table file “wbx.mb” with new one can support Chinese words and expressions input in Fcitx (a chinese input method software)
rm /usr/share/fcitx/data/wbx.mb
cp $CDLPATH/CDlinux/local/wbx.mb /usr/share/fcitx/data/wbx.mb

#load F-prot in the file sytem in loop device and update virus library
mkdir /mnt/save
mount -o loop $CDLPATH/CDlinux/local/save.img /mnt/save

ln -s /mnt/save/apps/f-prot/f-prot.conf /etc/f-prot.conf
ln -s /mnt/save/apps/f-prot/fpscan /usr/bin/fpscan
cd /mnt/save/apps/f-prot
./fpupdate &

#restart Xorg Xserver
killall xfce4-session

I can use this shell script file in this way, when start CDlinux, press “CTRL+ALT+F1” enter root console, execute:

. /media/sda1/CDlinux/CDlinux/local/run.sh

or

cp /media/sda1/CDlinux/CDlinux/local/run.sh ~/
cd
chmod +x run.sh
./run.sh

. In this way, Xorg Xserver will be restarted, all the config will take effect and antivirus tool F-prot will update its virus library automatically. Note, if you execute this script under X Window, because this script will kill the current window manager, so your antivirus tool will can’t get update.

5, Make CDlinux modules and packages
It is more simpler than for CDlinux 0.5.9 to make modules for CDlinux0.6.2. Boot into CDlinux 0.6.2, put the files of your modules into a temporary directory (e.g., temp), then execute “mksquashfs temp module-cdl.md” in the upper level directory, “module” in “module-cdl.md” is the module name you can name it arbitrarily. Why I must boot into CDlinux-0.6.2 to make modules? Because CDlinux 0.6.2 has used new compress arithmetic “lzma” for “squashfs” file system for its module files *.md and initrd file, it will can’t work under a common Linux system without Lzma squashfs patch for kernel (such as Ubuntu 6.06 or Ubuntu 8.04 I am using).

Make a package is just add the files into a gziped archive file with name “*-cdl.tgz” (do it with command “tar cfvz packagename-cdl.tgz”), then put it into a proper location.

The difference between module and package in CDlinux 0.6.2 is, module can be loaded as a loop device when there is no enough physical memory when package always load all files into memory.

From the booting screen information, I can know the loading order of modules and packages, load the base system in directory “extra”, then load the stuff in “lang” directory, load the stuff in directory “local” at last. So, you should put your own modules or packages into directory “local”. I haven’t studied the loading order of modules and packages in CDlinux 0.6.2 too much. Such as: suppose two packages extracted in the runing CDlinux, there are files in these two packages has the same path and file name, how does the system process them?

Ok, stop here about CDlinux 0.6.2 configure and software installation. Welcome point out or even correct my mistake for my limited knowledge. Thanks.

The next will be: CDlinux practice.

2 Comments

[…] This is the first diary of CDlinux 0.6.2 Usage Summary diaries series, the next will be: CDlinux 0.6.2 Configuration and Software Installation. […]

[…] CDlinux 0.6.2 Configuration and Software Installation Include: Configure CDlinux to fit your hardware environment, add softwares you need into CDlinux, […]

蜀ICP备2021012931号-1 川公网安备51092202000377号