2020-05-13 09:41:38 +08:00
|
|
|
|
# Yocto 基本使用和常见问题
|
2020-04-15 16:05:56 +08:00
|
|
|
|
|
|
|
|
|
## 交叉编译配置
|
|
|
|
|
|
|
|
|
|
在 yocto 根目录下:
|
|
|
|
|
|
2020-05-20 16:18:39 +08:00
|
|
|
|
```bash
|
2020-04-15 16:05:56 +08:00
|
|
|
|
source <sdk root>/oe-init-build-env
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 编译目标
|
|
|
|
|
|
|
|
|
|
使用如下命令查看所有编译目标:
|
|
|
|
|
|
2020-05-20 16:18:39 +08:00
|
|
|
|
```bash
|
2020-04-15 16:05:56 +08:00
|
|
|
|
bitbake -s
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 在 build 目录下进行编译
|
|
|
|
|
|
2020-05-20 16:18:39 +08:00
|
|
|
|
```bash
|
2020-04-15 16:05:56 +08:00
|
|
|
|
bitbake <target> -C compile
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
参数:
|
|
|
|
|
|
|
|
|
|
-C 强制编译,配置、编译目标并打包;
|
|
|
|
|
-c 不强制。
|
|
|
|
|
|
|
|
|
|
生成的文件在:
|
|
|
|
|
|
2020-05-20 16:18:39 +08:00
|
|
|
|
```bash
|
2020-04-15 16:05:56 +08:00
|
|
|
|
<yocto root>/build/tmp/deploy/images/<product>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
目录下。
|
|
|
|
|
|
2020-11-30 14:36:49 +08:00
|
|
|
|
## Clean
|
|
|
|
|
|
|
|
|
|
注意:Clena 动作会清除 build/tmp 文件夹下的源码。
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
bitbake <target> -c cleansstate
|
|
|
|
|
```
|
|
|
|
|
|
2020-04-15 16:05:56 +08:00
|
|
|
|
## Linux Kernel
|
|
|
|
|
|
|
|
|
|
Kernel 源码在:
|
|
|
|
|
|
2020-05-20 16:18:39 +08:00
|
|
|
|
```bash
|
2020-04-15 16:05:56 +08:00
|
|
|
|
<yocto root>/build/tmp/work-shared/<product>/kernel-source
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
目录下。
|
|
|
|
|
|
|
|
|
|
Kernel 配置方法为:
|
|
|
|
|
|
2020-05-20 16:18:39 +08:00
|
|
|
|
```bash
|
2020-04-15 16:05:56 +08:00
|
|
|
|
bitbake linux-renesas -c do_menuconfig
|
|
|
|
|
```
|
2020-05-13 09:41:38 +08:00
|
|
|
|
|
|
|
|
|
## 常见问题
|
|
|
|
|
|
|
|
|
|
### Please use a locale setting which supports utf-8
|
|
|
|
|
|
|
|
|
|
Yocto 需要 locales 支持且设置为 UTF8。
|
|
|
|
|
|
2020-05-20 16:18:39 +08:00
|
|
|
|
```bash
|
2020-05-13 09:41:38 +08:00
|
|
|
|
# Ubuntu
|
2022-04-29 13:20:16 +08:00
|
|
|
|
sudo apt install locales
|
2020-05-13 09:41:38 +08:00
|
|
|
|
sudo dpkg-reconfigure locales
|
2020-11-19 15:38:45 +08:00
|
|
|
|
sudo locale-gen "en_US.UTF-8"
|
|
|
|
|
sudo update-locale LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8"
|
|
|
|
|
export LANG="en_US.UTF-8"
|
2020-05-13 09:41:38 +08:00
|
|
|
|
```
|