[CentOS] recompiling kernel results in error: .../linux-2.6.18.i686/arch//Makefile: No such file or directory

Mon May 21 06:03:08 UTC 2007
Akemi Yagi <amyagi at gmail.com>

On 5/20/07, dcw <dwoody1 at charter.net> wrote:
> I have installed CentOS 5 with all updates. Also I have 2 ne2000 isa cards.
> In recompiling the kernel, I have been trying to follow the instructions on this URL:
>         http://wiki.centos.org/HowTos/Custom_Kernel
> The complete error message I get is:
> Makefile:403: /home/cs/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/arch//Makefile: No such file or directory


Makefile is expected to be in .../arch/i686/ not .../arch// .

I could reproduce the problem. I don't know where the source of the
problem is, but I am sure we will hear from experts on this mailing
list.  At the risk of getting reprimanded by KB, I will share my quick
and dirty solution.

Look at the first line of

SOURCES/kernel-2.6.18-`uname -m`.config

It's supposed to be # i686 (or in my case # x86_64).  ARCH is defined
by this line (around line 1917) of .spec:

Arch=`head -1 .config | cut -b 3-`  (.config comes from the above file)

But the .config file has only a # on the first line.  Therefore, ARCH
ends up with an empty string leading to an empty directory for

This means that the initial .config file in the BUILD directory was
already wrong.

So, a quick (temporary) solution is to change the # to # i686.  Not
the right way, but if you must build your kernel now, you may need to
resort to the manual editing method.  Otherwise, wait for real help.