LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-04-2004, 02:09 AM   #1
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Question Building a kernel RPM with applying a patch


Hi, i'm trying to build an kernel rpm with applying a netfilter patch (time extension). Firstly I simply add a Patch entry into the spec file and then build and install it, then recompile the iptables package; but the iptables' ipt_time.o file (in /lib/modules/`uname -r`/kernel/net/ipv4/netfilter) isn't created. I get "No target/match/chain by that name" error when i try to use time match. When i look at the Makefile in linux-2.4.20/net/ipv4/netfilter directory i see that all of the iptables match module files ipt_*.o has an entry but there is no ipt_time.o entry. Then i added the line

Code:
obj-$(CONFIG_IP_NF_MATCH_TIME) += ipt_time.o
to the Makefile and used the script below in the spec file just before %build file to add required lines to autoconf.h and .config files (I shortcut the rpm build to make it start from build step for not to lost changes i made)

Code:
echo -e "\aadding CONFIG_IP_NF_MATCH_TIME to .config files.."
sleep 5
# mbaris -- 270704 -- netfilter time patch configuration
# add constant to .config file
for file in configs/*.config; do
  if echo $file | grep -v BOOT > /dev/null; then
    cat >> $file << EOF
CONFIG_IP_NF_MATCH_TIME=m
EOF
  else
    cat >> $file << EOF
# CONFIG_IP_NF_MATCH_TIME is not set
EOF
  fi
done


echo -e "\aadding CONFIG_IP_NF_MATCH_TIME to autoconf.h file.."
sleep 5
# mbaris -- 030804 -- netfilter time patch configuration
# add constant to autoconf.h
cat >> ./include/linux/autoconf.h << EOF
#define CONFIG_IP_NF_MATCH_TIME_MODULE 1
EOF
(The reason i added these into these files is that: When i do a `make menuconfig' and check the files that have changed in 5 or less minutes in kernel source; find command gives me the autoconf.h file.)

There is still no ipt_time.o file and corresponding match in iptables. Should i change the Config.in files also? What i am doing wrong? Thanks.
 
Old 08-04-2004, 06:50 AM   #2
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Original Poster
Rep: Reputation: 30
Problem solved and replying myself for archives :-)

Firstly, i used path-o-matic (thanks Rusty) for appyling patches. There is no need to dive into patch and Config.in files (as i've done enough :-)). Then the problem is this: even if you apply some patches to source tree, all of changes will be lost in rpm build process' setup directive part. Because %setup directive extracts to several shell script lines and these do remove the current source tree and extract the package to same space instead. To overcome this i used the -D (do not delete source directory before unpacking) and -T (do not perform default archive unpacking) options and thus i could save the changes. But, as you know, when we apply a netfilter extension patch, we need to select them as module or compile them into kernel.. So i do a make menuconfig and at last i added the corresponding constant to .config files in configs directory with the script below:

Code:
echo -e "\aadding CONFIG_IP_NF_MATCH_TIME to .config files.."
sleep 5
# mbaris -- 270704 -- netfilter time patch configuration
# add constant to .config file
for file in configs/*.config; do
  if echo $file | grep -v BOOT > /dev/null; then
    cat >> $file << EOF
CONFIG_IP_NF_MATCH_TIME=m
EOF
  else
    cat >> $file << EOF
# CONFIG_IP_NF_MATCH_TIME is not set
EOF
  fi
done
Then, when you recompile your iptables package (or install it's rpm) you will be able to use time extension.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying Kernel Patch browser Linux - Software 2 08-31-2005 06:18 AM
Applying a kernel patch.. RoaCh Of DisCor Linux - Software 2 05-07-2005 07:41 PM
applying kernel patch pirozzi Debian 1 12-01-2004 07:47 AM
applying ck kernel patch Abe_the_Man Linux - General 1 01-29-2004 11:43 AM
kernel compilation; applying patch h/w Linux - Software 11 07-23-2003 10:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration