Makefile: No such file or directory & No rule to make target, while compiling Linux kernel - linux

I just download a linux kernel, add some systemcalls and then try to compile it.
While I use "make mrproper" and "menuconfig" it happened:
root#krasus-virtual-machine:/home/krasus/lib1/linux-5.19.10# make mrproper
Makefile:1022: scripts/Makefile.extrawarn: No such file or directory
make: *** No rule to make target "scripts/Makefile.extrawarn". Stop.
root#krasus-virtual-machine:/home/krasus/lib1/linux-5.19.10# make menuconfig
Makefile:611: scripts/Makefile.compiler: No such file or directory
make: *** No rule to make target "scripts/Makefile.compiler". Stop.
My vmware version is ubuntu 20.04.5 LTS with kernel 5.15.0-48,
The version of the kernel I'm compiling is linux-5.19.10.
I would really appreciate if you can give me some help, I've tried a lot but nothing worked, and now I'm crazzy about it.
Please forgive my poor English.

Related

RISC-V Linux running on Qemu

I am trying to run RISC-V linux on Qemu, following the instruction: Running 64- and 32-bit RISC-V Linux on QEMU
I have downloaded and installed the RISC-V GNU compiller Toolchain
./configure --prefix=/opt/riscv
make linux
and when I execute the command:
make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfig
I got the following error:
:~/Documents/riscv64-linux/linux$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfig
*** Default configuration is based on 'defconfig'
scripts/Kconfig.include:39: compiler 'riscv64-unknown-linux-gnu-gcc' not found
make[1]: *** [scripts/kconfig/Makefile:73: defconfig] Error 1
make: *** [Makefile:602: defconfig] Error 2
Kindly, advice how can I fix this problem.
This is standart problem, try to type whereis riscv64-unknown-linux-gnu-gcc if it get nothing, try to type riscv64- and press tab, you should see necessary prefix you need paste after CROSS_COMPILE=. Also maybe you also need add PATH variable with path to riscv-toolchain's bin in ~/.bashrc or/and in ~/.profile.
Build own linux is a big task, maybe you should learn some manuals about toolchain and building linux.
riscv toolchain link

Problems building driver on Linux kernel 5.8.x

I'm working with a Linux driver that is building on v5.7.x kernels but not on the latest v5.8.x releases.
To summarise, most of the driver is pre-built and the kernel interface is built on the target. This involves a make -f Kbuild command.
Having checked all of the relevant kernel interface files for any changes that would affect us, normally the driver would just build as usual on a new kernel. However, this time we get the following error:
make[2]: *** [scripts/Makefile.modpost:111: /path/to/source/Module.symvers] Error 1
make[1]: *** [Makefile:1669: modules] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.8.0-1.el8.elrepo.x86_64'
make: *** [Kbuild:26: default] Error 2
This is from CentOS 8.1, but the same error has been seen on Ubuntu 20.04.
I am no expert on this so interpreting these errors is a bit difficult. I have tried building with the KBUILD_VERBOSE flag and it doesn't really provide any useful information, other than the build succeeding until this point.
On previous kernels the Module.symvers file would be created but empty. On 5.8 this file is not created at all presumably due to this error. As a result, the .ko file is not created.
Finally, if we drop in the source files rather than the pre-built .o files the build does succeed. These .o files are built with a very old version of GCC (4.4.7) but we have also tried building with a much newer version (8.3.1), the same version as the target machine.
I would appreciate suggestions for things to check. Let me know if any other details would help.
Edit:
I ran make on Makefile.modpost manually and got the following output:
sudo make -f ./scripts/Makefile.modpost
WARNING: Symbol version dump "vmlinux.symvers" is missing.
Modules may not have dependencies or modversions.
make -f /scripts/Makefile.modfinal
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-050800-generic'
make[1]: /scripts/Makefile.modfinal: No such file or directory
make[1]: *** No rule to make target '/scripts/Makefile.modfinal'. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-050800-generic'
make: *** [scripts/Makefile.modpost:117: __modpost] Error 2
I am answering my own question in case it helps anyone else with this problem. Although it has never been an issue in the past, we've always had a warning that the corresponding .o.cmd file was not present for our .o_shipped files. This appears to be important in kernel 5.8 onwards and my fix was to add a touch command to the Kbuild file (i.e. "touch .driver.o.cmd"). This does not remove the warning but it allows the driver to build as normal.

