首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Yocto构建中将第三方库作为包添加

如何在Yocto构建中将第三方库作为包添加
EN

Stack Overflow用户
提问于 2018-08-28 13:35:19
回答 1查看 3.8K关注 0票数 4

我有一个不出名的库,而且这个库https://github.com/dailab/libsml没有可用的包,通常我通过执行make install在设备上安装这个库。

如何将这个库作为包添加到我的Linux发行版中。就像我可以在我的local.conf中添加python或任何其他菜谱一样

我的local.conf看起来像这样

代码语言:javascript
复制
MACHINE ?= "phyboard-regor-am335x-1"

DISTRO ?= "yogurt"

# The following line disables the autostart of the phytec-qtdemo by
# default, but you can start the demo anytime using
#  $ systemctl start phytec-qtdemo.service
#SYSTEMD_AUTO_ENABLE_pn-phytec-qtdemo = "disable"

# That are the default values of bitbake.  Adapt these to your workspace and
# host preferences.
#DL_DIR = "${TOPDIR}/downloads"
#SSTATE_DIR = "${TOPDIR}/sstate-cache"

# License Handling
#  - Uncomment for i.MX6 proprietary GPU libraries
#LICENSE_FLAGS_WHITELIST += "license-nxp_v14-june-2016_imx-gpu-viv"
#  - Uncomment for Freescale i.MX6 legacy VPU firmware blobs
#LICENSE_FLAGS_WHITELIST += "license-freescale_v6-february-2015_firmware-imx"

# You can disable and enable FSTYPES as you wish. e.g. 'ext4'.
# This is ordering dependend. IMAGE_FSTYPES += "tar.gz" IMAGE_FSTYPES_append_mx6 = " sdcard ubifs" IMAGE_FSTYPES_append_ti33x
= " sdcard ubifs" IMAGE_FSTYPES_append_rk3288 = " sdcard"
#IMAGE_FSTYPES_append_ti33x = " emmc" DEPLOY_DIR = "${TOPDIR}/deploy"

# Select configuration UI for linux and barebox recipe. The openembedded
# default is 'menuconfig', 'nconfig' has more features.
#KCONFIG_CONFIG_COMMAND = "menuconfig" KCONFIG_CONFIG_COMMAND = "nconfig"

# Turn on debugging options of the kernel
# This is currently only supported for the TI kernel v4.4 DEBUG_BUILD_pn-linux-ti = "1"

# The default package class of the distro yogurt is 'package_ipk'. The first
# value is used as the package manager to build the image and sdk. To build
# also tar packages use
#PACKAGE_CLASSES = "package_ipk package_tar"

# Variable IMAGE_ROOTFS_EXTRA_SPACE from poky/meta/conf/documentation.conf:
#   Defines additional free disk space created in the image in Kbytes. By
#   default, this variable is set to '0'.
# This example line adds an additional 512 MiB of free space to the root
# filesystem:
#IMAGE_ROOTFS_EXTRA_SPACE = "524288"

# See http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#ref-features-image
#   "Through these variables, you can add several different predefined
#    packages such as development utilities or packages with debug information
#    needed to investigate application problems or profile applications EXTRA_IMAGE_FEATURES = ""
# - "Makes an image suitable for development (e.g. allows root logins without
#    passwords and enables post-installation logging)" EXTRA_IMAGE_FEATURES += "debug-tweaks"
# - "Installs debug symbol packages for all packages installed in a given
#    image."
#EXTRA_IMAGE_FEATURES += "dbg-pkgs"
# - "Installs debugging tools such as strace and gdb."
#EXTRA_IMAGE_FEATURES += "tools-debug"
#python-netserver for python cgi IMAGE_INSTALL_append = "mc nano openvpn apache2 dhcp-server lora-gateway lora-pkt-fwd spitools python avro-c python-kafka ntp python-netserver iptables"

#SDKMACHINE ?= "x86_64"

OE_TERMINAL = "auto" PATCHRESOLVE = "noop" BB_DISKMON_DIRS = "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
    ABORT,${SSTATE_DIR},100M,1K"

CONF_VERSION = "1"

我的bblayers.conf看起来是这样的:

代码语言:javascript
复制
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

OEROOT := "/home/enilyser/sources/poky"
BBLAYERS  ?= " \
  ${OEROOT}/meta \
  ${OEROOT}/meta-poky \
  ${OEROOT}/../meta-phytec \
  ${OEROOT}/../meta-yogurt \
  ${OEROOT}/../meta-cloud-services-master/meta-openstack \
  ${OEROOT}/../meta-openembedded/meta-oe \
  ${OEROOT}/../meta-openembedded/meta-networking \
  ${OEROOT}/../meta-openembedded/meta-python \
  ${OEROOT}/../meta-openembedded/meta-multimedia \
  ${OEROOT}/../meta-qt5 \
  ${OEROOT}/../meta-openembedded/meta-ruby \
  ${OEROOT}/../meta-openembedded/meta-webserver \
  ${OEROOT}/../meta-lora-net-master \
  ${OEROOT}/../meta-lorawan-master \
  "
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-08-28 16:33:32

如果没有yocto发行版的2.4+版本,可以使用devtool添加菜谱。

代码语言:javascript
复制
devtool add libsml https://github.com/dailab/libsml

它将创建一个菜谱模板。

代码语言:javascript
复制
workspace/recipes/libsml/libsml_git.bb

这几乎是您所需要的,但有时您必须稍微调整一下,以确保交叉编译。

在这种情况下,它构建并运行测试,显然,当交叉构建时,我们可以构建测试,但是我们可以在构建机器上运行它们,所以您必须禁用它。您可以这样做,在食谱或通过补丁。通过菜谱,您将将do_configure函数更改为如下所示

代码语言:javascript
复制
do_configure () {
    # Specify any needed configure commands here
    sed -i -e "s#@./test##g" ${S}/test/Makefile
}

也可以更改do_install,这样就可以在目标上安装所需的文件。

代码语言:javascript
复制
do_install () {
    install -d ${D}${libdir} ${D}${includedir}
    install -m 0644 ${B}/sml/lib/libsml.* ${D}${libdir}
    rm -rf ${D}${libdir}/libsml.o
    cp -R --no-dereference --preserve=mode,links ${S}/sml/include/* ${D}${includedir}
    install -D -m 0644 sml.pc ${D}${libdir}/pkgconfig/sml.pc
}

来构建并查看一切是否正常

代码语言:javascript
复制
devtool build libsml

如果所有的构建,那么您就可以将配方应用到您选择的一层(例如meta)。

代码语言:javascript
复制
devtool finish libsml meta-oe -f

就是这样,现在您应该在meta层中看到菜谱,您可以尝试构建它。

代码语言:javascript
复制
bitbake libsml
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52059266

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档