LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By Anonymo at 2006-02-23 14:01
This guide was originally written by LQ member Ninja Cow. He has kindly given his permission for us to post it up here.

Welcome to Cooking Up Some Slack. (CUSS)
Go ahead and CUSS. Your mother will never know. :)

CUSS Index

-Introduction: "What is CUSS?", "Advanced or Newbie", "What You Will Need".
-Modifying Scripts, Part I: initrd.img
-Modifying Scripts, Part II: tagfiles
-Modifying Scripts, Part III: setpkg
-Modifying Scripts, Part IV: message.txt
-Editing Files For Fun: Revisiting initrd.img
-Obtaining And Adding Software: Making Your Distro Unique
-ISO Creation: Breathe Life Into Your Distribution
-Contact: Drop me a line.



What is CUSS?

Cooking Up Some Slack (or CUSS) is a website that explains how to make your own Slackware-based distribution. Have you ever wanted to make your own custom Slackware distro? Want to add specific programs to Slackware? Remove programs? We will teach you how, step by step.

Advanced or Newbie?

I will assume you have had previous experience with Slackware Linux. If you're not very familiar with Slackware I suggest you read the Slackware Essentials book. Take a day or two and read it once or twice.

What You Will Need

1). You will need a working Slackware setup. Editing the configuration files will come easier if you're already running Slackware. Also, creating a new partition for testing your new distro is recommended (but not necessarily needed.)

2). If you don't have Slackware already installed, you can always use something like UltraISO for Windows to create the ISO for your distribution.

3). The latest Slackware distro, Slackware 10.0 or current. Find a Slackware mirror and download all of the files in /slackware or /Slackware-10.0. Please note that you do not need /source, /extra, /testing, or /zipslack.

Modifying Scripts, Part I: initrd.img

If you want to make your own, custom Slack distro, you will need to modify a few scripts. Well, depending on what you want, you might be editing several scripts. In any case, we will start out with modifying the initrd.img you download in /slackware or /slackware-10.0. Go ahead and look in /slackware/isolinux. There are several files here worth looking over, but for now we're only concerned with the initrd.img.

Copy the initrd to another directory, but add a "gz" extension.

Code:
cp initrd.img initrd.img.gz
cp initrd.img.gz /your/directory/
Now, cd into the directory where you put your extra initrd. Gunzip the initrd like so:

Code:
gunzip initird.img.gz
Now you should have your initrd.img back again, ready to mount. In order for us to edit any files within initrd, we must mount it like so:

Code:
mount -o loop initrd.img /mnt/your-mount-point
Again, we will change our directory:

Code:
cd /mnt/your-mount-point
...You can find your scripts in:

Code:
/mnt/your-mount-point/usr/lib/setup
Note: You know, pico is an easy text editor suitable for everyone. Try editing one of your install scripts using pico.

Code:
pico SeTPKG
Easy stuff.

For now, you will need to configure these files on your own. In the future, CUSS will add a section for these files. Most of the scripts won't "need" to be edited anyway. Editing these scripts are optional.

Modifying Scripts, Part II: tagfiles

Moving on to what I think is the "fun" part of all this: Editing tagfiles. This allows you to add your own software to your distro.

Look inside of your /slackware (or /slackware-10.0) folders. See another "slackware" directory? This directory holds all of the software, documentation, and kernel. Vital? Yes. Everything in here is the backbone of your distro. You will find yourself in this directory often, so familiarize yourself with the directories and software.

Take a gander at the directory /a and find its tagfile. Please, please, PLEASE read the notes at the very beginning. You'll learn how to control the software you install. For example, it will teach you how to make software optional or required.

After you read the notes, let's look at the first four files that are installed during the Slackware installation process.

Code:
aaa_base: ADD
aaa_elflibs: ADD
acpid: REC
apmd: REC
You should know that the first two files are required during the installation process, while the last two are recommended.

Okay, so you know the basics of a tagfile. How will this benefit you? Well, now you can actually add software to your distro!

You can choose any directory (/a, /ap, /x, etc.) to place your software in. Furthermore, you can also make your own directories. More on that later.

