The Linux4all  LiveCD 'barebone' Customization Guide


for barebone 1.1

Customization 

The LiveCD barebone is only a very limited template system.
This page describes how to clone and customize it.

Since it is relatively small but still contains two kernels, it is also ideal to test the boot process and livecd start.  

Requirements

1. A Linux system or either a basilisk or a barebone livecd.
2. A partition with at least 800Mb free space
3. For yum: internet access

Terms used :

1. buildhost:  the system on which the livecd system is created
2. buildroot : since the livecd-devel directory may have any name and be anywhere, this is the common name for that directory.
3. zisofs tools: the default fedora packages 


 Setting up the buildroot for a customized livecd


1.The barebone iso disc contains the 'buildroot' as 'tarred&gzipped' archiv directly inside the iso image (replaces X_buildroot dir in compressed livelinuxcd.vhd).

To install the buildroot in /opt/livecd-devel do:

 load the barebone 1.1 iso
- mount the iso to your_isomountpoint
- extract 
your_isomountpoint/livecd-devel.tar.gz

You can rename or move the /opt/livecd-devel folder anywhere you want.

2. Copy the livelinuxcd.vhd from the iso image to buildroot-yourconfig/iso/

3. Copy the isolinux folder from the iso image to buildroot-yourconfig/iso/

Customizing a copy of the barebone livecd image

Use the following steps to  create a customized livecd  from a barebone - template:

0. Setup a buildhost, buildroot and optionally rpm package repository as described above

1. Change to buildroot: cd /mnt/partitionnumber/buildroot-yourconfig

2. Mount the  iso/livelinuxcd.vhd read-write to img/ : mount iso/livelinuxcd.vhd img -o loop

3. Chroot to img : chroot img

4. Mount proc : mount /proc /proc -t proc

5. optional: mount a partition from the buildhost to /mnt/yum - this leaves yum cache outside the livecd image.

6. Run yum and install your software

7. Check autostart - services

8.  Do other things ....

9. umount -a

10. umount /proc

11A. remove stale lockfiles and logs : cleanup.sh

11B. remove temporary rpm database files : rm /var/lib/rpm/__db*

12. check permissions on /home

