openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image
@ 2019-11-15  2:24 Bright Cheng/WYHQ/Wiwynn
  2019-11-15  2:51 ` Lei YU
  0 siblings, 1 reply; 6+ messages in thread
From: Bright Cheng/WYHQ/Wiwynn @ 2019-11-15  2:24 UTC (permalink / raw)
  To: openbmc, 'Adriana Kobylak',
	Gunnar Mills, Lei Yu, Ratan Gupta, Jayanth Othayoth
  Cc: 'Neeraj Ladkani',
	Delphine Chiu/WYHQ/Wiwynn, Bonnie Lo/WYHQ/Wiwynn


[-- Attachment #1.1: Type: text/plain, Size: 1345 bytes --]

Hi Adriana,

We add some modifications for phosphor-bmc-code-mgmt can support remote BMC update for static layout.

Do you agree these modifications?

phosphor-bmc-code-memt doesn't support static-layout remote update since static layout fw package could only has "image-bmc" in the package.

Following are the modifications
1. Add a name list for static layout only has image-bmc in the fw package and modify related image file checking.
2. Add checking ApplyTime property for static layout to decide whether reboot to apply update process or not.

Please find the patch for these modifications in the attachment.

Thanks in advanced for any insight !

---------------------------------------------------------------------------------------------------------------------------------------------------------------
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. 
Any unauthorized review, use, copying or distribution of this email or the content of this email is strictly prohibited.
If you are not the intended recipient, you may reply to the sender and should delete this e-mail immediately.
---------------------------------------------------------------------------------------------------------------------------------------------------------------

[-- Attachment #1.2: Type: text/html, Size: 5578 bytes --]

[-- Attachment #2: 0001-add-namelist-to-support-image-bmc-and-using-systemca.patch --]
[-- Type: application/octet-stream, Size: 6430 bytes --]

From a0fd6dc5dc538048e2bf4950b73f7f1a77dfb372 Mon Sep 17 00:00:00 2001
From: bright <bright_cheng@wiwynn.com>
Date: Thu, 12 Sep 2019 17:25:34 +0800
Subject: [PATCH] add namelist to support image bmc and using systemcall to
 reboot BMC

---
 activation.cpp       | 20 +++++++++++++++++---
 download_manager.cpp |  4 ++++
 images.hpp           |  2 ++
 item_updater.cpp     | 19 ++++++++++++++-----
 static/flash.cpp     | 22 +++++++++++++++++++---
 5 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/activation.cpp b/activation.cpp
index 0c18821..1ff8eff 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -78,7 +78,6 @@ void Activation::unsubscribeFromSystemdSignals()
 
 auto Activation::activation(Activations value) -> Activations
 {
-
     if ((value != softwareServer::Activation::Activations::Active) &&
         (value != softwareServer::Activation::Activations::Activating))
     {
@@ -200,7 +199,23 @@ auto Activation::activation(Activations value) -> Activations
         // Create active association
         parent.createActiveAssociation(path);
 
-        log<level::INFO>("BMC image ready, need reboot to get activated.");
+        if (Activation::checkApplyTimeImmediate() == true)
+        {
+            log<level::INFO>("Image Active. ApplyTime is immediate, "
+                             "rebooting BMC.");
+            auto reply = std::system("/sbin/reboot");
+            if (reply < 0)
+            {
+                log<level::ALERT>("Error in trying to reboot the BMC. "
+                                  "The BMC needs to be manually rebooted to complete "
+                                  "the image activation.");
+            }
+        }
+        else
+        {
+            log<level::INFO>("BMC image ready, need reboot to get activated.");
+        }
+
         return softwareServer::Activation::activation(
             softwareServer::Activation::Activations::Active);
 #endif
@@ -212,7 +227,6 @@ auto Activation::activation(Activations value) -> Activations
     }
     return softwareServer::Activation::activation(value);
 }
-
 void Activation::deleteImageManagerObject()
 {
     // Call the Delete object for <versionID> inside image_manager
diff --git a/download_manager.cpp b/download_manager.cpp
index 6357ee8..a6beee7 100644
--- a/download_manager.cpp
+++ b/download_manager.cpp
@@ -30,6 +30,8 @@ void Download::downloadViaTFTP(std::string fileName, std::string serverAddress)
 {
     using Argument = xyz::openbmc_project::Common::InvalidArgument;
 
+    fprintf(stdout, "TFTP download start \r\n");
+
     // Sanitize the fileName string
     if (!fileName.empty())
     {
@@ -43,6 +45,7 @@ void Download::downloadViaTFTP(std::string fileName, std::string serverAddress)
         log<level::ERR>("Error FileName is empty");
         elog<InvalidArgument>(Argument::ARGUMENT_NAME("FileName"),
                               Argument::ARGUMENT_VALUE(fileName.c_str()));
+        fprintf(stdout, "fileName is empty: %s \r\n", fileName.c_str());
         return;
     }
 
@@ -51,6 +54,7 @@ void Download::downloadViaTFTP(std::string fileName, std::string serverAddress)
         log<level::ERR>("Error ServerAddress is empty");
         elog<InvalidArgument>(Argument::ARGUMENT_NAME("ServerAddress"),
                               Argument::ARGUMENT_VALUE(serverAddress.c_str()));
+        fprintf(stdout, "serverAddress is empty: %s \r\n", serverAddress.c_str());
         return;
     }
 
diff --git a/images.hpp b/images.hpp
index 97b8f7f..ceac336 100644
--- a/images.hpp
+++ b/images.hpp
@@ -13,6 +13,8 @@ namespace image
 // BMC flash image file name list.
 const std::vector<std::string> bmcImages = {"image-kernel", "image-rofs",
                                             "image-rwfs", "image-u-boot"};
+// BMC flash image file name list (image-bmc)
+const std::vector<std::string> bmcFlashImages = {"image-bmc"};
 
 } // namespace image
 } // namespace software
diff --git a/item_updater.cpp b/item_updater.cpp
index 21fb6e0..911ddb0 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -358,16 +358,25 @@ ItemUpdater::ActivationStatus
 {
     bool invalid = false;
 
-    for (auto& bmcImage : bmcImages)
+    for (auto& bmcFlashImage : bmcFlashImages)
     {
         fs::path file(filePath);
-        file /= bmcImage;
+        file /= bmcFlashImage;
         std::ifstream efile(file.c_str());
         if (efile.good() != 1)
         {
-            log<level::ERR>("Failed to find the BMC image.",
-                            entry("IMAGE=%s", bmcImage.c_str()));
-            invalid = true;
+            for (auto& bmcImage : bmcImages)
+            {
+                fs::path file(filePath);
+                file /= bmcImage;
+                std::ifstream efile(file.c_str());
+                if (efile.good() != 1)
+                {
+                    log<level::ERR>("Failed to find the BMC image.",
+                                    entry("IMAGE=%s", bmcImage.c_str()));
+                    invalid = true;
+                }
+            }
         }
     }
 
diff --git a/static/flash.cpp b/static/flash.cpp
index 82c2393..b3f8640 100644
--- a/static/flash.cpp
+++ b/static/flash.cpp
@@ -6,6 +6,7 @@
 #include "images.hpp"
 
 #include <experimental/filesystem>
+#include <fstream>
 
 namespace
 {
@@ -28,10 +29,25 @@ void Activation::flashWrite()
     // the image to flash during reboot.
     fs::path uploadDir(IMG_UPLOAD_DIR);
     fs::path toPath(PATH_INITRAMFS);
-    for (auto& bmcImage : phosphor::software::image::bmcImages)
+    for (auto& bmcFlashImage : phosphor::software::image::bmcFlashImages)
     {
-        fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage,
-                      fs::copy_options::overwrite_existing);
+        fs::path file(uploadDir.c_str());
+        file /= versionId;
+        file /= bmcFlashImage;
+        std::ifstream efile(file.c_str());
+        if (efile.good() != 1)
+        {
+            for (auto& bmcImage : phosphor::software::image::bmcImages)
+            {
+                fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage,
+                              fs::copy_options::overwrite_existing);
+            }
+        }
+        else
+        {
+            fs::copy_file(uploadDir / versionId / bmcFlashImage, toPath / bmcFlashImage,
+                          fs::copy_options::overwrite_existing);
+        }
     }
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image
  2019-11-15  2:24 phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image Bright Cheng/WYHQ/Wiwynn
@ 2019-11-15  2:51 ` Lei YU
  2019-11-15 16:00   ` Adriana Kobylak
  0 siblings, 1 reply; 6+ messages in thread
From: Lei YU @ 2019-11-15  2:51 UTC (permalink / raw)
  To: Bright Cheng/WYHQ/Wiwynn
  Cc: openbmc, Adriana Kobylak, Gunnar Mills, Ratan Gupta,
	Jayanth Othayoth, Neeraj Ladkani, Delphine Chiu/WYHQ/Wiwynn,
	Bonnie Lo/WYHQ/Wiwynn

On Fri, Nov 15, 2019 at 10:24 AM Bright Cheng/WYHQ/Wiwynn
<Bright_Cheng@wiwynn.com> wrote:
>
> Hi Adriana,
>
>
>
> We add some modifications for phosphor-bmc-code-mgmt can support remote BMC update for static layout.
>
>
>
> Do you agree these modifications?
>
>
>
> phosphor-bmc-code-memt doesn’t support static-layout remote update since static layout fw package could only has “image-bmc” in the package.

For now, it does support static layout, you just need to upload the
tarball contains separated images, instead of the whole "image-bmc"
tarball.

>
>
> Following are the modifications
>
> 1. Add a name list for static layout only has image-bmc in the fw package and modify related image file checking.
>
> 2. Add checking ApplyTime property for static layout to decide whether reboot to apply update process or not.
>
>
>
> Please find the patch for these modifications in the attachment.

It may be useful to support the whole image as well, so please submit
the code to gerrit, and we could review the code.
Please follow https://github.com/openbmc/docs/blob/master/CONTRIBUTING.md#submitting-changes-via-gerrit-server-to-openbmc
for how to submit changes to gerrit.
Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image
  2019-11-15  2:51 ` Lei YU