Let's say you want to add the best damn browser ever dreamed up to your distro. Straight from LinuxPackages.net, we will download mozillafirefox-1.0-i686-1jim.

After you move this software to the desired directory, we will need to edit the tagfile in said directory. Remember how I mentioned pico earlier? Let's use it.

Code:
pico tagfile
Now insert something like this in your tagfile:

Code:
mozillafirefox: REC
or

Code:
mozillafirefox: ADD
or

Code:
mozillafirefox: OPT
Using the first part of the filename in your tagfile is needed. Tinker around with the tagfile options a bit. You will be customizing your own distro in no time at all. Later on in this guide I will explain exactly how to choose, find, or compile your own software for use in your distro. For now, let's move on to the setpkg script...

Modifying Scripts, Part III: setpkg

Remember when I told you earlier that there are several scripts in /slackware/isolinux that can be edited? Well, this time we're going to be editing a file called "setpkg". This file will present the user the option to select different directories containing software as well as letting you add your own directories. Change directory to /slackware/isoliux and open up setpkg.

Code:
pico setpkg
Find the first four directories along with their descriptions. It should look like this:

"A" "Base Linux system" on "The A (base) series contains the kernel and main system utilities." \
"AP" "Various Applications that do not need X" on "The AP series is a collection of useful applications." \
"D" "Program Development (C, C++, Lisp, Perl, etc.)" on "The D series contains compilers, debuggers, and other programming tools." \
"E" "GNU Emacs" on "The E series contains the GNU Emacs advanced real-time display editor." \

To be honest, this isn't too hard to understand setpkg's structure. All you do is add your own directory to the /slackware/slackware directory then edit setpkg to correspond with your newly created directory.

An example would be something like this:

I created /z in /slackware/slackware and now I need to edit setpkg to reflect this. /z contains my extra packages for Slackware.

Adding this line to setpkg will allow users to select/deselect this directory if they desire.

"Z" "Extra Packages" on "The Z series contains extra packages for my custom Slackware distribution. " \

Remember, you can also remove lines and directories to free up space on your distro. You're not limited to just adding software -- you can remove it as well.

Modifying Scripts, Part IV: message.txt

This section is fairly small since you're only creating a welcome message. Once again, if you look in /slackware/isolinux, you will find yet another file we can configure. Find "message.txt" and open it with pico.

Of course, you can edit this file to whatever you want. You may wish to add your distro's name. "Bob's Uber Cool Slackware Distro". Okay, that name may suck, but at least you know which file to edit when adding a welcome message!

Editing Files For Fun: Revisiting initrd.img

Yes, we're revisiting the initrd.img once again. If you have yet to read the first section, "Modifying Scripts, Part I (initrd.img)", do so now. It contains the information you will need to actually edit the files within the initrd.

Remember, you do not *need* to edit these files. You can create a working distro without touching any file in here. But hey, some folks may prefer to edit every file possible to further customize their distro.

Let's take a look at the "setup" script. This file contains the Slackware Installer's setup functions. Change directory to /mnt/yourmountpoint/usr/lib/setup. Pico time.

You know the drill:

Code:
pico setup
Does anything look familiar? It should, since this is what you see when you install Slackware. Well... kind of. You don't see the actual functions or code. Anything can be edited in this file, so play around a bit.

Here's what I edited first. Find this section and let's edit some things.

Code:
dialog --title "Slackware Linux Setup (version 10.0)" \
--menu \
"Welcome to Slackware Linux Setup.\n\
Select an option below using the UP/DOWN keys and SPACE or ENTER.\n\
Alternate keys may also be used: '+', '-', and TAB." 18 72 9 \
"HELP" "Read the Slackware Setup HELP file" \
"KEYMAP" "Remap your keyboard if you're not using a US one" \
"ADDSWAP" "Set up your swap partition(s)" \
"TARGET" "Set up your target partitions" \
"SOURCE" "Select source media" \
"SELECT" "Select categories of software to install" \
"INSTALL" "Install selected software" \
"CONFIGURE" "Reconfigure your Linux system" \
"EXIT" "Exit Slackware Linux Setup" 2> $TMP/hdset
You can input your own text for just about everything here. Adding your distro's name within the installer might be a good idea...

