1、安装Ubuntu环境,硬盘配置至少100GB大小
2、更换ubutun软件源。编辑/etc/apt/sources.list文件,添加以下内容
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
然后执行
sudo apt-get update
sudo apt-get upgrade
3、安装开发中必要的支持软件
sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm sed cvs subversion help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc npm meson tree
sudo apt-get install -y git build-essential libsdl1.2-dev texinfo gawk chrpath diffstatsudo apt-get install -y liblz4-tool zstd
sudo apt-get install -y ipmitool
4、配置git
git config --global user.name XXXX (github官网注册的用户名)
git config --global user.email XXXX@xxxx.com (gitub官网注册绑定的邮箱)
查看配置
git config --list
生成SSH秘钥
ssh-keygen -t rsa -C "XXXX@xxxx.com"
gedit ~/.ssh/id_rsa.pub
登录git官网,网址:https://github.com/。
右上角 登陆后点击settings->SSH and GPS keys->New SSH key,添加id_rsa.pub中的内容
5、下载openBmc源码
git clone git@github.com:openbmc/openbmc.git
6、编译openbmc
. setup evb-ast2600
sudo vim conf/local.conf,添加三行
BB_NUMBER_THREADS ='8' #(修改编译线程的数量,改为多线程)
PARALLEL_MAKE ='-j 8' #(修改cpu核的数量,不宜超过电脑cpu核数量)
BB_NO_NETWORK = "1" #网络环境不好的时候,配置成离线编译
编译并显示时间
time bitbake obmc-phosphor-image
只下载代码不编译:
bitbake obmc-phosphor-image -c fetch
清除编译
bitbake -c clean -v u-boot
bitbake -c cleanall xx-image #清除所有编译中间
bitbake -c cleansstate xx-image #清除编译