栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

<Linux> 使用Yocto构建Linux OS

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

<Linux> 使用Yocto构建Linux OS

编译环境: Ubuntu 18

目的: 通过Yocto项目构建Linux OS,并通过qemu模拟运行.

官方网址: [https://www.yoctoproject.org/]

官方教程: [https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html]

1, 搭建编译环境
$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev
2, 下载项目源码
$ git clone git://git.yoctoproject.org/poky
3, 初始化环境变量
$ cd poky/
$ source oe-init-build-env

You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to, for
example, select a different MACHINE (target hardware). See conf/local.conf
for more information as common configuration options are commented.

You had no conf/bblayers.conf file. This configuration file has therefore
been created for you with some default values. To add additional metadata
layers into your configuration please add entries to conf/bblayers.conf.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    https://docs.yoctoproject.org

For more information about OpenEmbedded see their website:
    https://www.openembedded.org/

### Shell environment set up for builds. ###

You can now run 'bitbake '

Common targets are:
    core-image-minimal
    core-image-full-cmdline
    core-image-sato
    core-image-weston
    meta-toolchain
    meta-ide-support

You can also run generated QEMU images with a command like 'runqemu qemux86-64'

Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package tasks
4, 编译

初始化环境变量的时候,我们没有指定目录,相关命令会自动在poky目录下创建默认目录build/,并自动进入此目录,我们根据Step 3的提示信息,执行如下编译命令:

例如,编译最小镜像:

# 编译最小镜像
$ bitbake core-image-minimal

又或者,编译带图形UI镜像:

# 编译带图形界面镜像
$ bitbake core-image-sato

当然,可以都编译,只是会占比较多内存.

Note:
编译过程中会从互联网镜像网站,下载相关package源码的资源,其中有一部分资源,当前国内网络环境无法访问,需要科学上网,嫌麻烦的话,我在本文末尾会陆续提供部分资源的可下载链接,希望可以帮助到有需要的人.

5, 运行
$ runqemu qemux86-64

如果,编译了多个工程,则可以显式指定运行哪个工程,如下:

显式运行:core-image-minimal编译工程:

$ runqemu qemux86-64 core-image-minimal ext4

显式运行:core-image-sato编译工程:

$ runqemu qemux86-64 core-image-sato ext4
6, 效果

core-image-minimal编译工程(无图形界面),运行效果:

 

core-image-sato编译工程(有图形界面),运行效果:

 相关资源下载链接(任选其一):

1, github    # 陆续更新

2, pan.baidu.com # 陆续更新

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/277381.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号