For example:

We change this:

Code:
dialog --title "Slackware Linux Setup (version 10.0)" \
and this:

Code:
"Welcome to Slackware Linux Setup.\n\
to...

This:

Code:
--title "Bob's Good Ole Setup" \
and this:

Code:
Welcome to Bob's Linux Setup.\n\
Very simple, yes. Meaningful? Not really. Fun? Yes, as you can edit the file anyway you like. This goes for most of the files here -- try opening SeTpasswd and editing the message in the file. The best way to learn here is looking over each file very carefully. I could continue on with each file, but I already sound repetitive enough.

Word of warning: If you want to edit the actual code of each file, make sure you know what you're doing. Honestly, there isn't a reason to edit the structure of the Slackware Installer since it's perfect (in my humble opinion.)

After editing the files in initrd.img, you will need to move or copy the file back to /slackware/isolinux.

Code:
mv initrd.img /path/to/slackware/isolinux
or

Code:
cp initrd.img /path/to/slackware/isolinux
Now that you're done editing your initrd, let's move on to adding software to your custom distro.

Obtaining And Adding Software: Making Your Distro Unique

Earlier when we covered tagfiles I explained how to add software. In this section I will show you how you can obtain slackpacks. Slackpacks are already-built software packages, much like RPM or DEB packages without the dependency hell. I'll also explain how you can create your own slackpacks by compiling software. Using a program called "checkinstall" will make your Slack-life a lot easier.

The easiest way to obtain software for your custom Slackware distro is using a site called Linux Packages. Linux Packages has a wealth of slackpacks, submitted by several members of the Slackware community.

Just a word of advice: You should always get permission before you snatch up slackpacks. Those packages were compiled by someone else on someone else's time. E-mailing LinuxPackages.net and asking for their approval would indeed be a wise choice.

You could also offer to place their address in your welcome message. (See Modifying Scripts, Part IV (message.txt) Something like "Extra packages are provided by www.LinuxPackages.net" wouldn't hurt!

You may prefer to compile your own packages. While it's definitely more time consuming compiling your own packages rather than adding pre-built packages, in the end you will not need to give credit to any person except Pat. You will need checkinstall to create your slackpacks after you compile your software, so go ahead and download checkinstall from LinuxPackages.net.

Keep in mind that you should also add a description of the software in a txt file named AFTER said software. For example, if you look in /slackware/slackware/xap, you will notice that each file has a txt with the same name. Open up Mozilla's description.

Code:
mozilla: mozilla (an open-source web browser)
mozilla:
mozilla: The Mozilla web browser. Mozilla is a cousin to Netscape
mozilla: Communicator that is being developed by the Free Software Community
mozilla: with the cooperation and support of Netscape. Mozilla uses a next-
mozilla: generation browser engine known as Gecko.
mozilla:
mozilla:
mozilla:
mozilla:
mozilla:
You should always use this format when adding new software. Simplified, it comes down to this after configuring your tagfile(s):

1). Add the software to the specific directory.
2). Add a a txt file (a description) of the software in the same directory of the software you just added.

Truly simple, yes?

ISO Creation: Breathe Life Into Your Distribution

We've configured our scripts, added software, and now we're ready to make our Slackware ISO. Probably the easiest step in the whole process, you will create the ISO at the command line.

Enter your /slackware directory. (You should see the first five folders: bootdisks, isolinux, kernels, rootdisks, and slackware.)

At the command line, use this command to create your ISO:

Code:
mkisofs -o /tmp/slackware.iso -R -J -V "Slackware Install" -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 "My Custom Slackware CD" .
Note: You must include the period at the very end of that command. Sometimes folks think the period isn't part of the actual command, but it is. Don't forget it!

Your brand spankin' new Slackware ISO can be located in /tmp. The only thing left to do is burn it. Good luck. :)


  



All times are GMT -5. The time now is 12:30 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration