minor error on http://wiki.centos.org/HowTos/Custom_Kernel?highlight=%28HowTos%29
the rpmbuild steps specifies kernel.spec, when in fact the filename is kernel-2.6.spec, at least with 2.6.9-42.0.10.EL
this occurs a BUNCH of times on that wiki page... also kernel2.6.9 -> kernel-2.6.9 on the cp command after 'configuring your kernel'
On Fri, 09 Mar 2007 19:40:08 -0800, John R Pierce wrote:
minor error on http://wiki.centos.org/HowTos/Custom_Kernel?highlight=%28HowTos%29
the rpmbuild steps specifies kernel.spec, when in fact the filename is kernel-2.6.spec, at least with 2.6.9-42.0.10.EL
this occurs a BUNCH of times on that wiki page... also kernel2.6.9 -> kernel-2.6.9 on the cp command after 'configuring your kernel'
In case people are wondering if these typos are Johnny's...they are most likely Jim's work...
Akemi :)
John R Pierce wrote:
minor error on http://wiki.centos.org/HowTos/Custom_Kernel?highlight=%28HowTos%29
the rpmbuild steps specifies kernel.spec, when in fact the filename is kernel-2.6.spec, at least with 2.6.9-42.0.10.EL
this occurs a BUNCH of times on that wiki page... also kernel2.6.9 -> kernel-2.6.9 on the cp command after 'configuring your kernel'
and, after digging through all that, it didn't work.
no RPMs in the rpmbuild/RPMS dir, the whole final rpmbuild step only took about 3 mins on a fairly slow box.
here's the output of the rpmbuild...
what did I miss??
John R Pierce wrote:
and, after digging through all that, it didn't work.
no RPMs in the rpmbuild/RPMS dir, the whole final rpmbuild step only took about 3 mins on a fairly slow box.
what did I miss??
| [ralph@logout ~]$ rpmbuild --help | Usage: rpmbuild [OPTION...] | | Build options with [ <specfile> | <tarball> | <source package> ]: | -bp build through %prep (unpack sources and apply | patches) from <specfile>
Where the HowTo says
[user@host SPECS]$ rpmbuild -ba --target=`uname -m` kernel.spec
which will build the actual rpms :)
Concerning the errors: I'll fix them, thanks for noticing and telling.
Cheers,
Ralph
On Mar 10, 2007, at 3:10, Ralph Angenendt wrote:
Concerning the errors: I'll fix them, thanks for noticing and telling.
I was just going to report these myself. Anyway, I am on the final step at the moment (the RPM is being built). But I have a couple of questions regarding this process of building a custom kernel:
1. Why is it not a good idea to build a custom kernel as root (you have to be root to install it)?
2. Why do these steps not work if you do this as root (i.e., no ~/rpmbuild after fedora-buildrpmtree)?
3. After copying the config file an making one small change with "make xconfig", why are there so many differences in the config file?
The first two questions are just intellectual curiosity, but the third one really has me wondering what's going on. I followed the steps in the Wiki, and when I diff'ed the original config file to the one create by "make xconfig" after making two changes in the serial port section, I saw a lot of differences.
Alfred
On 3/12/07, Alfred von Campe alfred@110.net wrote:
I was just going to report these myself. Anyway, I am on the final step at the moment (the RPM is being built). But I have a couple of questions regarding this process of building a custom kernel:
- Why is it not a good idea to build a custom kernel
as root (you have to be root to install it)?
Building as root is bad practice for all software. This is mostly to protect you from bad code. If a cleanup script tries to delete / instead of just the buildroot, you'll be in a world of hurt by building as root. By building as a normal/restricted user you reduce the permissions available to the code, thereby minimizing potential damage.
- Why do these steps not work if you do this as root (i.e., no ~/rpmbuild after fedora-buildrpmtree)?
Root's rpmbuild dir is /usr/src/redhat
- After copying the config file an making one small change with "make xconfig", why are there so many differences in the config file?
Are they actual changes, or is the diff now simply off by a few lines?
The first two questions are just intellectual curiosity, but the third one really has me wondering what's going on. I followed the steps in the Wiki, and when I diff'ed the original config file to the one create by "make xconfig" after making two changes in the serial port section, I saw a lot of differences.
Like what?
On Mar 12, 2007, at 10:15, Jim Perrin wrote:
Building as root is bad practice for all software. This is mostly to protect you from bad code. If a cleanup script tries to delete / instead of just the buildroot, you'll be in a world of hurt by building as root. By building as a normal/restricted user you reduce the permissions available to the code, thereby minimizing potential damage.
OK, I understand. A (somewhat) related question: can I move the ~/ rpmbuild directory to a different location? My home directory is NFS mounted, and I'd rather do a build on a local disk. Can I just move it myself or is there a way to specify this as an option when installing the fedora-rpmdevtools RPM?
- Why do these steps not work if you do this as root (i.e., no ~/rpmbuild after fedora-buildrpmtree)?
Root's rpmbuild dir is /usr/src/redhat
Of course, I should have known that.
- After copying the config file an making one small change with "make xconfig", why are there so many differences in the config file?
Are they actual changes, or is the diff now simply off by a few lines?
Actual changes. And lots of them. The output of diff is over 2,000 lines long. It may be that things just got reordered, but all I did was a "make xconfig" and change two settings.
The first two questions are just intellectual curiosity, but the third one really has me wondering what's going on. I followed the steps in the Wiki, and when I diff'ed the original config file to the one create by "make xconfig" after making two changes in the serial port section, I saw a lot of differences.
Like what?
In order to compare apples to apples, I ran both config files through the following "filter": sort -u <configfile> | grep -v '^#'. The resulting output of diff is now only 317 lines, and here are the first 20 or so:
# diff -wib /tmp/config.orig /tmp/config.new | head -25 2d1 < 21d19 < CONFIG_ACPI_NUMA=y 24a23
CONFIG_ACPI_SLEEP_PROC_FS=y
31,32d29 < CONFIG_ACT200L_DONGLE=m < CONFIG_ACTISYS_DONGLE=m 73a71
CONFIG_ATM_IDT77252_USE_SUNI=y
99c97 < CONFIG_BLK_DEV_DELKIN=y ---
CONFIG_BLK_DEV_DELKIN=m
159a158
CONFIG_BROKEN_ON_SMP=y
200,201d198 < CONFIG_COPS_DAYNA=y < CONFIG_COPS_TANGENT=y 207c204 < CONFIG_CPU_FREQ_GOV_USERSPACE=m ---
CONFIG_CPU_FREQ_GOV_USERSPACE=y
212c209
The only changes I intended to make were the following two:
CONFIG_SERIAL_8250_MANY_PORTS=y CONFIG_SERIAL_8250_NR_UARTS=20 [from 4]
I may only need one or the other, but I wasn't sure so I changed them both. Anyway, I thought I followed the recipe to the letter, and I got all these changes. After I noticed this, I even copied the config file again and re-ran "make xconfig" and the same thing happened again.
Alfred
Alfred von Campe spake the following on 3/12/2007 9:02 AM:
On Mar 12, 2007, at 10:15, Jim Perrin wrote:
Building as root is bad practice for all software. This is mostly to protect you from bad code. If a cleanup script tries to delete / instead of just the buildroot, you'll be in a world of hurt by building as root. By building as a normal/restricted user you reduce the permissions available to the code, thereby minimizing potential damage.
OK, I understand. A (somewhat) related question: can I move the ~/rpmbuild directory to a different location? My home directory is NFS mounted, and I'd rather do a build on a local disk. Can I just move it myself or is there a way to specify this as an option when installing the fedora-rpmdevtools RPM?
You can have your rpmbuild directory anywhere the user has r/w access to. It just needs to be pointed out in the users .rpmmacros file. The .rpmmacros file will need to be in the root of the users home directory though, because that is where RPM looks for it.
On Mon, 2007-03-12 at 12:02 -0400, Alfred von Campe wrote:
On Mar 12, 2007, at 10:15, Jim Perrin wrote:
Building as root is bad practice for all software. This is mostly to protect you from bad code. If a cleanup script tries to delete / instead of just the buildroot, you'll be in a world of hurt by building as root. By building as a normal/restricted user you reduce the permissions available to the code, thereby minimizing potential damage.
OK, I understand. A (somewhat) related question: can I move the ~/ rpmbuild directory to a different location? My home directory is NFS mounted, and I'd rather do a build on a local disk. Can I just move it myself or is there a way to specify this as an option when installing the fedora-rpmdevtools RPM?
You can put the /rpmbuild directory anywhere you want ... edit the .rpmmacros file in the "builder user's" home directory and adjust the the %_topdir to where you want to build ... mine looks like this:
%_topdir /home/hughesjr/rpmbuild
Make sure the "build user" has rw permissions in the rpmbuild dir.
- Why do these steps not work if you do this as root (i.e., no ~/rpmbuild after fedora-buildrpmtree)?
Root's rpmbuild dir is /usr/src/redhat
Of course, I should have known that.
- After copying the config file an making one small change with "make xconfig", why are there so many differences in the config file?
Are they actual changes, or is the diff now simply off by a few lines?
Actual changes. And lots of them. The output of diff is over 2,000 lines long. It may be that things just got reordered, but all I did was a "make xconfig" and change two settings.
The first two questions are just intellectual curiosity, but the third one really has me wondering what's going on. I followed the steps in the Wiki, and when I diff'ed the original config file to the one create by "make xconfig" after making two changes in the serial port section, I saw a lot of differences.
Like what?
In order to compare apples to apples, I ran both config files through the following "filter": sort -u <configfile> | grep -v '^#'. The resulting output of diff is now only 317 lines, and here are the first 20 or so:
# diff -wib /tmp/config.orig /tmp/config.new | head -25 2d1 < 21d19 < CONFIG_ACPI_NUMA=y 24a23
CONFIG_ACPI_SLEEP_PROC_FS=y
31,32d29 < CONFIG_ACT200L_DONGLE=m < CONFIG_ACTISYS_DONGLE=m 73a71
CONFIG_ATM_IDT77252_USE_SUNI=y
99c97
< CONFIG_BLK_DEV_DELKIN=y
CONFIG_BLK_DEV_DELKIN=m
159a158
CONFIG_BROKEN_ON_SMP=y
200,201d198 < CONFIG_COPS_DAYNA=y < CONFIG_COPS_TANGENT=y 207c204
< CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
212c209
The only changes I intended to make were the following two:
CONFIG_SERIAL_8250_MANY_PORTS=y CONFIG_SERIAL_8250_NR_UARTS=20 [from 4]
I may only need one or the other, but I wasn't sure so I changed them both. Anyway, I thought I followed the recipe to the letter, and I got all these changes. After I noticed this, I even copied the config file again and re-ran "make xconfig" and the same thing happened again.
Did you do "make oldconfig" with the old config file?
you might also want to ensure you are using the correct target and arch .. I do this:
rpmbuild -bp --target i686 kernel-2.6.spec
the go to the linux directory under BUILD ... and copy the configs/kernel-xxxx.config file into .config
then do this:
ARCH=i386 make oldconfig
Then ...
ARCH=i386 make menuconfig
(you can use xconfig if you like)
make changes
save config file
====== If this is C4 .. you can take that .config file that you saved and move it directly into SOURCES to use (replace the current one of that type ... OR name it something else and modify the spec file to use the new name as a source).
If this is C5 (or FC5/6) you will need some stuff added to the top of the config file to get it to work ... but on C4, you can use the config directly from make menuconfig (xconfig) as a kernel config file.
Thanks, Johnny Hughes
On Mar 12, 2007, at 14:43, Johnny Hughes wrote:
My ISP must have been having some problems yesterday, because replies to my last post arrived up to 8 hours before my post. So thanks for all the responses, and sorry for not replying sooner.
You can put the /rpmbuild directory anywhere you want ... edit the .rpmmacros file in the "builder user's" home directory and adjust the the %_topdir to where you want to build ... mine looks like this:
%_topdir /home/hughesjr/rpmbuild
Make sure the "build user" has rw permissions in the rpmbuild dir.
Great, thanks. I worked around this be creating a local rpmbuild account.
Did you do "make oldconfig" with the old config file?
Nope, I just followed the instructions in the CentOS HowTo.
you might also want to ensure you are using the correct target and arch .. I do this:
rpmbuild -bp --target i686 kernel-2.6.spec
the go to the linux directory under BUILD ... and copy the configs/kernel-xxxx.config file into .config
That's exactly what the HowTo says to do.
If this is C4 .. you can take that .config file that you saved and move it directly into SOURCES to use (replace the current one of that type ... OR name it something else and modify the spec file to use the new name as a source).
Again, the HowTo mentioned this as well. The part that confused me is that running make menuconfig (or xconfig) starting with the config file copied from the SOURCES directory produces a very different config file (as shown by diff). But it turns out that this config file is identical to the original config file in the BUILD directory except for the changes made during the menuconfig/xconfig. So what is the use in copying the config file from the SOURCES to the BUILD directory?
If this is C5 (or FC5/6) you will need some stuff added to the top of the config file to get it to work ... but on C4, you can use the config directly from make menuconfig (xconfig) as a kernel config file.
I will probably have to rebuild the kernel again after CentOS 5 is released to enable support for the additional serial ports, unless this is already the default in the new kernel. And if there are some things that need to be added to the config file in C5, I'm sure that the Wiki HowTo gets updated (you guys do a great job -- thanks!).
Alfred
On 3/12/07, Jim Perrin jperrin@gmail.com wrote:
On 3/12/07, Alfred von Campe alfred@110.net wrote:
I was just going to report these myself. Anyway, I am on the final step at the moment (the RPM is being built). But I have a couple of questions regarding this process of building a custom kernel:
- Why is it not a good idea to build a custom kernel
as root (you have to be root to install it)?
Building as root is bad practice for all software. This is mostly to protect you from bad code. If a cleanup script tries to delete / instead of just the buildroot, you'll be in a world of hurt by building as root. By building as a normal/restricted user you reduce the permissions available to the code, thereby minimizing potential damage.
And that is the critical type of problems (i.e. removing /). Subtler issues can occur also if the build scriptlets install files, or change configs your build system becomes polluted.
Cheers...james
On Mar 12, 2007, at 10:15, Jim Perrin wrote:
- After copying the config file an making one small change with "make xconfig", why are there so many differences in the config file?
Are they actual changes, or is the diff now simply off by a few lines?
I went back and started the process of building a kernel from scratch on a different system. This time I paid closer attention to what was going on. After the "rpmbuild -bp --target=`uname -m` kernel-2.6.spec" step, the ~/rpmbuild/BUILD/kernel-2.6.9/linux-2.6.9 directory contains among other things these two files:
-rw-r--r-- 1 rpmbuild rpmbuild 50332 Mar 12 15:32 .config -rw-r--r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:31 .config.old
Notice the size difference of these two files. After copying the config file from the ~/rpmbuild/SOURCES directory, these two files now look like this:
-rw-rw-r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:42 .config -rw-r--r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:35 .config.old
And a diff confirms the the two files are now identical. However, after doing a "make xconfig", changing two settings in the Serial Port section and saving the config file, the directory looks like this:
-rw-rw-r-- 1 rpmbuild rpmbuild 50322 Mar 12 15:44 .config -rw-rw-r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:42 .config.old
Finally, comparing the new .config file with the original .config file only shows the expected changes:
# diff /tmp/saved_configs/.config .config 4c4 < # Mon Mar 12 15:32:01 2007 ---
# Mon Mar 12 15:44:32 2007
1501c1501 < CONFIG_SERIAL_8250_NR_UARTS=4 ---
CONFIG_SERIAL_8250_NR_UARTS=16
1503c1503 < # CONFIG_SERIAL_8250_MANY_PORTS is not set ---
CONFIG_SERIAL_8250_MANY_PORTS=y
While I don't quite understand what is going on, it appears that xconfig is doing the right thing. I'm rebuilding the kernel again as I type this. BTW, there are lots of compiler warnings: is this normal/expected for a kernel build?
Alfred
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Alfred von Campe Sent: Monday, March 12, 2007 12:54 PM To: CentOS mailing list Subject: Re: [CentOS] wiki howto on custom kernel
I type this. BTW, there are lots of compiler warnings: is this normal/expected for a kernel build?
I always see them, but since they're all warnings, I don't usually pay attention to them.
mhr
On 3/12/07, Alfred von Campe alfred@110.net wrote:
On Mar 12, 2007, at 10:15, Jim Perrin wrote:
- After copying the config file an making one small change with "make xconfig", why are there so many differences in the config file?
Are they actual changes, or is the diff now simply off by a few lines?
I went back and started the process of building a kernel from scratch on a different system. This time I paid closer attention to what was going on. After the "rpmbuild -bp --target=`uname -m` kernel-2.6.spec" step, the ~/rpmbuild/BUILD/kernel-2.6.9/linux-2.6.9 directory contains among other things these two files:
-rw-r--r-- 1 rpmbuild rpmbuild 50332 Mar 12 15:32 .config -rw-r--r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:31 .config.old
Notice the size difference of these two files. After copying the config file from the ~/rpmbuild/SOURCES directory, these two files now look like this:
-rw-rw-r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:42 .config -rw-r--r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:35 .config.old
And a diff confirms the the two files are now identical. However, after doing a "make xconfig", changing two settings in the Serial Port section and saving the config file, the directory looks like this:
-rw-rw-r-- 1 rpmbuild rpmbuild 50322 Mar 12 15:44 .config -rw-rw-r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:42 .config.old
Finally, comparing the new .config file with the original .config file only shows the expected changes:
# diff /tmp/saved_configs/.config .config 4c4
< # Mon Mar 12 15:32:01 2007
# Mon Mar 12 15:44:32 2007
1501c1501
< CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_NR_UARTS=16
1503c1503
< # CONFIG_SERIAL_8250_MANY_PORTS is not set
CONFIG_SERIAL_8250_MANY_PORTS=y
While I don't quite understand what is going on, it appears that xconfig is doing the right thing. I'm rebuilding the kernel again as I type this. BTW, there are lots of compiler warnings: is this normal/expected for a kernel build?
Its kind of a sad state of affairs but the kernel since as far back as I can remember has been chock full of warnings, such that the warnings are useless to someone like you and me. Only the developers of different parts can tell which are meaningful are not...james
On 3/12/07, Alfred von Campe alfred@110.net wrote:
Are they actual changes, or is the diff now simply off by a few lines?
I went back and started the process of building a kernel from scratch on a different system. This time I paid closer attention to what was going on. After the "rpmbuild -bp --target=`uname -m` kernel-2.6.spec" step, the ~/rpmbuild/BUILD/kernel-2.6.9/linux-2.6.9 directory contains among other things these two files:
-rw-r--r-- 1 rpmbuild rpmbuild 50332 Mar 12 15:32 .config -rw-r--r-- 1 rpmbuild rpmbuild 61600 Mar 12 15:31 .config.old
I ran into much the same today using xconfig to build a RHEL-5 2.6.18-8.1.1.el5 kernel with a single change. I ran a diff and IIRC got about 50-60 lines of output. I'm sort of under the impression you can open the config with xconfig and save it and it will differ, but I haven't tested that.
rgds/ldv