Arch Linux: make - no such file or directory

I have a problem by compiling a driver (WLAN-dongle Edimax ac600).
I´m using an Archlinux on my raspberry-pi and want to install my dongle for 5Ghz. During comiling the driver I get this message. I tried to install the linux-headers without success. (in other threads it will be a solution)
Here is my output of make:
[root#raspberry_pi_1 rtl8812AU]# make make ARCH=arm CROSS_COMPILE= -C
/lib/modules/4.9.43-1-ARCH/build M=/root/rtl8812AU modules make[1]:
*** /lib/modules/4.9.43-1-ARCH/build: No such file or directory. Stop. make: *** [Makefile:1576: modules] Error 2
I found out that my pi has a two-arch...-directories:
4.9.43-1-ARCH/
4.9.51-1-ARCH/
Only the second one has the build directory...
How can I fix the problem?!
thanks a lot,
a Linux noob...
[Reputation is too low to post comment]
Use uname -r to make sure which version of the kernel you use.
If it's 4.9.43 : you have newer version of the kernel and this confuse your installer. You should reboot on the 51 one
If it's 4.9.51 : You messed up your installation step and are trying to compile for an old target. You should review the compilation process and change every mention of the 4.9.43 to 4.9.51 since it's the version you use.
If you upgrade your kernel, you may have to rebuild the thing again (You may like to have script in the future ;) ) with the new kernel version.

Setup Buildroot for an old linux kernel

I am encountering a problem while trying to setup a cross-compiler for an old linux kernel.
cp -dpRf package/config/buildroot-config /tmp/buildroot/buildroot-2009.02/project_build_mips/uclibc/buildroot-config
(cd /tmp/buildroot/buildroot-2009.02/toolchain_build_mips/linux-2.6.15; \
/usr/bin/make -j1 ARCH=mips \
HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" \
HOSTCXX="/usr/bin/g++" \
INSTALL_HDR_PATH=/tmp/buildroot/buildroot-2009.02/toolchain_build_mips/linux headers_install; \
)
make[1]: Entering directory `/tmp/buildroot/buildroot-2009.02/toolchain_build_mips/linux-2.6.15'
Makefile:486: .config: No such file or directory
make[1]: *** No rule to make target `headers_install'. Stop.
make[1]: Leaving directory `/tmp/buildroot/buildroot-2009.02/toolchain_build_mips/linux-2.6.15'
make: *** [/tmp/buildroot/buildroot-2009.02/toolchain_build_mips/linux/.configured] Error 2
notice the make[1]: *** No rule to make target 'headers_install'. Stop. line.
I made a search on stackoverflow and came across this thread:
Setup buildroot for old kernels.
The guy faced the same problem as me.
The answer, suggested using an old version of buildroot. Therefore I used buildroot-2009.02 which is the oldest version of buildroot, but still got the same result.
Please don't advise me to upgrade my kernel to a newer version, I must use particularly this version.
I would love to get explanation about what it says and maybe someone could help me fix it.
Thanks in advance.
The error you show doesn't seem to be related to building the kernel, but rather it seems to be during the toolchain (= cross-compiler) build. The toolchain needs to install the kernel headers, which are used by the C library to create system calls. To do this, buildroot uses the 'headers_install' target of the kernel.
Unfortunately, this target was only introduced in Linux 2.6.18. So with your kernel version, you cannot use buildroot to build the cross compiler.
I also don't know how you're supposed to do build a cross-compiler for such an old kernel. You can try to use the original 'crosstool' project (not crosstool-NG, that is also too modern).

Trouble Configuring Linux Kernel

I am trying to recompile the Linux kernel, but before I do this, I need to configure it. I use the following command to try to do this:
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- gconfig
where arm-xilinx-linux-gnueabi- is the prefix of the version of gcc I'm using. Unfortunately, instead of popping up the configuration window, this gives me the message:
make: *** No rule to make target `gconfig'. Stop.
Does anyone know what the problem is?
Is anyone of make xconfig, make gconfig and make menuconfig working?
I guess you aren't on the right kernel directory.
Please read this again: HOWTO compile linux kernel

Resources