答复: [External] Re: Clarify some questions about in-band firmware update

Andrew MS1 Peng pengms1 at lenovo.com
Fri Jul 5 19:20:16 AEST 2019


Hi Patrick,
Following your instructions to build SDK environment, the host tool has been compiled successfully. I really appreciate your help.
Regards,
Andrew

发件人: Patrick Venture <venture at google.com>
发送时间: 2019年7月4日 21:59
收件人: Andrew MS1 Peng <pengms1 at lenovo.com>
抄送: Duke KH Du <dukh at lenovo.com>; benjaminfair at google.com; OpenBMC Maillist <openbmc at lists.ozlabs.org>
主题: Re: [External] Re: Clarify some questions about in-band firmware update



On Thu, Jul 4, 2019 at 5:19 AM Andrew MS1 Peng <pengms1 at lenovo.com<mailto:pengms1 at lenovo.com>> wrote:
Hi Patrick,
I refer to https://github.com/openbmc/docs/blob/master/development/dev-environment.md#download-and-install-sdk  to set up my OpenBmc SDK environment, but it seems to be different from yours since your SDK environment has packagegroup-core-standalone-sdk-target.bbappend file. I would like to build your SDK environment to test, could you give me some clue or guideline to set up the environment?

The file to which you're referring is not special to my environment and it's part of openbmc.  I added ipmi-blob-tool to it so that I wouldn't have to build it ahead of building burn_my_bmc.  I provided the patch in my email so you could make the same change.

I didn't follow those instructions because I don't know when the last build was of the SDK that's published there.  But you can build it yourself trivially:

$ git clone https://github.com/openbmc/openbmc.git
$ pushd openbmc
### apply the patch or change I mentioned
$ TEMPLATECONF=meta-phosphor/conf source oe-init-build-env
$ umask a+rx,u+rwx
$ MACHINE=qemux86-64 bitbake obmc-phosphor-image -c populate_sdk
### wait while it builds everything
$ SDK_DIR=/opt/openbmc-phosphor/2.7.0
$ sudo ./tmp/deploy/sdk/oecore-x86_64-core2-64-toolchain-nodistro.0.sh<http://oecore-x86_64-core2-64-toolchain-nodistro.0.sh> -d $SDK_DIR
### let it install the SDK
$ source $SDK_DIR/environment-setup-core2-64-openbmc-linux
$ git clone https://github.com/openbmc/phosphor-ipmi-flash
$ pushd phosphor-ipmi-flash
$ export OECORE_TARGET_SYSROOT=$SDK_DIR/sysroots/core2-64-openbmc-linux
$ autoreconf -if
$ ./configure --enable-oe-sdk --host "$(uname -m)" --disable-build-bmc-blob-handler AR=x86_64-openbmc-linux-gcc-ar RANLIB=x86_64-openbmc-linux-gcc-ranlib
### and it's built
$ popd
$ popd

Like I said though, you don't need to use the SDK at all to build it.  You can just build it on your development workstation following the instructions in the README and it'll take a lot less time.




•  My SDK environment setup procedure
## Fetch the OpenBmc x86-64 toolchain
1. wget https://openpower.xyz/job/openbmc-build-sdk/distro=ubuntu,target=qemux86-64/lastSuccessfulBuild/artifact/deploy/sdk/oecore-x86_64-core2-64-toolchain-nodistro.0.sh

## install toolchain
2. run ./oecore-x86_64-core2-64-toolchain-nodistro.0.sh<http://oecore-x86_64-core2-64-toolchain-nodistro.0.sh>

## run source env
3. source ~/SDK/oecore-x86_64/environment-setup-core2-64-openbmc-linux

