Journalog #3: eudyptula – challenge #1

This is not really a challenge; I’ve done it before. Anyways, now I have the insight about what’s happening behind-the-scenes, and also it’s very easy to recreate the environment and obtain the tools I need to do it.

The first challenge is very simple, as rephrased in my own words:

Write a hello world linux kernel module for your current kernel (supposedly 2.6+), which writes “Hello World!” to your kernel debug log level, upon its initialization.

Tools and programs you’ll need: vim, make, insmod, lsmod, rmmod. And, later on, mutt or sendmail or similar to send your work to little.

Overview

It’s better to start with the Makefile. Add at least two targets to it: all and clean. Refactoring variables (for example, paths) is also nice, if you see yourself repeating the same strings in both targets.

Later, you will create a hello.c file which should be very simple in nature. It should have two functions, one for initialization and one for cleanup for the time the module is unloaded. It will probably also have a couple of standard macros for modules.

Testing your work should also be very straightforward: (i) make, (ii) insmod hello.ko, (iii) rmmod hello. And see your log messages with dmesg | tail.

After everything is done, you can use mutt to send your sources to little, either interactively (hint: use ‘a’ to add attachments) or with a single command:

mutt -s "<id> challenge 1" -a hello.c -a Makefile little@eudyptula-challenge.org < <message>

where <message> is a file corresponding to the body or your email.

 

Journalog #3: eudyptula – challenge #1

Journalog #1: eudyptula

I have no idea if it’s still alive, but I want to participate in the eudyptula challenge again. Last time I did it was probably a little less than 2 years ago, and I was still playing with with Arch at the time.

I am using OS X this month, which screws the whole thing from the beginning. I have to use a virtual machine then. VMWare Fusion is already installed in my system, so whatever. I have to grab a Linux box now. Heck…something very lightweight, no-frills. First thing that comes to mind: CRUX. Yeah, it’s you baby.

ISO file is ~400MB in size. I said lightweight, not small. Installation process is cool.

Screen Shot 2016-07-12 at 9.08.22 PM5 min or so and everything is properly set up. Bootloader, fstab…nothing fancy. CRUX uses LILO (I forgot about that!), but this is a simulated BIOS system anyway (in VMWare), so TO /dev/null, mister GRUB2! And you then reach a few seconds of enlightenment, away from the 21st century. systemd? Xorg? What’s that? OK, there are some btrfs packages laying around. Still!! What? The folks at without-systemd.org (no hyperlink. Go figure.) have a point.

Serendipity: it turns out some people really take this seriously.

All set, rebooting. Let’s work!! I am going to do everything as root, I don’t care. Screw. It’s 2016, virtual machines do have snapshots, bae.

I need to send one plain text (non-HTML) email to start the challenge. That’s all. So I need to grab mutt. I don’t care about sendmail, mail, fetchmail, whatever; so I will need a TUI to do basic stuff. Yah, I know, mutt will use sendmail behind-the-scenes, whatever.

This leads me to…package management. How to install mutt? Heck, no apt-get, yum, pacman. I chose CRUX, now I pay for that, right?? Not really. CRUX has a very basic ports/package management system, I’d compare it to OpenBSD. Hopefully, mutt is going to be present there. It is. So…1 or 2 min reading its handbook and it turns out all I need is

ports -u && prt-get install mutt

Cool. Now here comes the PITA stuff. I have to get a very basic ~/.muttrc. Well, it would be a PITA if we were in the 2000s, but no one cares about man pages anymore(1). Stack Overflow and hippie blogs are the way to go. So a quick Googling here and there leads me to a basic IMAP + SMTP mutt setup with my email provider.

…er, no. Grrrrrr. Mutt does not recognize smtp. Whaaat?! It turns out the default mutt from CRUX is not compiled with smtp enabled. You gotta be kidding me. Okay, let’s compile it from source with the correct flags. I would usually probably take 20+ minutes to figure this out, but I think after all these years playing with linux distros I learned something. It took me less than 3 minutes to go to /usr/ports/opt/mutt and edit the Pkgfile over there, then run pkgmk and finally pkgadd -u to install it. I didn’t have any prior knowledge of this stuff, it was mostly a matter of Cmd-F’ing the handbook webpage and introspecting (=a fancy word for trial-and-error) the command line.

OK, mutt is now installed. WITH SUPPORT FOR EVERYTHING I NEED, damn it. Now…let’s log in. Cool, it works. Actually…my email provider (Google, yaaay) tells me I am logging in from an insecure app, and thus it blocks my login attempt. Aaaaaaaa….ok, I like this feature! But I temporarily disable it (note to self: re-enable it later, you security freak creature!).

Test #1: hello world email sent back to myself. OK, my phone rings. In fact, twice. Leave me alone, I am migrating my apps, I have more than one email client installed on it. You never did that?! Well…everything’s working, so I just send an email to little@eudyptyla.

And this is supposed to be a happy ending. For today. Except that…maybe this challenge does not even exist anymore. I hope it does, I really want to do it. Time is key.

Screen Shot 2016-07-12 at 9.35.04 PM.png

Bye.

(1) man anymore: this is my first footnote. For more information, see anymore(8).

Journalog #1: eudyptula