@ 2019-11-15 16:00   ` Adriana Kobylak
  2019-11-21 10:29     ` Bright Cheng/WYHQ/Wiwynn
  0 siblings, 1 reply; 6+ messages in thread
From: Adriana Kobylak @ 2019-11-15 16:00 UTC (permalink / raw)
  To: Lei YU, Bright Cheng/WYHQ/Wiwynn
  Cc: openbmc, Adriana Kobylak, Neeraj Ladkani,
	Delphine Chiu/WYHQ/Wiwynn, Jayanth Othayoth, Gunnar Mills,
	Ratan Gupta, openbmc

>> phosphor-bmc-code-memt doesn’t support static-layout remote update 
>> since static layout fw package could only has “image-bmc” in the 
>> package.
> 
> For now, it does support static layout, you just need to upload the
> tarball contains separated images, instead of the whole "image-bmc"
> tarball.
> 

Checking the build files, the *.static.mtd.all.tar contains the 
image-bmc, manifest and signature files so yeah we can just upload that 
file without any build changes, we just need to add the support in the 
bmc-code-mgmt repo.

>> 
>> 
>> Following are the modifications
>> 
>> 1. Add a name list for static layout only has image-bmc in the fw 
>> package and modify related image file checking.
>> 
>> 2. Add checking ApplyTime property for static layout to decide whether 
>> reboot to apply update process or not.
>> 
>> 
>> 
>> Please find the patch for these modifications in the attachment.

