hamid
hamid

Reputation: 714

How to fix 'make: *** [modules_install] Error 1' error in compiling linux kernel?

I want to add a system call to linux kernel 3.14.61 that print 'hello world'.
First I downloaded kernel 3.14.61 source code then followed these steps.

1- I add 316 64 hello sys_hello line to arch/x86/syscalls/syscall_64.tbl file.

2- Then I add asmlinkage long sys_hello(void); line to include/linux/syscalls.h file.

3- I create a new file named hello.c in kernel. Address of hello.c file is kernel/hello.c, and I put in it this:

#include <linux/kernel.h>

asmlinkage long sys_hello(void) {
    printk("hello world\n");
    return 0;
}

4- Then I add hello.o to kernel/Makefile at the end of obj-y like this:

obj-y     = fork.o exec_domain.o panic.o \
    cpu.o exit.o itimer.o time.o softirq.o resource.o \
    sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \
    signal.o sys.o kmod.o workqueue.o pid.o task_work.o \
    extable.o params.o posix-timers.o \
    kthread.o sys_ni.o posix-cpu-timers.o \
    hrtimer.o nsproxy.o \
    notifier.o ksysfs.o cred.o reboot.o \
    async.o range.o groups.o smpboot.o hello.o

5- After top 4 steps I tried to compile custom kernel. So I ran these commands, one by one:

‫‪make‬‬ ‫‪localmodconfig‬‬
make oldconfig
‫‪make‬‬ ‫‪–j2‬‬
‫‪sudo‬‬ ‫‪make‬‬ ‫‪modules_install‬‬

But when I ran the last command (sudo make modules_install) I saw this error:

The present kernel configuration has modules disabled.
Type 'make config' and enable loadable module support.
Then build a kernel with module support enabled.

make: *** [modules_install] Error 1

How can I fix it?

Upvotes: 2

Views: 4633

Answers (1)

mfro
mfro

Reputation: 3335

Apparently, your kernel config has loadable modules disabled, thus it doesn't make much sense to install them.

There is probably something wrong with your kernel config.

Upvotes: 1

Related Questions