How to create modules for Slax 6


Slax modules may be created any way you like, as long as you are the only one who use them. If you wish to share your modules with other users, you have to follow several rules described in this document.

Slax module is a compressed squashfs filesystem with .lzm extension. The module is created by a mksquashfs utility and may be extracted (unpacked) using unsquashfs.

Both these tools must be patched (modified) to support LZMA compression algorithm. These utilities are already included in Slax.
Every Slax module contains all files and directories with full path.
For example, a module with bash (the binary and some man pages) would look like this:


/bin/ /bin/bash/usr/ /usr/man/ /usr/man/man1/ /usr/man/man1/bash.1

1) All the directories in your module have to be accessible for a regular user. Reset all directory permissions to 755 (drwxr-xr-x), unless there is a sensible reason to use different permissions for a particular directory.

find ./ -type d | xargs chmod -v 755;

2) Keep the size of your module small.

Uncompress all archives which may be safely left uncompressed (for example man pages, because LZMA will compress them far better), delete all files which are not needed to run the software (for example unneeded documentation, unused sounds, png/jpg images, unneeded translations from /usr/share/locale) and strip all unneeded symbols from binaries.

find . | grep .gz | xargs gunzip find . | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded

3) Provide the build script, which is used to create the module. The build script must handle the whole module creation, including download of the sources from the web (for example by wget). Build script allows others to see how to create your module, where to fetch the sources; moreover it makes it easy to take over your module in the case you stop updating it. Copy the build script to your module to:

/usr/src/slaxbuilds/your_module_name.build

4) When you compile the software, make sure to use correct cflags and parameters. The following is recommended in order to use i486 instructions (which provides the best backward compatibility), but tune the performance of the code as if the target architecture was i686:


CFLAGS="-O3 -march=i486 -mtune=i686" ./configure --prefix=/usr --build=i486-Slackware-linux

5) Never include any existing files from Slax in your module, even if you modified them. In other words, your module should never ‘overwrite’ any existing file in Slax. It can make your module incompatible with newer Slax versions and it can cause problems for modules from other users. If you really have to overwrite a file in Slax, (for example in order to append a newpath to /etc/ld.so.conf), write a startup script which will modify (update) the particular file in Slax, instead of overwriting it by your module.


Example startup script to delete one line from ld.so.conf and add a new one at the end:

#!/bin/bash sed -i -r ';/usr/local/lib;d' /etc/ld.so.conf echo '/opt/kde/lib' >> /etc/ld.so.conf

Source: Slax Blog

1 comments:

nectarineblue said...

Kewlness my fellow slackerZ
The mob ruleZ.... I've got the whole
slackware 12 in Lzm format now...
took forever to get er done.. but itz
done..

Delicious Digg Technorati Reddit Furl BlinkList Yahoo! NewsVine Netscape Google Live Bookmark Netvouz Squidoo StumbleUpon Magnolia.png