Looks good, if you could just break the patch into two separate patches, 
one for the supporting image-bmc and one for adding the ApplyTime 
property, and submit via gerrit as Lei YU pointed. Let us know if you 
have any questions with the process. Thanks!

> 
> It may be useful to support the whole image as well, so please submit
> the code to gerrit, and we could review the code.
> Please follow
> https://github.com/openbmc/docs/blob/master/CONTRIBUTING.md#submitting-changes-via-gerrit-server-to-openbmc
> for how to submit changes to gerrit.
> Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image
  2019-11-15 16:00   ` Adriana Kobylak
@ 2019-11-21 10:29     ` Bright Cheng/WYHQ/Wiwynn
  2019-11-22  1:36       ` Adriana Kobylak
  0 siblings, 1 reply; 6+ messages in thread
From: Bright Cheng/WYHQ/Wiwynn @ 2019-11-21 10:29 UTC (permalink / raw)
  To: Adriana Kobylak, Lei YU
  Cc: openbmc, Adriana Kobylak, Neeraj Ladkani,
	Delphine Chiu/WYHQ/Wiwynn, Jayanth Othayoth, Gunnar Mills,
	Ratan Gupta, openbmc

Dear Adriana and Lei Yu,

We have some questions about submitting code to gerrit, 
1. We add remote to gerrit server using "https://gerrit.openbmc-project.xyz/openbmc/phosphor-bmc-code-mgmt" and try to push the commit to gerrit server.
The result shows that we need to register an email address, but we cannot verify my email address and receive an error 422 (Unprocessable Entity): invalid token.

2. We also try to add remote to gerrit server using "ssh://gerrit.openbmc-project.xyz/openbmc/phosphor-bmc-code-mgmt", but ssh connection cannot be established because timeout.

Could you help us to solve this problem? Thanks!

-----Original Message-----
>> phosphor-bmc-code-memt doesn’t support static-layout remote update 
>> since static layout fw package could only has “image-bmc” in the 
>> package.
> 
> For now, it does support static layout, you just need to upload the 
> tarball contains separated images, instead of the whole "image-bmc"
> tarball.
> 

Checking the build files, the *.static.mtd.all.tar contains the image-bmc, manifest and signature files so yeah we can just upload that file without any build changes, we just need to add the support in the bmc-code-mgmt repo.

>> 
>> 
>> Following are the modifications
>> 
>> 1. Add a name list for static layout only has image-bmc in the fw 
>> package and modify related image file checking.
>> 
>> 2. Add checking ApplyTime property for static layout to decide 
>> whether reboot to apply update process or not.
>> 
>> 
>> 
>> Please find the patch for these modifications in the attachment.

Looks good, if you could just break the patch into two separate patches, one for the supporting image-bmc and one for adding the ApplyTime property, and submit via gerrit as Lei YU pointed. Let us know if you have any questions with the process. Thanks!

> 
> It may be useful to support the whole image as well, so please submit
> the code to gerrit, and we could review the code.
> Please follow
> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenbmc%2Fdocs%2Fblob%2Fmaster%2FCONTRIBUTING.md%23submitting-changes-via-gerrit-server-to-openbmc&amp;data=02%7C01%7CBright_Cheng%40wiwynn.com%7C442ee4941d444751b2fc08d769e4b6ca%7Cde0795e0d7c04eebb9bbbc94d8980d3b%7C1%7C0%7C637094303364000313&amp;sdata=wHVT%2BukHbr0REbsXaoU8QxxNLtSR1yoLcMaWjlZpZYA%3D&amp;reserved=0
> for how to submit changes to gerrit.
> Thanks!

---------------------------------------------------------------------------------------------------------------------------------------------------------------
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. 
Any unauthorized review, use, copying or distribution of this email or the content of this email is strictly prohibited.
If you are not the intended recipient, you may reply to the sender and should delete this e-mail immediately.
---------------------------------------------------------------------------------------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image
  2019-11-21 10:29     ` Bright Cheng/WYHQ/Wiwynn
