【BMC】OpenBMC开发基础2:修改原有程序

这篇具有很好参考价值的文章主要介绍了【BMC】OpenBMC开发基础2:修改原有程序。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

修改原有程序

通常情况下我们会需要修改OpenBMC原有的程序来适配我们的项目,本节将介绍一般的流程。

为此首先我们需要了解devtool这个工具,注意它不是前端开发用的那个devtool,而是由OE(或者Yocto?)提供的一个用于构建、测试和打包程序的工具,在7 devtool Quick Reference — The Yocto Project ® 4.2.999 documentation有具体的介绍,我们一般用它来编辑和打包源代码。

devtool的帮助说明如下:

jw@HOME:~/openbmc/build$ devtool --help
NOTE: Starting bitbake server...
usage: devtool [--basepath BASEPATH] [--bbpath BBPATH] [-d] [-q] [--color COLOR] [-h] <subcommand> ...

OpenEmbedded development tool

options:
  --basepath BASEPATH   Base directory of SDK / build directory
  --bbpath BBPATH       Explicitly specify the BBPATH, rather than getting it from the metadata
  -d, --debug           Enable debug output
  -q, --quiet           Print only errors
  --color COLOR         Colorize output (where COLOR is auto, always, never)
  -h, --help            show this help message and exit

subcommands:
  Beginning work on a recipe:
    add                   Add a new recipe
    modify                Modify the source for an existing recipe
    upgrade               Upgrade an existing recipe
  Getting information:
    status                Show workspace status
    search                Search available recipes
    latest-version        Report the latest version of an existing recipe
    check-upgrade-status  Report upgradability for multiple (or all) recipes
  Working on a recipe in the workspace:
    build                 Build a recipe
    rename                Rename a recipe file in the workspace
    edit-recipe           Edit a recipe file
    find-recipe           Find a recipe file
    configure-help        Get help on configure script options
    update-recipe         Apply changes from external source tree to recipe
    reset                 Remove a recipe from your workspace
    finish                Finish working on a recipe in your workspace
  Testing changes on target:
    deploy-target         Deploy recipe output files to live target machine
    undeploy-target       Undeploy recipe output files in live target machine
    build-image           Build image including workspace recipe packages
  Advanced:
    create-workspace      Set up workspace in an alternative location
    extract               Extract the source for an existing recipe
    sync                  Synchronize the source tree for an existing recipe
    menuconfig            Alter build-time configuration for a recipe
    export                Export workspace into a tar archive
    import                Import exported tar archive into workspace
Use devtool <subcommand> --help to get help on a specific command

下面开始介绍如何修改源码并最终将修改之后的结果放到我们自己的项目中使用,这里以webui-vue为例。

  1. 首先我们创建一个workspace用来放置源码,前面已经提到过,OpenBMC框架中并没有实际的代码,而是需要在构建的过程中下载来,具体存放的位置就是build下的download目录:
jw@HOME:~/openbmc/build$ ls downloads/
Cython-0.29.33.tar.gz		git2_source.denx.de.u-boot.u-boot.git.tar.gz		nbd-3.24.tar.xz
Cython-0.29.33.tar.gz.done	git2_source.denx.de.u-boot.u-boot.git.tar.gz.done	nbd-3.24.tar.xz.done
Jinja2-3.1.2.tar.gz			git2_sourceware.org.git.glibc.git.tar.gz			net-snmp-5.9.3.tar.gz
Jinja2-3.1.2.tar.gz.done	git2_sourceware.org.git.glibc.git.tar.gz.done		net-snmp-5.9.3.tar.gz.done
# 后面略

这些压缩包不应该直接去修改,为此我们先创建一个目录来存放解压缩之后的源代码,这里通过devtool的create-workspace子命令来创建存放源代码的目录,执行的命令如下:

jw@HOME:~/openbmc/build$ devtool create-workspace
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)... (22:46:33.532066)
NOTE: Reconnecting to bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)... (22:46:33.532066)
NOTE: Retrying server connection (#1)... (22:46:33.532066)
NOTE: Starting bitbake server...

此时build下就会多一个workspace目录:

jw@HOME:~/openbmc/build$ ls
bitbake-cookerdaemon.log  cache  conf  downloads  sstate-cache  tmp  workspace
jw@HOME:~/openbmc/build$ tree workspace/
workspace/
├── README
└── conf
    └── layer.conf

1 directory, 2 files

里面也会有一个layer文件,实际上create-workspace就是创建了一个新的分层,并且还会修改build目录下的bblayers.conf文件来包含这个分层,这样这里面的代码才会在后续被编译和使用:

BBLAYERS ?= " \
  /home/jw/openbmc/meta \
  /home/jw/openbmc/meta-poky \
  /home/jw/openbmc/meta-openembedded/meta-oe \
  /home/jw/openbmc/meta-openembedded/meta-networking \
  /home/jw/openbmc/meta-openembedded/meta-python \
  /home/jw/openbmc/meta-phosphor \
  /home/jw/openbmc/meta-aspeed \
  /home/jw/openbmc/meta-beni \
  /home/jw/openbmc/build/workspace \ # 这个就是新增的
  "

之后我们找一个配方来修改其代码,这里就以webui-vue为例:

jw@HOME:~/openbmc/build$ bitbake -s | grep webui
phosphor-webui                      :1.0+gitAUTOINC+e16bb5c358-r1                                                    
webui-vue                           :1.0+gitAUTOINC+0f6147ca25-r1
  1. 我们需要解压它的源码并放到workspace目录中,为此需要执行devtool的modify子命令:
jw@HOME:~/openbmc/build$ devtool modify webui-vue
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)... (22:50:43.681700)
Loading cache: 100% |###############################################################################################################| Time: 0:00:00
Loaded 4383 entries from dependency cache.
Parsing recipes: 100% |###############################################################################################################| Time: 0:00:00
Parsing of 2709 .bb files complete (2708 cached, 1 parsed). 4384 targets, 566 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-20.04"
TARGET_SYS           = "arm-openbmc-linux-gnueabi"
MACHINE              = "beni-ast2500"
DISTRO               = "openbmc-phosphor"
DISTRO_VERSION       = "nodistro.0"
TUNE_FEATURES        = "arm thumb arm1176jzs"
TARGET_FPU           = "soft"
meta                 
meta-poky            
meta-oe              
meta-networking      
meta-python          
meta-phosphor        
meta-aspeed          = "HEAD:67c9d4e715c705cd05fd04f7c8cd4fad300a4666"
meta-beni            = "master:37708567fc4efacfcba74f8274edc924e7ba7a1e"
workspace            = "HEAD:67c9d4e715c705cd05fd04f7c8cd4fad300a4666"

Initialising tasks: 100% |###############################################################################################################| Time: 0:00:00
Sstate summary: Wanted 0 Local 0 Mirrors 0 Missed 0 Current 20 (0% match, 100% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 93 tasks of which 90 didn't need to be rerun and all succeeded.
INFO: Source tree extracted to /home/jw/openbmc/build/workspace/sources/webui-vue
INFO: Using source tree as build directory since that would be the default for this recipe
INFO: Recipe webui-vue now set up to build from /home/jw/openbmc/build/workspace/sources/webui-vue

此时再次查看workspace目录:

jw@HOME:~/openbmc/build$ tree workspace/
workspace/
├── README
├── appends
│   └── webui-vue_git.bbappend
├── conf
│   └── layer.conf
└── sources
    └── webui-vue
        ├── # 中间略
        └── vue.config.js

97 directories, 318 files

然后我们修改webui-vue中的某些代码,这里修改登录界面的LOGO,替换成Apple的音乐图标。重新编译webui-vue:

jw@HOME:~/openbmc/build$ devtool build webui-vue
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)... (23:04:57.342934)
Loading cache: 100% |###############################################################################################################| Time: 0:00:00
Loaded 4383 entries from dependency cache.
Parsing recipes: 100% |###############################################################################################################| Time: 0:00:00
Parsing of 2709 .bb files complete (2707 cached, 2 parsed). 4384 targets, 566 skipped, 0 masked, 0 errors.
Removing 1 recipes from the allarch sysroot: 100% |###############################################################################################################| Time: 0:00:03
Removing 1 recipes from the beni_ast2500 sysroot: 100% |###############################################################################################################| Time: 0:00:00
Loading cache: 100% |###############################################################################################################| Time: 0:00:03
Loaded 4383 entries from dependency cache.
Parsing recipes: 100% |###############################################################################################################| Time: 0:00:00
Parsing of 2709 .bb files complete (2707 cached, 2 parsed). 4384 targets, 566 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-20.04"
TARGET_SYS           = "arm-openbmc-linux-gnueabi"
MACHINE              = "beni-ast2500"
DISTRO               = "openbmc-phosphor"
DISTRO_VERSION       = "nodistro.0"
TUNE_FEATURES        = "arm thumb arm1176jzs"
TARGET_FPU           = "soft"
meta                 
meta-poky            
meta-oe              
meta-networking      
meta-python          
meta-phosphor        
meta-aspeed          = "HEAD:67c9d4e715c705cd05fd04f7c8cd4fad300a4666"
meta-beni            = "master:37708567fc4efacfcba74f8274edc924e7ba7a1e"
workspace            = "HEAD:67c9d4e715c705cd05fd04f7c8cd4fad300a4666"

Initialising tasks: 100% |###########################################################################################################| Time: 0:00:00
Sstate summary: Wanted 0 Local 0 Mirrors 0 Missed 0 Current 94 (0% match, 100% complete)
NOTE: Executing Tasks
NOTE: webui-vue: compiling from external source tree /home/jw/openbmc/build/workspace/sources/webui-vue
NOTE: Tasks Summary: Attempted 435 tasks of which 427 didn't need to be rerun and all succeeded.

可以看到编译没有问题,说明修改本身也没有问题,下面的步骤就需要合入修改的代码。

  1. 由于实际的源码是下载来的压缩包,所以无法直接修改,因此为了使最终结果生效,我们需要采取的方式是打补丁,为此先需要合入代码,这需要通过git commit的方式:
jw@HOME:~/openbmc/build/workspace/sources/webui-vue$ git commit -m "[ADD]Modify." src/assets/images/applemusic.svg --no-
verify
[devtool 53f5b88] [ADD]Modify.
 1 file changed, 1 insertion(+)
 create mode 100644 src/assets/images/applemusic.svg
jw@HOME:~/openbmc/build/workspace/sources/webui-vue$ git commit -m "[ADD]Modify." --no-verify src/layouts/LoginLayout.vue
[devtool 02f4773] [ADD]Modify.
 1 file changed, 1 insertion(+), 1 deletion(-)

这里增加了一个SVG图片,修改了Web的一行代码指向新的图片,总共有两个修改,都合入即可。然后通过devtool的update-recipe子命令生成补丁和对应的bbappend文件,并存放在我们的自定义项目目录中:

jw@HOME:~/openbmc/build$ devtool update-recipe webui-vue -a ../meta-beni/
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)... (00:14:14.267139)
Loading cache: 100% |####################################################################################| Time: 0:00:00
Loaded 4382 entries from dependency cache.
Parsing recipes: 100% |##################################################################################| Time: 0:00:00
Parsing of 2709 .bb files complete (2707 cached, 2 parsed). 4384 targets, 566 skipped, 0 masked, 0 errors.
NOTE: Writing append file /home/jw/openbmc/meta-beni/recipes-phosphor/webui/webui-vue_git.bbappend
NOTE: Copying 0001-ADD-Modify.patch to /home/jw/openbmc/meta-beni/recipes-phosphor/webui/webui-vue/0001-ADD-Modify.patch
NOTE: Copying 0002-ADD-Modify.patch to /home/jw/openbmc/meta-beni/recipes-phosphor/webui/webui-vue/0002-ADD-Modify.patch

得到的结果:

└── recipes-phosphor
    ├── packagegroups
    │   └── packagegroup-obmc-apps.bbappend
    └── webui	# 新增目录
        ├── webui-vue
        │   ├── 0001-ADD-Modify.patch
        │   └── 0002-ADD-Modify.patch
        └── webui-vue_git.bbappend
  1. 这样补丁文件就已经在我们自己的项目中了,之后可以将webui-vue在workspace中的内容删除:
jw@HOME:~/openbmc/build$ devtool reset webui-vue
NOTE: Starting bitbake server...
INFO: Cleaning sysroot for recipe webui-vue...
INFO: Preserving source tree in /home/jw/openbmc/build/workspace/attic/sources/webui-vue.20230809002034
If you no longer need it then please delete it manually.
It is also possible to reuse it via devtool source tree argument.

此时源码还在,不过已经变了名字了,如果不需要就手动删除即可。

  1. 最后重新编译OpenBMC二进制,成功之后执行该二进制,然后通过浏览器再次访问BMC的Web,得到的登录界面变成了如下的样子:

【BMC】OpenBMC开发基础2:修改原有程序,openbmc

红框部分就是新的LOGO。

到此,修改OpenBMC原有程序的操作就已经完成了。文章来源地址https://www.toymoban.com/news/detail-634777.html

