Host Code Update ================ Reference: https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Software Following are the steps to update the host firmware (or "BIOS"). This assumes the host is not accessing its firmware. 1. Get a squashfs image: * Build op-build: https://github.com/open-power/op-build * After building, the image should be a tarball in the output/images directory called .pnor.squashfs.tar 2. Transfer the generated squashfs image to the BMC via one of the following methods: * Method 1: Via scp: Copy the generated squashfs image to the `/tmp/images/` directory on the BMC. * Method 2: Via REST Upload: https://github.com/openbmc/docs/blob/master/rest-api.md#uploading-images * Method 3: Via TFTP: Perform a POST request to call the `DownloadViaTFTP` method of `/xyz/openbmc_project/software`. ``` curl -b cjar -k -H "Content-Type: application/json" -X POST \ -d '{"data": ["", " MANIFEST | sed -ne '/version=/ {s/version=//;p}' | head -n1 | tr -d '\n' | sha512sum | cut -b 1-8 ``` 4. To initiate the update, set the `RequestedActivation` property of the desired image to `Active`, substitute ```` with the hash value noted on the previous step, this will write the contents of the image to a UBI volume in the PNOR chip via one of the following methods: * Method 1: From the BMC command line: ``` busctl set-property org.open_power.Software.Host.Updater \ /xyz/openbmc_project/software/ \ xyz.openbmc_project.Software.Activation RequestedActivation s \ xyz.openbmc_project.Software.Activation.RequestedActivations.Active ``` * Method 2: Using the REST API: ``` curl -b cjar -k -H "Content-Type: application/json" -X PUT \ -d '{"data": "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"}' \ https://${bmc}/xyz/openbmc_project/software//attr/RequestedActivation ``` 5. (Optional) Check the flash progress. This interface is only available during the activation progress and is not present once the activation is completed via one of the following: * Method 1: From the BMC command line: ``` busctl get-property org.open_power.Software.Host.Updater \ /xyz/openbmc_project/software/ \ xyz.openbmc_project.Software.Activation Progress ``` * Method 2: Using the REST API: ``` curl -b cjar -k https://${bmc}/xyz/openbmc_project/software//attr/Progress ``` 6. Check the activation is complete by verifying the Activation property is set to Active via one of the following methods: * Method 1: From the BMC command line: ``` busctl get-property org.open_power.Software.Host.Updater \ /xyz/openbmc_project/software/ \ xyz.openbmc_project.Software.Activation Activation ``` * Method 2: Using the REST API: ``` curl -b cjar -k https://${bmc}/xyz/openbmc_project/software/ ``` ### Patching the host firmware Copy the partition binary file to `/usr/local/share/pnor/` on the BMC. The partition binary file must be named the same as the partition name that intends to patch, ex: `ATTR_TMP`. ### Associations, MANIFEST File, Deleting an Image, Software Field Mode, and Software Factory Reset Information about associations, the MANIFEST file, deleting an image, software field mode, and software factory reset can be found at [ubi-code-update.md#associations](ubi-code-update.md#associations) ### Implementation https://github.com/openbmc/openpower-pnor-code-mgmt