As i previously discussed i have swapped to Void Linux after having been a long time Arch Linux user. I have however tweaked Void from the stock setup. Hopefully some of these tweaks will be helpful for other users of Void and other distros. The first thing i do upon a fresh install is to get the WiFi working (i install Void from the USB with local install for quickness)

sudo su -c 'echo "wpa_passphrase SSID Password >> /etc/wpa_supplicant/wpa_supplicant.conf'

replace SSID with your WiFi name, i tend to put this in quotation marks as a few of my SSID’s have non standard characters e.g. &, and without quotations i have to write it as \&. Also replace Password with your WiFi password. You can do this for every SSID you connect to and dhcpcd will auto connect to the strongest WiFi network. Then fully update the system (might have to run this command multiple times to fully update the system)

xbps-install -Suv

Once the system is updated, reboot to make sure your running the latest applications and kernels. Then i install my system as a single command

xbps-install vim emacs-gtk2 alsa-utils apulse xorg-minimal xorg-fonts xf86-input-libinput mesa-intel-dri libEGL xfontsel terminus-font font-sourcecodepro bspwm sxhkd st dmenu lemonbar firefox void-repo-nonfree void-repo-multilib void-repo-multilib-nonfree xtools make gcc git python python-pip python-virtualenv ruby ruby-devel

That’s pretty much my whole system, however once the additional void repo’s are installed, ill then add a couple of non-free applications

xbps-install -Su Spotify openjdk-jre steam mesa-intel-dri-32bit

Those two lines will install everything i need for a running system. No email manager, no file manager, no office suite. Although emacs is a new addition to my workflow, and it will hopefully replace a lot of what i used to do with ncurses applications.

Configuring setup

Firstly i setup my Xorg to use the British keyboard layout and change the touchpad and mouse options. If you are an Arch user, not that void uses /usr/share/X11 instead of /etc/X11/

vim /usr/share/X11/xorg.conf.d/40-libinput.conf

here is an example of my layout

# Match on all types of devices but joysticks
Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "AccelProfile" "flat"
EndSection

Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "XkbLayout" "gb"
EndSection

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "AccelProfile" "flat"
        Option "Tapping" "on"
        Option "NaturalScrolling" "on"
EndSection

Next is to setup my .xinitrc and auto login.

cp -r /etc/X11/xinit/xinitrc ~/.xinitrc

then edit the xinitrc file, replacing the bottom section

twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login

with

exec bspwm

then i download my config folders for bspwm and sxhkd from github and place them in my ~/.config folder. Then test my Xorg install by running startx.

If my desktop is all working fine, i then setup autologin and auto-start x following the guide on the Void wiki

Then reboot the computer, and i should automatically get dumped into bspwm. Start a new terminal by running Super+Return (Windows key+Return), and then go about tweaking the system.

Tweaking

First i start by reducing the number of services running to the bare minimum, so check the running services and remove the unnecessary ones.

ls /var/service

If your using a laptop then make sure acpid is enabled, and if you’re using a desktop system the you can remove acpid. I then remove all agetty sessions on terminal from 3-6

rm -Rf /var/service/agetty-tty{3,4,5,6}

Because my system has a fixed disk setup, with no dual boot i can remove UUID from my system from removing the uuidd service to editing my fstab.

vim /etc/fstab

my default fstab looks like this

UUID=e91029e0-0202-438b-a78c-31592e515054 / f2fs defaults 0 0
UUID=8bce70f0-056c-4708-8c84-2261e80375c0 none swap sw 0 0
UUID=3ec990d2-50c0-4868-bdf3-c3e9b49ff133 /boot ext2 defaults 0 2
UUID=ED2C-8F4D /boot/efi vfat defaults 0 2
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0

and I’ve changed it to look like this

/dev/mmcblk0p1          /boot           ext2    defaults        0 0
/dev/mmcblk0p2          /boot/efi       vfat    defaults        0 0
/dev/mmcblk0p3          /               f2fs    defaults        0 0
/dev/mmcblk0p4          none            swap    sw              0 0
tmpfs                   /tmp            tmpfs   defaults,nosuid,nodev    0 0

my system uses /dev/mmcblk0 as the default drive (eMMC drive), yours will most likely be /dev/sda

then remove the uuidd service along with sshd if you don’t require ssh access

rm -Rf /var/service/{sshd,uuidd}

Finally i edit my /etc/runit/core-services/03-filesystems.sh

vim /etc/runit/core-services/03-filesystems.sh

and comment out the sections i don’t require. A copy of my 03-filesystems file is on my github

