openbmc u-boot:环境准备
romulus 为示例
jagger@jagger-u220402:~/working/openbmc$ . setup romulus
Machine romulus found in meta-ibm/meta-romulus
Common targets are:
obmc-phosphor-image
1、bitbake 查看
jagger@jagger-u220402:~/working/openbmc/build/romulus$ bitbake -s |grep u-boot
nativesdk-u-boot-tools 1:2023.07.02-r0
u-boot-aspeed-sdk 1:v2019.04+git999-r0
u-boot-fw-utils-aspeed 1:v2016.07+gitAUTOINC+1ded9fa3a2-r0
u-boot-fw-utils-aspeed-cross 1:v2016.07+gitAUTOINC+1ded9fa3a2-r0
u-boot-fw-utils-aspeed-sdk 1:v2019.04+gitAUTOINC+66672e5af3-r0
u-boot-fw-utils-aspeed-sdk-cross 1:v2019.04+gitAUTOINC+66672e5af3-r0
u-boot-tools 1:2023.07.02-r0
u-boot-tools-native 1:2023.07.02-r0
2、romulus.conf 文件查看
jagger@jagger-u220402:~/working/openbmc/meta-ibm/meta-romulus/conf/machine$ cat romulus.conf
KMACHINE = "aspeed"
KERNEL_DEVICETREE = "${KMACHINE}-bmc-opp-${MACHINE}.dtb"
UBOOT_MACHINE = "evb-ast2500_defconfig"
UBOOT_DEVICETREE = "ast2500-romulus"
require conf/machine/include/ast2500.inc
require conf/machine/include/obmc-bsp-common.inc
require conf/machine/include/openpower.inc
require conf/machine/include/p9.inc
PHOSPHOR_MRW_LICENSE = "Apache-2.0"
PHOSPHOR_MRW_LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
PHOSPHOR_MRW_URI = "git://github.com/open-power/romulus-xml;branch=master;protocol=https"
PHOSPHOR_MRW_REV = "14b471fbf37f5fb60261de001df83caf5f96d81f"
PREFERRED_PROVIDER_virtual/openpower-occ-control-config-native = "romulus-occ-control-config-native"
PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "romulus-led-manager-config-native"
PREFERRED_PROVIDER_virtual/phosphor-logging-callouts = "romulus-phosphor-logging-callouts-native"
QB_MACHINE:romulus = "-machine romulus-bmc"
QB_MEM:romulus = "-m 512"
openbmc u-boot:本地代码
devtool 获取 u-boot 代码:下面两种方式都可以
devtool modify u-boot
devtool modify u-boot-aspeed-sdk
jagger@jagger-u220402:~/working/openbmc/build/romulus$ devtool modify u-boot
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)... (09:50:51.882866)
Loading cache: 100% |########################################################################################################################################| Time: 0:00:02
Loaded 4689 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################| Time: 0:00:11
Parsing of 2882 .bb files complete (2879 cached, 3 parsed). 4691 targets, 603 skipped, 0 masked, 0 errors.
INFO: Mapping u-boot to u-boot-aspeed-sdk
ERROR: recipe u-boot-aspeed-sdk is already in your workspace
jagger@jagger-u220402:~/working/openbmc/build/romulus$ devtool modify u-boot-aspeed-sdk
NOTE: Starting bitbake server...
ERROR: recipe u-boot-aspeed-sdk is already in your workspace
openbmc u-boot:编译
jagger@jagger-u220402:~/working/openbmc/build/romulus$ bitbake u-boot
Loading cache: 100% |########################################################################################################################################| Time: 0:00:02
Loaded 4689 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################| Time: 0:00:12
Parsing of 2882 .bb files complete (2879 cached, 3 parsed). 4691 targets, 603 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "2.4.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "ubuntu-22.04"
TARGET_SYS = "arm-openbmc-linux-gnueabi"
MACHINE = "romulus"
DISTRO = "openbmc-openpower"
DISTRO_VERSION = "nodistro.0"
TUNE_FEATURES = "arm thumb arm1176jzs"
TARGET_FPU = "soft"
meta
meta-oe
meta-networking
meta-perl
meta-python
meta-phosphor
meta-aspeed
meta-openpower
meta-romulus
workspace = "master:dda5d32624f0eefd22c4ad47eb4fe18ca277c7ce"
Initialising tasks: 100% |###################################################################################################################################| Time: 0:00:02
Sstate summary: Wanted 0 Local 0 Mirrors 0 Missed 0 Current 337 (0% match, 100% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 993 tasks of which 993 didn't need to be rerun and all succeeded.
openbmc u-boot:vscode clangd 阅读代码
u-boot code source 存储路径
agger@jagger-u220402:~/working/openbmc/build/romulus/workspace/sources/u-boot-aspeed-sdk$ pwd
/home/jagger/working/openbmc/build/romulus/workspace/sources/u-boot-aspeed-sdk
u-boot code 编译生成文件存储路径
jagger@jagger-u220402:~/working/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/u-boot-aspeed-sdk/v2019.04+git999/u-boot-aspeed-sdk-v2019.04+git999$ pwd
/home/jagger/working/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/u-boot-aspeed-sdk/v2019.04+git999/u-boot-aspeed-sdk-v2019.04+git999
compile_commands.json 文件生成
拷贝 clangd-tools 到 u-boot 编译生成文件根目录下的 scripts 下
jagger@jagger-u220402:~/working/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/u-boot-aspeed-sdk/v2019.04+git999/u-boot-aspeed-sdk-v2019.04+git999$ cp ~/working/clang-tools/ ./scripts/ -rf
执行脚本,生成文件
jagger@jagger-u220402:~/working/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/u-boot-aspeed-sdk/v2019.04+git999/u-boot-aspeed-sdk-v2019.04+git999$ ./scripts/clang-tools/gen_compile_commands.py
jagger@jagger-u220402:~/working/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/u-boot-aspeed-sdk/v2019.04+git999/u-boot-aspeed-sdk-v2019.04+git999$ ls compile_commands.json
compile_commands.json
compile_commands.json 在 u-boot code source 目录下创建链接文件
jagger@jagger-u220402:~/working/openbmc/build/romulus/workspace/sources/u-boot-aspeed-sdk$ pwd
/home/jagger/working/openbmc/build/romulus/workspace/sources/u-boot-aspeed-sdk
jagger@jagger-u220402:~/working/openbmc/build/romulus/workspace/sources/u-boot-aspeed-sdk$ sudo ln -s /home/jagger/working/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/u-boot-aspeed-sdk/v2019.04+git999/u-boot-aspeed-sdk-v2019.04+git999/compile_commands.json ./compile_commands.json
jagger@jagger-u220402:~/working/openbmc/build/romulus/workspace/sources/u-boot-aspeed-sdk$ ls compile_commands.json -lh
lrwxrwxrwx 1 root root 171 9月 12 11:29 compile_commands.json -> /home/jagger/working/openbmc/build/romulus/tmp/work/romulus-openbmc-linux-gnueabi/u-boot-aspeed-sdk/v2019.04+git999/u-boot-aspeed-sdk-v2019.04+git999/compile_commands.json
openbmc u-boot vscode clangd 阅读代码
现在就可以实现代码阅读自动跳转了
vscode clangd 配置及错误处理,请参阅: