Building RPM Kernel with a patch -- how to add?

Place to discuss Fedora and/or Red Hat
figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Building RPM Kernel with a patch -- how to add?

Post by figuerres » Mon Feb 21, 2005 8:41 am

Hey FOlks !!

I found and read the Void Main how-to on building a new Kernel but I have a question or two I could use some help with.

I have a box I want to make into a firewall and vpn server.

I do not want to build on that box so I want to make my kernel on another box as an rpm. I also wan to be able to do this for some customers who are upgrading stuff and have a "spare" box thats good for a firewall but not for new windows and Microsoft stuff.


so I have the full Fedora 3 installed on a workstation with all the updates and the sourses I need for the kernel etc....

thats good so far...

two things / maby one really...

I want to add a kernel patch to the build so that I can run rpmbuild {blah}
and get a nice binary rpm with the patch added.

how?

I tried and missed somethig cause it just untarred the stock kernel and re-patched it with the stock patch set ....

I tried make rpm and that built an rpm but it was a huge file of about 75 megs!!!

so how do I add my small patch to the spec so that it patches it into the sorce and builds an rpm of the right size??

by the way it's a patch for vpn / ppp to add mppe and mppc that are needed for windows clients to use pptp with decent levels of compression and security.

the patch is a .patch file I can add by hand afer running rpmbuild -bp {blah}

when I tried to add it to the spec file it crashed the patch / prep stage of rpmbuild.

if you need more details I'll fill them in....

thanks for any help on this!

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Feb 21, 2005 9:31 am

The short answer is you add the patch to your ~/redhat/SOURCES directory and you would add two new lines to the kernel.spec to define and apply it. I will have more time this evening for a much longer answer if you need it. Point me to the patch and I would be more than happy to give detailed instructions (I was actually thinking of adding this to the HOWTO when I wrote it).

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Mon Feb 21, 2005 10:25 am

Void Main wrote:The short answer is you add the patch to your ~/redhat/SOURCES directory and you would add two new lines to the kernel.spec to define and apply it. I will have more time this evening for a much longer answer if you need it. Point me to the patch and I would be more than happy to give detailed instructions (I was actually thinking of adding this to the HOWTO when I wrote it).
THANKS!!!

I did *TRY* to add it to the spec but I guess I put it to soon in the list or patches?? as the make exited with an error status.

First a few links so you can see what's going on:

1) www.PoPToP.org
this is the VPN server home site, pptpd that uses pppd to handle part of the process.
2) a current pppd tar can be found at http://ppp.samba.org/ppp/download.html
this is ok -- i have no problem building it just so you can see all the players.
3) a howto that does not say how to get this into the rpm build:
http://www.gfxcafe.com/VPN%20Howto.html
but does give the steps of building the "Old way"
4) Jan Dubiec's site that has the patch files:
http://www.polbox.com/h/hs001/
the patch for my current Fedora is:
linux-2.6.10-mppe-mppc-1.2.patch.gz patch for kernel 2.6.10

If I was just building this on the local box I'd be done....
I have used Linux off and on for a *LONG* time!
but the new stuff just happens to fast for an old guy like me who has to keep up with to many things :-)

PS: I Used to sell Slackware CD's from Walnut Creek CD-ROM in a game store back in the mid 90's --- and used to use the Yarsiggdl "Linux Bibble"
back then.... I must have shown Linux to at least a hundred others back then.... they were amazed to see it....

thanks again!

If I can just get the spec file stuff worked out; I know I am *CLOSE* but dang I don't have the time right now to spend learning yet another scripting tool and all ..... :-)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Feb 21, 2005 8:36 pm

Ok, you'll find a spec file for the 2.6.10-1.766_FC3 kernel with the patches added and a couple of other minor changes (comment indicating patch was added and commented out two debugging lines), the patch, and modified *.config files here:

http://voidmain.is-a-geek.net/files/misc/mppe-mppc/

After "apt-get source kernel", which will get and install the latest kernel source (for 2.6.10-1.766_FC3 version), place the stuff from SOURCES above to your /usr/src/redhat/SOURCES directory and put the spec file in your /usr/src/redhat/SPECS directory. You can do the diff on it with the stock kernel-2.6.spec if you want to see my changes. It will build a 2.6.10-1.766_FC3 (uni processor only) and with no name changes from the stock name. Modify the spec file and change the name according to my HOWTO if you want to make it different than the stock (probably a good idea). The build doc should cover everything else (but do not copy the config from /boot as mentioned in the doc).

On a side note I'm no spring chicken myself. I used to use SLS before Slackware came out and built from scratch before that. I remember the Walnut Creek CDs very well. Ah the good old days! :) I actually had Slackware installed on 50 PCs at work (UNIX development shop with lots of big iron).

