更新时间:2022-04-09 23:40:48
/lib/modules/$(uname -r)/build通常是到执行构建目录的软链接.因此,执行此操作的方法是简单地执行
Typically /lib/modules/$(uname -r)/build is a soft-link to the directory where performed the build. So the way to do this is to simply do a
make modules_install INSTALL_MOD_PATH=/some/root/
在内核的构建目录中,其中/some/root是您希望交叉编译片段结束的位置.这将在/some/root/lib/modules/$(uname -r)中创建指向您的内核构建路径的链接...验证.
in the build directory of the kernel where /some/root is where you want your cross compile pieces to end up. This will create a link to your kernel build path in /some/root/lib/modules/$(uname -r) ... verify that.
现在,当您构建compat_wireless驱动程序时,使用KLIB_BUILD变量在Makefile中将内核构建目录指定为/some/root(读取Makefile)
Now when you build the compat_wireless drivers specify the kernel build directory in the Makefile as /some/root using the KLIB_BUILD variable (read the Makefile)
make modules KLIB_BUILD=/some/root/lib/modules/$(uname -r)/build
这应该为您解决问题.
编辑A
回答以下您的评论:
将"newmodules"保留在内核目录之外,将其放在内核目录中是个坏主意.所以mkdir newmodules像/home/foo或/tmp之类的东西.这是构建链接搞砸的原因之一
Keep "newmodules" outside the kernel directory it's a bad idea to put it in the the kernel directory. so mkdir newmodules somewhere like /home/foo or /tmp or something. This is one of the reasons your build link is screwed up
ALSO .../build是/to/kernel/build/location的软链接,它将仅作为软链接进行复制.您还需要使用相同的相对位置,将实际的内核源代码/内核构建目录复制到您的microSD上.例如,
ALSO .../build is a soft link /to/kernel/build/location it will only copy over as a soft-link. You also need to copy over the actual kernel source / kernel build directory to your microSD, using the same relative location. For example,
假设您的内核源位于:
/usr/src/linux-3.5.0/
您的内核构建目录是:
/usr/src/linux-3.5.0-build/
您的新模块(在以下1.之后)位于:
Your newmodules (after following 1.) is in:
/tmp/newmodules/
因此,在/tmp/newmodules/下,您会看到安装在树中的模块,如:
So under /tmp/newmodules/ you see the modules installed in a tree like:
lib/modules/$(uname -r)/
在此目录中执行ls -al时,您会看到该构建是指向以下内容的软链接:
when you do an ls -al in this directory, you'll see that build is a soft link to:
build -> /usr/src/linux-3.5.0-build/
现在,假设您的microSD安装在/mnt/microSD下
Now let's say your microSD is mounted under /mnt/microSD
然后您需要执行以下操作
then you need to do the following
mkdir -p /mnt/microSD/usr/src
cp -a /usr/src/linux-3.5.0 /usr/src/linux-3.5.0-build /mnt/microSD/usr/src
cp -a /tmp/newmodules/lib /mnt/microSD/lib
现在,您拥有将其带到嵌入式环境所需的所有内容.我认为您是在目标系统上进行compat_wireless构建,而不是交叉编译?
Now you have all the content you need to bring over to your embedded environment. I take it you are doing the compat_wireless build on your target system rather than cross compiling it?
如果您的内核版本与内核源代码相同,则只需复制内核源代码,而忽略上述复制说明中的linux-3.5.0-build
If your kernel build is the same as the kernel source then just copy over the kernel source and ignore the linux-3.5.0-build
in copy instructions above