Then i reboot. If I’ve done everything correctly my system should boot up correctly and drop me into bspwm. Now for the fun part!

Custom Kernel

Now that the system has been tweaked we can start tweaking the kernel. The easiest way I’ve found to do this is use the traditional kernel compilation method. I start by creating a folder to work in

mkdir ~/.kernel/;cd ~/.kernel

Then download the latest stable kernel, currently its version 4.13.9

curl -O https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.13.9.tar.xz
tar -xvf linux-4.13.9.tar.xz
cd linux-4.13.9

I’ve found using localmodconfig to generate a base config the best way to get started. This generates a kernel config based on the currently running kernel modules. Plug in every device you might need or want to use (game controllers, USB mice/keyboards), sdcard adapters etc. Then run this command

make localmodconfig

this will generate a basic config file you can tweak to your liking. We can then edit our config using nconfig, which i find better than the standard menuconfig. For this we need to install some applications

xbps-install ncurses-devel bc perl

then we can run

make nconfig

Go through and tweak your kernel to your liking and requirements. For my minimal config, i have disabled ‘Enable loadable module support’ and i have built all modules into the kernel. Make sure your File system is enabled as a built in module under File Systems ---> I then set my required kernel drivers to be built into the kernel, Device Drivers ---> Generic Driver Options ---> Include in-kernel firmware blobs in kernel binary

then add your required blobs, for me i have to enable the following

iwlwifi-3168-22.ucode iwlwifi-3168-27.ucode i915/bxt_dmc_ver1_07.bin

Set your firmware blobs root directory to

/lib/firmware

Then go to Processor type and features —> and enable the following options `

+EFI runtime service support +EFI stub support +EFI mixed-mode support +Built-in kernel command line `

for my system i use the following command line config

root=/dev/mmcblk0p3 rootfstype=f2fs quiet

This should allow our system to boot the kernel direct without the need for grub, and most importantly a ramdisk. We just boot the kernel straight up and everything we need is loaded automatically. This should be everything we need so we can save and quit by pressing F9. An example of my config in on my github account under the dotfiles/kernel repo.

Then we can build our kernel using make

make

s will take a while, but subsequent recompiles will take less time. Once this is complete, we can replace our grub.efiwith our compiled kernel. On my system, the Acer bios only boots specific efi files hard-coded into the bios, so that /boot/efi/EFI/void_grub/grubx64.efi won’t boot. On my system i use /boot/efi/EFI/Linux/BOOTX64.efifile. However with your first kernel compile, it might not be the best idea to replace our grub just yet. So at first we’ll just copy our compiled bzImage to /boot and have grub generate a new config.

cp -v arch/x86/boot/bzImage /boot/vmlinuz-linux-4.13.9
grub-mkconfig -o /boot/grub/grub.cfg

Reboot and test our new kernel. On the grub boot loader, select our newly created kernel. If everything was done correctly we should be put into our bswm desktop. Test the system by running your applications and hardware. Make sure controllers, device and applications work properly. If they do, we can remove grub and just boot straight to our kernel.

cp -v ~/.kernel/linux-4.13.9/arch/x86/boot/bzImage /boot/efi/EFI/Linux/BOOTX64.efi

but for most people you need to use this instead

cp -v ~/.kernel/linux-4.13.9/arch/x86/boot/bzImage /boot/efi/EFI/void_grub/grubx64.efi

That should be our new minimal Void system with a lightweight kernel and minimal running services.

Additional Notes

While i find it easier to just replace the grub bootlaoder with our new kernel, it is also possible to add our kernel image to our system alongside the grub boot. To do this copy the kernel alongside our grub efi

mkdir /boot/efi/EFI/void/
cp -v ~/.kernel/linux-4.13.9/arch/x86/boot/bzImage /boot/efi/EFI/void/kernel.efi

Then use efibootmgr to add our efi file to the UEFI list

efibootmgr -c -d /dev/sda -p 2 -L "Void Kernel" -l "\efi\void\kernel.efi"

make sure tat the UEFI loader boots to the void kernel first

efibootmgr

check the boot order and change if needed

efibootmgr -o 0001,0002,0003...

Then reboot, and you should have a grubless system that boots insanely quick.

You can then delve deeper into the kernel config and change things such as the I/O scheduler

Enable the block layer —> IO Schedulers —> Default I/O scheduler

I won’t detail all the tweaks i’m constantly tweaking this. However you can view my current config on my github

I provide the config as an example of my current kernel. This will most not likely work for you unless you have similar hardware AND setup, ie drive setup, as the boot parameters are hardcoded to /dev/mmcblk0p3 and f2fs.

Continue to part 2