Tutorials Lightweight system
Compile it yourself for performance Mats Tage Axelsson guides you through creating an image that is the smallest fully fledged system possible – and then expands on it. re you worried that most of your software sucks resources out of your system like a wet sponge? Then you’ll be interested in Suckless Tools (https://tools.suckless.org). All the tools in this series have been designed to be as small as possible, even when some functionality is sacrificed. But when would you use them? Well, you can usually live with a regular system, but when you have a small system or a background process such as mining, you might want to use Suckless Tools to have another machine available for commands. In this tutorial, we’ll learn how to compile and patch the most common parts of the Suckless Tools. You will be able to transition over to a smaller system without killing your current system. This way you can get used to the new ways of running your computer.
our expert Mats Tage Axelsson shows you what even he can do using Linux to make the world a better place.
Get set for sucking Suckless Tools are based on Plan 9, a system developed by Bell Labs that implements most of the *Nix based systems in a more networkcentred way.
You need to have the essential development tools for compiling C: gcc is the most common choice. However, the project considers that a bloated piece of software too, so don’t ask them for help with gcc. We’ll use gcc though, since it will probably already be installed on your system. Otherwise, your best bet for getting the source is to set up a directory where you clone each package into its own directory. Then add a patches directory and you are good to go. If you want to publish your unique masterpieces, create forks with git: $ git branch MyConfig
$ git checkout MyConfig
After you have run these two commands, you can add your changes to your own git branch and then publish to GitHub or any git server. You can also send any brilliant changes to the Suckless Tools by using git’s send-email functionality. In general, all you need is to have a great editor for the command line and the particular development libraries. Finding the libraries you need may be a challenge because the developers assume you know this or can find it easily. It is easy! With that said, these tools need very little, since that’s the basic idea of the whole project. To make sure you know which libraries you need, open config.mk. In that file, you have all statements that include libraries. The file also sets all the flags for the compiler process. In most package managers you also have buildessential options, for example under Ubuntu: $ sudo apt install build-essential
Due to the minimalist ideal of the developer community, there are very few libraries needed. For each package, there are just a few needed. We will point out what’s required throughout this tutorial.
Libraries that suck The exact libraries depend on the package you are configuring. Suckless Tools needs only libx11-dev, the header files to get access to your X11 environment. You need to check and possibly change two files before you start compiling. The first is config.mk, which sets the paths, libraries and flags for your compiler. The second file is config.h, which is where you set features to be on or off. This is also usually patched – more on that later. $ sudo make clean install
If you leave all configurations as standard, the file will end up in /usr/local/bin/. The new binary is also set to the default one. Try it with the which command. You may have created a mess at this point – don’t worry, you can remove it with the uninstall option. $ sudo make uninstall
When you have run the patch command, Vimdiff is a great alternative to check what has been rejected so you can correct it yourself.
76 LXF254 September 2019
This way you can experiment without destroying your existing install. All packages can be installed this way, so you can try it out before committing it to your new system. To remove it, you can just erase the executable – though we recommended using the
You can subscribe to this magazine @ www.myfavouritemagazines.co.uk