Mepis Remastering HowTo
Introduction
Before you begin
Similar to Knoppix, Mepis uses the cloop kernel module to compress/decompress packages on the fly to and from memory - thus achieving an effective 2GB+ loop back image. Therefore your host Linux setup (that is used for remastering) should have the ability to read cloop devices via the cloop kernel module. Unfortunately since cloop is not, (at the time of writing), part of the official kernel source, it must be downloaded seperately and applied as a patch.
Fortunately there are easier alternatives...
- LiveCD option - Boot via a cloop supported liveCD (knoppix or mepis) and mount the hard disk partition that you wish to use for remastering purposes. Make sure you have the creare_compressed_fs binary (mepis & knoppix has it) or else apt-get install cloop-utils
- Using an installed LiveCD - Alternatively you could install Knoppix/Mepis to the hard drive, and work from within it.
- Patch the kernel - If you don’t want to leave your favorite distro, then try your luck with patching your kernel with the cloop kernel patch.
I used this approach and thanks to gentoo, it was a snap!
# emerge cloop
Instructions
- Make 2 directories, one for your new Master CD, one for the source, on a directory (or a mounted disk partition). Also, make additional directories under these named linux:
# mkdir -p /mnt/mymepis/{source,master}/linux
- Copy the content of the mounted (using cloop) linux file. If not didn’t boot from mepis but have cloop support issue.
# modprobe cloop file=/mnt/cdrom/linux/linux
# mount /dev/cloop/0 /mnt/loop
# cp -Rp /mnt/loop/* /mnt/mymepis/source
- Copy all the other files except the big linux file
# cd /mnt/cdrom
# find . -size -10000k -type f -exec cp -p --parents '{}' \
/mnt/mymepis/master/ \;
- Chroot to the sources we copied.
# choot /mnt/mymepis/source/linux
# mount -t proc none /proc
- Add/Remove software and customize the system as you would with debian 1).
- Unmount /proc and get out of (chrooted) jail
# umount /proc
# exit
- Create the cloop compressed image
# Clean up
rm /mnt/mymepis/source/linux/root/.bash_history
rm /mnt/mymepis/source/linux/root/.viminfo
# Make the compress loop add -b after create_compressed_fs for best compression
mkisofs -R -U -V "My Mepis" -publisher "Bud - www.babytux.org" -hide-rr-moved \
-cache-inodes -no-bak -pad /mnt/mymepis/source/linux | nice -n -5 \
/usr/bin/create_compressed_fs - 65536 > /mnt/mymepis/master/linux/linux
# cd /mnt/mymepis/master
# mkisofs -l -r -R -v -V "Remastered Mepis" -no-emul-boot -boot-load-size 4 \
-boot-info-table -b boot/grub/stage2_eltorito -c boot.catalog -hide-rr-moved \
-o /mnt/mymepis/mymepis.iso /mnt/mymepis/master
- Burn the CD iso image. Replace hdc with your CD burner device
# cdrecord -v -dao -eject dev=/dev/hdc /mnt/mymepis/mymepis.iso
Remastering Tips
- To get a list of packages already installed, sorted by size:
# dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -n
- To remove a package (and all packages dependant on it):
# apt-get remove --purge <name-of-package-to-remove>
- To check for orphaned packages, and automatically remove if your brave!:
# deborphan
# deborphan | xargs apt-get -y remove
- When you’re done removing and adding packages, a good way to clean up is by typing this:
# COLUMNS=200 dpkg -l |grep ^rc |awk '{print $2} ' | xargs dpkg -P
- To clean the apt cache (deb files that were downloaded)
# apt-get clean
# rm /mnt/mymepis/source/linux/root/.bash_history
# rm /mnt/mymepis/source/linux/root/.viminfo
- When testing X-based programs:
On the chrooted environment...
# export DISPLAY=localhost:0.0
On the host environmemt used to remaster...
# xhost + localhost
- For this to work, it seems the X server should be listening to tcp (can it work using unix pipes?).
to check if X is listening to tcp...
telnet localhost 3306
to enable tcp listening using startx (this can be insecure!)
# defaultserverargs="" startx
- Installed package info are in /var/lib/dpkg/info (for grepping purposes)
Customization Tips
(Note: paths are given relative to the chrooted environment)
Copy one of the sample bootsplashes and modify it
# cp -a /etc/bootsplash/themes/{linux,mysplash}
Modify /etc/bootsplash/themes/mysplash/{images,config} files
Remove the current boot splash from the initrd...
# cd /mnt/mymepis
# gunzip master/boot/initrd.gz; gzip master/boot/initrd
Append the new one to it...
# /sbin/splash -s -f \
/mnt/mymepis/etc/bootsplash/themes/mytheme/config/bootsplash-1024x768.cfg \
>> /mnt/mymepis/master/boot/initrd
Do the same for the boot splash found in the chroot (/mnt/mymepis/source/linux/boot/initrd.splash)
- To customize kdm background image
# cp mywallpaper.png /usr/share/wallpapers
# vi /etc/kde3/kdm/backgroundrc
Wallpaper=mywallpaper.png
- To customize desktop wallpaper
# cp mywallpaper.png /usr/share/wallpapaers
# vi /etc/kde3/kdesktoprc
Wallpaper=/usr/share/wallpapers/mywallpaper.png
- Customized Grub boot splash, extract /boot/message and modify background.pcx 14 color image
cpio --extract < /boot/grub/message
find . | cpio -ov > ../message