当前位置: 首页 > 工具软件 > OpenBMC > 使用案例 >

【OpenBMC 系列】2.OpenBMC镜像编译流程以及如何加速编译

法弘壮
2023-12-01

1.依赖安装

Yocto
Build Host Packages
You must install essential host packages on your build host. The following command installs the host packages based on an Ubuntu distribution:

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 zstd liblz4-tool
sudo apt-get install -y git build-essential libsdl1.2-dev texinfo gawk chrpath diffstat

2.配置

. setup evb-ast2600

先到build/evb-ast2600目录下,查看配置文件:

cat conf/local.conf

想要加速编译,有如下方法:
(1)使用多线程编译:参考bitbake-user-manual
BB_NUMBER_THREADS : The maximum number of tasks BitBake should run in parallel at any one time. If your host development system supports multiple cores, a good rule of thumb is to set this variable to twice the number of cores.
一般为实际cpu核个数的两倍(本机为4物理核)

gedit openbmc/build/you_project_name/conf/local.conf

填入

BB_NUMBER_THREADS ='8' #(修改编译线程的数量,改为多线程)
PARALLEL_MAKE ='-j 8' #(修改cpu核的数量,根据实际情况修改,不宜超过电脑cpu核数量)

我的理解:
BB_NUMBER_THREADS 表示 同时执行的编译任务数编译任务,PARALLEL_MAKE 表示 编译的时候,每个任务最多使用的线程数
(2)网络环境不好的时候,配着成离线编译:

BB_NO_NETWORK = "1"

3.编译

clean build:

bitbake -c clean -v u-boot
bitbake -c cleanall     xx-image            #清除所有编译中间
bitbake -c cleansstate   xx-image            #清除编译                    

只下载代码不编译:

bitbake obmc-phosphor-image -c fetch
test@ubuntu:~/Documents/openbmc_ws/openbmc/build/evb-ast2600$ bitbake obmc-phosphor-image -c fetch
Loading cache: 100% |                                                                                   | ETA:  --:--:--
Loaded 0 entries from dependency cache.
WARNING: /home/test/Documents/openbmc_ws/openbmc/meta-phosphor/recipes-phosphor/mrw/mrw-api-native.bb: QA Issue: mrw-api-native: native/nativesdk class is not inherited last, this can result in unexpected behaviour. Classes inherited after native/nativesdk: mrw-rev.bbclass perl-version.bbclass cpan-base.bbclass perlnative.bbclass [native-last]
Parsing recipes: 100% |#########################################################################################################| Time: 0:02:21
Parsing of 2629 .bb files complete (0 cached, 2629 parsed). 4034 targets, 370 skipped, 0 masked, 0 errors.
WARNING: No bb files in default matched BBFILE_PATTERN_meta-evb-ast2600 '^/home/test/Documents/openbmc_ws/openbmc/meta-evb/meta-evb-aspeed/meta-evb-ast2600/'
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.51.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-18.04"
TARGET_SYS           = "arm-openbmc-linux-gnueabi"
MACHINE              = "evb-ast2600"
DISTRO               = "openbmc-phosphor"
DISTRO_VERSION       = "nodistro.0"
TUNE_FEATURES        = "arm armv7a vfp vfpv4d16 callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            
meta-oe              
meta-networking      
meta-perl            
meta-python          
meta-security        
meta-phosphor        
meta-aspeed          
meta-evb-ast2600     = "master:7843a81ebc3592ec45793964880328937305b8c2"

Initialising tasks: 100% |######################################################################################################| Time: 0:00:00
Sstate summary: Wanted 0 Local 0 Network 0 Missed 0 Current 0 (0% match, 0% complete)
NOTE: No setscene tasks
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded.

Summary: There were 2 WARNING messages shown.
test@ubuntu:~/Documents/openbmc_ws/openbmc/build/evb-ast2600$ time bitbake obmc-phosphor-image 
Loading cache: 100% |###########################################################################################################| Time: 0:00:01
Loaded 4033 entries from dependency cache.
Parsing recipes: 100% |#########################################################################################################| Time: 0:00:00
Parsing of 2629 .bb files complete (2628 cached, 1 parsed). 4034 targets, 370 skipped, 0 masked, 0 errors.
WARNING: No bb files in default matched BBFILE_PATTERN_meta-evb-ast2600 '^/home/test/Documents/openbmc_ws/openbmc/meta-evb/meta-evb-aspeed/meta-evb-ast2600/'
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.51.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-18.04"
TARGET_SYS           = "arm-openbmc-linux-gnueabi"
MACHINE              = "evb-ast2600"
DISTRO               = "openbmc-phosphor"
DISTRO_VERSION       = "nodistro.0"
TUNE_FEATURES        = "arm armv7a vfp vfpv4d16 callconvention-hard"
TARGET_FPU           = "hard"

编译并显示时间
time bitbake obmc-phosphor-image

test@ubuntu:~/Documents/openbmc_ws/openbmc/build/evb-ast2600$ bitbake obmc-phosphor-image 
Loading cache: 100% |#######################################################################################################################################################################| Time: 0:00:00
Loaded 4033 entries from dependency cache.
Parsing recipes: 100% |#####################################################################################################################################################################| Time: 0:00:00
Parsing of 2629 .bb files complete (2628 cached, 1 parsed). 4034 targets, 370 skipped, 0 masked, 0 errors.
WARNING: No bb files in default matched BBFILE_PATTERN_meta-evb-ast2600 '^/home/test/Documents/openbmc_ws/openbmc/meta-evb/meta-evb-aspeed/meta-evb-ast2600/'
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.51.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-18.04"
TARGET_SYS           = "arm-openbmc-linux-gnueabi"
MACHINE              = "evb-ast2600"
DISTRO               = "openbmc-phosphor"
DISTRO_VERSION       = "nodistro.0"
TUNE_FEATURES        = "arm armv7a vfp vfpv4d16 callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            
meta-oe              
meta-networking      
meta-perl            
meta-python          
meta-security        
meta-phosphor        
meta-aspeed          
meta-evb-ast2600     = "master:7843a81ebc3592ec45793964880328937305b8c2"

Initialising tasks: 100% |##################################################################################################################################################################| Time: 0:00:02
Sstate summary: Wanted 0 Local 0 Network 0 Missed 0 Current 1334 (0% match, 100% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 3782 tasks of which 3782 didn't need to be rerun and all succeeded.

Summary: There was 1 WARNING message shown.
real	40m16.310s
user	0m10.051s
sys	0m2.011s

 类似资料: