No Makefile in kernel source

Hi,

I’ve tried to install several times kernel sources on Leap 15.1 (via zypper or Yast ; I’ve emptied my /usr/src directory before last install), but I always have the same problem: I can’t find a “Makefile” in it (and previously I didn’t have either .config nor makefile) ; therefore I can’t configure (and build) kernel :

# ls -a /usr/src/linux-4.12.14-lp151.28.52
.   .cocciconfig  .get_maintainer.ignore  .mailmap  CREDITS        MAINTAINERS  README.SUSE  block  crypto   firmware  init  kernel  mm   samples   sound  usr
..  .config       .gitattributes          COPYING   Documentation  README       arch         certs  drivers  fs        ipc   lib     net  security  tools  virt


Logically :


/usr/src/linux-4.12.14-lp151.28.52# make menuconfig
make: *** No rule to make target 'menuconfig'.  Stop.

On the other hand, no problem with vanilla sources :

# ls -a /usr/src/linux-4.12.14-lp151.28.52-vanilla/
.   .cocciconfig  .config.old             .gitattributes  COPYING  Documentation  Kconfig      Makefile  arch   certs   drivers   fs       init  kernel  mm   samples  security  tools  virt
..  .config       .get_maintainer.ignore  .mailmap        CREDITS  Kbuild         MAINTAINERS  README    block  crypto  firmware  include  ipc   lib     net  scripts  sound     usr

usr/src/linux-4.12.14-lp151.28.52-vanilla# make menuconfig
  HOSTCC  scripts/basic/fixdep

etc.

I’m not an expert in compiling kernel questions, but I’ve never experienced that in other distributions like Debian, Fedora or Gentoo.

Moreover I’ve searched on the web and I couldn’t find users with similar problems in comparable situations. I’ve asked on alionet.org forum (a French forum dedicated to OpenSuse) and I couldn’ get a satisfactory answer. No help found either in kernel documentation folder.

I guess I am missing something. Could someone help?

@Akar:

Take a look here: <https://en.opensuse.org/Kernel> and, here: <https://en.opensuse.org/openSUSE:Kernel_git>.

Show exact command and its output that you use to install kernel sources.

and previously I didn’t have either .config

.config is not and should not be present in openSUSE kernel sources. These packages are pristine kernel sources with separate object directory. .config for each kernel flavor is located in flavor-specific build directory; all of them share the same /usr/src/linux-$VERSION.

therefore I can’t configure (and build) kernel

You should never build kernel in /usr/src/linux; you break openSUSE packages and make impossible to build external modules for openSUSE kernels.

After running ‘zypper remove kernel-source’:

# zypper in kernel-source
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  kernel-source

1 new package to install.
Overall download size: 107.3 MiB. Already cached: 0 B. After the operation, additional
704.8 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package kernel-source-4.12.14-lp151.28.52.1.noarch
                                                    (1/1), 107.3 MiB (704.8 MiB unpacked)
Retrieving: kernel-source-4.12.14-lp151.28.52.1.noarch.rpm ...........[done (11.1 MiB/s)]

Checking for file conflicts: ......................................................[done]
(1/1) Installing: kernel-source-4.12.14-lp151.28.52.1.noarch ......................[done]

.config is not and should not be present in openSUSE kernel sources. These packages are pristine kernel sources with separate object directory. .config for each kernel flavor is located in flavor-specific build directory; all of them share the same /usr/src/linux-$VERSION.

You should never build kernel in /usr/src/linux; you break openSUSE packages and make impossible to build external modules for openSUSE kernels.

Indeed I could eventually find a vast serie of configfiles in /usr/src/linux-4.12.14-lp151.28.52/arch/. I understand better now. Thanks, and thanks for the advice too!

Makefile is part of kerne-devel RPM. kernel-source RPM requires kernel-devel, so you apparently have kernel-devel already installed. When you deleted content of /usr/src/, you also deleted files that belong to kernel-devel. But package is still marked as installed in RPM database, so installing kernel-source does not (re-)install kernel-devel.

Remove both kernel-devel and kernel-source, clean up /usr/src (at least /usr/src/linux-$VERSION mathching packages you removed) and install kernel-source again. It should now install both packages. Do not remove anything else in /usr/src without first verifying which package owns these directories. And never manually remove files/directories owned by installed packages.

You seem to misunderstand. This directory is still part of kernel source. Kernel object directories are /usr/src/linux-xxx-obj and belong to kernel-flavor-devel packages (e.g. kernel-default-devel). And each such directory has .config file for this specific kernel variant.

Agreed, you’re missing something: <https://kernel.opensuse.org/&gt;.

Welcome To The openSUSE Kernel Site

For example, the “Stable kernel branch” «aka “Tumbleweed”»: <https://kernel.opensuse.org/stable.html&gt;.

If you just want to hack on the sources and do not need to package the kernel, use the kernel git repository. This one has the same layout as the upstream kernel. Clone command:

git clone https://github.com/openSUSE/kernel -b stable

Alternatively, you can use the absolute “bleeding edge”: https://kernel.opensuse.org/master.html

This is the master kernel branch. It will eventually be branched into the next openSUSE kernel release, but for now it tracks the upstream kernel.org releases.

Use this branch at your own risk and please report bugs against openSUSE Factory.

git clone https://github.com/openSUSE/kernel -b master

[HR][/HR]Please note the following from the “Kernel git” Wiki:

Building kernel packages

scripts/tar-up.sh

This creates a source package in the kernel-source subdirectory. You can use rpmbuild to build a kernel RPM, or if you have a Build Service account, use the osc_wrapper script: