必威体育Betway必威体育官网
当前位置:首页 > IT技术

YOCTO使用技巧

时间:2019-06-19 02:40:00来源:IT技术作者:seo实验室小编阅读:83次「手机版」
 

jkk

1. 增加编译线程

vi build-fb/conf/local.conf

BB_NUMBER_THREADS = "32" /* 修改BitBake可以使用的线程 */

parallel_MAKE = "-j 32" /* 修改make可以使用的线程 */

2. 下载代码

bitbake fsl-image-qt5-validation-imx -c fetchall

3. 使用图形化界面查看软件依赖关系

bitbake --ui=depexp -g bluez5

4. 选择编译适合自己的交叉编译器

将自己选择好的写入vi build-fb/conf/local.conf中:

5. 使用包管理器

vi build-fb/conf/local.conf

PACKAGE_CLASSES ?= "package_rpm"

增加以上选项,编译后就可以生成rpm包了:

build-fb/tmp/deploy/rpm/imx6qsabresd/

配置文件服务器

wxli@ubuntu:/bt/wxli/temp/fsl/linux/fsl-release-bsp/build-fb/tmp/deploy/rpm/imx6qsabresd$ Python -m SimpleHTTPServer 8000

Serving HTTP on 0.0.0.0 port 8000 ...

192.168.0.51 - - [23/Mar/2018 13:24:24] "GET / HTTP/1.1" 200 -

192.168.0.51 - - [23/Mar/2018 13:24:24] code 404, message file not found

192.168.0.51 - - [23/Mar/2018 13:24:24] "GET /favicon.ico HTTP/1.1" 404 -

http://192.168.0.53:8000/

查看包的status:

smart stats

使用的smart工具添加channel:

sudo smart channel --add imx6qsabresd type=rpm-md baseurl=http://192.168.0.53:8000/imx6qsabresd

更新状态:

sudo smart update

查看包的status:

wxli@ubuntu:/bt/wxli/temp/fsl/linux/fsl-release-bsp/build-fb/tmp/deploy/rpm$ smart stats

Loading cache...

Updating cache... ################################################################################################################### [100%]

Installed Packages: 1294

Total Packages: 56499

Total Provides: 62101

Total requires: 40759

Total Upgrades: 56499

Total Conflicts: 11789

6. 查找包名

bitbake -s | grep XXX

7. yocto添加自己的应用程序

a. 样例演示

1)创建样例 brcm-88335

wxli@ubuntu:/bt/wxli/temp/fsl/linux/fsl-release-bsp/sourrces$ yocto-layer create brcm-88335

Please enter the layer priority you'd like to use for the layer: [default: 6] # 优先级

would you like to have an example recipe created? (y/n) [default: n] y # 是否包含一个样例

Please enter the name you'd like to use for your example recipe: [default: example] brcm-88335 # 样例名字

Would you like to have an example bbAPPend file created? (y/n) [default: n] y # 是否创建样例的bbappend文件

Please enter the name you'd like to use for your bbappend file: [default: example] brcm-88335 # 样例的bbappend名字

Please enter the version number you'd like to use for your bbappend file (this should match the recipe you're appending to): [default: 0.1]

New layer created in meta-brcm-88335.

Don't forget to add it to your BBlayers (for details see meta-brcm-88335/README).

wxli@ubuntu:/bt/wxli/temp/fsl/linux/fsl-release-bsp/build-fb/tmp/work/cortexa9hf-neon-poky-linux-gnueabi$

2) 执行成功后生成yocto layer路径如下:

sources/meta-brcm-88335

sources/meta-brcm-88335/recipes-example/example/brcm-88335-0.1

vi conf/bblayers.conf

+ BBLAYERS += " ${BSPDIR}/sources/meta-brcm-88335 "

3)将新建的层添加到工程中

vi ./fsl-setup-release.sh

META_FSL_BSP_RELEASE="${CWD}/sources/meta-fsl-bsp-release/imx/meta-bsp"

echo "##Freescale Yocto Project Release layer" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-bsp \"" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-sdk \"" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-browser \"" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-gnome \"" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-networking \"" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-python \"" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-filesystems \"" >> $BUILD_DIR/conf/bblayers.conf

+ echo "BBLAYERS += \" \${BSPDIR}/sources/meta-brcm-88335 \"" >> $BUILD_DIR/conf/bblayers.conf

echo "BBLAYERS += \" \${BSPDIR}/sources/meta-qt5 \"" >> $BUILD_DIR/conf/bblayers.conf

4)编译新建样例

DISTRO=fsl-imx-fb MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-fb

bitbake brcm-88335

或者

bitbake -b ../sources/meta-brcm-88335/recipes-brcm/brcm/brcm-88335_0.1.bb -v

5) 编译成功后中间文件目录

build-fb/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/brcm-88335

b.实例演示

1)创建 brcm-88335

wxli@ubuntu:/bt/wxli/temp/fsl/linux/fsl-release-bsp/sources$ yocto-layer create brcm-88335

Please enter the layer priority you'd like to use for the layer: [default: 6]

Would you like to have an example recipe created? (y/n) [default: n] n

Would you like to have an example bbappend file created? (y/n) [default: n] n

New layer created in meta-brcm-88335.

Don't forget to add it to your BBLAYERS (for details see meta-brcm-88335/README).

2)创建bb文件

vi sources/meta-brcm-88335/brcm-88335_0.1.bb

DESCRIPTION = "hello world and Zlib test"

DEPENDS = "zlib"

SECTION = "libs"

LICENSE = "MIT"

# PV = "3"

# PR = "r0"

SRC_URI = " \

file://brcm_patchram_plus.c \

file://makefile \

"

LIC_FILES_CHKSUM = "file://brcm_patchram_plus.c;md5=627e9612337e5ef6027a87a79c491446"

S = "${WORKDIR}"

do_compile () {

make

}

do_install () {

install -d ${D}${bindir}/

install -m 0755 ${S}/brcm_patchram_plus ${D}${bindir}/

}

FILES_${PN} = "${bindir}/brcm_patchram_plus"

INSANE_SKIP_${PN} = "ldflags"

#For dev packages only

INSANE_SKIP_${PN}-dev = "ldflags"

3)创建源码目录brcm-88335-0.1,源文件brcm_patchram_plus.c, Makefile

4) Makefile

vi sources/meta-brcm-88335/brcm-88335-0.1/Makefile

TARGET=brcm_patchram_plus

LDFLAGS= -lz

all: $(TARGET)

helloYocto: brcm_patchram_plus.o

$(CC) $(CFLAGS) -o $@ $^

#zlibtest: zlibtest.o

# $(CC) $(CFLAGS1) -o $@ $^ $(LDFLAGS)

clean:

rm -f $(OBJS) $(TARGET)

5) 修改bblayers.conf,增加bitbake编译选项,支持编译brcm-88335_0.1.bb

vi build-fb/conf/bblayers.conf

+ BBLAYERS += " ${BSPDIR}/sources/meta-brcm-88335 "

6)编译

DISTRO=fsl-imx-fb MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-fb

bitbake brcm-88335

或者

bitbake -b ../sources/meta-brcm-88335/recipes-brcm/brcm/brcm-88335_0.1.bb -v

相关阅读

分享到:

栏目导航

推荐阅读

热门阅读