For the 3rd task (this task) in The Eudyptula Challenge, we continue our work from the last challenge, compiling the absolute latest Linux Kernel from the source code. This time we focus on modifying the Makefiles and
.config files that help us compile the kernel.
Before we begin, if you wish to work on The Eudyptula Challenge yourself before you read my notes (recommended), you can use my git repository, which has all 20 tasks and the code I used to complete each one.
Now that you have your custom kernel up and running, it's time to modify it!
The tasks for this round is:
- take the kernel git tree from Task 02 and modify the Makefile to and modify the EXTRAVERSION field. Do this in a way that the running kernel (after modifying the Makefile, rebuilding, and rebooting) has the characters "-eudyptula" in the version string.
- show proof of booting this kernel. Extra cookies for you by providing creative examples, especially if done in interpretive dance at your local pub.
- Send a patch that shows the Makefile modified. Do this in a manner that would be acceptable for merging in the kernel source tree. (Hint, read the file Documentation/SubmittingPatches and follow the steps there.)
Depending on how literally we interpret "modifying the Makefile", there are multiple ways we can accomplish this challenge. One of which we briefly talked about in the last challenge was to override variables in our
make command when compiling the kernel.
Just like with a lot of userspace projects, the Linux kernel uses GNU make to compile the various files into its final form. This means we can use make's ability to pass variable assignments as command line arguments.
From Chapter 6 of make's documentation, if we use a command line argument to set the
EXTRAVERSION variable, then all other assignments to
EXTRAVERSION within the Makefile will be ignored. For example, we can override
EXTRAVERSION by using a
make command like this:
$ make -j `getconf _NPROCESSORS_ONLN` EXTRAVERSION=-eudyptula
This will force
make to set
-eudyptula and ignore the value set in the kernel's Makefile, accomplishing our task for The Little Penguin.
Modify the Makefile
Our second option, if you want to take "modifying the Makefile" literally, is to do exactly that.
Simply open the kernel's Makefile, located in the root directory in the source code we copied from Linus in the last challenge, with your favorite text editor. The first five lines will have
EXTRAVERSION somewhere in it. Change the value to
-eudyptula and save.
-EXTRAVERSION = -rc1 +EXTRAVERSION = -eudyptula
Now that the kernel's Makefile will append
-eudyptula to the kernel's version string by default, we can simplify our
make command to build the kernel into:
$ make -j `getconf _NPROCESSORS_ONLN`