For a project in an operating systems class, I need to add a systemcall to a linux operating system. To do this, I'm using Centos5 with Linux kernel 2.6.18-238.19.1.el5.
I followed these instruction to obtain the kernel source: http://wiki.centos.org/HowTos/I_need_the_Kernel_Source
It is sitting in ~/rpmbuild/
I then modified the source files to add the system call using these instructions: http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/
Finally, I followed these instruction to compile and install the kernel: http://wiki.centos.org/HowTos/Custom_Kernel
When I reboot and run uname -v, it shows the buildid I set while configuring the kernel. However, my system call doesn't work (returns -1). Upon inspection, I found that my changes to the source in ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.i686/ were all reverted. This makes me think that I'm going about the installation process wrong.
I noticed that the final line in the instruction to compile:
[code]rpmbuild -bb --target=`uname -m` kernel-2.6.spec 2> build-err.log | tee build-out.log[/code]
is very similar to the final line in the instructions for extracting the source:
[code]rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log[/code]
Am I re-extracting the source code over my changes? Why do I see my new buildid after installing the edited kernel?
I also used the "--with baseonly" argument when compiling the kernel, could this have anything to do with it?
Thanks in advance for your help!
-Alex
[RESOLVED] Trouble Compiling and Installing
- AlanBartlett
- Forum Moderator
- Posts: 9345
- Joined: 2007/10/22 11:30:09
- Location: ~/Earth/UK/England/Suffolk
- Contact:
Re: Trouble Compiling and Installing
Welcome to the [i]CentOS[/i] fora.
Normally I would then type "[i]The recommended reading for all new members starts with the [url=https://www.centos.org/modules/newbb/viewforum.php?forum=47]FAQ & Readme First[/url][/i]", however I suspect you have already done that. :-)
[quote]
Upon inspection, I found that my changes to the source in ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.i686/ were all reverted. This makes me think that I'm going about the installation process wrong.
[/quote]
Yes, you have failed to perform a few vital steps. What you should have done was to have created a patch file containing your changes, copied your patch file to the [b]~/rpmbuild/SOURCES/[/b] directory and added two lines to the [i]kernel-2.6.18.spec[/i] file -- to define your patch and to apply your patch during the subsequent build process.
[quote]
Am I re-extracting the source code over my changes? Why do I see my new buildid after installing the edited kernel?
I also used the "--with baseonly" argument when compiling the kernel, could this have anything to do with it?
[/quote]
Three questions requiring three answers which, briefly, are:
(1) Yes.
(2) Because you have defined it in the spec file.
(3) No. That is a good choice if you do not intend to build the "full set" of packages.
You have, essentially, discovered the answers for yourself. Please take a few minutes to read through the [url=http://wiki.centos.org/HowTos/Custom_Kernel]Custom Kernel[/url] article once again and look out for the mention of applying patches.
Normally I would then type "[i]The recommended reading for all new members starts with the [url=https://www.centos.org/modules/newbb/viewforum.php?forum=47]FAQ & Readme First[/url][/i]", however I suspect you have already done that. :-)
[quote]
Upon inspection, I found that my changes to the source in ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.i686/ were all reverted. This makes me think that I'm going about the installation process wrong.
[/quote]
Yes, you have failed to perform a few vital steps. What you should have done was to have created a patch file containing your changes, copied your patch file to the [b]~/rpmbuild/SOURCES/[/b] directory and added two lines to the [i]kernel-2.6.18.spec[/i] file -- to define your patch and to apply your patch during the subsequent build process.
[quote]
Am I re-extracting the source code over my changes? Why do I see my new buildid after installing the edited kernel?
I also used the "--with baseonly" argument when compiling the kernel, could this have anything to do with it?
[/quote]
Three questions requiring three answers which, briefly, are:
(1) Yes.
(2) Because you have defined it in the spec file.
(3) No. That is a good choice if you do not intend to build the "full set" of packages.
You have, essentially, discovered the answers for yourself. Please take a few minutes to read through the [url=http://wiki.centos.org/HowTos/Custom_Kernel]Custom Kernel[/url] article once again and look out for the mention of applying patches.
Re: Trouble Compiling and Installing
Thanks! After figuring out how to create patches, the process went swimmingly! :-D
(how do I mark the topic as resolved? I don't seem to have edit priveleges)
(how do I mark the topic as resolved? I don't seem to have edit priveleges)
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
[RESOLVED] Trouble Compiling and Installing
The best way, given our current brain-damaged forum software, is to reply with [SOLVED] or [RESOLVED] in the topic as desired. A moderator should then take note and mark the thread appropriately, as explained in [url=https://www.centos.org/modules/newbb/viewtopic.php?topic_id=14274&forum=47]the forum guidelines #12[/url].
Done on your behalf and for posterity. Thanks for reporting back.
Done on your behalf and for posterity. Thanks for reporting back.
- AlanBartlett
- Forum Moderator
- Posts: 9345
- Joined: 2007/10/22 11:30:09
- Location: ~/Earth/UK/England/Suffolk
- Contact:
Re: [RESOLVED] Trouble Compiling and Installing
[quote]
Thanks! After figuring out how to create patches, the process went swimmingly! :-D
[/quote]
Excellent news.
Just one question from me, as the co-maintainer of those [i]CentOS[/i] wiki kernel articles. Considering that explicit instructions can not be given for every conceivable kernel build case, is there anything you can see that would improve the article(s)?
(Apart from updating to include [i]CentOS 6[/i], which is currently being considered . . . just need to ensure that [b]toracat[/b] is awake. ;-) )
Thanks! After figuring out how to create patches, the process went swimmingly! :-D
[/quote]
Excellent news.
Just one question from me, as the co-maintainer of those [i]CentOS[/i] wiki kernel articles. Considering that explicit instructions can not be given for every conceivable kernel build case, is there anything you can see that would improve the article(s)?
(Apart from updating to include [i]CentOS 6[/i], which is currently being considered . . . just need to ensure that [b]toracat[/b] is awake. ;-) )