I have also colorized the SPEC file (ala VIM) and underlined lines that I have added or changed:
http://voidmain.is-a-geek.net/files/mis ... .spec.html

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Tue Feb 22, 2005 4:54 am

Void Main wrote:Ok, you'll find a spec file for the 2.6.10-1.766_FC3 kernel with the patches added and a couple of other minor changes (comment indicating patch was added and commented out two debugging lines), the patch, and modified *.config files here:

http://voidmain.is-a-geek.net/files/misc/mppe-mppc/

After "apt-get source kernel", which will get and install the latest kernel source (for 2.6.10-1.766_FC3 version), place the stuff from SOURCES above to your /usr/src/redhat/SOURCES directory and put the spec file in your /usr/src/redhat/SPECS directory. You can do the diff on it with the stock kernel-2.6.spec if you want to see my changes. It will build a 2.6.10-1.766_FC3 (uni processor only) and with no name changes from the stock name. Modify the spec file and change the name according to my HOWTO if you want to make it different than the stock (probably a good idea). The build doc should cover everything else (but do not copy the config from /boot as mentioned in the doc).

On a side note I'm no spring chicken myself. I used to use SLS before Slackware came out and built from scratch before that. I remember the Walnut Creek CDs very well. Ah the good old days! :) I actually had Slackware installed on 50 PCs at work (UNIX development shop with lots of big iron).

I have also colorized the SPEC file (ala VIM) and underlined lines that I have added or changed:
http://voidmain.is-a-geek.net/files/mis ... .spec.html
Thanks!

right now my main work comes from folks who want me to work on windows stuff for business so I don't have the time for the Linux stuff like I used to.

One thing I am watching and looking for ways to get paid for using is Mono
dot net is one thing that Microsoft has done that really has been a good thing.... and with Mono it gets a chance to live on past microsoft...

well thanks for the info and the files.... I'll have to find something I can do for you / this board later.....

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Feb 22, 2005 9:01 am

There was a period in the middle of my computer career that I dealt with MS systems. I have to tell you that before I ever do that again I would take a job as the fry guy at my local fast food establishment. In fact I would rather be poked repeatedly in the eyes with hot needles dipped in iodine. :)

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Sun Feb 27, 2005 8:24 pm

Void Main wrote:Ok, you'll find a spec file for the 2.6.10-1.766_FC3 kernel with the patches added and a couple of other minor changes (comment indicating patch was added and commented out two debugging lines), the patch, and modified *.config files here:

http://voidmain.is-a-geek.net/files/misc/mppe-mppc/

After "apt-get source kernel", which will get and install the latest kernel source (for 2.6.10-1.766_FC3 version), place the stuff from SOURCES above to your /usr/src/redhat/SOURCES directory and put the spec file in your /usr/src/redhat/SPECS directory. You can do the diff on it with the stock kernel-2.6.spec if you want to see my changes. It will build a 2.6.10-1.766_FC3 (uni processor only) and with no name changes from the stock name. Modify the spec file and change the name according to my HOWTO if you want to make it different than the stock (probably a good idea). The build doc should cover everything else (but do not copy the config from /boot as mentioned in the doc).

On a side note I'm no spring chicken myself. I used to use SLS before Slackware came out and built from scratch before that. I remember the Walnut Creek CDs very well. Ah the good old days! :) I actually had Slackware installed on 50 PCs at work (UNIX development shop with lots of big iron).

I have also colorized the SPEC file (ala VIM) and underlined lines that I have added or changed:
http://voidmain.is-a-geek.net/files/mis ... .spec.html
I must be missing something really simple....

I used your files and I get the same error as when I did a modified spec file.

I enter rpmbuild -bp --target=i586 mppe.spec
it starts ok and I see it do "Patch 3000 ... "
then a few steps later it's doing this:
for i in '*.config'
...
then
+ make ARCH=i386 nonint_oldconfig
.config:221 trying to assign nonexistent symbol ACPI_CONTAINER
,,,
then
.config:2581: trying to assign nonexistent symbol CRYPTO_DEV_PADLOCK_AES
CONFIG_PPP_MPPE_MPPC
make[1]: *** [nonint_oldconfig] error 1
make: *** [nonint_oldconfig] error2
error: Bad exit status from /var/tmp/rpm-tmp.74171 (%prep)

RPM build errors:
Bad exit ....

with the mppe patch not in the spec file this does not happen.

so I guess the patch is command is ok but some text it adds to a file having to do with getting it to config inside the rpmbuild is what is hanging the rpmbuild process??
somewhre near line 2581 of the .config file??

