<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 24, 2020, at 9:40 AM, Samuel Herts <<a href="mailto:sdherts@gmail.com" class="">sdherts@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">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. </div></div></blockquote><div><br class=""></div><div>This would probably make a good tutorial under</div><div><a href="https://github.com/openbmc/docs/tree/master/development" class="">https://github.com/openbmc/docs/tree/master/development</a></div><div>but here’s the really fast answer from my perspective.</div><div><br class=""></div><div>First you create a git repository somewhere (i.e. github).</div><div><br class=""></div><div>Next you pick a logical location in for your recipe to</div><div>be located. For example if it was going to be a package used</div><div>by all of OpenBMC, it would go out somewhere in</div><div><a href="https://github.com/openbmc/openbmc/tree/master/meta-phosphor/recipes-phosphor" class="">https://github.com/openbmc/openbmc/tree/master/meta-phosphor/recipes-phosphor</a></div><div><br class=""></div><div>A good example is bmcweb:</div><div><a href="https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb" class="">https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb</a></div><div>You’d make a recipe like this, point SRC_URI and SRCREV to your</div><div>code and the commit id to pick up.</div><div><br class=""></div><div>You’d create your own service file, like bmcweb.service</div><div>(note the service file is packaged in your repo).</div><div>(i.e. <a href="https://github.com/openbmc/bmcweb/blob/master/bmcweb.service.in" class="">https://github.com/openbmc/bmcweb/blob/master/bmcweb.service.in</a>)</div><div>For the [Install] section you would just put the following</div><div>to ensure your service was started on BMC boot up.</div><div>WantedBy=multi-user.target</div><div>You’d adjust the ExecStart to call your application</div><div><br class=""></div><div>Note that bmcweb uses CMake but we’re moving a lot of</div><div>projects to meson which is what I’d recommend if you’re</div><div>creating a new project.</div><div><a href="https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-state-manager/+/27878" class="">https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-state-manager/+/27878</a></div><div>is an example of adding service files to meson.</div><div><br class=""></div><div>Then you would go into a packagegroup, like</div><div><a href="https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb" class="">https://github.com/openbmc/openbmc/blob/master/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb</a></div><div>and do something similar to what they did with</div><div>bmcweb and add it as an RDEPENDS</div><div><br class=""></div><div>Then you would bitbake your image and voila, your code would</div><div>be pulled down, built, and packaged into the image. When you</div><div>start it in QEMU you would see your application run.</div><div><br class=""></div><div>If you were writing something you thought would be useful</div><div>for the community then you would send out an email and</div><div>write up a design doc to get feedback on the right</div><div>location for the code and recipe to go.</div><div><a href="https://github.com/openbmc/docs/blob/master/designs/design-template.md" class="">https://github.com/openbmc/docs/blob/master/designs/design-template.md</a> </div><div><br class=""></div><div>Andrew</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 20, 2020 at 1:57 AM Michael Richardson <<a href="mailto:mcr@sandelman.ca" class="">mcr@sandelman.ca</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br class="">
Samuel Herts <<a href="mailto:sdherts@gmail.com" target="_blank" class="">sdherts@gmail.com</a>> wrote:<br class="">
    > I am currently working on getting a working OpenBMC test environment<br class="">
    > up and running. I am using VirtualBox and the github Development<br class="">
    > Environment tutorial. I had a couple questions regarding how to make<br class="">
    > our own modules. Would it be possible to upload files to the bmc on<br class="">
    > the virtual server?<br class="">
<br class="">
You can do that.<br class="">
The disk is rather small by default.<br class="">
If you are using VirtualBox, you may be able to use the vboxfs file system to<br class="">
mount the host. That might require adding modules to the kernel.<br class="">
<br class="">
    > And would I be able to make a script which can read text off of that<br class="">
    > file inside the bmc chip?<br class="">
<br class="">
    > I have a physical server which I am not using yet, would I be able to<br class="">
    > install openbmc and the scripts and insert the file onto the actual<br class="">
    > bmc chip, and eventually read from that file?<br class="">
<br class="">
Maybe. What server do you have?<br class="">
<br class="">
--<br class="">
]               Never tell me the odds!                 | ipv6 mesh networks [<br class="">
]   Michael Richardson, Sandelman Software Works        |    IoT architect   [<br class="">
]     <a href="mailto:mcr@sandelman.ca" target="_blank" class="">mcr@sandelman.ca</a>  <a href="http://www.sandelman.ca/" rel="noreferrer" target="_blank" class="">http://www.sandelman.ca/</a>        |   ruby on rails    [<br class="">
<br class="">
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class="">Sincerely, <div class="">Samuel Herts</div></div></div>
</div></blockquote></div><br class=""></body></html>