compiling kernel -- 3.9.4 -- issues - linux

I have a desktop on which fedora linux is installed. Kernel i am using is 3.9.4 .
I need to recompile my 3.9.4 kernel for CAN bus support.
My kernel source is here :---
[root#localhost 3.9.4-200.fc18.x86_64]# pwd
/usr/src/kernels/3.9.4-200.fc18.x86_64
Then i did -- make menuconfig, -- changed the configuration.
Error i get after -- make.
[root#localhost 3.9.4-200.fc18.x86_64]# make
make[1]: *** No rule to make target `/usr/src/kernels/3.9.4-200.fc18.x86_64/arch/x86/syscalls/syscall_32.tbl', needed by `arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h'. Stop.
make: *** [archheaders] Error 2
How to get rid of this error to compile my kernel ?

You need to get the entire source tree for the kernel. /usr/src/kernels/3.9.4-200.fc18.x86_64/ does not contain the entire source for the Fedora kernel, it only contains headers and makefiles for building additional modules.
You can either get the source rpm for that kernel and rebuild it. Or get a mainline kernel directly from kernel.org and build it.

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

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).

Can't figure out how to compile Linux kernel module

I have been trying to figure out how to compile a kernel module. I started with http://www.tldp.org/LDP/lkmpg/2.6/lkmpg.pdf to learn. I then found Compiling a kernel module, header problems, makefile problems to get my makefile going. After running make. I get the following output:
Building target module 2.6 kernel.
PLEASE IGNORE THE "Overriding SUBDIRS" WARNING
make -C /lib/modules/2.6.32-431.el6.i686/build SUBDIRS=/root/kerntest/hello modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-431.20.3.el6.i686'
Building modules, stage 2.
MODPOST 1 modules
make[1]: Leaving directory `/usr/src/kernels/2.6.32-431.20.3.el6.i686'
I see the .ko file, but don't see any kernel messages showing the module was activated. I also checked in /lib/modules/2.6.32-431.20.3.el6.i686/extra but there is nothing there. I also tried 'dmesg' and 'lsmod' but didn't see it.
Can anyone point me in the right direction?
I am trying this on CentOS 6.5
You need to actually load the module into the kernel after compiling by using insmod or modprobe :)

Can I use Linux kernel image even after this build failure

I am new to Linux Kernel and trying to build my first Kernel image, I am building from 3.4.28 Linux Kernel on i686 Architecture for 32 bit.
After one and half hours of build process, I got the following errors
BUILD arcarch/x86/boot/compressedh/x86/boot/bzImage
Setup is 16540 bytes (padded to 16896 bytes).
System is 4667 kB
CRC c2376a1f
Kernel: arch/x86/boot/bzImage is ready (#1)
Building modules, stage 2.
MODPOST 3508 modules
ERROR: "__sync_fetch_and_and_4" [drivers/staging/line6/line6usb.ko] undefined!
ERROR: "__sync_fetch_and_or_4" [drivers/staging/line6/line6usb.ko] undefined!
WARNING: modpost: Found 28 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
But if I go and look in the "arch/x86/boot/compressed" directory, I find vmlinux.bin image with ELF header.
I wanted to know can I use this vmlinux binary for my purpose or is a complete successful build required to make this binary fully functional.
As long as nothing relies on the kernel module line6usb.ko or any modules built after it you are likely ok.
My answer is also same as JimR; the kernel module line6usb.ko is not so much important module. Firstly disable this module by first running mrproper then after make menuconfig.
In the menuconfig find the driver in drivers staging and disable it. Later again cross compile the kernel.
disable the module in kernel configuration.
by choosing like this
device drivers ----
staging drivers

Resources