The Eudyptula Challenge β Part #2
β’ 604 words β’ 3 min β’ updated
Last post.
Hello there. Little is back, and so is me. I’m returning to the eudyptula challenge, restarting from task #06. By the way, I just sent it to Little a few minutes before writing this post β I hope it is right…
Okay, so after 3 months I forgot a few things. The Linux Kernel is tricky but it is very well designed. Let’s document a few resources here β they might be useful in the future:
Note: this is not in a tutorial style; it is more in a reference style.
Coding your module #
-
This vim plug-in by Vivien Didelot β the same author of i3blocks β is very nice to force the usage of the linux kernel coding style. I added it to my pathogen setup.
-
Also, don’t forget to double check that your C code is valid in terms of formatting and style! Use:
shellscripts/checkpatch.pl -f code.c -
checkpatch.plalso contains a--fixcommand. But you should try to manually fix errors yourself first. And also note that this--fixthing is still experimental. -
There is also a
scripts/cleanfileprogram to fix any messes about line endings (\r\nvs\nfor example) and similars. -
The best source of documentation I’m using right now is
ack+find+tmux. I tried to quickly set up NetBeans and Qtcreator just for documentation purposes β not for Linux coding! β but they do not work out of the box. I believe it is better to stick to a ‘manually search for documentation’ approach. IDEs don’t scale well for this task β at least for kernel and systems programming; I wouldn’t say the same about Java or other very IDE-friendly programming languages.
Testing your module #
make,make,make!makewill create a*.komodule, which you will load withinsmod *.ko.- Alternatively, you can
make modules_installyour module, which will be put at/lib/modules//extra. Then you can load it withmodprobe *.ko. - Always remember unloading your module (
rmmod *.ko) before reloading it. It is a good practice: clean before beginning again! - To check debug messages, use either
dmesgorjournalctl -xnβ supposing you’re using a systemd-based daemon for your system (it is the case of Arch right now).
Building your kernel #
Use:
make localmodconfig. You don’t want to create a.configfile from scratch!make nconfigto tweak the settings of your.configfile.maketo build the kernelmake modulesto build the kernel modulessudo make modules_installwill install your modules. Very important to boot into it later on!sudo make install- It is important to create a boot entry for your kernel. syslinux users will
probably find this task trivial (it is just a matter of mimicking the
configuration from your current kernel on
/boot/syslinux/syslinux.cfg); grub users should edit/etc/grub.d/40_customand create amenuentrybased on an already existing entry on/boot/grub/grub.cfg. After that, update your config file withsudo grub-mkconfig -o /boot/grub/grub.cfg - You should also pay attention if your linux distribution uses an initramdisk.
Arch does, so I created another config file on
/etc/mkinitcpio.d/just for the eudyptula kernel (and then amkinitcpio -p linux-eudyptula). - Use
uname -ato check your new kernel after booting into it.
Sending non-HTML mail #
- Mutt is still the best option for me for this.
- Use
mto create a new e-mail. - Use
ato add attachments. - Use
yto send your e-mail. - Now, if you need to create a
.muttrcfile from scratch…I’d recommend you to (for example) to use mine as an inspiration.
And let’s see if this thing will keep going on. See you later :) β