Outils pour utilisateurs

Outils du site


issue152:certifie_linux

Ceci est une ancienne révision du document !


Before we start , here is a new link to test yourself: http://www.penguintutor.com/quiz/index.php

Where we are: https://www.lpi.org/our-certifications/exam-201-objectives (Topic 201: The kernel). In your LPIC study guide, mine is the second edition, this will be chapter 3 (pages 94 – 132). If you are using the free book above, it’s chapter 1 (page 15-44).

Welcome back learners, and a nod to those “just interested”.

Some distributions make it easier than others to compile a kernel, some not so much. What you need to know is the gist of the thing, meaning almost a generalization. LPIC does not cover a specific distribution, but it wants you to have the tools and knowledge, so you can read the documentation on “distro x” and be able to follow the steps. It is like following a recipe, you are free to change it so you end up with a chocolate cake instead of a vanilla cake, for instance. So let’s discuss the recipe. Now, as with any recipe, if you do not have the tools, you probably are going to fail. You will be installing a lot of tools, source, documentation and libraries, so make sure you have enough disk space free. If you have a system you have built on before, it is a good idea to clean up before you build your custom kernel. Keeping with our cake analogy, ‘make clean’, ‘make distclean’ and ‘make mrproper’ are the commands you can run to clean your workspace.

Configuring a kernel takes a lot of reading. Do not attempt if you are not prepared to read a lot of recipes and directions. Information is everywhere, so you need to pay attention.

make menuconfig (this requires ncurses) or:

make xconfig (QT)

or:

make gconfig (GTK)

Tip: copy your .config-files to a USB thumbdrive before you change anything. This is especially true when you are working with a kernel that is the same version as your current one. Mistakes will be made and accidents do happen (If you do not have a copy VM!).

‘Excluded’ is the most confusing. Excluded means it is not loaded in this kernel. This does not mean you cannot load it via a module after the fact. So be aware of this when you fire up: make menuconfig. The rest are self explanatory.

Tip: When you practise this, do it in a VM you already have a copy of.

When you hit save in make menuconfig, it overwrites your .config files!

It is a good idea to do compilation in a safe spot. What I mean by this is that the power must be stable; if not, use a UPS. Also keep children away, and make sure you can’t trip over the power cable. Usually one compiles a kernel for systems with low resources to speed them up. The downside is that the lower the resources, the longer it takes to compile. The last time I did this was installing Gentoo on a PII Gateway machine. It took three days to install.

Let’s look at our first target: make bzImage

This will make the base. When you run the command, go make some tea and sandwiches; it may take a while. This is where leveraging the power of virtual machines comes in. If you want to do it again, you need to wait for it to complete, but with a bunch of VM’s you can do it a few times in a row to get the hang of things. Change it up, remove the parallel port in one and the floppy in another. Go wild, see what it takes to break it. Breaking and fixing something is a great way to learn.

Our next target: make modules

Now that the kernel image has been built, the next step is to look at modules. Do not leave the source folder. When you run this command, you now have the opportunity to go wash those dishes from earlier. You can read the section in the book if you have not done so.

Our next target: make modules_install

This is what we need to map our modules we just made. If you were watching the previous make commands run, you may have noticed that they make files like “parport.o”. Those output files now need to be sorted and polished and whatever else is needed for the modules to install. You don’t need to know any of this in-depth.

Don your hard hat and let’s move the bzImage. For the exam, be aware which trees use gzip and which use bzip. When you move your bzImage to your boot folder, you can rename it to vmlinuz<kernel version.arch> Now we go to the next step, mkinitrd /boot/initrd<kernel version>.img <target> You need to know Ubuntu uses mkinitramfs not mkinitrd.

So now we have a recipe and we understand the flow. If you are doing this in a flavour of Ubuntu or Red Hat, make sure you read that documentation to understand all the quirks. You can still find a copy of CentOS5 and Debian5 to play with.

If you would like to jump ahead, or test your skills at an LPI exam, do a test paper here: https://www.itexams.com/exam/117-201 (These were once valid LPI questions and will ease you into the format).

* The new exam number is 201-400, and 117-201 was the old one.

*The site does require signing up, but sign up with temporary email – not your real email.

*DO NOT learn these questions parrot fashion, as they are probably not real exam questions.

Let us know how you did; good or bad – it does not matter. Good means you are ready to write and confident in your skills. Bad means you will be learning new stuff!! Yay! There is no downside here. If you do not know why an answer is the way it is, contact us.

issue152/certifie_linux.1577692278.txt.gz · Dernière modification : 2019/12/30 08:51 de d52fr