OpenBMC Starting Point

Andrew Geissler geissonator at yahoo.com
Tue Feb 25 07:22:13 AEDT 2020



> On Feb 24, 2020, at 9:40 AM, Samuel Herts <sdherts at gmail.com> wrote:
> 
> So if I wanted a c++ script to run on the bmc whenever I desired, how exactly would I go about implementing it as a module to run? Kind of like the Phosphor state manager module that the Hello World guide starts on, specifically, what steps would I need to take or what resources should I look into for creating my own module that will run when a specific command is sent, like the systemctl start phosphor. 

This would probably make a good tutorial under
https://github.com/openbmc/docs/tree/master/development <https://github.com/openbmc/docs/tree/master/development>
but here’s the really fast answer from my perspective.

First you create a git repository somewhere (i.e. github).

Next you pick a logical location in for your recipe to
be located. For example if it was going to be a package used
by all of OpenBMC, it would go out somewhere in
https://github.com/openbmc/openbmc/tree/master/meta-phosphor/recipes-phosphor <https://github.com/openbmc/openbmc/tree/master/meta-phosphor/recipes-phosphor>

A good example is bmcweb:
https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb <https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb>
You’d make a recipe like this, point SRC_URI and SRCREV to your
code and the commit id to pick up.

You’d create your own service file, like bmcweb.service
(note the service file is packaged in your repo).
(i.e. https://github.com/openbmc/bmcweb/blob/master/bmcweb.service.in <https://github.com/openbmc/bmcweb/blob/master/bmcweb.service.in>)
For the [Install] section you would just put the following
to ensure your service was started on BMC boot up.
WantedBy=multi-user.target
You’d adjust the ExecStart to call your application

Note that bmcweb uses CMake but we’re moving a lot of
projects to meson which is what I’d recommend if you’re
creating a new project.
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-state-manager/+/27878 <https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-state-manager/+/27878>
is an example of adding service files to meson.

Then you would go into a packagegroup, like
https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb <https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb>
and do something similar to what they did with
bmcweb and add it as an RDEPENDS

Then you would bitbake your image and voila, your code would
be pulled down, built, and packaged into the image. When you
start it in QEMU you would see your application run.

If you were writing something you thought would be useful
for the community then you would send out an email and
write up a design doc to get feedback on the right
location for the code and recipe to go.
https://github.com/openbmc/docs/blob/master/designs/design-template.md <https://github.com/openbmc/docs/blob/master/designs/design-template.md> 

Andrew


> 
> On Mon, Jan 20, 2020 at 1:57 AM Michael Richardson <mcr at sandelman.ca <mailto:mcr at sandelman.ca>> wrote:
> 
> Samuel Herts <sdherts at gmail.com <mailto:sdherts at gmail.com>> wrote:
>     > I am currently working on getting a working OpenBMC test environment
>     > up and running. I am using VirtualBox and the github Development
>     > Environment tutorial. I had a couple questions regarding how to make
>     > our own modules. Would it be possible to upload files to the bmc on
>     > the virtual server?
> 
> You can do that.
> The disk is rather small by default.
> If you are using VirtualBox, you may be able to use the vboxfs file system to
> mount the host. That might require adding modules to the kernel.
> 
>     > And would I be able to make a script which can read text off of that
>     > file inside the bmc chip?
> 
>     > I have a physical server which I am not using yet, would I be able to
>     > install openbmc and the scripts and insert the file onto the actual
>     > bmc chip, and eventually read from that file?
> 
> Maybe. What server do you have?
> 
> --
> ]               Never tell me the odds!                 | ipv6 mesh networks [
> ]   Michael Richardson, Sandelman Software Works        |    IoT architect   [
> ]     mcr at sandelman.ca <mailto:mcr at sandelman.ca>  http://www.sandelman.ca/ <http://www.sandelman.ca/>        |   ruby on rails    [
> 
> 
> 
> -- 
> Sincerely, 
> Samuel Herts

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20200224/15534bb9/attachment-0003.htm>


More information about the openbmc mailing list