summaryrefslogtreecommitdiffstats
path: root/ubi
Commit message (Collapse)AuthorAgeFilesLines
* Host.Updater.service: Move dependency on ubi service to the ubi serviceAdriana Kobylak2019-10-281-0/+4
| | | | | | | | | | | | | | | The org.open_power.Software.Host.Updater.service is a service common to the static and ubi layout, but it had a dependency on a ubi service. It doesn't cause a failure on the static layout because the dependency is a Wants vs a Required, but it should not be there. Move the dependency instead to the ubi service. Tested: Verified on witherspoon that the org.open_power.Software.Host.Updater.service started followed by the obmc-flash-bios-ubipatch.service as it did before. Change-Id: I9c850e312d0b11faaf2a08db6b3ccb17cdfcbcb6 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Move updatesymlinks to new vpnor featureAdriana Kobylak2019-10-253-80/+2
| | | | | | | | | | | | | | The updatesymlinks functionality is to support virtual pnor and it does not depend on the filesystem type. Move it to a new vpnor feature so that users can make use of this feature without being tied to UBI, for example on a eMMC that has a combined BMC+PNOR image. Tested: Verified that the witherspoon image contained the new script and service file and that it powered on to the host. Change-Id: Ic5e51dfde81718e5e285f010be67afbd58eac2e1 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Code Update: Host ApplyTime supportJayashankar Padath2019-08-091-0/+8
| | | | | | | | | | | | | | | | | | | | Get the requested image apply time value provided through the UpdateService redfish schema. If the apply time value is Immediate, then host reboot will be triggered just after the new pnor image activation. The default apply time value is OnReset in which the new image remains at Active state and user has to manualy reboot the host for applying the new image. Tested: Verified that host is getting rebooted while doing a pnor code update if the apply time value is Immediate. Tested this use case at server power Off and Running scenarios. OnReset scenario was also tested in which new image remained at Active state as pnor code update application did not trigger the host reboot. Note: This change is applicable to ubi based systems (Witherspoon) Signed-off-by: Jayashankar Padath <jayashankar.padath@in.ibm.com> Change-Id: I74f73172626919b225efef43d9baacd64eadbf60
* ubi: Rewrite freePriorityAdriana Kobylak2019-07-231-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | freePriority is called by RedundancyPriority::priority() to ensure that there are no duplicate priority values. Originally, freePriority would call priority() whenever it updated a priority value, but this would call freePriority again. This can cause the priorities stored on flash to not match the D-Bus values. The priorities on flash are used to determine which version to boot from so that leads to unexpected behavior. Example is if A has priority 1 and B has priority 2, and the priority of B is changed to 1, this triggers the new value of 1 to be stored on flash, then A is bumped to 2, but then B that originally had 2 is bumped to 3, so that at the end of the operation, B has priority 3 on flash but the correct 1 in D-Bus. The solution is to prevent freePriority from calling itself, by sorting all versions by priority in ascending order, so that if a version is bumped, then only the remaining versions need to be checked. Then locally update the priority values on flash and on D-Bus for each changed one. Tested: Changed priorities multipled times and verified the mismatch is not seen anymore. Change-Id: I704ee98f356a1a77f431b83e4b9d787b2671aeb2 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Move script and systemd service files into repoAdriana Kobylak2019-06-2112-0/+487
| | | | | | | | | | Move the obmc-flash-bios script and systemd service files from openbmc/openbmc to the local repo. Tested: PNOR code update was successful on witherspoon. Change-Id: Ibb7adba0638b8205173cb0ec4d4d61f2aeb6ce28 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Static layout: support image verificationLei YU2019-04-043-3/+3
| | | | | | | | | | | Add support of image verification for static layout PNOR code update. Tested: Verify the PNOR code update succeeds with valid-signed PNOR; and fails with invalid-signed PNOR or a PNOR tarball without signature. Change-Id: I1aafeb4e8e07eaa16c170f33f4f21940f7c9c146 Signed-off-by: Lei YU <mine260309@gmail.com>
* activation_ubi: Set priority in constructorAdriana Kobylak2019-03-251-1/+6
| | | | | | | | | | | | | | | | | | The base activation class sets the priority value in its constructor, but since the ubi class overrides this method, need to call it in the ubi constructor as well, otherwise the priority values won't get written to flash after a BMC factory reset, causing the pnor updater to think there are no pnor versions installed. Tested: After a BMC factory reset, the ubi priority() method was called, which restores the pnor priority files, and the pnor symlinks were created. Fixes: openbmc/openbmc#3507 Change-Id: I5d234ab232c91ac01d5c15c1c6ae87408c73b99c Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Refactor: Use hiomapd instead of mboxdLei YU2019-03-181-59/+5
| | | | | | | | | | | | | | mbox service is renamed to hiomapd and provides "Suspend" and "Resume" method calls, which is more appropriate for raw "cmd" calls. Use the new methods to suspend and resume hiomapd. Move "getService()" function into utils so it is shared by multiple files. Tested: Verify the reset works on Romulus Change-Id: I8f89de134b13126697bfc69a21a3148a01c34cca Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Fix issues found by cppcheckLei YU2019-03-135-12/+12
| | | | | | | | | | | | | | | | | | | | | | | Resolve several issues found by cppcheck: [msl_verify.hpp:28]: (style) Class 'MinimumShipLevel' has a constructor with 1 argument that is not explicit. [ubi/watch.hpp:21]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [item_updater_main.cpp:22] -> [item_updater_main.cpp:49]: (style) Local variable rc shadows outer symbol [serialize.cpp:19]: (performance) Function parameter 'versionId' should be passed by const reference. [ubi/watch.hpp:43]: (style) Struct 'CustomFd' has a constructor with 1 argument that is not explicit. [serialize.cpp:52]: (performance) Function parameter 'versionId' should be passed by const reference. [serialize.cpp:116]: (performance) Function parameter 'versionId' should be passed by const reference. [activation.cpp:115] -> [activation.cpp:152]: (style) Local variable mapperResponseMsg shadows outer symbol [version.hpp:114]: (performance) Variable 'eraseCallback' is assigned in constructor body. Consider performing initialization in initialization list. [image_verify.hpp:53]: (style) Struct 'CustomFd' has a constructor with 1 argument that is not explicit. [ubi/item_updater_ubi.cpp:192]: (performance) Function parameter 'versionId' should be passed by const reference. [ubi/item_updater_ubi.cpp:203]: (performance) Function parameter 'versionId' should be passed by const reference. Tested: Verify the code compiles and cppcheck does not report the above issues. Change-Id: I096392a2a7a283fe198c9c29185125e61295e10f Signed-off-by: Lei YU <mine260309@gmail.com>
* test: Add sources of static PNORLei YU2019-03-132-2/+15
| | | | | | | | | | | | | | | | Add sources in static dir to test. It generates a link error about duplcated GardReset::reset(). Then an issue is found that GardReset::~GardReset() is not virtual, this will casuse the destructor not calling its super class' dtor. To fix the above link error, add GardReset[Ubi|Static] to make ubi/static specific implementation in its own class. Tested: Verify the test build works fine. Change-Id: I41bd4d522e8b9c4053283c0cf4373807ef4f2d1c Signed-off-by: Lei YU <mine260309@gmail.com>
* Static layout: Do not update PNOR when host is onLei YU2019-03-132-2/+5
| | | | | | | | | | | | | | Static layout only has 1 active and functional PNOR. When host is running, do not update PNOR. This is done by checking the return value of freeSpace(), and if it returns false, it means there is no space for PNOR because the host is running and erase() returns false. Tested: Verify the status becomes Failed when trying to activate a PNOR while host is running. Change-Id: Ie2986b0c6fd29557685f67eb77ccc29709e1669a Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Make createActivation() commonLei YU2019-03-082-107/+41
| | | | | | | | | | | | | | | | | | The function is almost the same for ubi and static layout, except a few differences that creates the ubi objects. Add below pure virtual functions for ubi to create ubi specific objects * createActivationObject() * createVersionObject() Then it is possible to move most of the code in createActivation() into the commone one. Tested: On the last commit of the patch series, run code update and factory reset on Witherspoon and all work fine. Change-Id: Ieb3e783bc5b251529a55909f9e9f644230b274e7 Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Move serialize to ubiLei YU2019-03-083-0/+174
| | | | | | | | | | Functions in serialize are specific to UBI, move it to ubi dir. Tested: On the last commit of the patch series, run code update and factory reset on Witherspoon and all work fine. Change-Id: I9176e638d9f3bfe0d424b57f8da4667a751cb5bd Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Split Activation into common and ubiLei YU2019-03-084-4/+249
| | | | | | | | | | | | | | | | | Activations has a few functions coupled with ubi, split them into ubi/activation_ubi * Keep common code in activation. * Make start/finishActivation() pure virtual. * Move ubi specific code into ubi. * Move ubiVolumnCreated into ubi. * Make validateSignature() not inline, otherwise it gets compile error. Tested: On the last commit of the patch series, run code update and factory reset on Witherspoon and all work fine. Change-Id: I7c8a0de6b0be4b1e9814ea75fd802a014b4aacfc Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Remove unused isLowestPriority()Lei YU2019-03-072-17/+0
| | | | | | | | | | The function isLowestPriority() is not used, remove it. Tested: On the last commit of the patch series, run code update and factory reset on Witherspoon and all work fine. Change-Id: Ib71ce5b9ad0319f8d7db3442d507c3fee7aba7fa Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Move determinId to ubiLei YU2019-03-073-3/+11
| | | | | | | | | | The function determinId is used only in ubi case, move it to ubi. Tested: On the last commit of the patch series, run code update and factory reset on Witherspoon and all work fine. Change-Id: I8974d25bf904a5202b913fc185790c5ecf8eca90 Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Move watch to ubiLei YU2019-03-073-1/+249
| | | | | | | | | | watch is ubi specific functions, move it to ubi dir. Tested: On the last commit of the patch series, run code update and factory reset on Witherspoon and all work fine. Change-Id: Ia7f6b6de845ddd40e2a32ad626d3b7af9074c7f3 Signed-off-by: Lei YU <mine260309@gmail.com>
* Refactor: Split item_updater to common and ubiLei YU2019-03-073-0/+640
The existing item_updater is highly coupled with ubifs. It will support static layout and ubi in future. So split the functions in to common ones and ubi specific ones, and move the ubi specific code in ubi dir. 1. Keep common functions and make them virtual for extension. createActiveAssociation() updateFunctionalAssociation() removeAssociation() erase() 2. Create ubi/item_updater_ubi and move other functions into it. 3. Change updateFunctionalAssociation() parameter for future use. To support static layout, a new item_updater_static will be written. Tested: On the last commit of the patch series, run code update and factory reset on Witherspoon and all work fine. Change-Id: I4cc55b31ee3f37c5b27168611305dee8ce02880a Signed-off-by: Lei YU <mine260309@gmail.com>
OpenPOWER on IntegriCloud