## Fetch source code then compile ipmi-blob-tool and phosphor-ipmi-flash
4.1 git clone https://github.com/openbmc/ipmi-blob-tool
   4.1.1 cd  ipmi-blob-tool
   4.1.2 ./bootstrap.sh
   4.1.3 ./configure --prefix=/home/pengms1/SDK/OpenBmc/rootfs --build=x86_64-linux --host=x86_64-openbmc-linux -with-libtool-sysroot=/home/pengms1/SDK/oecore-x86_64/sysroots/core2-64-openbmc-linux/ -enable-shared --enable-static
   4.1.4 make && make install
4.2 git clone https://github.com/openbmc/phosphor-ipmi-flash
    4.2.1 cd  phosphor-ipmi-flash
    4.2.2 ./bootstrap.sh
    4.2.3 export   PKG_CONFIG_PATH="/home/pengms1/SDK/oecore-x86_64/sysroots/core2-64-openbmc-linux/usr/lib/pkgconfig:/home/pengms1/SDK/oecore-x86_64/sysroots/core2-64-openbmc-linux/usr/share/pkgconfig:/home/pengms1/SDK/OpenBmc/rootfs/lib/pkgconfig"
    4.2.4 ./configure --prefix=/home/pengms1/SDK/OpenBmc/rootfs --build=x86_64-linux --host=x86_64-openbmc-linux  -with-libtool-sysroot=/home/pengms1/SDK/oecore-x86_64/sysroots/core2-64-openbmc-linux/  --disable-build-bmc-blob-handler
    4.2.5  make CPPFLAGS="-I /home/pengms1/SDK/OpenBmc/rootfs/include/" LDFLAGS="-L/home/pengms1/SDK/OpenBmc/rootfs/lib -lipmiblob"

•  Compile status

Source code hash id


Compile Status


Attached file


c37fe1e938238a10520ff6d120ccf5194ff60fa2


Compile successful


successful.log


33311b47b3b656cfc16568b4b971730cb79130bc


Compile failed


failed.log



Regards,
Andrew
发件人: Patrick Venture <venture at google.com<mailto:venture at google.com>>
发送时间: 2019年7月4日 1:04
收件人: Andrew MS1 Peng <pengms1 at lenovo.com<mailto:pengms1 at lenovo.com>>
抄送: Duke KH Du <dukh at lenovo.com<mailto:dukh at lenovo.com>>; benjaminfair at google.com<mailto:benjaminfair at google.com>; OpenBMC Maillist <openbmc at lists.ozlabs.org<mailto:openbmc at lists.ozlabs.org>>
主题: Re: [External] Re: Clarify some questions about in-band firmware update



On Wed, Jul 3, 2019 at 7:47 AM Patrick Venture <venture at google.com<mailto:venture at google.com>> wrote:


On Wed, Jul 3, 2019 at 7:13 AM Patrick Venture <venture at google.com<mailto:venture at google.com>> wrote:


On Wed, Jul 3, 2019 at 4:51 AM Andrew MS1 Peng <pengms1 at lenovo.com<mailto:pengms1 at lenovo.com>> wrote:
Hi Patrick,

Could you help to take a look compile issue as below? I can compile host tool with hash id c37fe1e938238a10520ff6d120ccf5194ff60fa2 successfully, but fail to compile with hash id c37fe1e938238a10520ff6d120ccf5194ff60fa2 or later.  Thanks.

/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: burn_my_bmc-main.o: in function `host_tool::DevMemDevice::DevMemDevice(internal::Sys const*)':
/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/io.hpp:46: undefined reference to `internal::sys_impl'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: burn_my_bmc-main.o: in function `host_tool::BtDataHandler::BtDataHandler(ipmiblob::BlobInterface*, internal::Sys const*)':
/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/bt.hpp:17: undefined reference to `internal::sys_impl'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: burn_my_bmc-main.o: in function `host_tool::LpcDataHandler::LpcDataHandler(ipmiblob::BlobInterface*, host_tool::HostIoInterface*, unsigned int, unsigned int, internal::Sys const*)':
/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/lpc.hpp:28: undefined reference to `internal::sys_impl'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: burn_my_bmc-main.o: in function `host_tool::P2aDataHandler::P2aDataHandler(ipmiblob::BlobInterface*, host_tool::HostIoInterface*, host_tool::PciUtilInterface*, internal::Sys const*)':
/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/p2a.hpp:28: undefined reference to `internal::sys_impl'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: ./.libs/libupdater.a(libupdater_la-updater.o): in function `host_tool::updaterMain(host_tool::UpdateHandlerInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/updater.cpp:42: undefined reference to `ipmi_flash::staticLayoutBlobId[abi:cxx11]'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: /home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/updater.cpp:42: undefined reference to `ipmi_flash::ubiTarballBlobId[abi:cxx11]'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: /home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/updater.cpp:59: undefined reference to `ipmi_flash::hashBlobId[abi:cxx11]'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: /home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/updater.cpp:64: undefined reference to `ipmi_flash::verifyBlobId[abi:cxx11]'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: /home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/updater.cpp:76: undefined reference to `ipmi_flash::updateBlobId[abi:cxx11]'
/home/pengms1/SDK/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/real-ld: ./.libs/libupdater.a(libupdater_la-handler.o): in function `host_tool::UpdateHandler::cleanArtifacts()':
/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools/handler.cpp:167: undefined reference to `ipmi_flash::cleanupBlobId[abi:cxx11]'
collect2: error: ld returned 1 exit status
Makefile:500: recipe for target 'burn_my_bmc' failed
make[3]: *** [burn_my_bmc] Error 1
make[3]: Leaving directory '/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools'
Makefile:632: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash/tools'
Makefile:611: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pengms1/SDK/OpenBmc/phosphor-ipmi-flash'
Makefile:463: recipe for target 'all' failed
make: *** [all] Error 2

Since that builds for me, I need to see how you're building it, not just the failure output.  How are you configuring it to build?  What changes have you made to the recipe?

I assume you meant you can build at that revision but not after.  The patchset after actually fixes it so it'll build properly given the instructions specified in the README.  There's a common base library used to store the common strings, etc, which are what you're seeing missing in the output.  Basically, I'd need to see more output, the commands that are running before the errors.

I'm building the SDK presently to see if I can reproduce in that environment.  If you don't need to build in that environment, you can build this without it.  The steps on the README were written while building it in a ubuntu docker instance that had nothing installed (then installed git, gcc, etc).

Firstly, I ran into the issue where ipmi-blob-tool isn't installed into the sdk by default:

--- a/meta-phosphor/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend
+++ b/meta-phosphor/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend
@@ -1 +1 @@
-RRECOMMENDS_${PN}_append = " gtest sdbusplus phosphor-logging libstdc++-staticdev"
+RRECOMMENDS_${PN}_append = " gtest sdbusplus phosphor-logging libstdc++-staticdev ipmi-blob-tool"

Then.

I'm seeing this, which is likely the cause of the problem.
x86_64-openbmc-linux-ar: .libs/libupdater.lax/libfirmware_common.a/libfirmware_common_la-sys.o: plugin needed to handle lto object
x86_64-openbmc-linux-ar: .libs/libupdater.lax/libfirmware_common.a/libfirmware_common_la-util.o: plugin needed to handle lto object
x86_64-openbmc-linux-ranlib: .libs/libupdater.a(libfirmware_common_la-sys.o): plugin needed to handle lto object
x86_64-openbmc-linux-ranlib: .libs/libupdater.a(libfirmware_common_la-util.o): plugin needed to handle lto object

I don't see this issue when building within other instances, bitbake, or docker ubuntu.

https://github.com/openbmc/meta-phosphor/blob/master/classes/flto-automake.bbclass

This defines what should be used with flto in these cases... (our bitbake recipes don't' use this consistently).

$ ./configure --enable-oe-sdk --host "$(uname -m)" --disable-build-bmc-blob-handler
...
checking for x86_64-ar... (cached) x86_64-openbmc-linux-ar
checking for archiver @FILE support... @
checking for x86_64-strip... (cached) x86_64-openbmc-linux-strip
checking for x86_64-ranlib... x86_64-openbmc-linux-ranlib

So it looks like it isn't checking for the gcc-ar and gcc-ranlib by default (no surprise).

I ran this:

$ make clean; make distclean;
$ ./configure --enable-oe-sdk --host "$(uname -m)" --disable-build-bmc-blob-handler AR=x86_64-openbmc-linux-gcc-ar RANLIB=x86_64-openbmc-linux-gcc-ranlib

...
checking for x86_64-ar... (cached) x86_64-openbmc-linux-gcc-ar
checking for archiver @FILE support... @
checking for x86_64-strip... (cached) x86_64-openbmc-linux-strip
checking for x86_64-ranlib... x86_64-openbmc-linux-gcc-ranlib
...

$ make
...
make[3]: Entering directory '/usr/local/google/git/workspaces/phosphor-ipmi-flash/tools'
  CXX      burn_my_bmc-main.o
  CXX      libupdater_la-updater.lo
  CXX      libupdater_la-handler.lo
  CXX      libupdater_la-helper.lo
  CXX      libupdater_la-bt.lo
  CXX      libupdater_la-lpc.lo
  CXX      libupdater_la-io.lo
  CXX      libupdater_la-pci.lo
  CXX      libupdater_la-p2a.lo
  CXX      libupdater_la-progress.lo
  CXXLD    libupdater.la<http://libupdater.la>
/opt/openbmc-phosphor/2.7.0/sysroots/x86_64-oesdk-linux/usr/bin/x86_64-openbmc-linux/../../libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/ar: `u' modifier ignored since `D' is the default (see `U')
  CXXLD    burn_my_bmc
make[3]: Leaving directory '/usr/local/google/git/workspaces/phosphor-ipmi-flash/tools'
Making all in test
make[3]: Entering directory '/usr/local/google/git/workspaces/phosphor-ipmi-flash/tools/test'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/usr/local/google/git/workspaces/phosphor-ipmi-flash/tools/test'
make[2]: Leaving directory '/usr/local/google/git/workspaces/phosphor-ipmi-flash/tools'
make[1]: Leaving directory '/usr/local/google/git/workspaces/phosphor-ipmi-flash'
....

This worked fine.
1) I should switch to flto-automake in the recipe
2) I can write up a section on compiling this against the SDK.
3) I should push for use of flto-automake in other recipes**until there's an upstream change to support this automatically (maybe there is***separate email thread)):

grep -rn "\-flto" ./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-*|grep Makefile.am
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-dbus-interfaces/1.0+gitAUTOINC+1f0e2ce6e1-r1/git/Makefile.am:9:libphosphor_dbus_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(SDBUSPLUS_CFLAGS) -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-fan/1.0+gitAUTOINC+d9a580aa50-r1/git/presence/Makefile.am:28: -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-fan/1.0+gitAUTOINC+d9a580aa50-r1/git/control/Makefile.am:30: -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-fan/1.0+gitAUTOINC+d9a580aa50-r1/git/monitor/Makefile.am:31: -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-fan/1.0+gitAUTOINC+d9a580aa50-r1/git/cooling-type/Makefile.am:17: -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-inventory-manager/1.0+gitAUTOINC+ded627c42f-r1/git/Makefile.am:13:phosphor_inventory_CXXFLAGS = $(SDBUSPLUS_CFLAGS) -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-ipmi-host/1.0+gitAUTOINC+2a5d8d1ffe-r1/git/user_channel/Makefile.am:2: -flto \
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-ipmi-host/1.0+gitAUTOINC+2a5d8d1ffe-r1/git/libipmid/Makefile.am:2: -flto \
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-ipmi-host/1.0+gitAUTOINC+2a5d8d1ffe-r1/git/Makefile.am:38: -flto \
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-ipmi-host/1.0+gitAUTOINC+2a5d8d1ffe-r1/git/test/Makefile.am:2:    -flto \
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-ipmi-net/1.0+gitAUTOINC+052b7cf374-r1/git/Makefile.am:76: -flto \
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-logging/1.0+gitAUTOINC+0a0b5ea558-r1/git/phosphor-rsyslog-config/Makefile.am:23: -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-network/1.0+gitAUTOINC+7bcaccfdae-r1/git/Makefile.am:45:ncsi_netlink_CXXFLAGS = -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-network/1.0+gitAUTOINC+7bcaccfdae-r1/git/Makefile.am:98: -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-software-manager/1.0+gitAUTOINC+a013560f96-r1/git/Makefile.am:101: -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-time-manager/1.0+gitAUTOINC+66bc0a5a9f-r1/git/Makefile.am:24:                    -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-time-manager/1.0+gitAUTOINC+66bc0a5a9f-r1/git/test/Makefile.am:24:                $(SDBUSPLUS_CFLAGS) -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-user-manager/1.0+gitAUTOINC+75b5a6fc4c-r1/git/phosphor-ldap-config/Makefile.am:26:                              -flto
./build/tmp/work/armv5e-openbmc-linux-gnueabi/phosphor-user-manager/1.0+gitAUTOINC+75b5a6fc4c-r1/git/phosphor-ldap-mapper/Makefile.am:21:                                -flto






