[[RFC PATCH] v2 00/14] Add interface to update firmware from Petitboot

Samuel Mendoza-Jonas sam at mendozajonas.com
Thu Jan 18 16:05:03 AEDT 2018


This series adds a generic framework to a) parse firmware version strings of
both the local machine and a remote metadata file, b) compare them for
differences and if the remote is newer, c) update the machine's firmware
to the remote updated version.
The pointy-end of the update process is provided by platform-specific code.
This series adds platform-powerpc support for updating OpenPOWER
BMC-based machines via MTD or OpenBMC's REST API. Other methods of updating
(eg. update_flash, etc) can be easily added to fit into this framework.

A new ncurses screen is added, "Firmware Updates" which allows the user to
set a remote metadata and/or update source, and execute an update. Current
and remote update versions are displayed here for comparison.

By itself this new functionality is recommended for development purposes
only - this does *not* implement authentication or verification of the
remote update. Access to this feature is only enabled if the
"petitboot,platform_update?" parameter is set to true in NVRAM.

The major difference from the first RFC is the addition of OpenBMC
support. Most OpenBMC machines can be updated via pflash as well, but on
at least "Witherspoon" machines pflash is deprecated and updates are
done via the REST API. This part in particular needs more testing as on
P9 machines the Host doesn't appear to have connectivity to the BMC, but
I suspect this is an NCSI configuration problem. Along the way we also
added a few minor fixups a reworked the generic interface slightly.


An example of the firmware screen:

 Firmware Updates
 ──────────────────────────────────────────────────────────────────────────────

  Metadata source:                                                    
                         [   Set and check remote metadata file   ]

  Update File:                                                        
                         [       Update firmware        ]

  Update Status:         No update running

  Packages           Current                       Update
  capp-ucode         1bb7503
  hostboot-binaries  fc2f7b9
  occ                d7efe30-dca92ac
  firestone-xml      2494a43
  petitboot          v1.4.4-a6d3938
  linux              4.4.92-openpower1-59284a2
  hostboot           2eb7706-f28ad92
  skiboot            5.4.8-7f3e3b0
  buildroot          81b8d98
  op                 build-d033e11
  IBM                firestone-ibm-OP8_v1.12_2.85


                         [   Help   ]        [  Cancel  ]


 ──────────────────────────────────────────────────────────────────────────────
 tab=next, shift+tab=previous, x=exit, h=help


Samuel Mendoza-Jonas (14):
  lib/process: Safely read partial stdout buffer
  lib/url: Check URL file extensions
  lib/system: Add pflash
  Explicitly parse version strings read from flash
  lib/version: Version parsing and comparison
  lib/device-tree: Parse package versions from ibm,firmware-versions
  Add generic support for platform updates
  ui/ncurses: "Firmware Updates" screen
  Retrieve IP address of BMC
  sysinfo: Display system name
  discover/platform-powerpc: Determine ppc platform type
  discover/platform-powerpc: Platform Firmware Updates
  utils: Add obmc-update
  discover/platform-powerpc-update: Implement OpenBMC support

 configure.ac                       |  14 +-
 discover/Makefile.am               |   2 +
 discover/device-handler.c          | 216 ++++++++++++++-
 discover/device-handler.h          |   2 +
 discover/discover-server.c         |   9 +
 discover/hostboot.c                |  88 +++++-
 discover/hostboot.h                |   5 +-
 discover/paths.c                   |   3 +-
 discover/platform-powerpc-update.c | 355 ++++++++++++++++++++++++
 discover/platform-powerpc-update.h |  19 ++
 discover/platform-powerpc.c        | 161 ++++++++++-
 discover/platform.c                |  19 ++
 discover/platform.h                |  12 +
 discover/sysinfo.c                 |  22 ++
 discover/sysinfo.h                 |   5 +
 lib/Makefile.am                    |  18 +-
 lib/device-tree/device-tree.c      | 117 ++++++++
 lib/device-tree/device-tree.h      |  34 +++
 lib/flash/flash.c                  |   4 +-
 lib/pb-config/pb-config.c          |   8 +
 lib/pb-protocol/pb-protocol.c      | 161 +++++++++--
 lib/pb-protocol/pb-protocol.h      |   2 +
 lib/process/process.c              |   8 +-
 lib/system/system.c                |   2 +
 lib/system/system.h                |   2 +
 lib/types/types.c                  |  16 ++
 lib/types/types.h                  |  30 +-
 lib/url/url.c                      |  15 +
 lib/url/url.h                      |   1 +
 lib/version/version.c              | 422 ++++++++++++++++++++++++++++
 lib/version/version.h              |  31 +++
 test/lib/Makefile.am               |   3 +-
 test/lib/test-version-parsing.c    | 104 +++++++
 test/parser/handler.c              |  10 +
 ui/common/discover-client.c        |  18 ++
 ui/common/discover-client.h        |   4 +
 ui/ncurses/Makefile.am             |   5 +-
 ui/ncurses/nc-cui.c                |  87 +++++-
 ui/ncurses/nc-cui.h                |   3 +
 ui/ncurses/nc-firmware-help.c      |   4 +
 ui/ncurses/nc-firmware.c           | 553 +++++++++++++++++++++++++++++++++++++
 ui/ncurses/nc-firmware.h           |  34 +++
 ui/ncurses/nc-scr.h                |   1 +
 ui/ncurses/nc-sysinfo.c            |  10 +-
 ui/ncurses/nc-widgets.c            |  12 +-
 ui/ncurses/nc-widgets.h            |   1 +
 utils/Makefile.am                  |   3 +-
 utils/obmc-update                  | 209 ++++++++++++++
 48 files changed, 2791 insertions(+), 73 deletions(-)
 create mode 100644 discover/platform-powerpc-update.c
 create mode 100644 discover/platform-powerpc-update.h
 create mode 100644 lib/device-tree/device-tree.c
 create mode 100644 lib/device-tree/device-tree.h
 create mode 100644 lib/version/version.c
 create mode 100644 lib/version/version.h
 create mode 100644 test/lib/test-version-parsing.c
 create mode 100644 ui/ncurses/nc-firmware-help.c
 create mode 100644 ui/ncurses/nc-firmware.c
 create mode 100644 ui/ncurses/nc-firmware.h
 create mode 100755 utils/obmc-update

-- 
2.15.1



More information about the Petitboot mailing list