[CentOS] CentOS6: Building a modified kernel rpm

Patrick Begou
Tue, 29 Mar 2016 09:27:02 -0000

Akemi Yagi wrote:
> On Fri, Mar 25, 2016 at 9:57 AM, Patrick Begou <
> Patrick.Begou at legi.grenoble-inp.fr> wrote:
>
>> I'm very confused on the right step to use to setup a modified
kernel in
>> centOS6.
>>
>> As a simple user, I've downloaded the latests sources (I'm
runing an old
>> kernel version) :
>>
>> rpm -i
>>
http://vault.centos.org/6.7/updates/Source/SPackages/kernel-2.6.32-573.22.1.el6.src.rpm
>>
>> in the spec file ~/rpmbuild/SPECS/kernel.spec I've set:
>> %define buildid .numa
>>
>> Now I want to set *CONFIG_NUMA_EMU=y*
>> before runing:
>> rpmbuild -bb --without xen --without debug --without debuginfo
>> --target=x86_64 ./SPECS/kernel.spec
>>
>> But where shoud I set this CONFIG_NUMA_EMU option ?
>> I've tested several config files where this options was specified
(using
>> grep as a last solution)  but each build reset my choice and it is not
>> available in the final kernel.
>>
>> And google is a little bit confusing for me with many and many
diverging
>> informations.
>>
>> Thank to kernel gourous for their advices.
>>
>> Patrick
>>
> I recommend you follows the instructions in this CentOS wiki article:
>
> https://wiki.centos.org/HowTos/Custom_Kernel
>
> If you encounter any issue, please let us know here.
>
> Akemi
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>
Thanks for answering Akemi . Indeed I tried using this howto before posting but
something is wrong in this tutorial.

I installed the prerequisites and downloaded the kernel sources as detailed in
section 2 of https://wiki.centos.org/HowTos/I_need_the_Kernel_Source.

But on https://wiki.centos.org/HowTos/Custom_Kernel, section 2, all goes wrong!
My ~/rpmbuild/BUILD directory is empty!
No configs directory too.
No ~/rpmbuild/BUILD/kernel-*/linux-*/ available, all configs files are in
~/rpmbuild/SOURCES

Since this I try to modify ~/rpmbuild/SOURCES/config-x86-generic because it was
the only file containing the CONFIG_ACPI_NUMA flag. No success, the build does
not take account of my changes as the
~/rpmbuild/BUILD/kernel-2.6.32-573.22.1.el6/linux-2.6.32-573.22.1.el6.numa.x86_64/.config
created file with:
rpmbuild -bb --without xen --without debug --without debuginfo --target=x86_64
./SPECS/kernel.spec
says "# CONFIG_NUMA_EMU is not set"

So I change this file with an editor and rebuild the rpm package of the kernel
with the same command. The .config file is overwriten.

Today I've founded the "Howto Rebuild Centos 6.0 Linux Kernel"
page of Vaidas
Jablonskis
(https://jablonskis.org/2011/howto-rebuild-centos-6-0-linux-kernel/index.html)

rpm -i
http://vault.centos.org/6.7/updates/Source/SPackages/kernel-2.6.32-573.22.1.el6.src.rpm
edit ~/rpmbuild/SPECS/kernel.spec to set the buildid
rpmbuild -bp ~/rpmbuild/SPECS/kernel.spec
cd
~/rpmbuild/BUILD/kernel-2.6.32-573.22.1.el6/linux-2.6.32-573.22.1.el6.numa.x86_64/
edit .config  or make menuconfig to set CONFIG_NUMA_EMU=y
make rpm

But compilation fails with
arch/x86/mm/srat_64.c: In function 'acpi_fake_nodes':
arch/x86/mm/srat_64.c:469: error: implicit declaration of function
'__acpi_map_pxm_to_node'

An error i've met some years ago and the only work arround found was to use
an
older kernel source package.

Patrick
||

--
==================================================================|  Equipe
M.O.S.T.         |                                      |
|  Patrick BEGOU           | mailto:Patrick.Begou at grenoble-inp.fr |
|  LEGI                    |                                      |
|  BP 53 X                 | Tel 04 76 82 51 35                   |
|  38041 GRENOBLE CEDEX    | Fax 04 76 82 52 71                   |
===================================================================