PDA

View Full Version : Dirty Little KNOPPIX Remastering



PrOCesSkIlL
10-07-2003, 11:34 AM
:twisted: Hi all,

last days I found that pretty well Linux Distribution KNOPPIX :D and I must say: NICE WORK!

After some testing, I decided to try to remaster the CD to my own needs.
First tries failed :roll:

But after reading some docs it works fine. 8)

Now, I am writing some remastering tools. One of the first tools is fs-reengine, written in php, running in the command-shell with php-cgi!

You can download the tool at http://linuxcracks.bravehost.com/fs-reengine.png

What is fs-reengine?
fs-reengine is a tool, which scans the filesystem at the given entry point and renames/relinks/remasters the filesystem-contents (files/links/dirs), based on a list of replacements-2-make.

Why do I need fs-reengine?
I don't know! But I use it to mass-reconfigure the KNOPPIX configuration files and directory names :lol: to remaster the CD

How to use the tool?
First of all you should have the KNOPPIX-CD booted (I used Version 3.3), in runlevel 2. Therefore you have to type knoppix 2 at the boot prompt (when you can see the KNOPPIX boot-screen).

STARTING FROM SCRATCH

After KNOPPIX has finished its booting process to runlevel 2, you'll need a harddisk with at least 5 GB of free space.

I recommend, that you have created a partitition with 5 or more GB of free space and formatted it with an EXT3 filesystem. So let's call this partition /dev/hda5 for our example (maybe your device name depends).

Any of the following commands you should type is highlighted blue. (Beware! Change the /dev/hda5 and /mnt/hda5 to your needs!)

Lets create the mount point, mount our harddisk and create the directories we need:

root@KNOPPIX# touch /mnt/hda5
root@KNOPPIX# mount /dev/hda5 /mnt/hda5
root@KNOPPIX# cd /mnt/hda5
root@KNOPPIX# mkdir /knx
root@KNOPPIX# mkdir /knx/master
root@KNOPPIX# mkdir /knx/source
root@KNOPPIX# mkdir /knx/iso

Now, we have to copy the data in the /cdrom directory:

root@KNOPPIX# cp -av /cdrom/* /mnt/hda5/knx/master

:roll: Take a beer and relax, this may take a while

After that we have to copy the root-fs itself:

root@KNOPPIX# cp -av /KNOPPIX /mnt/hda5/knx/source

:roll: Take a bigger beer, this will take some time, too

Its a good choice, to make your Internet-Connection work now!

However, change to the source/KNOPPIX directory and make it chrooted, and don't forget to mount the proc fs :? :

root@KNOPPIX# cd /mnt/hda5/knx/source/KNOPPIX
root@KNOPPIX# chroot .
root@KNOPPIX# mount -t proc /proc proc

Let's make the internet work for our chrooted environment:

root@KNOPPIX# echo "nameserver 145.253.2.203" >/etc/resolv.conf

...little test...

root@KNOPPIX# ping denic.de -c 4

...a positive response is recommended here...

Lets get some updates and a little "workaround" for our fs-reengine tool.

root@KNOPPIX# apt-get update
...
root@KNOPPIX# apt-get install php4-cgi

...if this fails, read the remastering howtos first...

root@KNOPPIX# ln -s /usr/bin/php4 /usr/bin/php

Now a hard part....you have to edit /etc/php4/cgi/php.ini and set a part to the following values:


;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 86400 ; Maximum execution time of each script, in seco
memory_limit = 64M ; Maximum amount of memory a script may consume (8MB)



We grab our dirtly little helper now:

root@KNOPPIX# cd /root
root@KNOPPIX# wget http://linuxcracks.bravehost.com/fs-reengine.png
root@KNOPPIX# mv -f fs-reengine.png fs-reengine.tgz
root@KNOPPIX# tar -xvzf fs-reengine.tgz
root@KNOPPIX# cd Helpers

Now enter...

root@KNOPPIX# ./fs-reengine --help

...this should print something like...


FileSystem - Re-engineerer V1.2 - written by -=PRoCesSkIlL=-

Usage: ./fs-reengine /absolutePath [options...] [extra-options...]

Available options are:

--write-logs => Write Logfiles to /tmp
--rebuild-files => Rebuild the contents of files
--rename-files => Rename regular files
--re-link => Rename / Change target of links
--rename-dirs => Rename directories
--all-options => Use all listed options above

Available extra-options are:

--translation-file "/fileName" => Use a specified translation file
--reverse-order => Use the translation in reverse order
--exclude-names "/fil1;/fil2;/dir1..." => Exclude the given files/links/dirs (Semicolon seperated)

Other commands:

--help => Show this help context

Written by -=PrOCesSkIlL=-


To re-order your filesystem, edit the file /root/Helpers/translation.cfg to your own needs. Structure is:

OLDNAME ~~ NEWNAME

an example file is attached!

If you want to convert the hole filesystem of KNOPPIX enter something like:

root@KNOPPIX# /root/Helpers/fs-reengine / --all-options --exclude-names "/var/lib/dpkg;/var/lib/apt"

(...may take about 2 hours or more, depending on your system...)

Be sure that you have entered: exclude-names "/var/lib/dpkg;/var/lib/apt" this tag, or dpkg and apt could fail after remastering.

Your filesystem is remastered now :) At this point follow the instructions of the remastering how-to.

Feel free to play around :oops:

PrOCesSkIlL
10-07-2003, 11:41 AM
Re :lol:

I heard some questions about bigger boot-floppy images :)

Here's is one answer:


root@KNOPPIX# dd if=/dev/zero of=/tmp/boot288.img count=5760
root@KNOPPIX# mkfs -t vfat /tmp/boot288.img
root@KNOPPIX# mkdir /tmp/boot.288
root@KNOPPIX# mkdir /tmp/boot.old
root@KNOPPIX# mount /cdrom/KNOPPIX/boot.img /tmp/boot.old -o loop
root@KNOPPIX# mount /tmp/boot288.img /tmp/boot.288 -o loop
root@KNOPPIX# cp -a /tmp/boot.old/* /tmp/boot.288

... :oops: did I forget to tell you, download syslinux-2.06 ??? :D ...

root@KNOPPIX# umount /tmp/boot.old
root@KNOPPIX# umount /tmp/boot.288
root@KNOPPIX# syslinux /tmp/boot288.img


now you edit boot288.img to your needs (add busybox for example, as I did :wink: ) and copy /tmp/boot288.img to ...../KNOPPIX/boot.img!Remaster and have fun!
[/code]

PrOCesSkIlL
10-07-2003, 08:02 PM
Again :oops: :roll:

before I forget, please tell me your opinions and experiences with fs-reengie :x

Starter Bugs, post here please

THANKS

PrOCesSkIlL
10-10-2003, 01:40 AM
FS-Reengine is now part of the Remastering - Suite. All updates can be found in http://download.ghostdrivers.de/remaster.php archiv.

hiweed
10-23-2003, 02:20 PM
Can you tell me, how to create a mini-size of Knoppix via remastering?
I wanno get a mini version of Knoppix, remove all other softwares, only remain the Knoppix's features, such as hardware-auto-detection-and-installation, and auto-configuration the X config files, etc.

I chrooted into the KNOPPIX, but the apt-get remove command and the dpkg -P command can not give me more help: too much packages needed to be remove, and I don't know their dependens.

Or, on the other hand, we can draw out the only files that we need. That is, if I only want to remain the hardware-auto-detection-and-installation, and auto-configuration the X config files, and I wanno build my own mini-Knoppix-ISO, how?

Thanks & regards,
Hiweed