13. remove /var/log/*

14. remove /.autofsck

15. leave the image : exit

16. run : ./mknewcd.sh to update the /livecd cache file , zisof compress and move the compressed image to the disc1 folder, and finally create the iso image.

17. burn the image


Manually Creating the transparent compressed ISO Image

Assuming `pwd`=buildroot-yourconfig

1. umount the image :
umount img

2. Filecheck the livecd image:
e2fsck -f iso/livelinuxcd.vhd

3. compress iso folder to temporary folder :
mkzftree -v --level 2 iso isoz/isoztmp-1

4. Create disc folder to master the transparent compressed iso :
mkdir disc1

5. move the compressed image to the disc folder:
mv isoz/isoztmp-1/livelinuxcd.vhd disc1/

6. copy isolinux directory and iso boot files to the disc1 folder:
cp -a iso/isolinux isoz/isoztmp-1/  ;cp -a iso/b* isoz/isoztmp-1/

7.  create the transparent compressed iso image in the directory above: 
./bin/make-iso.sh disc1 ../

8. write the image to readwrite media, test them.
./bin/write-cd.sh ../disc1.iso

9. test customized livecd -  with  a bit of luck, it works on the first try.

10. repeat ad nauseum until everything works well.




Special 1: creating a new virtual livecd image (livelinuxcd.vhd)

1. change/check buildroot_mklodisk_size parameter in buildroot.config :

 vi buildroot.config

2. run the helpscript to create, format and testmount an ext2 loopback filesystem:

./bin/mkvhd.sh

virtual harddisk maker creating loop-back disk livelinuxcd with size of 642000 blocks with type ext2 on master
continue ? Any key or CTRL-C :>
...
Filesystem Size Used Avail Use% Mounted on
livelinuxcd.vhd 229M 176M 53M 77% master

3. remount the image to ./img and copy the system from ./master 
umount master/
mount livelinuxcd.vhd img/ -o loop
cp -a master/* img/ umount img
e2fsck -f livelinuxcd.vhd

4. remount the image, and decide the livecd boot layout and kernel / initrd
mount iso/livelinuxcd.vhd img -o loop



Special 2: create an  iso image in : make-iso.sh

The make-iso script increments the build number and creates the iso image.

Mkisofs Command: 

Please see: doc/mkisofs-2.01/README.eltorito and doc/mkisofs-2.01/README.joliet

mkisofs -z -o $ISO -b isolinux/isolinux.bin -c isolinux/boot.cat \
 -no-emul-boot -boot-load-size 4 -boot-info-table -l \
 -R -r $CDIMAGE

Compressed:

Please see also: doc/mkisofs-2.01/README.compression

1. Create a compressed copy from the iso folder:
 mkzftree --verbose --level 3 iso isoz
iso/isolinux -> isoz/isolinux ...

2.  Now replace unusable compressed isolinux files with fresh copies from the iso directory:
rm -rf isoz/isolinux
rm -rf isoz/b*
cp -a iso/isolinux isoz/
cp -a iso/b* isoz/

Write compressed iso:
3. ./make-iso.sh isoz/tmp-nr/ 


Uncompressed:

Remove the '-z' Option from mkisofs command.
(Change make-iso.sh )

 ./make-iso.sh iso ../

Special : write cd

Wrapper to cdrecord:
./bin/write-cd.sh $isoimage
Verbose,auto-select device and speed.

Verify Media :
Please see : doc/cdrecord-2.01/README.verify

 

Special 3: create a system with image on harddisk 

1. Boot the new system, eg. from this livecd.
2. Decide which hardisk and partition for the image
! XP/NTFS are not supported by fedora kernels ! use parted, fdisk ...
3. copy the livelinuxcd.vhd from network or the one from the still mounted livecd (if you booted that machine with one...)

4. adjust / create linuxrc.vhd
If you want to install a grub bootloader (overwrites ms and others), then:
create a boot partition for /boot
mount /boot
grub-install /dev/
cp iso/isolinux/initrd.img /boot
cp iso/isolinux/vmlinuz /boot

Mount the initial ramdisk: mount /boot/initrd.img img -o loop
edit /boot/grub/grub.conf :


 

Special: Create Package Repository on harddisk 

This repository can be mounted from inside a chrooted livecd image.

3. copy -a /var/cache/yum/* to the partition
4. bind the mounted partition to /var/cache/yum
5. run yum :)
6. yum check-update : to upgrade this image
7. optional: Copy a full RPM directory from a mirror Eg. from: http://download.fedora.redhat.com/pub/fedora/linux/core/

Mirrors for fedora core 2 packages can be found at http://fedora.redhat.com


Special : Yum

Yum has now a working ".local" configuration file.

It makes yum using it`s own cache or  a harddisk or network based repository as package source.
It assumes a yum repository at /mnt/yum (see below).

call with:
 yum -c /etc/yum.conf.local install packagename :

more /etc/yum.conf.local

[main]
#cachedir=/var/cache/yum
#change to /mnt/yum
cachedir=/mnt/yum/fedora-core/2/
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=fedora-release
tolerant=1
exactarch=1

[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
#baseurl=file:///var/cache/yum/base/
baseurl=file:///mnt/yum/fedora-core/2/base

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
#baseurl=http://ftp.ens.utulsa.edu/pub/linux/fedora/core/updates/$releasever/$basearch
#baseurl=http://rpmfind.net/linux/fedora/core/updates/$releasever/$basearch
#http://mirrors.usc.edu/pub/linux/fedora/fedora/fedora/$releasever/$basearch/yum/updates
baseurl=file:///mnt/yum/fedora-core/2/updates-released


Yum - Repository Style:

The yum repository for above configuration must be mounted to /mnt/yum.

Mountpoint: /mnt/yum/
|+Basedir: fedora-core/2/base :
  | +Subdir: packages/: *.rpm
  | +Subdir: headers/ :  header.info,*header*


Special: LiveCD Shell (/imc, /opt/imc)

Run: /imc/imc_main.sh

This is a shell script driven menu system that allows to quickly setup/monitor the livecd, network/internet connection via modem/isdn/dsl, to install / check for updated packages with yum and some more things.

It is manly usefull on console only (=X-less) systems as configuration tool.



spec_networking

 Special: Networking 

Lan autoconfig:

Per default, the system will try to configure eth0 via dhcp, assuming that this disc is mostly used in a lan.
The bug that prevented dhclient to create /etc/resolv.conf has been fixed.

Analog/ISDN :

Configuration:  system-config-network-tui
terminal menu to configure lan, modem and isdn connections


DSL :

adsl-connect : adsl-setup
edit: /etc/ppp/pppoe.conf


HOSTS :

The default hosts file contains static information for a 'virtual' livecd network - so your local lan should not use the same ip range.

/livecd/etc/hosts: more img/livecd/etc/hosts
#Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.42.1 vpdc.livecd.dom vpdc
192.168.42.101 client1.livecd.dom client1
192.168.42.250 vgate.livecd.dom vgate
192.168.42.251 vpngate.livecd.dom vgate