Step by Step write Bitbake simple HelloWorld Expamle (2)

Source: Internet
Author: User
Tags mkdir parse error yocto

This time does not follow Bitbake's introduction. Instead of stepping through the steps to solve the problems encountered in the middle


Create a new env.sh to initialize the environment.

The start content is as follows, step by step Add. and runs through the source env.sh


The initial time to create a working directory HelloWorld. If not,

#!/bin/sh

if! [-D HelloWorld];then

mkdir HelloWorld

Fi


1 need to be able to execute Bitbake command

#!/bin/sh
if! [-D HelloWorld];then
mkdir HelloWorld
Fi

Export path= $PATH:/home/xxxx/yocto/poky/bitbake/bin



Run Bitbake Tips

The Bbpath variable is not set and bitbake do not find a conf/bblayers.conf xxxxxx

Bbpath variable not found

2 Add the Bbpath variable. Set the working directory to HelloWorld enter this working directory at the same time

CD HelloWorld

Export bbpath=$ (PWD)

You can also define a wdir =xxxx

The final script is as follows

#!/bin/sh
Export Wdir=helloworld

if! [-D $WDIR];then
mkdir $WDIR
Fi
Export path= $PATH:/home/xxxx/yocto/poky/bitbake/bin
CD $WDIR
Export bbpath=$ (PWD)



Subsequent operations are not written in the script.

Run Bitbake Tips

File conf/bitbake.conf not found In/home/xxxx/yocto/poky/helloworld

4 Create a new conf directory in the HelloWorld directory. and add a bitbake.conf file


Tip Unable to parse/lib/bb/parse/parse_py/confhandler.py Classes/base.bbclass

This is because all recipes are automatically integrated with a class file called Base.bbclass. This base.bbclass defines a series of basic compilation processes. Do_fetch do_unpack ... do_build


5 Create a new classes directory in the HelloWorld directory. Create a new Base.bbclass file

Run prompt

Error:please set the ' Persistent_dir ' or ' CACHE ' variable

You want to set the cache variable. This variable is set in the bitbake.conf. Remember the quoted number

Tmpdir= "${topdir}/tmp"
CACHE = "${tmpdir}/cache"

Run Bitbake Tips

Nothing to do. Use "Bitbake World" to build everything, or run ' bitbake--help ' for usage information.


The configuration of the variables to which this description is based has been completed. The HelloWorld directory structure is as follows (Bitbake/bin's directory is not included here,)


----HelloWorld

----Classes

----Base.bbclass

----conf

----bitbake.conf




6 running Bitbake HelloWorld The default is to perform do_build tasks

Tips

Error:no recipe files to build, check your Bbpath and bbfiles?

The reason is there is no bb recipe file at all. How does Bitbake know how to compile HelloWorld?

We also set a variable inside the bitbake.conf bbfiles

Bbfiles= "${TOPDIR}/*.BB"

It means parsing all files in the HelloWorld directory with the suffix BB.

7 Run Bitbake HelloWorld again

Hint error:nothing provides ' HelloWorld '

Because there are no BB files in the directory

So we're building a new helloworld.bb.


8 Run Bitbake HelloWorld again

Tips

For task in Tasks

TypeError: ' Nonetype ' object is not iterable

Without any task

So we're going to define the default Do_build task in the BB file.

DESCRIPTION = "Prints Hello World"
PN = ' HelloWorld '
PV = ' 1 '
Python Do_build () {
Bb.plain ("********************");
Bb.plain ("* *");
Bb.plain ("* Hello, World Recpie");
Bb.plain ("* *");
Bb.plain ("********************");
}
AddTask Do_build


A BB file is either empty. Otherwise, there must be a description description. Otherwise parse error

PN = ' HelloWorld ' is the package name
PV = ' 1 ' package version


Python do_build () is called Python to perform do_build tasks. The task is to print


8 Run the prompt again if the stamp is missing, it's not currentxxx

We did not set the stamp directory. This is set in the Bitbake.conf file.

STAMP = "${tmpdir}/stamps"

9 Run the prompt again "T variable not set

We did not set the T directory. This is set in the Bitbake.conf file.

t= "${tmpdir}/work"


10 run again prompt i = p.rfind ('/') + 1
Attributeerror: ' Nonetype ' object has no attribute ' RFind '

This is not set B directory is also bitbake.conf


b= "${tmpdir}"



Run Perfect execution again

********************
*                  *
* Hello, World Recpie
*                  *
********************



After the explanation of the B catalogue and the T directory, etc.











Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.