![]() |
|
ADSP 21xx
Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now? Please make a donation to help with maintenance. |
Custom Search
Kernel Patch HowToHerman Oosthuysen Copyright Aerospace Software Ltd, GPL, http://www.gnu.org, 2003. ScopeThis document provides a brief description of the Linux kernel patch and compile process. This process is documented in many generic howtos, but this one is version specific and therefore without all the generic caveats, disclaimers, tricks and traps for all the other Linux distributions, which can make a guide hard to follow. This is important, since a single mistake will blow you out of the water... For the Super ImpatientIf you wish to do the bare minimum to compile software, install the source as explained below then: make oldconfig && make prepare && make modules_prepare For the Normal ImpatientIf you wish to compile software on your system, then you first have to compile the kernel, to ensure that all dependencies and headers are set up. Get your kernel version: # uname -a Run MCC Software Configuration and search for 'kernel' and install the source for your kernel version. Now do this: # cd /usr/src/linux # make mrproper # make oldconfig # make bzImage # make modules If you only wish to be able to compile software, then stop here. If you wish to really hack and install the kernel, then do: # make modules_install # make install # reboot Le voila! For a Redhat, Fedora or Centos SystemOn new Redhat systems, the headers are included in the kernel-devel package and the compile process is a little different. First you need to update a few things: # up2date redhat-rpm-config rpm-build # up2date --get-source kernel # rpm -ivh /var/spoo/up2date/kernel*.src.rpm Then you have to prepare the kernel source and links: # cd /usr/src/SPECS # rpmbuild -bp --target-i686 kernel-2.6.spec # cp -a /usr/src/redhat/BUILD/kernel-2.6.x.y/linux-2.6.x.y /usr/src # ln -s /usr/src/linux.2.6.x.y /usr/src/linux Now you can build the kernel: # make mrproper # make oldconfig # cp .config .config.old # make You can stop here if you only want to compile other programs and did not change the kernel, or you can install it again: # make modules_install # make install La voila! Manual InstallCopy the compressed kernel image to the /boot directory:
Why vmlinuz?There is some history behind that. Digital Equipment Corporation had an OS called VMS, so at first vmlinux was used, then it was compressed and became vmlinuz. You can call your image whatever you want, though it is easier to find your way around a system if everybody keeps to the same conventions. Post InstallEdit /etc/lilo.conf (or /boot/grub/menu.lst) and include an option to boot from the new image. Copy the default text, change the image and label: image=/boot/vmlinuz-2.4.22-1as.img label=linux-2.422-1as read-only root=/dev/hda1I f you have modified the lilo.conf file, you have to install the boot loader, else the system will not be able to boot. Grub is less finicky. I only give a Lilo example, since this is the tricky one:
Save the new configuration:
Kernel Patch ProcessIf you need to apply a kernel patch, first do all of the above without making any configuration changes and make sure that the system can boot up as before. Only then patch the kernel, rinse and repeat. Otherwise, if the system won't boot up after applying the patch, you will have no idea about what went wrong and you may have difficulty recovering from the disaster... To make the patch process work, keep separate directories for an original kernel source tree from Mandrake Linux, and your modified kernel source tree. We assume that your /src/linux symbolic link is pointing to your brand new super kernel version. Make a PatchCreate a compressed patch file for your modified kernel source tree
with the diff and bzip utilities - the basic
syntax of diff is
Apply a PatchThe bzip, cat and patch utilities are used to apply a compressed patch file to a directory tree pointed to by the /src/linux symbolic link:
Check for rejected parts:
This happens when you apply a patch to a different kernel version than the one the patch was intended for. Remove any rejected files after manual patching has been done with:
Any files that would be modified by the patch are first backed-up into a file with the same name, but with the suffix of .orig added. You can remove these files with:
RPMsWhile we are on the compile topic, note that whenever you make and install software from source, it is actually a good idea to compile the programs to RPMs, since then you are able to easily remove them again, if you have to. Making RPMs used to be a black art, steeped in mystery, but thanks to a utility called checkinstall the voodoo is no more. Get checkinstall here: http://asic-linux.com.mx/~izto/checkinstall/download.php For Mandriva 10.2LE, you have to get the source code 1.6.0 or later and compile checkinstall. Don't use the RPM file, it is for RedHat. Using checkinstall, the method to make an RPM is extremely simple: # ./configure # make # checkinstall The result is a RPM file, which can then be installed with: # rpm -i whateveritis For the growing army of Ubuntu Geeks, Checkinstall can make 'debs' too. 'Hope this helps! |
|
Copyright © 2005-2008, Aerospace Software Ltd., GPL. |