Regards,
Andrew

发件人: Patrick Venture <venture at google.com<mailto:venture at google.com>>
发送时间: 2019年6月29日 6:24
收件人: Andrew MS1 Peng <pengms1 at lenovo.com<mailto:pengms1 at lenovo.com>>
抄送: OpenBMC Maillist <openbmc at lists.ozlabs.org<mailto:openbmc at lists.ozlabs.org>>; Duke KH Du <dukh at lenovo.com<mailto:dukh at lenovo.com>>; benjaminfair at google.com<mailto:benjaminfair at google.com>; Adriana Kobylak <anoo at us.ibm.com<mailto:anoo at us.ibm.com>>
主题: Re: [External] Re: Clarify some questions about in-band firmware update



On Fri, Jun 28, 2019 at 7:09 AM Patrick Venture <venture at google.com<mailto:venture at google.com>> wrote:


On Fri, Jun 28, 2019 at 4:30 AM Andrew MS1 Peng <pengms1 at lenovo.com<mailto:pengms1 at lenovo.com>> wrote:
Hi Patrick,

I synchronized our Openbmc repository with upstream repository then compiled and checked the result yesterday, we can generate dynamically linked binary but still failed to generate statically linked binary.  I used OpenBmc environment to compile and also created a SDK environment by using x86-64 toolchain (oecore-x86_64-core2-64-toolchain-nodistro.0.sh<http://oecore-x86_64-core2-64-toolchain-nodistro.0.sh>) to compile, the compile result is the same. It seems to the linker not find the archive file libpci.a, could you take a look my problem? Thanks.

I will get error message when I run the tool in my host platform as below. The dynamically linked binary is not convenience to use since I have to modify rpath and interpreter of already compiled ELF.
pengms1 at hsbmc: $ ./burn_my_bmc
-bash: ./burn_my_bmc: No such file or directory

pengms1 at hsbmc: $ ldd ./burn_my_bmc
./burn_my_bmc: /lib/x86_64-linux-gnu/libpci.so.3: version `LIBPCI_3.5' not found (required by ./burn_my_bmc)
       linux-vdso.so.1 =>  (0x00007ffcd2363000)
       libipmiblob.so.0 => /home/pengms1/SDK/OpenBmc/rootfs/lib/libipmiblob.so.0 (0x00007f25d373a000)
       libpci.so.3 => /lib/x86_64-linux-gnu/libpci.so.3 (0x00007f25d3512000)
       libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f25d3190000)
       libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f25d2f79000)
       libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f25d2baf000)
       libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f25d28a6000)
       libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f25d268b000)
       libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f25d2470000)
       libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f25d2450000)
       /lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x000055731193b000)
       librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f25d2247000)
       libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f25d202a000)

The compile error message is below:
x86_64-openbmc-linux-libtool: link: x86_64-openbmc-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/pengms1/openbmc_trunk_x86/build/tmp/work/core2-64-openbmc-linux/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1/recipe-sysroot -std=c++17 -I../../git -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/pengms1/openbmc_trunk_x86/build/tmp/work/core2-64-openbmc-linux/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1=/usr/src/debug/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1 -fdebug-prefix-map=/home/pengms1/openbmc_trunk_x86/build/tmp/work/core2-64-openbmc-linux/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1=/usr/src/debug/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1 -fdebug-prefix-map=/home/pengms1/openbmc_trunk_x86/build/tmp/work/core2-64-openbmc-linux/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1/recipe-sysroot= -fdebug-prefix-map=/home/pengms1/openbmc_trunk_x86/build/tmp/work/core2-64-openbmc-linux/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1/recipe-sysroot-native= -fvisibility-inlines-hidden -Wall -Werror -DENABLE_REBOOT_UPDATE -DENABLE_STATIC_LAYOUT -DENABLE_LPC_BRIDGE -DASPEED_LPC -static -o burn_my_bmc burn_my_bmc-main.o  ./.libs/libupdater.a -lipmiblob -lpci
| /home/pengms1/openbmc_trunk_x86/build/tmp/work/core2-64-openbmc-linux/phosphor-ipmi-flash/0.1+gitAUTOINC+7c79b252c1-r1/recipe-sysroot-native/usr/bin/x86_64-openbmc-linux/../../libexec/x86_64-openbmc-linux/gcc/x86_64-openbmc-linux/9.1.0/ld: cannot find -lpci

That's indicating that it couldn't find the pciutils installed.  Like I said yesterday, I hadn't tried to build the host-tool in this environment and had to clean up the dependency checks for it.  That said, I went through and fixed it all and got it to build as expected from a pure ubuntu docker container.  Those patches are up for review and not yet in OpenBMC.  That said, I dont' know why the lpci might not be found for that compilation other than possibly the pciutils recipe is broken.  I found yesterday while getting this to work that the instructions on the pciutils README weren't quite right for building the library AND installing that library.

So I wrote up custom instructions in the README for phosphor-ipmi-flash, that patch is under review.

If you want to debut your current environment, you need to see if you can find the pkgconfig file and libraries defined:
https://github.com/pciutils/pciutils/blob/master/lib/libpci.pc.in

Basically search for libpci.pc and then read that file.  Verify the shared library objects are in the SDK environment.

If you need the libpci archive object for static compilation, that may not be installed by default, you'll want to read the pciutils README.


My OpenBmc build environment is below.
OpenBmc Setting

phosphor-ipmi-flash setting (build static binary)

Extra setting

Build Configuration:
BB_VERSION           = "1.43.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-16.04"
TARGET_SYS           = "x86_64-openbmc-linux"
MACHINE              = "qemux86-64"
DISTRO               = "openbmc-phosphor"
DISTRO_VERSION       = "0.1.2"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""

EXTRA_OECONF += " --enable-build-host-tool --enable-static-layout --enable-lpc-bridge
--enable-aspeed-lpc MAPPED_ADDRESS=0x98000000 --enable-reboot-update "
EXTRA_OEMAKE += " LDFLAGS=-all-static " (Build a statically linked binary)

DISABLE_STATIC = ""  (Build statically library for ipmi-blob-tool)

phosphor-ipmi-flash setting (build dynamic binary)

EXTRA_OECONF += " --enable-build-host-tool --enable-static-layout --enable-lpc-bridge
--enable-aspeed-lpc MAPPED_ADDRESS=0x98000000 --enable-reboot-update "


Regards,
Andrew

发件人: Patrick Venture <venture at google.com<mailto:venture at google.com>>
发送时间: 2019年6月27日 9:59
收件人: Andrew MS1 Peng <pengms1 at lenovo.com<mailto:pengms1 at lenovo.com>>; OpenBMC Maillist <openbmc at lists.ozlabs.org<mailto:openbmc at lists.ozlabs.org>>
抄送: Duke KH Du <dukh at lenovo.com<mailto:dukh at lenovo.com>>; benjaminfair at google.com<mailto:benjaminfair at google.com>; Adriana Kobylak <anoo at us.ibm.com<mailto:anoo at us.ibm.com>>
主题: [External] Re: Clarify some questions about in-band firmware update



On Wed, Jun 26, 2019 at 7:44 AM Patrick Venture <venture at google.com<mailto:venture at google.com>> wrote:


On Wed, Jun 26, 2019 at 4:28 AM Andrew MS1 Peng <pengms1 at lenovo.com<mailto:pengms1 at lenovo.com>> wrote:
Hi Patrick,

I have some questions as below, could you help to clarify. Thanks.

1.      Do you have any plans to support BIOS update in phosphor-ipmi-flash?

If the answer is no, we would like to help to add this feature. Could you give us some advice or clues to implement it.

This could be added to the design (first step).
I could probably roll out this in a day or two, it's not a difficult extension with a few caveats. We'd have to define new services, such as update_bios.service instead of update_bmc.service.

I have some cycles, so I don't mind reviewing the changes required and rolling something out --


2.      The FPGA rom image is embedded in BMC image, we would like to add fpga-update.service and fpga-verify.service in phosphor-ipmi-flash, we expect that run both services after update BMC image completely. Do you have any concerns about it?

There are a couple things to unpack here.  The FPGA rom is embedded in the BMC image.  How is the BMC updated?  I ask because a machine can (and is expected to) provide its own update_bmc.service implementation.  This service could trigger the fpga-verify and fpga-update services within whatever code is called from the update_bmc service you specify.


3.      How can I make a static executable host tool (burn_my_bmc)? Currently, I can’t to make a statically linked binary successfully, but I have made it before you added p2a function.
For the host tool you need to specify very little, you should be able to build it via:
./bootstrap.sh
./configure
./make

You will need to checkout and install ipmi-blob-tool first (openbmc/ipmi-blob-tool)


^^ --- those steps should go on the README.  Will add them shortly.


Based on different OS environment as below, I would like to have a static executable since dynamically linked binary can’t work normally in host OS.

Host OS environment


Build environment (OpenBmc)


Gcc  v4.8.5


Gcc   v8.3.0


Glibc  v2.17


Glibc  v2.29


The bitbake recipe isn't meant to be used for the host tool.  It explicitly disables building the host-tool by default.  You should be able to check out the repo and build from there.  Let me know if you run into issues with that.


4.      I didn’t find the below service files in source tree, where can find default services or should we provide our own services?

update_bmc.service
verify_image.service
prepare_update.service

That's correct.  There are currently no default service files.  I am thinking of providing a default prepare_update service in a later CL, however updating the BMC or verifying the image depend entirely on the system -- which makes it difficult to have a default.  In point of fact, there isn't really a valid default phosphor-ipmi-flash build for a BMC.  Everything needs to be specified.

^--- I can work on making the ubi bmc option available if the ubi distro feature is enabled, etc -- providing some defaults.
^--- I have a plan to provide a prepare_update.service once I finish testing Aspeed LPC support.


I've been reviewing the build process for the host-tool and the configure file and other pieces require the BMC-stuff to be installed first (sdbusplus, etc).  I'm going to cleanup the configure file so that if you're building the host-tool it doesn't try to build the BMC stuff.



Regards,
Andrew

Andrew, the steps here should work for you to build out the host-tool: https://github.com/openbmc/phosphor-ipmi-flash#building-and-using-the-host-tool

That said, because you requested we support BIOS images too, I'm looking at re-working some of the blobIDs involved.  That said, the host-tool and BMC version are locked together.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20190705/194b5640/attachment-0001.htm>


More information about the openbmc mailing list