[CentOS] CentOS6: Building a modified kernel rpm

Wed Mar 30 10:19:50 UTC 2016
Patrick Begou <Patrick.Begou at legi.grenoble-inp.fr>

Dear Akemi,

I'm really ashamed, in "https://wiki.centos.org/HowTos/I_need_the_Kernel_Source" 
I've missed the last 5 lines following the CentOS5 section. All is now clear for 
me on the process to follow to build a new kernel from source rpm and the 
CONFIG_NUMA_EMU option is active.
I've set it with make menuconfig to avoid some additional mistakes in the config 
file.

However, with this CONFIG_NUMA_EMU option , the compiler returns an error and 
compilation fails.
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'
make[2]: *** [arch/x86/mm/srat_64.o] Error 1
make[1]: *** [arch/x86/mm] Error 2
make: *** [arch/x86] Error 2
make: *** Waiting for unfinished jobs....
error: Bad exit status from /var/tmp/rpm-tmp.VkJ805 (%build)
     Bad exit status from /var/tmp/rpm-tmp.VkJ805 (%build)

Without CONFIG_NUMA_EMU option, compilation is successfull.
It is the CentOSplus kernel from kernel-2.6.32-573.el6.centos.plus.src.rpm as 
yous suggested.

Thank for your patience

Patrick

Akemi Yagi wrote:
> On Tue, Mar 29, 2016 at 2:27 AM, Patrick Begou <
> Patrick.Begou at legi.grenoble-inp.fr> wrote:
>
>> Akemi Yagi wrote:
>>
>>> 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
>>>
>>> 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
>>
> The referenced wiki article should work for building CentOS-6 kernels (not
> quite ready for CentOS-7). You really have to dot the i's and cross the
> t's. If you miss a step or command in there, chances are it will fail.
>
>
>> 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.
>>
> As you found out, editing the existing config-x86-generic file would not
> work because the final config file is created on the fly. This is why the
> wiki instructions tell you to create your customized config file and show
> you how to get that config file to be used during the build process.
>
> I have another suggestion for you. Get the srpm for the CentOSPlus kernel
> instead of the distro kernel. The plus kernel is a customized kernel. It
> has kernel-xx-config files that you can directly edit. They will not be
> overwritten. Perhaps this method is easier.
>
> But if you wish to go for the original method, just be extremely precise
> not to skip any step.
>
> Hope this helps,
>
> Akemi
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>


-- 
===================================================================
|  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                   |
===================================================================