@ 2019-11-22  1:36       ` Adriana Kobylak
  2019-11-28  3:15         ` Bright Cheng/WYHQ/Wiwynn
  0 siblings, 1 reply; 6+ messages in thread
From: Adriana Kobylak @ 2019-11-22  1:36 UTC (permalink / raw)
  To: Bright Cheng/WYHQ/Wiwynn
  Cc: Lei YU, openbmc, Adriana Kobylak, Neeraj Ladkani,
	Delphine Chiu/WYHQ/Wiwynn, Jayanth Othayoth, Gunnar Mills,
	Ratan Gupta

On 2019-11-21 04:29, Bright Cheng/WYHQ/Wiwynn wrote:
> Dear Adriana and Lei Yu,
> 
> We have some questions about submitting code to gerrit,
> 1. We add remote to gerrit server using
> "https://gerrit.openbmc-project.xyz/openbmc/phosphor-bmc-code-mgmt"
> and try to push the commit to gerrit server.
> The result shows that we need to register an email address, but we
> cannot verify my email address and receive an error 422 (Unprocessable
> Entity): invalid token.
> 
> 2. We also try to add remote to gerrit server using
> "ssh://gerrit.openbmc-project.xyz/openbmc/phosphor-bmc-code-mgmt", but
> ssh connection cannot be established because timeout.
> 
> Could you help us to solve this problem? Thanks!
> 

