-   Linux - Newbie (
-   -   Kernel fails to compile (

richucj 05-22-2019 07:24 AM

Kernel fails to compile
After including a driver in kernel using make menuconfig.
I try to build the entire kernel but it throws error as below.

scripts/kconfig/conf --silentoldconfig Kconfig
*** Configuration file ".config" not found!
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.

Can anyone explain how to rectify these?

hazel 05-22-2019 10:01 AM

You need a configuration file (always called .config) to build a kernel. You can get one with sensible defaults by using the command make defconfig. Then use make menuconfig to explore the configuration and make any necessary changes.

richucj 05-22-2019 11:35 PM

Thanks for your reply,

I try to build the kernel after using make defconfig and it throws another error as below.
scripts/kconfig/conf --silentoldconfig Kconfig
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_64.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
WRAP arch/x86/include/generated/asm/clkdev.h
WRAP arch/x86/include/generated/asm/mcs_spinlock.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
GEN include/generated/asm-offsets.h
CALL scripts/
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
HOSTCC scripts/selinux/genheaders/genheaders
HOSTCC scripts/selinux/mdp/mdp
HOSTCC scripts/kallsyms
HOSTCC scripts/pnmtologo
HOSTCC scripts/conmakehash
HOSTCC scripts/sortextable
CC init/main.o
In file included from include/linux/kernel_stat.h:8:0,
from init/main.c:32:
include/linux/interrupt.h: In function ‘tasklet_unlock’:
include/linux/interrupt.h:502:2: error: implicit declaration of function ‘smp_mb__before_atomic’ [-Werror=implicit-function-declaration]
include/linux/interrupt.h: In function ‘tasklet_disable_nosync’:
include/linux/interrupt.h:550:2: error: implicit declaration of function ‘smp_mb__after_atomic’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2

#### make failed to build some targets (14 seconds) ####

pan64 05-23-2019 06:13 AM

please do not post centered text, this is more or less unreadable.
You need to use code tags to insert such text.

jpollard 05-25-2019 09:46 AM

Are you building for your own system to boot, or building one for a different system?

Frequently the "defconfig" is not necessarily the right one to use, and the error messages imply there is a conflicting option being specified... (basically, a bug in the defconfig, but it can depend on which architecture is the default).

I use what is specified in the /boot/config-<version>... file.

That way I know it is coming from a working configuration foundation for the system I am using.

All I do is "cp /boot/config-<version>... .config"

All times are GMT -5. The time now is 10:20 PM.