Phytec中国的wiki
support@phytec.cn
热线:0755-61802110-803
如果需要在镜像中安装需要的软件请参考以下文档:
在yocto中怎样为系统安装/删除软件 / yocto how to add/remove packages
本文档介绍直接在开发板linux中安装需要的软件的方法, 无需再重新编译新的镜像.
生成带软件包管理工具的镜像
由于标准的镜像并没有添加软件包管理工具, 无法直接在linux中安装和卸载软件.
因此首先需要先将软件包管理工具编译进镜像里:
因为bsp生成用于开发板的软件包是ipk格式, 所以可以使用opkg这个软件包管理工具.
修改bsp包的配置文件build/conf/local.conf, 添加以下内容安装opkg这个工具:
IMAGE_INSTALL_append = " opkg"
修改配置文件后, 需要在BSP包中重新编译生成新的镜像
source sources/poky/oe-init-build-env bitbake phytec-qt5demo-image
编译完成后的镜像就带有opkg这个软件包管理工具了, 将该镜像更新到开发板中.
bsp包编译需要的软件
在bsp包查找所需要的软件是否存在:
bitbake -s | grep [software]
如:
$ bitbake -s | grep nfs-utils nfs-utils :1.3.4-r0
编译生成所需软件:
$ bitbake [software] $ bitbake nfs-utils
经过以上编译软件完成后, 该软件可在build/deploy/ipk目录下找到该软件包
nzhang@Z220:~/bsp/am335x/PD16.2.0/build/deploy/ipk$ find . -name "*nfs-utils*" ./cortexa8hf-neon/nfs-utils-dbg_1.3.3-r0_cortexa8hf-neon.ipk ./cortexa8hf-neon/nfs-utils-dev_1.3.3-r0_cortexa8hf-neon.ipk ./cortexa8hf-neon/nfs-utils-stats_1.3.3-r0_cortexa8hf-neon.ipk ./cortexa8hf-neon/nfs-utils_1.3.3-r0_cortexa8hf-neon.ipk ./cortexa8hf-neon/nfs-utils-client_1.3.3-r0_cortexa8hf-neon.ipk ./cortexa8hf-neon/nfs-utils-doc_1.3.3-r0_cortexa8hf-neon.ipk
主机建立http服务端
bsp包编译后生成的软件都是放在build/deploy/ipk目录下的.
进入bsp目录下的build/deploy/ipk目录建立http服务端
$ cd build/deploy/ipk/ $ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...
此时可在同一网段ip下的电脑使用浏览器进入该http地址, 如以下:(ip需替换为http服务端主机ip)
开发板新建opkg配置
在开发板linux的/etc/opkg目录下, 新建配置文件my_repo.conf ,配置软件源地址, 可参考如下:
src/gz all http://192.168.1.253:8000/all src/gz cortexa8hf-neon http://192.168.1.253:8000/cortexa8hf-neon src/gz phycore_am335x_1 http://192.168.1.253:8000/phycore_am335x_1 src/gz cortexa8hf-neon-ti33x http://192.168.1.253:8000/cortexa8hf-neon-ti33x
配置文件完成后, 使用以下命令更新配置
root@phycore-am335x-1:~# opkg update Downloading http://192.168.1.253:8000/all/Packages.gz. Updated source 'all'. Downloading http://192.168.1.253:8000/cortexa8hf-neon/Packages.gz. Updated source 'cortexa8hf-neon'. Downloading http://192.168.1.253:8000/phycore_am335x_1/Packages.gz. Updated source 'phycore_am335x_1'. Downloading http://192.168.1.253:8000/cortexa8hf-neon-ti33x/Packages.gz. Updated source 'cortexa8hf-neon-ti33x'.
am57x的bsp(PD19.1.1)中并没有Packages.gz这个包, 可以在BSP中执行以下命令生成这个包
bitbake package-index
开发板安装软件
使用以下命令安装bsp编译好的软件:
opkg install [software]
如安装nfs-utils,
root@phycore-am335x-1:~# opkg install nfs-utils Installing nfs-utils (1.3.3-r0) on root. Downloading http://192.168.1.253:8000/cortexa8hf-neon/nfs-utils_1.3.3-r0_cortexa8hf-neon.ipk. nfs-utils: unsatisfied recommendation for kernel-module-nfsd Installing nfs-utils-client (1.3.3-r0) on root. Downloading http://192.168.1.253:8000/cortexa8hf-neon/nfs-utils-client_1.3.3-r0_cortexa8hf-neon.ipk. Installing libnfsidmap0 (0.25-r0) on root. Downloading http://192.168.1.253:8000/cortexa8hf-neon/libnfsidmap0_0.25-r0_cortexa8hf-neon.ipk. Installing libevent (2.0.22-r0) on root. Downloading http://192.168.1.253:8000/cortexa8hf-neon/libevent_2.0.22-r0_cortexa8hf-neon.ipk. Installing libwrap0 (7.6-r10) on root. Downloading http://192.168.1.253:8000/cortexa8hf-neon/libwrap0_7.6-r10_cortexa8hf-neon.ipk. Running useradd commands... NOTE: nfs-utils: Performing useradd with [ --system --home-dir /var/lib/nfs --shell /bin/false --user-group rpcuser] Configuring libwrap0. Configuring libnfsidmap0. Configuring libevent. Configuring nfs-utils-client. Configuring nfs-utils.
以上所有操作更多详细信息可参考yocto文档:
https://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#using-runtime-package-management