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

news2025/2/23 19:01:54

修改原有程序

通常情况下我们会需要修改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,得到的登录界面变成了如下的样子:

在这里插入图片描述

红框部分就是新的LOGO。

到此,修改OpenBMC原有程序的操作就已经完成了。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/850995.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

当肠道免疫系统与微生物共舞:了解肠道免疫细胞和肠道菌群互作

谷禾健康 同样暴露在含有致病微生物的环境中&#xff0c;有的人很少生病&#xff0c;有的人却很容易感染并生病。这是因为每个人的机体对潜在的病原体产生的免疫应答不同。 ★ 固有免疫和适应性免疫保护着人体 人体的免疫应答分为固有免疫&#xff08;先天免疫&#xff09;和适…

AVS3:跨多通道预测PMC

前面的文章中介绍了TSCPM&#xff0c;它是AVS3中用于intra模式的跨通道预测技术&#xff0c;它利用线性模型根据亮度重建像素预测色度像素&#xff0c; 跨通道预测技术用于去除不同通道间的冗余信息&#xff0c;TSCPM可以去除Y-Cb、Y-Cr通道间的冗余&#xff0c;然而却忽略了…

# Failed to initialize NVML: Driver/library version mismatch 的解决方法

Failed to initialize NVML: Driver/library version mismatch 的解决方法 首发于知乎: https://zhuanlan.zhihu.com/p/643343668 全网同名, 欢迎大家关注我的知乎帐号! 经常电脑好好的, 昨天还可以训练, 第二天忽然驱动就掉了: 这个错误通常表示NVIDIA驱动程序和NVIDIA管理库…

Octave Conv

Octave ConvOctave Convolution 代码详解_octconv代码_zghydx1924的博客-CSDN博客 def forward(self, x):X_h, X_l xif self.stride 2:X_h, X_l self.h2g_pool(X_h), self.h2g_pool(X_l)X_h2l self.h2g_pool(X_h)# X_h2l指的是对输入进行下采样&#xff0c;下采样的方法时卷…

用python做一个小游戏代码,用python制作一个小游戏

大家好&#xff0c;小编来为大家解答以下问题&#xff0c;如何用python编写一个简单的小游戏&#xff0c;用python做一个小游戏代码&#xff0c;今天让我们一起来看看吧&#xff01; 今天呢&#xff0c;给大家展示一下Python有趣的小地方&#xff0c;展示给大家看看&#xff0c…

Android复习(Android基础-四大组件)——Service与Activity通信

我们前面学会了启动和停止服务的方法&#xff0c;但是服务虽然是在活动里启动的&#xff0c;但是启动服务之后&#xff0c;活动与服务之间基本没什么关系了。正常情况&#xff0c;我们在Activity里调用startService()方法启动MyService这个服务&#xff0c;然后MyService的onCr…

Openlayers实战:利用turf获取两个多边形的交集、差集、并集

在数据统计方面,通常会涉及到图形间的交集、并集、差集等。在Openlayers的实战中,我们显示两个多边形的交集、并集、差集的表现。通过turf的方式,可以快速的实现我们的数据处理,具体的请参考源代码。 效果图 源代码 /* * @Author: 大剑师兰特(xiaozhuanlan),还是大剑师…

three.js的镜面反射

three.js做成这种镜面反射的效果。 那就要使用three自带的功能Reflector 1.引入 组件 import { Reflector } from ../../node_modules/three/examples/jsm/objects/Reflector.js; 2.创建反射投影的存在面 let reflectorGeometry new THREE.PlaneBufferGeometry(100, 100); 3…

Java经典面试题总结(一)

Java经典面试题总结&#xff08;一&#xff09; 题一&#xff1a;Java编译运行原理题二&#xff1a;JDK&#xff0c;JVM&#xff0c;JRE三者之间的关系题三&#xff1a;谈一下对冯诺依曼体系的了解题四&#xff1a;重载与重写的区别题五&#xff1a;拆箱装箱是指什么&#xff1…

Spring源码解析(八):bean后置处理器CommonAnnotationBeanPostProcessor

Spring源码系列文章 Spring源码解析(一)&#xff1a;环境搭建 Spring源码解析(二)&#xff1a;bean容器的创建、默认后置处理器、扫描包路径bean Spring源码解析(三)&#xff1a;bean容器的刷新 Spring源码解析(四)&#xff1a;单例bean的创建流程 Spring源码解析(五)&…

本地项目如何连接git远程仓库

在本地新建项目后&#xff0c;如何连接git远程仓库呢&#xff1f;步骤如下&#xff1a; 第一步&#xff0c; 首先我们在git上新建仓库&#xff0c;设置模板可勾选Readme文件。&#xff08;readme文件的创建是为了介绍所写代码的一些详细信息,为了之后更好的维护。&#xff09;…

记录问题: servlet获取项目包绝对路径

【2023-8-8 23:46:27 星期二】 如何获取在webapp下的路径?而不是target包下的webapp目录 比如这里应该获取到 F:\Tiam\Desktop\freemarker\freemarker-demo01\src\main\webapp 而readPath总是获取到 F:\Tiam\Desktop\freemarker\freemarker-demo01\target\freemarker-demo0…

Leetcode-每日一题【剑指 Offer 11. 旋转数组的最小数字】

题目 把一个数组最开始的若干个元素搬到数组的末尾&#xff0c;我们称之为数组的旋转。 给你一个可能存在 重复 元素值的数组 numbers &#xff0c;它原来是一个升序排列的数组&#xff0c;并按上述情形进行了一次旋转。请返回旋转数组的最小元素。例如&#xff0c;数组 [3,4…

Styletron: 面向组件的样式设计工具包

styletron官网&#xff1a; styletron的GitHub链接&#xff1a; styletron-react 一. 介绍 Styletron是一个通用的component-oriented&#xff08;面向组件的&#xff09;样式工具。它属于css-in-js类别。Styletron可以很好地与React配合使用&#xff0c;但也可以与其他框架或…

Allegro172版本无法低亮颜色的解决办法

Allegro172版本无法低亮颜色的解决办法 在用Allegro172版本做PCB设计的时候,高亮颜色是常用的命令,同时将高亮的颜色去高亮也是使用的十分频繁。 有时在去高亮的时候会出现无法去高亮的情况如下图 右边这块铜皮被高亮成了白色 可以看到即便使用去高亮命令,铜皮的颜色仍然还…

初次使用GPU云服务器

前言&#xff1a; 在体验了GPU云服务器&#xff08;GPU Cloud Computing&#xff0c;GPU&#xff09;后&#xff0c;我认为这是一个非常强大的弹性计算服务。它为深度学习、科学计算、图形可视化、视频处理等多种应用场景提供了强大的GPU算力&#xff0c;能够满足各类用户的计算…

web集群学习--基于CentOS构建LVS-DR集群、配置nginx负载均衡

基于CentOS构建LVS-DR集群 环境准备 主机名 ip地址 node1 192.168.1.140 client node2 192.168.1.141 LVS node3 192.168.1.142 RS1 node4 192.168.1.143 RS2配置 1.关闭防火墙和SELinux [rootclient~]# systemctl stop firewalld [rootclient~]# systemctl disabl…

实现UDP可靠性传输

文章目录 1、TCP协议介绍1.1、ARQ协议1.2、停等式1.3、回退n帧1.4、选择性重传 1、TCP协议介绍 TCP协议是基于IP协议&#xff0c;面向连接&#xff0c;可靠基于字节流的传输层协议 1、基于IP协议&#xff1a;TCP协议是基于IP协议之上传输的&#xff0c;TCP协议报文中的源端口IP…

【Linux升级之路】5_基础IO

&#x1f31f;hello&#xff0c;各位读者大大们你们好呀&#x1f31f; &#x1f36d;&#x1f36d;系列专栏&#xff1a;【Linux升级之路】 ✒️✒️本篇内容&#xff1a;文件操作&#xff0c;文件管理&#xff0c;重定向&#xff0c;简易shell添加重定向功能&#xff0c;文件属…

领航优配:暑期旅游市场热度持续攀升,相关公司业绩有望持续释放

到发稿&#xff0c;海看股份涨停&#xff0c;中广天择、探路者、众信旅行等涨幅居前。 8月8日&#xff0c;在线旅行板块震动上涨&#xff0c;到发稿&#xff0c;海看股份涨停&#xff0c;中广天择、探路者、众信旅行等涨幅居前。 今年以来&#xff0c;国内旅行商场逐渐恢复。文…