I will try and see if I can find the problem but perhaps you have some tips on what this is?

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Sun Feb 27, 2005 8:44 pm

OK so I read the code from the temp file and the other bits....

it's trying to run the make nonint_oldconfig with the 586 smp.config and thats where it's going wrong...

but I don't want to do the smp jsut the uni-proc ..... but now I am at least close to whats happening....

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sun Feb 27, 2005 8:52 pm

You are missing the modified config files. See my earlier post where I pointed you to the spec file. You should also find the modified config files that include the new variables. All the files I modified for you are here:

http://voidmain.is-a-geek.net/files/mis ... c/SOURCES/

These go in your SOURCES directory.

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Mon Feb 28, 2005 5:41 pm

How right you are....

I was just focused on the one version I wanted to make, just grabbed the one for that build.

thanks for the help so far, tonight I can work on the ret of the build and see if I get the right results.

but that was the main error from day one: having the right .config files in the SOURCES folder so that rpmbuild uses them to do the build.

that detail was the one that was not clear before.

now I have a handle on what rpmbuild is doing; I had been looking for a howto or faq that would tell me that but now I got it.

perhaps a short write up for others would help? or is this out there and I just did not find it?

what I mean is the way the rpmbuild uses the tar'ed source tree and the .patch files and the .config files in the %prep stage to build a source tree for the actual build of the binary and the binary rpm's

when I first went to use the rpmbuild command to "finish" a build and saw that it had nuked my work I was stunned for a while....

I had run the -bp
then patched and configured the code
then figured I could just tell it to make an rpm and it would
"do the rest" I went to do some other stuff and came back and saw that my chnages were gone and that it had re-ran the prep stage ....
I was ticked! I was thinking "what the heck, why do that to my work?"
now I see the logic and how I will have to copy files back to the start of the process to get it to keep the chnages to some files and settings.

thanks again!

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Feb 28, 2005 7:06 pm

To be honest I don't really know a great up to date tutorial site on building RPMs. I pretty much started by using Matthias' (FreshRPMS) short RPM building document called The Fight as a base and then just figuring out the rest by hacking packages/spec files. I feel like I get a little better at it with each package. The RPM HOWTO is here:

http://www.rpm.org/RPM-HOWTO/

It hasn't been updated in a few years but I think the basics should still be the same. Oh, and of course the man pages are always a great read. The kernel is probably not the best RPM to cut your RPM building teeth on. :)

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Tue Mar 01, 2005 4:59 pm

Ok so I got closer this time....

todays problem:

I ran

Code: Select all

rpmbuild --vv -ba --target=i586 kernel2.6m.spec --clean
and it was running along nice ----
it got to the modules build and ran them.
then I saw an error message about "no job control" ??

when I looked at the tmp file that was refered to it ends like this:

Code: Select all

BuildKernel


###
### install
###

%{null}
exit 0
the line "%{null}" is where it died.

so I think it was done with the building the binaries and should have went to building the rpm next right??

so now what?? :roll:

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Mar 01, 2005 5:23 pm

Hmmm, it's sort of hard for me to tell without more info. What exact kernel version are you building and can I see your spec file and build params? Maybe I can recreate your problem.

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Tue Mar 01, 2005 5:35 pm

Void Main wrote:Hmmm, it's sort of hard for me to tell without more info. What exact kernel version are you building and can I see your spec file and build params? Maybe I can recreate your problem.
it's the spec file you did a few days back I just shortened the name a bit.

the *ONLY* things I have changed was to:

remove the other config files from the SOURCES folder
so that it did not have to do the for-each-config loop.
renamed the spec to make it simple to keyin the command line.
ran the commands from your how-to
so that I have a kernel-2.6.10-i586.config with my settings.

just to check I re-started the rpmbuild and halted it and found the tmp folder had the same result.

it builds the kernel but where it should then make the rpm it bails....

I will take a look at your files on the web site to see if I may have some simple problem like the files did not download right ...
I'll re-check as much as I can think of...

*****
also the sign-the-modules loop had messages about not finding the file it wanted for signing..... but that did not stop the build
and the temp file with the shell commands was already written with the odd ending.... so I don't see any connection but so you know...

figuerres
user
user
Posts: 23
Joined: Mon Feb 21, 2005 8:03 am
Location: Florida USA, Tampa Bay Area

Post by figuerres » Tue Mar 01, 2005 5:48 pm

Ok, just looked at your colorized spec file and my file is the same just with the %define chnaged like your how to says to chnage it for the name to show it's my build.

Kernel 2.6.10 766 all compiles
just that rpmbuild is giving us the wrong ending to the shell script.

the system running the build has all the FC3 packages installed and was up-to-date as of a few days back.

?

Post Reply