CDlinux HOWTOs

English    Russian    Simplified Chinese    Traditional Chinese   
Home

Contents

Install


Customize


Configure



Use

Install

Howto "install" CDlinux?

    CDlinux is distributed as a standard ISO image. So the simplest way to install is: just burn CDlinux.iso to a CD and boot with it.

    You can also install CDlinux in a hard disk or a USB disk, see below.

Howto integrate CDlinux into my own CD image?

    CDlinux is a tiny distribution. As of 0.4.9, it's only about 17M, that's far less then the capacity of an ordinary CDR. So, if you like, you can integrate CDlinux with other stuffs and  build your own CD image. You can do this either with Linux or with Windows.

The Linux way (you can do it either in CDlinux or in a normal Linux installation)

    First, extract the contents from the CDlinux ISO image:

        # mount -o loop CDlinux-x.x.x.iso /some/where

    There you'll find all the contents of CDlinux in /some/where. Assume all other stuffs you want to build into the image are located in the /mycd folder. Now you should copy the content of CDlinux to that folder too:

        # cp -p -r /some/where/* /mycd

    Next, cd to the /mycd folder, and modify the mkisofs.sh script to fit your own situation.
    Finally, build the CD image with:

        # ./mkisofs.sh

    By default, the new image will be generated as /tmp/1.iso. You can burn it with cdrecord or what ever burning tools you like.

    Note that, the ISO image generated in the former procedure will boot directly into CDlinux. If you want to build a multi-boot CD, you can use isolinux, which is a component of syslinux. For howto use isolinux, please refer to its own docs.

The Windows way


    I'm not familiar with the Windows based burning softwares, but I guess it won't be too complicated. Here are some tips:
  • To extract the contents from the CDlinux ISO image, you can use WinRAR.
  • CDlinux uses boot/CDlinux/CDlinux.img, which is a 2.88M floppy image, to boot.
  • Keep the directory hierarchy of CDlinux unchanged in your image.
  • Don't change the case of file/folder names, CDlinux is case-sensitive.
Howto install CDlinux on a hard disk?

    Thanks to the versatility of Linux, we can install CDlinux on a hard disk in many ways. Here we'll only explain howto install CDlinux on a Windows FAT partition, and boot it with loadlin. You can figure out the other ways yourself.

    In the following discussion, we'll assume your Windows C: drive is /dev/hda1, and it's formated as FAT16/FAT32. To install CDlinux on C:

