使用 Openembedded 烘焙具有依赖项的 Linux 内核模块
Linux 内核模块 (LKM) B 依赖于 LKM A 提供的符号。
因此,构建 LKM B 需要以下内容:
- 中的头文件
- LKM A符号表 (请参阅 Kbuild 详细信息文档)
我使用 BitBake 配方来构建 LKM A 和 B。我所做的:
- 将 LKM A 的头文件和符号表传播到暂存包含目录
${STAGING_INCDIR}< /代码>。
- 我提供舞台包括和 符号表的路径为
KBUILD_EXTRA_SYMBOLS
变量到 LKM B 的 Makefile
示例:
#BB-recipe for LKM A
# Staging of .h files and symbol-table
do_install_append () {
install -d ${STAGING_INCDIR}
install ${WORKDIR}/${PN}/src/*.h ${STAGING_INCDIR}/
install ${WORKDIR}/${PN}/Module.symvers ${STAGING_INCDIR}/rtserial.symvers
}
#BB-recipe for LKM B
do_compile () {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS CC LD CPP
cd "${WORKDIR}/mstp"
oe_runmake KDIR="${KERNEL_SOURCE}" \
ARCH="${ARCH}" \
CROSS_COMPILE="${CROSS_COMPILE}" \
IDIR="${STAGING_INCDIR}" \
KBUILD_EXTRA_SYMBOLS="${STAGING_INCDIR}/rtserial.symvers" \
build
}
问题:
- do_install_append 是否是暂存共享资源的正确任务?我读到 do_staging() 有些已弃用...
- 在哪里暂存符号表?
感谢您提供任何最佳实践提示。
The Linux Kernel Modules (LKM) B depends on Symbols provided by LKM A.
Thus the following is required to build LKM B:
- Header files from LKM A
- Symbol-table (see Kbuild
Documentation for details)
I use a BitBake recipe to build LKMs A and B. What I do:
- I propagate the header files and the symbol-table of LKM A into the staging include directory
${STAGING_INCDIR}
. - I feed the staging include and the
path to the symbol-table asKBUILD_EXTRA_SYMBOLS
variable into
the Makefile of LKM B
Example:
#BB-recipe for LKM A
# Staging of .h files and symbol-table
do_install_append () {
install -d ${STAGING_INCDIR}
install ${WORKDIR}/${PN}/src/*.h ${STAGING_INCDIR}/
install ${WORKDIR}/${PN}/Module.symvers ${STAGING_INCDIR}/rtserial.symvers
}
#BB-recipe for LKM B
do_compile () {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS CC LD CPP
cd "${WORKDIR}/mstp"
oe_runmake KDIR="${KERNEL_SOURCE}" \
ARCH="${ARCH}" \
CROSS_COMPILE="${CROSS_COMPILE}" \
IDIR="${STAGING_INCDIR}" \
KBUILD_EXTRA_SYMBOLS="${STAGING_INCDIR}/rtserial.symvers" \
build
}
Questions:
- Is the do_install_append the right task to stage shared resources? I read that do_staging() is somewhat deprecated ...
- Where to stage the symbol-table?
Thanks for any Best Practices hints.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于当前的 OpenEmbedded 和非“传统”暂存,不再直接进行任何暂存。所有内容都通过 do_install 安装到标准位置(即相对于 ${D} 而不是暂存位置),并且系统会根据该位置自动填充 sysroot。因此,我建议将 KVM A 的标头安装到 ${D}${includedir}/${PN},并将符号表安装到 ${D}${datadir}/${PN},然后 KVM B 仍然看起来在 STAGING_INCDIR 和 STAGING_DATADIR 处获取这些文件。您可能需要设置 NATIVE_INSTALL_WORKS = "1" 以让它知道修改后的 do_install 可以安全地与新样式暂存一起使用。
With current OpenEmbedded and non "legacy" staging, no staging is done directly anymore. Everything gets installed to standard locations with do_install (that is, relative to ${D} rather than the staging locations), and the system automatically populates the sysroot(s) based upon that. So, I'd suggest installing KVM A's headers to ${D}${includedir}/${PN}, and install the symbol table to ${D}${datadir}/${PN}, then KVM B still looks at STAGING_INCDIR and STAGING_DATADIR to get at those files. You may need to set NATIVE_INSTALL_WORKS = "1" to let it know that the modified do_install is safe to use with new style staging.