Build Kernel - Makefile Error
Hi,
When i do #make menuconfig, #make oldconfig, or any #make command (from the kernel's repository: /usr/src/linux$) i get: Code:
make: Makefile: No such file or directory |
Quote:
|
You should not be building in /usr/src/linux. You should install kernel source in a work area under your home directory and build there. The README file in the top-level directory of the kernel has instructions to build it.
http://lxr.free-electrons.com/source/README http://kernelnewbies.org/KernelBuild |
If /usr/src/linux is initially empty why would this be a problem if you could become root and were able to disconnect from the internet to run the make process(s)?
Fred. |
Quote:
|
Reason 1, yes I suppose so, but do you run fakeroot instead?
For reason 2, I get: Quote:
Quote:
Fred. |
/usr/src/linux should be left to distro kernel install, not for custom kernels
I mean /lib/modules/$(uname -r)/source link is created after kernel install, if you mess with your custom kernel and want to revert to the distro kernel, you won't be able to compile new modules (nvidia driver for example), as source link for reverted kernel will point to wrong sources |
But /usr/src/linux does not exist until you create it.
The reason why the original poster might get errors could be explained by reference to: and in particular (relating to Ubuntu, if that is your distro) Quote:
|
/usr/src/linux exists IF you are rebuilding system libraries so that they can interface to the kernel. If it doesn't exist at that time, you can't rebuild the libraries. It is to be owned by root to avoid the user from mucking up the system.
The intent is to provide kernel headers for the system libc (and some others) rebuld process. The kernel is NOT to be put there. It belongs in a users workspace, the kernel rebuild is completely self contained. The only step requiring root is the final installation step that copies things to /boot, /lib/modules, and modifies any boot menus. |
jpollard,
so, if you create /usr/src/linux, as root, where there was only /usr/src and do your build there it will not 'interface' with the current system only the source code you have downloaded from kernel.org? The finished kernel would still be inoperative until you put somewhere it could work,i.e., /boot /lib/modules. If you are using your home pc (disconnected from the internet) I don't see any advantage from putting the build in user space, unless there is more space. Fred. |
Quote:
Kernel developers designed the kernel to be compiled by a user. That is why it is done that way. Too many times the ability to compile an out-of-distribution driver failed because the wrong kernel headers are in /usr/src... So to silence the complaints, they moved the development out. Doing it in /usr/src hasn't been done since about version 2 of the kernel. More flexible, ability to have multiple compiles (bisections searching for regressions for one thing), no ownership issues or access problems... And it keeps the installed system safe for updates. |
Quote:
But on systems where I have compiled kernels on, /usr/src exists but is empty, on this pc it contains headers (this one being AntiX). Perhaps I was just lucky in that I chose Debian to to do the compiling on? I was under the impression that you could put the downloaded tarball in either the user space or /usr/src, I stuck it in the later because it was empty and would automatically have root permissions, are you saying it would still interact with the current kernel, in the case of Debian. Fred. |
As long as /lib/modules/$(uname -r)/source link points to the correct kernel source dir, it should be ok.
[edit] See Linus words about kernel source install in this README: https://github.com/torvalds/linux |
Quote:
As per the link given by keefaz: Code:
... Code:
/usr/src : Source code (optional) If you look at /lib/modules/$(uname -r)/source, it is a symbolic link to "build" (same directory), and that is a symbolic link to /usr/src/kernels/$(uname -r), which doesn't normally exist. The /usr/src directory tree is "reserved" for source code for the distribution, not experimental kernels. Now if you want to fill up /usr... go ahead. Most of the time you will get away with it. |
$ less README
in the root of the kernel tree. You probably skipped make mrproper which builds some of the first timer initial stuff. YMMV depending on where you got your sources from. |
All times are GMT -5. The time now is 03:05 PM. |