简体   繁体   中英

When compiling a custom kernel modules_install results in an error

I am trying to install a custom kernel and all goes fine except when i run make modules_install it results in the following:

ln: target ‘/lib/modules/4.2.0-rc4/source’ is not a directory
Makefile:1120: recipe for target '_modinst_' failed
make: *** [_modinst_] Error 1

I looked up line number 1120 in Makefile and it contained this:

_modinst_:
    @rm -rf $(MODLIB)/kernel
    @rm -f $(MODLIB)/source
    @mkdir -p $(MODLIB)/kernel

I googled a lot and all i found was it occurred (mostly what i found) due to an extra space in the EXTRAVERSION variable in the Makefile but there is no space in my Makefile.

Can anyone point me in the right direction?

Edit :

I followed the suggestions in comments below and did ls -al /lib/modules/4.2.0-rc4/ . There is no source file or source directory present and running modules_install with the make --trace produces this:

Makefile:1120: target '_modinst_' does not exist
rm -rf /lib/modules/4.2.0-rc4/kernel
rm -f /lib/modules/4.2.0-rc4/source
mkdir -p /lib/modules/4.2.0-rc4/kernel
ln -s `cd . && /bin/pwd` /lib/modules/4.2.0-rc4/source
ln: target ‘/lib/modules/4.2.0-rc4/source’ is not a directory
Makefile:1120: recipe for target '_modinst_' failed
make: *** [_modinst_] Error 1 

You didn't include the entire rule that appeared at line 1120; there must have been more text after the mkdir , that you didn't show. You need to show at least enough of the rule that we can see what might have gone wrong... in particular since your error message relates to ln you need to show the line containing the ln command.

However, based on the info you provided from make --trace , I'll bet I know what's wrong.

The problem is that the path to your working directory contains a directory with a space in the name. In other words if you run pwd you'll see there's directory name with a space in it. Or, possibly some other special character but most likely it's a space.

Don't do that: rename or move your current directory to someplace where the path doesn't contain a space.

Suppose your path is something like /home/myself/My Source Code/info . Then the ln command is:

ln -s /home/myself/My Source Code/info /lib/modules/4.2.0-rc4/source

which is an invalid command, because each of those words is treated as a separate argument, as if you'd written:

ln -s '/home/myself/My' 'Source' 'Code/info' '/lib/modules/4.2.0-rc4/source'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM