How do I patch my kernel?

Once you have a copy of the Linux/m68k kernel, you should rarely need to get a completely new tree. Instead, you can patch the kernel sources to the next released version.

For example, if you have the 2.0.25 kernel tree already, you need to get the file linux-2.0.28.diff.gz via FTP (don't get the file with the word "native" in it unless you have the same version kernel tree for Linux/i386). Then use cd to get to the directory above your kernel tree (probably /usr/src), and make a copy using hard links to save a lot of space:

cp -rl linux-2.0.25 linux-2.0.28

You may also want to change your symbolic link linux -> linux-2.0.25 to point to the new tree:

ln -sf linux-2.0.28 linux

This way, your links in /usr/include don't have to be changed every time you upgrade your kernel (i.e. you can link /usr/include/linux -> /usr/src/linux/include/linux instead of using the kernel version number hard-coded). Then, cd to linux-2.0.28 and type the following 2 commands:

rm -rf include/asm
zcat (path of linux-2.0.28.diff.gz) | patch -p1 -s

If all goes well, it will work for a minute or two and then return you to your shell's prompt. Make sure the patch applied correctly by typing find . -name '*.rej'. If no filenames are listed, everything worked perfectly.

Now do a make clean to delete all the backup .orig files left by patch, and then do a normal make config, make dep and finally make.

Once you've successfully made a copy of the new kernel, you can safely delete the previous version's tree using rm -r.

Please note that you will often get rejected patches if you patch a kernel tree that you have already patched from the Linux/m68k mailing list (or from any other source). The easiest way to avoid this is to make a "clean" (i.e. distribution) kernel tree and another tree that you apply the patches from the mailing list to.

Miniproject: Someone with a bit of spare time might want to adapt scripts/patch-kernel to understand Linux/m68k diffs. Your fellow Linux/m68k users would be eternally grateful.