红联Linux门户
Linux帮助

求救:modules.builtin: No such file or directory

发布时间:2017-05-06 12:02:04来源:红联作者:guozhi
1. cat /proc/version
Linux version 4.4.0-77-generic ([email protected]) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017
2. 编辑的hello.c模块程序
#include
#include

MODULE_LICENSE("GPL v2");

int __init hello_init(void)
{
printk("hello everyone!\n");

return 0;
}

void __exit hello_exit(void)
{
printk("bye bye!\n");
}

module_init(hello_init);
module_exit(hello_exit);

3. hello.c同目录下的Makefile文件内容:
KERNELDIR ?= /home/ubuntukylin/UbuntuTest/LinkTest/KernelSource/android-kernel-samsung-dev

obj-m += hello.o

default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_PATH=/home/ubuntukylin/workdir/FileSystem-Yaffs2 modules_install

clean:
rm -rf *.o *.ko *.mod* *.sy* *.ord* .*cmd .tmp*
其中指明的内核路径是正确的,指明的模块安装路径也是正确的。
4. 执行:arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-mpfr=/opt/FriendlyARM/toolschain/4.4.3 --with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.4.3 (ctng-1.6.1)
5. 文件结构如下:
tree
.
├── hello.c
└── Makefile
6. 执行:make
make -C /home/ubuntukylin/UbuntuTest/LinkTest/KernelSource/android-kernel-samsung-dev M=/home/ubuntukylin/UbuntuTest/Drivers/t0 modules
make[1]: Entering directory '/home/ubuntukylin/UbuntuTest/LinkTest/KernelSource/android-kernel-samsung-dev'
CC [M] /home/ubuntukylin/UbuntuTest/Drivers/t0/hello.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/ubuntukylin/UbuntuTest/Drivers/t0/hello.mod.o
LD [M] /home/ubuntukylin/UbuntuTest/Drivers/t0/hello.ko
make[1]: Leaving directory '/home/ubuntukylin/UbuntuTest/LinkTest/KernelSource/android-kernel-samsung-dev'
[email protected]:/home/ubuntukylin/UbuntuTest/Drivers/t0#
7. 执行:make install
make -C /home/ubuntukylin/UbuntuTest/LinkTest/KernelSource/android-kernel-samsung-dev M=/home/ubuntukylin/UbuntuTest/Drivers/t0 INSTALL_MOD_PATH=/home/ubuntukylin/workdir/FileSystem-Yaffs2 modules_install
make[1]: Entering directory '/home/ubuntukylin/UbuntuTest/LinkTest/KernelSource/android-kernel-samsung-dev'
INSTALL /home/ubuntukylin/UbuntuTest/Drivers/t0/hello.ko
DEPMOD 2.6.35.7
depmod: WARNING: could not open /home/ubuntukylin/workdir/FileSystem-Yaffs2/lib/modules/2.6.35.7/modules.builtin: No such file or directory
make[1]: Leaving directory '/home/ubuntukylin/UbuntuTest/LinkTest/KernelSource/android-kernel-samsung-dev'
[email protected]:/home/ubuntukylin/UbuntuTest/Drivers/t0#
8. 执行:[email protected]:/home/ubuntukylin/workdir/FileSystem-Yaffs2/lib/modules/2.6.35.7# tree
.
├── extra
│   └── hello.ko
├── modules.alias
├── modules.alias.bin
├── modules.builtin.bin
├── modules.dep
├── modules.dep.bb
├── modules.dep.bin
├── modules.devname
├── modules.order
├── modules.softdep
├── modules.symbols
└── modules.symbols.bin

1 directory, 12 files
[email protected]:/home/ubuntukylin/workdir/FileSystem-Yaffs2/lib/modules/2.6.35.7#
9. 请问:第7处当中出现的Warning为什么出现?怎么解决?
谢谢各位大侠,希望可以得到你们的赐教。谢谢!
[email protected]na.com
文章评论

共有 1 条评论

  1. duanshupeng 于 2017-06-21 10:36:14发表:

    66