The Linux way (you can do it either in CDlinux or in a normal Linux installation)

    First, mount the CDlinux ISO image and the C: drive:

        # mount -o loop CDlinux-x.x.x.iso /mnt/cdrom
        # mount /dev/hda1 /mnt/win

    (If you don't want to install it to C:, or your C: drive is not /dev/hda1, please change the second mount command accordingly.)

    Then, copy the extra packages and modules to C:

        # mkdir /mnt/win/CDlinux
        # cp -r /mnt/cdrom/boot/CDlinux/extra /mnt/win/CDlinux

    Next, copy the Linux kernel and the initrd to C:

        # mount -o loop /mnt/cdrom/boot/CDlinux/CDlinux.img /mnt/floppy
        # cp /mnt/floppy/bzImage /mnt/floppy/CDlinux.gz /mnt/win/CDlinux

    Finally, download loadlin (~10k) and extract it to C:

        # tar -C /mnt/win/CDlinux -zxf loadlin.tgz

    (This will expand the "loadlin.exe" and a sample "autoboot.bat" to that folder. Please check the "autoboot.bat" file first, and modify it if needed.)

    Now you can boot to "pure" DOS, and start CDlinux with:

        C:
        CD CDlinux
        AutoBoot

    Note that, the former is just as an example. Your situation may differ from the assumptions we made here. So, be sure to make any necessary changes. Please also take a look at A brief introduction to CDlinux' command line parameters and A brief introduction of the layout of CDlinux.

Howto install CDlinux on a USB disk?

    There are also many mays to install CDlinux on a USB disk. We'll only explain howto install CDlinux on a FAT partition, and boot it with syslinux. You can figure out the others yourself.

    In the following discussion, we'll assume your USB disk is in hard disk mode. The first partition on it is /dev/sda1, and it's formated as FAT12/FAT16/FAT32. To install CDlinux on it:

The Linux way (you can do it either in CDlinux or in a normal Linux installation)

    First, transfer syslinux to the USB disk:

        # syslinux /dev/sda1

    Mount the CDlinux ISO image and the USB disk:

        # mount -o loop CDlinux-x.x.x.iso /mnt/cdrom
        # mount /dev/sda1 /mnt/win

    (If your USB disk is not /dev/sda1, please change the second mount command accordingly.)

    Then, copy the extra packages and modules to it:

        # mkdir /mnt/win/CDlinux
        # cp -r /mnt/cdrom/boot/CDlinux/extra /mnt/win/CDlinux

    Next, copy the Linux kernel and the initrd to it:

        # mount -o loop /mnt/cdrom/boot/CDlinux/CDlinux.img /mnt/floppy
        # cp /mnt/floppy/bzImage /mnt/floppy/CDlinux.gz /mnt/win

    Finally, download the syslinux config (~2k) and extract it to the USB disk too:

        # tar -C /mnt/win -zxf syslinux-cfg.tgz

    (This will expand the "syslinux.cfg" and some other message files to that folder. Please check the "syslinux.cfg" file first, and modify it if needed.)

    Now set your BIOS to boot from USB-HDD or USB-zip (that depends on how your BIOS treat your USB disk), and reboot.

    Note that, the former is just as an example. Your situation may differ from the assumptions we made here. So, be sure to make any necessary changes. Please also take a look at A brief introduction to CDlinux' command line parameters.

A brief introduction on CDlinux' command line parameters

    To be more flexible and makes CDlinux capable of finding extra components on CDROMs as well as other devices, and can run in "normal" (ramdisk) mode as well as "loop" mode, we have defined three kernel command line parameters:

    CDL_DEV=:
      indicates on which device is CDlinux located.
      default: /dev/cdrom
      example: CDL_DEV=/dev/hda1

    CDL_DIR=:
      indicates in which folder (of the CDL_DEV file system) is CDlinux located.
      default: boot/CDlinux, CDlinux, zxh/CDlinux
      example: CDL_DIR=APPs/CDlinux

    CDL_LOOP:
      should CDlinux install all modules in "loop" mode ?
      default: no, install them into ramdisks if possible.
      example: CDL_LOOP

    These parameters are all optional. If not set, the default will be used.

Customize

A brief introduction on the layout of CDlinux.

    CDlinux is highly configurable. It's divided into 2 parts:

      1. base:  a single 2.88M floppy, i.e. CDlinux.img
      2. extra: other useful packages and modules

    The "base" part of CDlinux is a single 2.88M vfat floppy image, which contains the Linux kernel and some fundamental packages. If you just want a basic Linux environment, you can remove all other files of CDlinux, and use this image alone. It contains: bash (1.14.7), bftpd (a tiny ftp daemon), busybox, bzip2, e2fsprogs, file, find, gawk, grep, gzip, midnight commander (4.1.35), portmap (to mount nfs), sed, tar, and vim (5.8), etc.

    The "extra" part contains other useful packages and modules. These packages and modules are located at boot/CDlinux/extra/. At boot time, CDlinux will try to find the extra/ folder, and install those packages and modules in it automaticly.

    Although you can use CDlinux.img alone to boot, but if you want a full-featured version, be sure to keep the "extra" folder and the files in it. If you are brave enough, you can add your own favorite applications to extra/, remove those you don't need, and then rebuild your own version of CDlinux.

Howto add my favorite applications to CDlinux?

    CDlinux is meant to be tiny and user configurable. Thus many useful applications are not included. You can install them yourself by adding either a "package" or a "module". The choice is depend on the application you intend to add. If it is small, and don't need to be initialized before using, you can build it as a "package". Otherwise, a "module" is preferred. For example, you may build F-PROT as a module, and put it in the extra/ folder, making your CDlinux capable of scanning virus. (F-PROT is a cool virus scanner/cleaner. The reason why it is not integrated by default is that, I'm not sure whether its license allows me to do so.)

Notes on building applications for CDlinux
  • CDlinux is compiled with gcc-2.95.3 and linked against glibc-2.2.5. So you'd better build your app with gcc-2.95.x and glibc-2.2.x too.
  • If your app needs extra libraries which are not included in CDlinux, you should add the libs too.

Howto build a CDlinux "package"?

    To build a CDlinux "package" is very simple. A "package" is just a standard .tar.gz file. You can refer to those "xxx-cdl.tgz" files in the extra/ folder for the structure of a "package". Only note that:
  • Your package must be named as "xxx-cdl.tgz". Otherwise it'll be ignored and not installed.
  • Optionally, you can write a brief introduction of your package, and save it as zxh/SPEC. It'll be integrated into /var/log/packages automaticly. Please refer to the included "xxx-cdl.tgz" files for the format of SPEC.
  • All other stuff in the zxh/ folder except SPEC will be ignored and not installed.
  • CDlinux runs in a small RAM disk. So, keep your package tiny. You can put unnecessary files like man pages and docs to the zxh/ folder. Thus they'll not be installed during boot, while you can still refer to them later.

Howto build a "module" for CDlinux?

    If you intend to add a bigger application to CDlinux, you can build it as a "module". A CDlinux "module" is a standard cramfs disk image. During boot time, CDlinux will try to find files named as "xxx-cdl.md" in the extra/ folder, and mount them automaticly.

    The building of a CDlinux "module" is a bit complicated. You'll need mkfs.cramfs to create the disk image. Please refer to the included "xxx-cdl.md" files as examples of the structure of  "modules".

Notes on building a CDlinux "module"
  • The module must be named as xxx-cdl.md. Otherwise it'll be ignored and not installed.
  • You must indicated the mount point of the module. To do this, just write the mount point to a file named as ".mount_point" and save it to the root of the cramfs image. Please refer to the included "xxx-cdl.md" files in extra/ for the format of ".mount_point".
  • Optionally, if your application needs to be initialized before using, you can put its init script in the root of the cramfs image, and name it as ".init". CDlinux will find and execute ".init" automaticly.
  • By default, CDlinux will try to install "modules" to the memory. If you want to save more memory, you can force CDlinux to mount modules in "loop" mode by adding a "CDL_LOOP" option to the kernel command line.
  • The cramfs file system is readonly, and doesn't record the time stamps of files/folders.
Howto customize CDlinux to fit my own needs?

    In some case, you may want to modify the behavior and look, etc. of CDlinux to fit your own needs. There are both hard way and easy way to do this.

    The hard way is to modify the initrd directly. The initrd is a standard ext2 file system image. You can mount it, then make any changes you want. This way is not recommended, and we'll concentrate on the easy way in the following.

    The easy way is, make your modifications to extra/system-extra-cdl.tgz. If you've modified any file, e.g. /etc/profile, put your modified version back to system-extra-cdl.tgz. CDlinux will overwrite the original with your new version automaticly. You can also add a /etc/rc.d/rc.local script to system-extra-cdl.tgz. It will be auto detected and executed during boot time. Here are are some examples:

Change the bash prompt

    Modify the "PS1=" lines in /etc/profile, and put the modified version to system-extra-cdl.tgz, also as /etc/profile.

Change the command line editing style from emacs to vi

    Modify /etc/inputrc, add "set +o vi" to it. Then put the new version to system-extra-cdl.tgz, also as /etc/inputrc.

Let CDlinux mount my C: drive automaticly

    Modify /etc/fstab, and put it back to system-extra-cdl.tgz.

Let CDlinux auto detect my non-PnP ISA card(s)

    Assuming you have an NE2000 compatible, non-PnP ISA card, which uses 0x300 as the I/O port. To let CDlinux auto detect it, you can create a new shell script. Add a line "modprobe ne io=0x300" to it, and chmod it to executable. Then save it as /etc/rc.d/rc.local in system-extra-cdl.tgz.

Let CDlinux act as a simple Gateway/Firewall

    Modify the iptables-x.x.x-cdl.tgz package. Add a script as /etc/rc.d/init.d/IPTABLES, and put your rules there. Please refer to extra/dcron-x.x.x-cdl.tgz for the format of such a script.
    In fact, CDlinux will find and run any executables in /etc/rc.d/init.d/ during init. It's a bit like the sysvinit schema, except that CDlinux doesn't support run levels.

Configure

Howto configure my network?

    CDlinux has builtin drivers for many common network cards. While to keep it tiny, more other cards are only supported by kernel modules. During boot time, CDlinux will try to auto detect you network card(s). But if some card(s) were already recognized by the builtin drivers, the auto detecttion procedure will be skipped.

    You can also detect your network card(s) manually with

        # nic-detect

    This is a simple shell script that tries to detect what network card(s) you have. Currently, it's still considered primitive and dangerous, it may even hang your system. So, please use with care, and send me a bug report if you find it did any thing bad.

    CDlinux has included a DHCP client. So, if you have a DHCP server, your IP address, gateway, and DNS server, etc. should be setuped automaticly. You can also configure these setting manually with

        # net-config

    To set your proxy, run

        # proxy-config

    To change the MAC address of your card, run

        # mac-fake

    Then follow the instructions.

Howto configure my raid devices?

    The SCSI and RAID drivers are all built as kernel modules. So they can not be auto detected. You should install their corresponding kernel modules to drive them. As an example, let's assume you have an AHA1542 based SCSI card, and two SCSI disks are attached to it as /dev/sda and /dev/sdb respectively. The /dev/sda1 and /dev/sdb1 are integrated into a RAID0 md. You can configure it with:

    # modprobe aha1542
    # modprobe raid0
    # mdadm -A /dev/md0 /dev/sda1 /dev/sdb1

    Now, you should be able to access your md as /dev/md0.

Howto configure my mouse?

    Use mouse-config. (supports most COM/PS2/USB mice)

Use

Howto read/input CJK?

    Use CCE:

       cce    - Chinese (Simplified)
       cceb5  - Chinese (Traditional)
       ccejis - Japanese
       cceksc - Korean

    Then use Ctrl+Space and/or Ctrl+Shift to circle through the supported IMs. (If you don't need CJK support at all, you can simply drop the extra/cce-x.x.x-cdl.md file. It's OK.)

Howto exchange data with other computers?

    CDlinux has already included ftp, ssh1, and nfs3 servers and clients. By default, the ftp and ssh server are started automaticly. So, you can exchange data with other computers with either ftp or scp.

    By default, the nfs server doesn't export anything. You should first edit /etc/exports to tell the server what to export and how. Then restart it with

    # /etc/rc.d/init.d/UNFSD restart

    The nfs and samba clients are also included. To mount a nfs resource:

    # mount -t nfs xx.xx.xx.xx:/exported/resource /some/where

    To mount a samba resource:

    # mount -t smbfs -o username=xx //machine_name/resource_name /some/where

Howto resize/manipulate partitions?

    Use parted. And resize2fs etc.

My partition table was destroyed, howto restore it?

    Use gpart.(already applied the reiserfs-3.6 patch, so it's ok on reiserfs)

How to undelete files in an ext2 file system?

    Use e2undel.

My LILO/GRUB boot record was overwritten by Windows, howto restore it?

    If your newly installed Windows has overwritten the MBR, thus your Linux can't boot. You can restore it with CDlinux:

    First, mount the Linux root partition, for example /dev/hda5 with:

  # mount -t ext2 /dev/hda5 /mnt/local

    Then, assuming your boot manager is LILO, issue:

  # lilo -r /mnt/local

    That failed? Well, don't worry. Let's try this:

  # chroot /mnt/local /sbin/lilo

    Hum, that should work. Failed again? Well, I'm afraid you'd do the hack yourself now. And hope you good luck :(  BTW, if you are using GRUB instead, the command is "grub-install". Please refer to LILO/GRUB's docs for more detailed instructions.

Windows 9x has overwritten NT/2k/XP's boot record, howto restore it?

    Assume your C: drive is /dev/hda1, and it's formated as FAT32. Your newly installed Windows 98 has overwritten XP's boot record on it. And you can't see the dual boot menu of XP anymore. You can restore it with:

    # ms-sys -2 /dev/hda1

    For more detailed help, please refer to ms-sys' own docs.

How to restore NT/2k/XP administrator's password?

    If you've lost the administrator's password of your NT/2k/XP, there's no easy way to restore it. But you can "overwrite" it with a new password, or simplely clear the original password with:

    # nukent

    And follow the instructions.(Note: For recent versions of Windows, say Windows XP + SP2, "overwrite" with a new password doesn't work, but you can still clear it.)


    For more information on installed packages and a brief introduction of their usages, please refer to /var/log/packages. Many man pages are included within these packages (under the zxh/ folder, not installed by default). You can "mount /mnt/cdrom" and then find them inside those "-cdl.tgz" files. For detailed instruction on the the usage of a certain program, please refer to its own docs, that's beyond the topic of this mini HOWTO. Anyway, RTFM is an excellent way to learn :)
Top
 
Powered by BerliOS Developer Logo and SourceForge.net Logo      Last modified: 2006/11/03