Test the kernel code

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Sat Oct 5 00:18:03 EDT 2019


On Fri, 04 Oct 2019 22:07:21 -0500, CRISTIAN ANDRES VARGAS GONZALEZ said:

> I am starting to develop the kernel and I have been compiling the kernel,
> now it has been compiling for some time now. When a patch is added, should
> everything be compiled again? Or is there a different way to test the code
> that has been written?

The kernel build is driven by 'make', which is a dependency-driven program that
only rebuilds things which have changed dependencies.  How much actually gets
rebuilt depends on what exactly the patch changes.

It changes one .c file, it probably won't rebuild anything else.  If the patch
touches a major .h file that's included in a lot of things, both direct *and*
indirectly from other .h files, you will probably be looking at a long rebuild
as every .c file that includes the affected .h file gets recompiled.

One crucial point to keep in mind - make is *not* smart enough to understand
that foo.c references 3 structures defined in bar.h - and that the patch
touches some other structure in bar.h that isn't used in foo.c.  All it knows
is that foo.c #includes bar.h, and bar.h was modified (via checking the
timestamps), and thus a rebuild of foo.o is probably called for. If any of the
dependencies (usually the included .h files, but other dependencies can be
specified in the Makefile) has a newer last-modified timestamp than foo.c,
foo.c is getting rebuilt.

And then there's some changes that will end up forcing a rebuild of pretty much
everything in sight (for instance, anything that touches the top-level
Makefile, or certain other similar crucial files).

If you're not familiar with 'make', it's probably time you learned... :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20191005/8fb53339/attachment.sig>


More information about the Kernelnewbies mailing list