summaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* tools: increase polling timeout by 5 minutesBenjamin Fair2020-01-131-2/+2
| | | | | | | This is needed for 64 MiB images. Signed-off-by: Benjamin Fair <benjaminfair@google.com> Change-Id: I3e2a63d1c8ae5db956ca8d5553c98d9cc671409c
* tools: net: support IPv4 and IPv6 addressesBenjamin Fair2019-12-042-3/+3
| | | | | | | | Switch from IPv4-only to an unspecified address family, which will allow either IPv4 or IPv6 addresses to be used. Signed-off-by: Benjamin Fair <benjaminfair@google.com> Change-Id: I6f4d3e71e2a310fc158ec90793f5c7479e060f02
* tools: Fix clangtidy warning for PpcMemDeviceBrandon Kim2019-11-261-2/+2
| | | | | | | | | | | It seems that the the recently checked in PpcMemDevice code had a clangtidy issue with the move assignment operator. Fixing it by deleting the previously defaulted operator as it is implicitly deleted due to a non-static const data member "ppcMemPath". Signed-off-by: Brandon Kim <brandonkim@google.com> Change-Id: I125cbbb5be6edd53274a9025b741df98cb7f408d
* tools: net: add <optional> headerBenjamin Fair2019-11-251-0/+1
| | | | | | | The constant std::nullopt is used but the header was not included. Change-Id: Ibb79f7f0b9944425202695b8c5d4e1d191b72a69 Signed-off-by: Benjamin Fair <benjaminfair@google.com>
* tools: Add PpcMemDevice as an HostIoInterfaceBrandon Kim2019-11-252-0/+87
| | | | | | | | PPC platforms may require a different mempath and different I/O operations to access the file system. Change-Id: I46b8825c685b362009dc62fdbaa59c65239831d1 Signed-off-by: Brandon Kim <brandonkim@google.com>
* tools: add network bridge supportBenjamin Fair2019-11-216-3/+454
| | | | | | | | Add support to the host tool for sending the image data over a network connection. Signed-off-by: Benjamin Fair <benjaminfair@google.com> Change-Id: I88630d79499254d6c80ceaa8c7721c241d394fc8
* sys: add networking functionsBenjamin Fair2019-11-211-0/+7
| | | | | | | Add networking related functions to the syscall wrapper. Signed-off-by: Benjamin Fair <benjaminfair@google.com> Change-Id: I0ccb4138963ce2a8c7bb6f6f3a556de1afcd0c08
* tools: remove stat() check for supported interfaceBenjamin Fair2019-11-153-34/+2
| | | | | | | | If an unsupported interface is requested, the open() call will simply fail. Signed-off-by: Benjamin Fair <benjaminfair@google.com> Change-Id: Iefd11657d957931873a4d20246d9ccdd791ba0e5
* internal: Add pread pwrite support in sysBrandon Kim2019-11-051-0/+2
| | | | | Signed-off-by: Brandon Kim <brandonkim@google.com> Change-Id: I84c5e7f493afbb0894528f5d0986180b7109e170
* tools: Add ignoreUpdate parameterBrandon Kim2019-09-197-18/+55
| | | | | | | | | | | | | Adds ignoreUpdate flag to skip checking the update status and always return success instead. This is needed for platforms that use the reboot json and encounters an update failure due to IPMI going down during shutdown. Tested: Tried out an update with and without --ignore-update to verify that the flag ignores the update status and returns success. Signed-off-by: Brandon Kim <brandonkim@google.com> Change-Id: Ie20774f997229cd5ff8ae9082dc8a747079f9a2c
* tools: type field now matches the /flash/{type}Patrick Venture2019-08-152-26/+9
| | | | | | | | | | | Instead of mapping one word to a pre-defined mapping of types, let the host user specify any value. A user shouldn't specify hash, or update, or something meaningful. Perhaps this should be validated. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Icec103e0ade999d527923dcacb440086c93e175c
* tools: bump up timeout for polling to ~5.5 minutesPatrick Venture2019-08-141-1/+6
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I384734c592e39a01c5531d3d7d6c79474c2b0b44
* tools: p2a: enable bridge on host sidePatrick Venture2019-07-261-26/+64
| | | | | | | | | | Enable the PCI-to-AHB bridge from the host-side. Note: On my test system, this didn't seem to be required, it's possible the bit was stuck on when enabled. Tested: Not tested. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Idbea0e9d378ee108f24240d64b43b6a3c0eea799
* bugfix: tools: p2a: read returns boolPatrick Venture2019-07-261-5/+8
| | | | | | | | The read method returns bool, therefore if this returns 0, it's false, and therefore the read failed. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I365f9edf49a79ca5ea3c13090d6b8a11b9598e53
* tools: add bios supportPatrick Venture2019-07-032-4/+9
| | | | | | | | Add type "bios" to burn_my_bmc, such that when used it'll use the /flash/bios path for writing the bios contents. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I613af23b80eb99936b744d4138a61d2f7b39b962
* tools: tweak: add missing newline in progressPatrick Venture2019-07-021-0/+3
| | | | | | | | | | | | Given: The bridge is enabled! Received address: 0x47ff0000 Progress: 100.00%Sending over the hash file. Add the missing newline when the progress output reaches 100%. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I83f97144fcc6d675e2bace050de81bd0084338d2
* tools: add progress implementationPatrick Venture2019-06-2815-11/+169
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I9da1674d6cbc688efc7bab0e033788d6ee4694f7
* build: install burn_my_bmcPatrick Venture2019-06-271-1/+1
| | | | | | | Tested: Verified the build and install process works for the host-tool, burn_my_bmc. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Icf0fc9ed572055561fa0e82d71f7807410430794
* build: use a common library for shared piecesPatrick Venture2019-06-271-3/+2
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ic4b645091c71f270ba3b2f290f7206ebe3222f1d
* tools: remove phosphor-ipmi-blobs dependencyPatrick Venture2019-06-2712-31/+37
| | | | | | | | | | The host tool depended on the BMC header: firmware_handler.hpp because it defined the flags. This header depends on phosphor-ipmi-blobs, therefore the host-tool depends on this. Move the flags into a separate common header file and snip this dependency. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Id2ad33a1611c02605a1ed5c695429d0451eb98d4
* move bmc code into bmc folderPatrick Venture2019-06-272-2/+11
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I2407359461a1a2f0e733ff8cd0cb1744b6304c32
* tools: implement lpc supportPatrick Venture2019-06-242-17/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tested: Verified this works for a Nuvoton BMC. EXTRA_OECONF_append_xxx = " \ --enable-static-layout \ --enable-lpc-bridge \ --enable-nuvoton-lpc \ --enable-reboot-update \ MAPPED_ADDRESS=0xc0008000 \ " /tmp/phosphor_ipmi_flash_tool \ --command update \ --interface ipmilpc \ --image image-bmc \ --sig image-bmc.sig \ --type static \ --address 0xfedc1000 \ --length 0x1000 Sending over the firmware image. trying to open blob sending writeMeta caught exception EFBIG returned! sending writeMeta writemeta sent Sending over the hash file. trying to open blob sending writeMeta caught exception EFBIG returned! sending writeMeta writemeta sent Opening the verification file Committing to /flash/verify to trigger service Calling stat on /flash/verify session to check status other success Returned success succeeded Opening the update file Committing to /flash/update to trigger service Calling stat on /flash/update session to check status running Opening the cleanup blob Exception received: blob exception received: Received IPMI_CC: 255 Signed-off-by: Patrick Venture <venture@google.com> Change-Id: If866303e95e9b6a19dc8b20a99bb89fd66f95eeb
* tools: add support for ubi tarball from hostPatrick Venture2019-06-214-17/+43
| | | | | | | Add a parameter that specifies the layout type, static or ubitar. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I86c09d8ffeb55ba789279d2568b579a44b3923d7
* tools: bugfix: add missing close after failurePatrick Venture2019-06-201-1/+11
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Id873c41997e2617d1fa3db5767112c23d77c487c
* tools: split out the update handlerPatrick Venture2019-06-2010-325/+437
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I367ea961c98ec822d3200d101c4f5977d77e7402
* tools: specify parameter size limits for LPCPatrick Venture2019-06-204-8/+25
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ic7049ffc2a3c4e7dad3356e11f48f6e5ed8eeca1
* tools: add cleanup blob on failurePatrick Venture2019-06-204-30/+86
| | | | | | | | If the update process fails, call the cleanup blob and try to cleanup artifacts automatically. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ib57e5cc7f13b73e2d7371116058469a4d4bfd0c4
* tool: LPC data handler needs an address and lengthPatrick Venture2019-06-193-5/+35
| | | | | | | | The host needs to have memory set aside for this purpose, and this enables the caller to provide those values. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: If40ec3b08bd1932cba91d3f770c7fde6f280463d
* tool: continue the unit-tests of the host toolPatrick Venture2019-06-194-81/+98
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I51349fc103af2a55f1b83830bf8e74407fc15b9e
* test: cleanup by moving tool tests into subfolderPatrick Venture2019-06-199-0/+350
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I15b3514d095d9fc770a1b0fe125eb48d96ada2c8
* tools: update status debug messagePatrick Venture2019-06-121-7/+6
| | | | | | | | | Update the verification commit status debug message to not specify that it's the verification blob specifically as this method is used for both verification and update. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I0ee89a5e8f7eae2533ab89db12032b33d1c25ec1
* tools: open and commit() on updateBlobIdPatrick Venture2019-06-052-6/+22
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Id4d531e2ea2d755aa310261966254419d78dccdb
* merge Verification and Update statusesPatrick Venture2019-06-031-9/+7
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ibb9c1c9f9cb7e9cda18f4e8dddb31d57a12f0d90
* tools: updater: cppcheck fixupsPatrick Venture2019-05-281-3/+4
| | | | | | | | | The scope of the variable 'commandAttempts' can be reduced. The scope of the variable 'attempts' can be reduced. The scope of the variable 'exitLoop' can be reduced. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ib2e258c1af7110ff4568695b8f1ea877a9ffef99
* tools: scope of the variable 'bytesRead' can be reduced.Patrick Venture2019-05-202-7/+8
| | | | | | | | | (style) The scope of the variable 'bytesRead' can be reduced. [tools/bt.cpp:21] [tools/p2a.cpp:111] Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I6b96247a02cd35d073b424501bb161e80aedf3b4
* bmc: move away from blobs namespacePatrick Venture2019-05-206-21/+25
| | | | | | | | The blobs namespace is really owned by phosphor-ipmi-blobs. Move all phosphor-ipmi-flash objects into ipmi_flash namespace. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I51b721ad4f3cdc4cc43846c942967ed2e5f16589
* bmc: enable configuration of all verificationPatrick Venture2019-05-171-11/+8
| | | | | | | | | | Enable verification configuration beyond the result file check. This patchset allows a developer to provide their own verification mechanisms by implementing an interface and adding configuration to enable using their custom version. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Iba5d4be75bb49d9c4ab84be8578f0306c15b5be9
* util: create util object for bmc and toolPatrick Venture2019-05-172-13/+7
| | | | | | | | Create a common util object for the BMC library and host tool. Place in blobs namespace favoring BMC. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I036fd65d924c65fcfa71aba5cd76275a2941ff14
* tools: add update handlerPatrick Venture2019-05-163-119/+170
| | | | | | | | | | | Add an UpdateHandler to handle each step of the update process. This code was already in place but is now handled via an UpdateHandler object. Tested: Not yet tested. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I36cd1b94d8e2c0788d09805d935738d86e6e33de
* tools: drop extraneous return statemenPatrick Venture2019-05-161-2/+0
| | | | | Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I2a12b61b63ec1e0d54fffae07431c145b988ad7f
* tools: implement firmware verification pollingPatrick Venture2019-05-152-2/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The verification process is asynchronous, therefore poll the BMC firmware state. Tested: Verified it behaves as intended, before moving it into a sub-routine: Opening the verification file Committing to verification file to trigger verification service Calling stat on verification session to check status stat received: blob_state: 0x206 size: 0x0 metadata(1): 0x3 other stat received: blob_state: 0x206 size: 0x0 metadata(1): 0x0 running stat received: blob_state: 0x206 size: 0x0 metadata(1): 0x0 running stat received: blob_state: 0x206 size: 0x0 metadata(1): 0x1 success stat received: blob_state: 0x206 size: 0x0 metadata(1): 0x1 success Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I3cb13d1a966c2c833fd4fee5654332f34e80355a
* tools: trigger verificationPatrick Venture2019-05-151-2/+37
| | | | | | | Trigger verification via committing to the verify blob id. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ia3722ff144ba268cd554bac0fda06f0c426edd88
* tools: io: fix printf portabilityPatrick Venture2019-05-151-2/+2
| | | | | | | | The printfs were using actual sizes instead of leveraging %z to deal with std::size_t. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I7ac731b0458d9501762651bdc9d796f7a6ada620
* bugfix: tools: use pci memberPatrick Venture2019-05-151-2/+1
| | | | | | | | | Tool worked by declaring its own pci utility object instead of using the one provided. There are not yet unit-tests associated with the P2aDataHandler that would have caught this. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I62cdeb17d298f1db51d8f513c59bfd299fc2884a
* updater: send hash file contentsPatrick Venture2019-05-141-1/+26
| | | | | | | | | | | | Send the hash file contents to the firmware image or tarball can be verified, for whatever verification process is used by a platform. Tested: Verified md5sum of /tmp/bmc.sig matches the signature file's hash on the host. Sent the contents over P2A. The implementation uses the same data pathway for the firmware image and the signature file. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Icbc7fddc4587059004935cf51063797b25f76ad0
* pci: implement sending firmware image over p2aPatrick Venture2019-05-144-35/+91
| | | | | | | | | | | | | | | | | | | | | Implement sending firmware image over p2a via the aspeed-p2a-ctrl driver. Test configuration: # Image is static, uses the PCI bridge, and requires the ASPEED # PCI-to-AHB hardware implementation. EXTRA_OECONF_append_quanta-q71l = " --enable-static-layout" EXTRA_OECONF_append_quanta-q71l = " --enable-pci-bridge" EXTRA_OECONF_append_quanta-q71l = " --enable-aspeed-p2a" EXTRA_OECONF_append_quanta-q71l = " MAPPED_ADDRESS=0x47FF0000" Tested: Verified via md5sum the image-bmc file sent from the host via this tool matches the hash of /run/initramfs/bmc-image. This code can be used to send any file down, but was only tested with a "static" layout build. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I430bc7444f06f4f93a63e3bf2646bd195eaa2e52
* add exception catch-all in mainPatrick Venture2019-05-141-0/+7
| | | | | | | Catch all derived exceptions that may be thrown from the Updater. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I7ab1e74fc1378a3e8f73eae40295e42ef7a2833a
* tools: main: update ipmi-blob-tool constructorsPatrick Venture2019-05-131-2/+2
| | | | | | | | ipmi-blob-tool changed the constructors to perform explicit ownership of the inputs. Therefore, update our constructions to obey this pattern. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I8029ce2ced3d75505f918a66afdc5fd61409c69d
* tools: io: do aligned read/write mappingPatrick Venture2019-05-071-6/+23
| | | | | | | | | Align the mmap by pagesize. Tested: Verified alignment is correct and mmap succeeds where it would fail on a mis-aligned call. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I76a4f94415c9337d8ca983e24a18e3e4fc701564
* tools: p2a: read the PCI configurationPatrick Venture2019-05-071-0/+14
| | | | | | | | | | | Read the PCI configuration from the blob handler itself. Don't use this yet, but read it. Tested: Verified with a bugfix in ipmi-blob-tool that it was able to read back and print the value configured into the BMC image. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I49a8c93508e64a65fd37b50ec2b437f0016272f2
OpenPOWER on IntegriCloud