Building Your Own Slackware Distribution

Ubuntu, Debian, Fedora, and SuSE have system for making respins. Slackware's package manager has an easy to use makepkg script, and the installer is wickedly easy to customize to meet your needs. So, let's go through making a Slackware-based distribution. Alright, so we start with the ISO file you download of the Slackware DVD. Open a terminal, and loop mount the ISO, then list the files

# mount -o loop SlackwareDVD.iso /mnt/cdrom -t \
auto && ls /mnt/cdrom

You ought to get something similar to the following:

ANNOUNCE.12_2
BOOTING.TXT
CHANGES_AND_HINTS.TXT
CHECKSUMS.md5
CHECKSUMS.md5.asc
COPYING
COPYING3
COPYRIGHT.TXT
CRYPTO_NOTICE.TXT
ChangeLog.txt
FAQ.TXT
FILELIST.TXT
GPG-KEY
PACKAGES.TXT
README.TXT
README.initrd
README_CRYPT.TXT
README_LVM.TXT
README_RAID.TXT
RELEASE_NOTES
SPEAKUP_DOCS.TXT
SPEAK_INSTALL.TXT
Slackware-HOWTO
UPGRADE.TXT
extra/
isolinux/
kernels/
pasture/
patches/
slackbook/
slackware/
source/
testing/
usb-and-pxe-installers/

Go ahead and make a build directory for yourself, as well as a package creation directory, then move into your build directory. Copy the contents of the DVD into your build directory.

$ mkdir ~/build
$ mkdir ~/packages
$ cd ~/build
$ cp -R /mnt/cdrom/* ~/build

Now comes the "fun" part. If you move into the slackware/ directory you are greeted by an ugly assortment of files and packages. The installer in isolinux/ reads these package directories and files to install packages in the target HDD. For it to do this, each package series' directory contains a few unique files: install, install.end, maketag, maketag.ez, and tagfile. You will not need to touch install or install.end, but do not delete either file. maketag and maketag.ez are identical. tagfile is different from the other two, but is mostly just a list. Every package you add or remove has to be listed in all three of those files. You can look at each one and get a good sense of how to edit them. You can remove an entire series of packages if you wish, but you will need to make an adjustment to the installer if you do. For example, I prefer to use CLI only systems. I always remove X. Move into isolinux/ and look for 'setpkg'. You need to remove any package series from this file if you removed them from slackware/ --ie if you deleted x/ you will want to remove line 32 and line 33 (X and XAP):

"X" "X Window System" on "This series contains X, the window system (or GUI)
used by Linux." \
"XAP" "X Applications" on "The XAP series is a collection of applications for X." \

A quick note that the minimum is:

aaa_base-13.0-i486-2
aaa_elflibs-13.0-i486-2
aaa_terminfo-5.7-noarch-1
bash-3.1.017-i486-2
bin-11.1-i486-1
bzip2-1.0.5-i486-1
coreutils-7.4-i486-1
devs-2.3.1-noarch-25
dhcpcd-3.2.3-i486-1
dialog-1.1_20080819-i486-2
diffutils-2.8.1-i486-3
e2fsprogs-1.41.8-i486-1
etc-13.0-i486-2
findutils-4.4.2-i486-1
gawk-3.1.6-i486-1
glibc-solibs-2.9-i486-3
gnupg-1.4.9-i486-1
grep-2.5.4-i486-1
gzip-1.3.12-i486-1
iputils-s20070202-i486-2
kernel-huge-smp-2.6.29.6_smp-i686-2
kernel-modules-smp-2.6.29.6_smp-i686-2
logrotate-3.7.4-i486-1
module-init-tools-3.6-i486-2
net-tools-1.60-i486-2
network-scripts-13.0-noarch-2
openssh-5.2p1-i486-1
openssl-solibs-0.9.8k-i486-2
pkgtools-13.0-noarch-3
procps-3.2.7-i486-2
sed-4.1.5-i486-1
shadow-4.0.3-i486-18
slackpkg-2.80.2-noarch-3
sysklogd-1.4.1-i486-10
sysvinit-2.86-i486-6
sysvinit-functions-8.53-i486-2
sysvinit-scripts-1.2-noarch-30
tar-1.22-i486-2
udev-141-i486-3
util-linux-ng-2.14.2-i486-1
wget-1.11.4-i486-1
which-2.20-i486-1
xz-4.999.8beta-i486-1

So, if all you are doing is changing the package selection, Slackware can be a good basis. More can be done though. You can change the installer by extracting the initrd.img file in isolinux/

$ cd ~
$ mkdir extracted
$ cd extracted
$ zcat ../build/isolinux/initrd.img | cpio -div

You will find the installation scripts in extracted/usr/lib/setup. I am not going to detail each file, as that is beyond the scope of my post, but if you search for lines that start with --dialog, you will have a good idea of what is going on. Reassembling your initrd is easy:

$ cd ~/extracted
$ find . | cpio -o -H newc | gzip -9fv > ../build/isolinux/initrd.img

Making packages is relatively easy but it changes for each piece of software you wish to add. For the majority you can download the source, extract it, and then cd into the new directory, compile and then run makepkg. Example:

$ wget http://www.gnu.org/some/piece/of/software.tar.gz
$ tar -xzf software.tar.gz
$ cd software/
$ ./configure --prefix=/home/username/packages
$ make && make install
$ cd ~/packages
$ makepkg software.tgz

I would now move software.tgz into the slackware/ folder in ~/build and add it to the maketag files and the tagfile.

To assemble the ISO image:

$ cd ~/build
$ mkisofs -o ~/myDistro.iso -R -J -V "myDistro" \
-hide-rr-moved -v -d -N -no-emul-boot \
-boot-load-size 32 -boot-info-table \
-sort isolinux/iso.sort -b isolinux/isolinux.bin \
-c isolinux/isolinux.boot -A "myDistro" .

Do NOT forget the trailing period after the last "myDistro". Yet, another way is to use some scripts for automation of certain software package's compilation and do things from scratch otherwise. You can still use the Slackware install disc, but you would replace the setup scripts in the initrd with your own scripts (for your own package manager unless you want to use Slackware's). You could also use linux-live scripts to generate a liveCD.


© MMIX - MMXVII absurd.wtf
Licentiam Absurdum