到了这里,关于【BMC】OpenBMC开发基础2:修改原有程序的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 本地开发项目删除原有git信息,上传到自己的git仓库

    进入到项目的目录,右键,选择 git Bash Here 输入 rm -rf .git 查看当前的远程信息: git remote -v 如果有远程信息 使用 git remote rm origin 删除 使用 git remote add origin https://xxxx.git 此步如果报错 fatal: not a git repository (or any of the parent directories): .git 则使用 git init 进行初始化 之后再使用

    2024年02月09日
    浏览(33)
  • python使用flask实现前后端分离&通过前端修改数据库数据【全栈开发基础】

    完整代码放到了最后,时间紧张的话直接拉到最后或点击目录【🥩 完整代码】看完整代码 这里先提一下,我们运行后端代码之前需要先建立一个名字为 python 的数据库,而后在该数据库下创建表 userinfo ,因为看到有的朋友后端代码拿过去后会运行不起来或者就是直接报错了

    2023年04月09日
    浏览(32)
  • uniapp开发小程序如何修改picker选中样式及选中字体样式

    需求1:修改选中的样式 需求2:修改选中字体的颜色 indicator-class 设置选择器中间选中框的类名 2.修改选中后字体的样式(重要代码段) //选中字体样式 .pickerSelected { color: #ffffff !important; z-index: 2; } 这边是改造uview的picker组件全部代码

    2024年02月11日
    浏览(44)
  • 四、arcgispro二次开发运行程序修改的地方还是没有变踩坑

    对于arcgispro二次开发学习是一件充满兴趣并且具有好奇心的一件事,但是当创建了一个工程第一次调试成功,并出来了自己期待很久的一个程序后,当第二次修改并运行,发现一直没有反应,很是头疼,查了很多资料也没有结果,经过自己反复试验,最终发现,是因为每次运

    2024年01月25日
    浏览(26)
  • uniapp开发小程序uview的u-button样式自定义修改

    u-button组件里:customStyle=\\\"样式数据名\\\" 在data里申明样式数据名,形式为对象,注意值要加引号,且有-的只要改为驼峰命名如border-Radius

    2024年02月03日
    浏览(31)
  • 服务器硬件学习-BMC

    本专栏所有图片和文字内容均来自\\\"尚诚云IT课堂\\\",本博主只负责内容整理,如需查看源视频,请迁移指下面网址 【服务器电源与PC电源到底有什么区别?】https://www.bilibili.com/video/BV1Xr4y1B7mv?vd_source=08192e8d3b82bf20dfe6807a2901dd9e 整理内容不易,学习的朋友麻烦关注下博主,后面学习

    2024年04月26日
    浏览(31)
  • BMC管理服务器(实战)

    BMC: 它可以在机器未开机的状态下,对机器进行固件升级、查看机器设备、等一些操作。 一、实战环境 海康服务器、笔记本、网线、浏览器。用网线接入服务器的Mgmt口和笔记本的网口。 海康服务器 网线一端接入Mgmt口 网线一端接入笔记本  二、网络配置  1、服务器开机狂按

    2024年02月05日
    浏览(26)
  • ipmitool 配置BMC的ip

    要使用ipmitool配置BMC的IP地址,可以按照以下步骤进行操作: 确保已安装ipmitool工具。如果尚未安装,可以使用以下命令进行安装: |复制代码 连接到BMC:使用IPMI-over-LAN(通过网络连接)或串行连接(通过串口)等方式连接到BMC。 执行以下命令来配置BMC的IP地址: |复制代码

    2024年02月15日
    浏览(67)
  • 运维:硬件服务器BMC介绍

    BMC(Baseboard Management Controller)是硬件服务器上的一个专用子系统,它允许管理员通过独立于主操作系统、CPU和主内存的远程管理工具来监视和管理服务器的硬件状态。这种接口通常用于远程监控和管理服务器,特别是在数据中心和大规模服务器部署环境中。 BMC接口规格: 接

    2024年04月12日
    浏览(38)
  • 微信小程序的基础开发

    一个小程序主体部分由三个文件组件,必须放在项目的根目录, 一个小程序 page 页面由四个文件组件,分别为: ,js文件:用来写JavaScript wxml文件:写页面结构,可以理解为html json: 里面是页面配置 wxss:用来写css样式的文件 wxml: WXML和HTML 非常相似, WXML 由标签,属性等等构成

    2024年01月18日
    浏览(30)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包