我正在使用yocto并尝试在内核模块和用户应用程序中使用库。
app param1 param2 ...
最好的方法是什么?我的内核模块和我的用户应用程序正在运行,但每次我尝试实现共享库时,它都会变得非常混乱,我会收到错误(主要是因为包含文件)。
是否有一个很好的例子可以解决这样的问题或一些可能有用的关键字?
因为库在本地存储了一些信息,所以不适合复制两个目录中的文件。
提前致谢!
所以,这是更详细的情况:
UART文件夹结构:
uart_1.0.bb
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-
2.0;md5=801f80980d171dd6425610833a22dbe6"
inherit module
SRC_URI = " \
file://inc/altera_uart.h \
file://src/altera_uart.c \
file://Makefile \
"
S = "${WORKDIR}"
COMPATIBLE_MACHINE = "cyclone5"
生成文件
obj-m:= uart.o
uart-objs := ./src/altera_uart.o
SRC := $(shell pwd)
all:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
modules_install:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
clean:
rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
rm -f Module.markers Module.symvers modules.order
rm -rf .tmp_versions Modules.symvers
bitbake uart
无错误地工作。
我的应用程序名为tbdriver。所以这是文件夹结构:
tbdriver_1.0.bb
LICENSE = "CLOSED"
SRC_URI = " \
file://tbdriver.c \
"
S = "${WORKDIR}"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/tbdriver.c -o tbdriver
}
do_install() {
install -d ${D}${bindir}
install -m 0755 tbdriver ${D}${bindir}
}
bitbake tbdriver
无错误地工作。
因此,我将库(debug_protocol)添加到内核模块文件夹,将它们添加到Makefile和.bb中。因此,bitbake uart
仍可正常运行。
然后我尝试将debug_protocol.h添加到tbdriver以便也可以访问它的函数。 (顺便说一句,我尝试了很多不同的版本)
tbdriver_1.0.bb
...
SRC_URI = " \
file://../../uart/uart-1.0/src/debug_protocol.h \
file://../../uart/uart-1.0/src/debug_protocol.c \
file://tbdriver.c \
"
...
WARNING: tbdriver-1.0-r0 do_fetch: Failed to fetch URL file://../../uart/uart-1.0/src/debug_protocol.h, attempting MIRRORS if available
ERROR: tbdriver-1.0-r0 do_fetch: Fetcher failure: Unable to find file file://../../uart/uart-1.0/src/debug_protocol.h anywhere. The paths that were searched were:
../meta-ines/recipes-myrecipes/tbdriver/tbdriver-1.0/poky
../meta-ines/recipes-myrecipes/tbdriver/tbdriver/poky
../meta-ines/recipes-myrecipes/tbdriver/files/poky
../meta-ines/recipes-myrecipes/tbdriver/tbdriver-1.0/cyclone5
../meta-ines/recipes-myrecipes/tbdriver/tbdriver/cyclone5
../meta-ines/recipes-myrecipes/tbdriver/files/cyclone5
../meta-ines/recipes-myrecipes/tbdriver/tbdriver-1.0/armv7a
../meta-ines/recipes-myrecipes/tbdriver/tbdriver/armv7a
../meta-ines/recipes-myrecipes/tbdriver/files/armv7a
../meta-ines/recipes-myrecipes/tbdriver/tbdriver-1.0/arm
../meta-ines/recipes-myrecipes/tbdriver/tbdriver/arm
../meta-ines/recipes-myrecipes/tbdriver/files/arm
../meta-ines/recipes-myrecipes/tbdriver/tbdriver-1.0/
../meta-ines/recipes-myrecipes/tbdriver/tbdriver/
../meta-ines/recipes-myrecipes/tbdriver/files/
.../yocto/build/downloads
ERROR: tbdriver-1.0-r0 do_fetch: Fetcher failure for URL: 'file://../../uart/uart-1.0/src/debug_protocol.h'. Unable to fetch URL from any source.
ERROR: tbdriver-1.0-r0 do_fetch: Function failed: base_do_fetch
ERROR: Logfile of failure stored in: ../yocto/build/tmp/work/armv7a-neon-poky-linux-gnueabi/tbdriver/1.0-r0/temp/log.do_fetch.7039
ERROR: Task (/../meta-ines/recipes-myrecipes/tbdriver/tbdriver_1.0.bb:do_fetch) failed with exit code '1'
甚至可以做我正在尝试的事情吗?
是? - >你有一个示例或提示的链接吗?
没有?会有什么选择?系统调用?似乎不适合我,因为我想用两侧的功能指针(UART和App)注册函数。但如果我错了,请告诉我。
提前致谢!