Hi, you may be missing some setup steps to link your github account to 
gerrit, here are the instructions:
https://github.com/openbmc/docs/blob/master/development/gerrit-setup.md

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image
  2019-11-22  1:36       ` Adriana Kobylak
@ 2019-11-28  3:15         ` Bright Cheng/WYHQ/Wiwynn
  0 siblings, 0 replies; 6+ messages in thread
From: Bright Cheng/WYHQ/Wiwynn @ 2019-11-28  3:15 UTC (permalink / raw)
  To: Adriana Kobylak
  Cc: Lei YU, openbmc, Adriana Kobylak, Neeraj Ladkani,
	Delphine Chiu/WYHQ/Wiwynn, Jayanth Othayoth, Gunnar Mills,
	Ratan Gupta

Hi Adriana,

Thanks for your friendly reminder, I actually missed the steps to link github account to gerrit.

We separate our the code into two commits and submit to gerrit:
1. Support static layout image-bmc
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-bmc-code-mgmt/+/27620
2. Add ApplyTime checking
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-bmc-code-mgmt/+/27621

Please let us know if you have any questions with our submit.
Thank you for your attention !

-----Original Message-----
From: Adriana Kobylak [mailto:anoo@linux.ibm.com] 
Sent: Friday, November 22, 2019 9:36 AM
To: Bright Cheng/WYHQ/Wiwynn <Bright_Cheng@wiwynn.com>
Cc: Lei YU <mine260309@gmail.com>; openbmc@lists.ozlabs.org; Adriana Kobylak <anoo@us.ibm.com>; Neeraj Ladkani <neladk@microsoft.com>; Delphine Chiu/WYHQ/Wiwynn <DELPHINE_CHIU@wiwynn.com>; Jayanth Othayoth <ojayanth@in.ibm.com>; Gunnar Mills <gmills@linux.vnet.ibm.com>; Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Subject: RE: phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image

Hi, you may be missing some setup steps to link your github account to gerrit, here are the instructions:
https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenbmc%2Fdocs%2Fblob%2Fmaster%2Fdevelopment%2Fgerrit-setup.md&amp;data=02%7C01%7CBright_Cheng%40wiwynn.com%7C566894981bb44427584108d76eec7485%7Cde0795e0d7c04eebb9bbbc94d8980d3b%7C1%7C0%7C637099834173075475&amp;sdata=Cy64J0xWrJTNgLbD4Sj8st172VsvAik64QJ1zUKdNec%3D&amp;reserved=0

---------------------------------------------------------------------------------------------------------------------------------------------------------------
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. 
Any unauthorized review, use, copying or distribution of this email or the content of this email is strictly prohibited.
If you are not the intended recipient, you may reply to the sender and should delete this e-mail immediately.
---------------------------------------------------------------------------------------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-28  3:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15  2:24 phosphor-bmc-code-memt: Support redfish remote firmware update with static layout image Bright Cheng/WYHQ/Wiwynn
2019-11-15  2:51 ` Lei YU
2019-11-15 16:00   ` Adriana Kobylak
2019-11-21 10:29     ` Bright Cheng/WYHQ/Wiwynn
2019-11-22  1:36       ` Adriana Kobylak
2019-11-28  3:15         ` Bright Cheng/WYHQ/Wiwynn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).