OpenWrt Forum Archive

Topic: Best way to apply a kernel patch...

The content of this topic has been archived on 6 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hey everyone,

I would like to apply the cttproxy patch to the kernel, and build its module for openwrt.  I am not sure exactly how this is done.

I can use the buildroot environment to build a firmware using two simple make commands.  If I then go into buildroot/build_mipsel/linux, I can cleanly apply the patches for the 2.4.29 kernel.  Do I simply need to run make again to re-build the firmware, or do I need to run some sort of 'make clean' first?

I also noticed the patch-kernel.sh script in the scripts folder.  Is this script called by the build process?  Can I just create a folder called kernel-patches in the buildroot folder and dump my patches there?

Thanks in advance for any help.

You can simply add your kernel patch into buildroot/linux/kernel-patches/ .

make dirclean
make

If you need to change the kernel configuration, you should do it in build_mipsel/linux/ and copy .config after modifying the existing configuration to buildroot/linux/linux.config
and do
make dirclean
make

what is cttproxy?

I am using experimental branch because I have hardware requireing it.

If I do 'make dirclean', it appears to delete all the source code.  When I run make again, it downloads the source again before building.  That effectivly wipes my patches away.

I would like to apply this patch to allow stunnel to do transparrent proxying:

http://www.stunnel.org/faq/transparent.html

just use

TOPDIR=`pwd` make -C package linux-clean

from your buildroot directory

This removes the buildroot/linux-2.4.29 directory.  This will still erase my patches.

What I need is a way to download the source  and set it up for build, then stop so I can patch, then after I patch, let it continue with the build until the end.

There is a ' source:' in the Makefile, but I cant seem to figure out how it works...

If you want to apply a kernel patch while compiling, you have to place your patch in :

buildroot/package/linux/kernel-patches/

You also have to give it a number and a name, for example : the last applied is 600-linux-squashfs-lzma because it requires the other to be applied first for instance.

Just remove once the kernel source, and then make distclean, and finally make should patch your kernel everytime you need it to be build.

Thanks, this works well.

(Last edited by netprince on 23 Apr 2009, 19:59)

The discussion might have continued from here.