August 8, 2020

Linux Kernel basics

None of this is specific to Armbian. The linuxtopia article has good information, but is excessively infested with ads. Getting ahead of ourselves, the following are key options that I will want to investigate:
make V=0 is the default
make V=1 gives a verbose build
make V=2 gives reason for rebuild of each target
To use multiple cores:
make -j6
make -j
The rule of thumb here is to give a number that is twice the number of processors. I have 8, so in theory I should give 16 if I want my machine to be fully utilized. But I want to keep some of the machine for other activities, so I don't go all out. Not specifying a number will let make find out how many cores you have for itself and use that value.
make drivers/usb/serial
make M=drivers/usb/serial
make drivers/usb/serial/dingus.o
These are all ways to build part of a kernel (but won't link a final kernel for you).
make O=/u1/build/latest
This tells make to put its output someplace other than where the sources are. This would work to build from a read only source tree.
make ARCH=arm CROSS_COMPILE=/usr/local/bin/arm-linux-
This would cross compile using a specified toolchain and target architecture

Basic tips

Do not keep kernel source in /usr/src -- leave that for your system kernel. At any rate, don't build against sources in this location. Also don't build as the root user.

Make clean will not discard your config, but "make distclean" will.

Configuration

The final configuration ends up in ".config".
make defconfig
make config
make menuconfig
make gconfig
The last uses a GTK based graphical configuration tool.

Installing

This depends. If you are cross-compiling, this is a major topic of its own.


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org