mirror of
https://git.yoctoproject.org/meta-zephyr
synced 2026-01-29 13:58:40 +01:00
README: update build guide with bitbake-setup
update build guide to use bitbake-setup. also drop the reference to poky Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
This commit is contained in:
committed by
Lee Chee Yang
parent
3097b198fe
commit
95f464af4a
125
README.md
125
README.md
@@ -6,75 +6,110 @@ This layer enables building Zephyr using Yocto Project.
|
||||
|
||||
This layer depends on:
|
||||
|
||||
URI: https://git.yoctoproject.org/poky
|
||||
layers: meta
|
||||
branch: master
|
||||
URI: https://git.openembedded.org/bitbake
|
||||
branch: master
|
||||
|
||||
URI: https://git.openembedded.org/meta-openembedded
|
||||
layers: meta-oe, meta-python
|
||||
branch: master
|
||||
URI: https://git.openembedded.org/openembedded-core
|
||||
layers: meta
|
||||
branch: master
|
||||
|
||||
URI: https://git.openembedded.org/meta-openembedded
|
||||
layers: meta-oe, meta-python
|
||||
branch: master
|
||||
|
||||
## Building Zephyr Images via bitbake recipes
|
||||
|
||||
More detailed and up-to-date information can be found here:
|
||||
### Quick Build
|
||||
|
||||
https://wiki.yoctoproject.org/wiki/TipsAndTricks/BuildingZephyrImages
|
||||
Ensure your build host meets the
|
||||
[Yocto Project system requirements](https://docs.yoctoproject.org/ref-manual/system-requirements.html)
|
||||
and follow the
|
||||
[Quick Build setup guide](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html#yocto-project-quick-build)
|
||||
to setup the host enviroment.
|
||||
|
||||
> **Pre-requisites:**
|
||||
1. Refer [Yocto Project Quick Build]( https://docs.yoctoproject.org/dev/singleindex.html#yocto-project-quick-build) documentation.
|
||||
Clone the following repos:
|
||||
|
||||
2. Clone and add following layers to BBLAYERS
|
||||
* meta-openembedded/meta-oe
|
||||
* meta-openembedded/meta-python
|
||||
* meta-zephyr-core
|
||||
* meta-zephyr-bsp
|
||||
```
|
||||
$ mkdir sources
|
||||
$ git clone -b <release-branch> https://git.yoctoproject.org/poky
|
||||
$ git clone -b <branch-name> https://git.openembedded.org/meta-openembedded
|
||||
$ git clone -b <branch-name> https://git.yoctoproject.org/meta-zephyr
|
||||
$ source poky/oe-init-build-env
|
||||
$ bitbake-layers add-layer ../meta-openembedded/meta-oe
|
||||
$ bitbake-layers add-layer ../meta-openembedded/meta-python
|
||||
$ bitbake-layers add-layer ../meta-zephyr/meta-zephyr-core
|
||||
$ bitbake-layers add-layer ../meta-zephyr/meta-zephyr-bsp
|
||||
- bitbake
|
||||
- meta-zephyr
|
||||
|
||||
```console
|
||||
git clone https://git.openembedded.org/bitbake
|
||||
git clone https://git.yoctoproject.org/meta-zephyr
|
||||
```
|
||||
|
||||
### Building and Running Zephyr Samples
|
||||
Initialize default build configuration with bitbake-setup:
|
||||
|
||||
You can build Zephyr samples. There are several sample recipes.
|
||||
|
||||
To use the Yocto toolchain, modify local conf by adding:
|
||||
```
|
||||
DISTRO = "zephyr"
|
||||
```console
|
||||
./bitbake/bin/bitbake-setup init --non-interactive \
|
||||
./meta-zephyr/zephyr-master.conf.json \
|
||||
zephyr-default distro/zephy machine/qemu-x86
|
||||
```
|
||||
|
||||
To use the Zephyr pre-built toolchain, modify local conf by adding:
|
||||
```
|
||||
ZEPHYR_TOOLCHAIN_VARIANT = "zephyr"
|
||||
Alternatively, run bitbake-setup with interactive mode to choose for
|
||||
different configuration:
|
||||
|
||||
```console
|
||||
./bitbake/bin/bitbake-setup init ./meta-zephyr/zephyr-master.conf.json
|
||||
```
|
||||
|
||||
For example, to build the Zephyr "philosophers" sample:
|
||||
Initialize build environment
|
||||
|
||||
```console
|
||||
source ./bitbake-builds/zephyr-master/build/init-build-env
|
||||
```
|
||||
$ MACHINE=qemu-x86 bitbake zephyr-philosophers
|
||||
|
||||
build the Zephyr "helloworld" sample:
|
||||
|
||||
```console
|
||||
bitbake zephyr-helloworld
|
||||
```
|
||||
|
||||
### Building and Running other Zephyr Samples
|
||||
|
||||
You can build other Zephyr samples. There are several sample recipes
|
||||
[available here](https://git.yoctoproject.org/meta-zephyr/tree/meta-zephyr-core/recipes-kernel/zephyr-kernel).
|
||||
|
||||
For example, to build the
|
||||
[Zephyr "philosophers" sample](https://git.yoctoproject.org/meta-zephyr/tree/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb):
|
||||
|
||||
```console
|
||||
bitbake zephyr-philosophers
|
||||
```
|
||||
|
||||
You can then run the created "philosophers" image in qemu:
|
||||
```
|
||||
$ runqemu qemu-x86
|
||||
|
||||
```console
|
||||
runqemu
|
||||
```
|
||||
|
||||
The same sample, for ARM image:
|
||||
```
|
||||
$ MACHINE=qemu-cortex-m3 bitbake zephyr-philosophers
|
||||
$ runqemu qemu-cortex-m3
|
||||
The same sample can be built for other machines/boards, for example ARM Cortex-M3:
|
||||
|
||||
```console
|
||||
bitbake-config-build enable-fragment machine/qemu-cortex-m3
|
||||
bitbake zephyr-philosophers
|
||||
runqemu
|
||||
```
|
||||
|
||||
The same sample, for Nios2 image:
|
||||
Alternatively, you can use the MACHINE variable to define the target machine,
|
||||
you will need to disable the machine fragment to prevent conflict:
|
||||
|
||||
```console
|
||||
bitbake-config-build disable-fragment machine/qemu-x86
|
||||
MACHINE=qemu-cortex-m3 bitbake zephyr-philosophers
|
||||
runqemu qemu-cortex-m3
|
||||
```
|
||||
$ MACHINE=qemu-nios2 bitbake zephyr-philosophers
|
||||
$ runqemu qemu-nios2
|
||||
|
||||
The default configuration (with `zephyr` DISTRO) uses the Yocto Project toolchain
|
||||
to compile Zephyr applications. To use the Zephyr pre-built toolchain instead,
|
||||
modify `local.conf` by adding:
|
||||
|
||||
```
|
||||
ZEPHYR_TOOLCHAIN_VARIANT = "zephyr"
|
||||
```
|
||||
|
||||
Other Tips and Tricks for building zephyr image can be found
|
||||
[here](https://wiki.yoctoproject.org/wiki/TipsAndTricks/BuildingZephyrImages).
|
||||
|
||||
|
||||
### Flashing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user