how to config help_manifest.prototxt?

100 views
Skip to first unread message

Guo-Zhong Liu

unread,
Jun 8, 2022, 10:03:30 AM6/8/22
to ChromiumOS Development, chromiu...@chromium.org
Hi,
  We need some experts to give us some good advice to verify firmware upgrade feature by modemFWD in Chromius OS with Chromebook hardware platform.
 for example, how to config help_manifest.prototxt, firmware_manifest.prototxt?
  We are going to make our modem module to support upgrade firmware by modemFWD in Chromium os. Our module is located in Chromebook. Now we implement some system APIs(include get_fw_info/prepare_to_flash/flash_main_fw/flash_carrier_fw/reboot) by add a standalone modem_program program. Now we are going to integrate test for firmware upgrade by modemFWD. The error message like "No suitable helpers found in /opt/google/modemfwd-helper" are shown. But I don't knowhow to config help_manifest.prototxt, firmware_manifest.prototxt. Thanks.

Andrew Lassalle

unread,
Jun 8, 2022, 12:59:29 PM6/8/22
to Guo-Zhong Liu, ChromiumOS Development
I assume this is for experimentation purposes, since adding new modem FWs to official ChromeOS devices requires Google's involvement.

If you can deploy your FW images to the device using a local build, you can follow the example of the Coral board:


The device_id in the helper_manifest.prototxt is the name of the USB device and it' used to detect the modem and select the corresponding modem helper binary, which is developed by the modem vendor. There are no examples of this binary in the public repos, since the code is vendor specific. 
 
Here is a  sample code that is used in most helpers:

#include <base/files/file_path.h>
#include <base/logging.h>
#include <base/strings/string_split.h>
#include <brillo/flag_helper.h>
#include <brillo/process/process.h>
#include <brillo/syslog_logging.h>
#include <chromeos/switches/modemfwd_switches.h>

int main(int argc, char** argv) {
  DEFINE_bool(prepare_to_flash, false, "Put the modem in flash mode");
  DEFINE_string(flash_fw, "", "Flash file(s) containing firmware to the modem");
  DEFINE_bool(get_fw_info, false, "Get custpack information");
  DEFINE_bool(reboot, false, "Reboot the modem");
  DEFINE_bool(flash_mode_check, false, "Check if the modem is in flash mode");
  DEFINE_string(fw_version, "", "Version number of the firmware to flash");

  brillo::FlagHelper::Init(argc, argv, "XX helper for modemfwd");
  brillo::InitLog(brillo::kLogToSyslog | brillo::kLogToStderrIfTty);

  int num_opts = FLAGS_prepare_to_flash + !FLAGS_flash_fw.empty() +
                 FLAGS_get_fw_info + FLAGS_reboot + FLAGS_flash_mode_check;
  if (num_opts != 1) {
    LOG(ERROR) << "Must supply exactly one supported action";
    return EXIT_FAILURE;
  }

  if (FLAGS_prepare_to_flash) {
    LOG(INFO) << "Get modem ready for flashing.";
    // Code here
    return EXIT_SUCCESS;
  }

  if (FLAGS_get_fw_info) {
    Version version;
    if (!GetVersion(&version))
      return EXIT_FAILURE;

    printf("%s:%s\n", modemfwd::kFwMain, version.main_version.c_str());
    printf("%s:%s\n", modemfwd::kFwCarrierUuid, version.carrier_uuid.c_str());
    printf("%s:%s\n", modemfwd::kFwCarrier, version.carrier_version.c_str());
    printf("%s:%s\n", modemfwd::kFwOem, version.oem_version.c_str());
    return EXIT_SUCCESS;
  }

  if (FLAGS_flash_mode_check) {
    puts(FlashModeCheck() ? "true" : "false");
    return EXIT_SUCCESS;
  }

  bool ret = helper::RebootModem();
  if (FLAGS_reboot || !ret)
    return ret ? EXIT_SUCCESS : EXIT_FAILURE;

  if (FLAGS_flash_fw.empty())
    return EXIT_SUCCESS;

  base::StringPairs parsed_versions;
  std::string main_version;
  std::string carrier_version;
  std::string oem_version;
  if (!FLAGS_fw_version.empty() &&
      base::SplitStringIntoKeyValuePairs(FLAGS_fw_version, ':', ',',
                                         &parsed_versions)) {
    for (const auto& pair : parsed_versions) {
      if (pair.first == modemfwd::kFwMain) {
        main_version = pair.second;
        DLOG(INFO) << "Flashing Main version: " << main_version;
      } else if (pair.first == modemfwd::kFwCarrier) {
        carrier_version = pair.second;
        DLOG(INFO) << "Flashing Carrier version: " << carrier_version;
      } else if (pair.first == modemfwd::kFwOem) {
        oem_version = pair.second;
        DLOG(INFO) << "Flashing OEM version: " << oem_version;
      } else {
        DLOG(WARNING) << "Unkown version type '" << pair.first << "' (='"
                      << pair.second << "')";
      }
    }
  }

  // Flash FWs
  ...
  ...


--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-dev

Guo-Zhong Liu

unread,
Jun 9, 2022, 10:48:54 AM6/9/22
to ChromiumOS Development, andrewl...@chromium.org, ChromiumOS Development, Guo-Zhong Liu
Hi Andrew,
     Many thanks for your kind support.
     However a new message 'Could not open journal file' happened after input helper_manifest.prototxt and firmware_manifest.prototxt to run 'modemfwd --firmware_directory=/opt/google/modemfwd/ --helper_directory=/opt/google/modemfwd-helper/'.
    So need we a journal file? Can you upload a sample for journal file to us to refer to?

   And we have other two questions:
      1) Can we use a uncompressed file such as 'ota.bin' as a firmware filename?
      2) Should we config firmware_manifest.proto and helper_manifest.proto to match firmware_manifest.prototxt and helper_manifest.prototxt?

 Thanks a lot in advance!
andrewl...@chromium.org 在 2022年6月9日 星期四上午12:59:29 [UTC+8] 的信中寫道:

Andrew Lassalle

unread,
Jun 9, 2022, 12:03:07 PM6/9/22
to Guo-Zhong Liu, ChromiumOS Development
the journal file should be added automatically by modemfwd, and it will be located in /var/cache/modemfwd/journal. You are probably having permission issues because you are running modemfwd manually.
Try using `restart modemfwd` so the modemfwd.conf script is used to launch modemfwd with the correct permissions. modemfwd prints it's log in /var/log/messages

> Can we use a uncompressed file such as 'ota.bin' as a firmware filename? 
I believe so, the paths in firmware_manifest.prototxt  are sent to the helper, and the helper takes care of reading those files.

>     2) Should we config firmware_manifest.proto and helper_manifest.proto to match firmware_manifest.prototxt and helper_manifest.prototxt?
No, the `proto` files are an API, which should be used by all modem vendors. You should only need to modify the `prototxt` files.

Guo-Zhong Liu

unread,
Jun 9, 2022, 10:47:59 PM6/9/22
to ChromiumOS Development, andrewl...@chromium.org, ChromiumOS Development, Guo-Zhong Liu
Hi Andrew,
    Thanks for your reply. Your reply made the second and third question clear. 
 
    It seems that we still have permission issues when we are running modemfwd manually, the output message of 'restart modemfwd'  and 'modemfwd --firmware_directory=/opt/google/modemfwd --helper_directory=/opt/google/modemfwd-helpers/' are attached, how can we fix the permission issues? thanks.

    

andrewl...@chromium.org 在 2022年6月10日 星期五上午12:03:07 [UTC+8] 的信中寫道:
the log of restart modemfwd and modemfwd.txt

Andrew Lassalle

unread,
Jun 10, 2022, 11:32:50 AM6/10/22
to Guo-Zhong Liu, ChromiumOS Development
`restart` only works when the service was previously running, otherwise you have to run `start modemfwd`

Can you provide `/var/log/messages` and `/var/log/audit/audit.log` after running `start modemfwd` or `restart modemfwd` ?
 

If you want to experiment with the manual command, the best and easiest way is to modify `/etc/init/modemfwd.conf`, and then run `start modemfwf`

Guo-Zhong Liu

unread,
Jun 11, 2022, 8:27:27 PM6/11/22
to ChromiumOS Development, andrewl...@chromium.org, ChromiumOS Development, Guo-Zhong Liu
Hi Andrew,
    Thanks for your direction.
    The attached file is the log for '/var/log/messages' after running 'start modemfwd'.
    I can't find '/var/log/audi/audit.log'.

    I think that  'start modemfwd' command can upgrade firmware by calling our systemAPI when I put our firmware image and firmware_manifest.prototxt into '/opt/google/modem-firmware' and put helper file 'modem_program' and help_manifest.prototxt' into '/opt/google/modem-helpers/'.  Am I right? If yes, we don't need to run modemfwd manually.

  Thanks again.

andrewl...@chromium.org 在 2022年6月10日 星期五下午11:32:50 [UTC+8] 的信中寫道:
messages

Guo-Zhong Liu

unread,
Jun 13, 2022, 8:47:20 AM6/13/22
to ChromiumOS Development, Guo-Zhong Liu, andrewl...@chromium.org, ChromiumOS Development
Hi Andrew,
    Congratulations, we can upgrade firmware by modemFWD, many thanks for your directions.

   However, we still have two problems and need some experts to give a good advice,thanks.
   1.How to configure carrier_uuid?
      We insert ChinaUnicom sim card, but it still upgrade firmware by main_firmware and default_main_firmware_version, but can't go into ChinaUnicom carrier firmware.

  2.How to inhabit our modem during flash firmware into modem?

  The attached file is the /var/log/messages, please refer to it, thanks.

Guo-Zhong Liu 在 2022年6月12日 星期日上午8:27:27 [UTC+8] 的信中寫道:
messages-20220613

Andrew Lassalle

unread,
Jun 13, 2022, 10:10:29 AM6/13/22
to Guo-Zhong Liu, ChromiumOS Development
The carrier_uuid is sent by shill to modemfwd. Shill has a list of carriers in platform2/shill/mobile_operator_db/serviceproviders.prototxt, and each carrier has an uuid. When the SIM card is inserted, shill identifies the carrier using the MCCMNC or other properties, and modemfwd requests the uuid from shill after that. 
If your SIM card is China Unicom(MCCMNC==46001), then the UUID is  17803117-3b91-4420-a948-02761ab0ce55. The value in your firmware_manifest.prototxt has to match this value.

To inhibit the modem, modemfwd gets the modem manager object path from shill. In your case, it seems that shill doesn't have this value. 
Is ModemManager running in your device?

ModemManager and Shill logs are located in /var/log/net.log

You should enable verbose logging for modemfwd/ModemManager and Shill by typing:
`config_net_log set-verbose-logging-on-reboot-all true` and then reboot

If you are having trouble with ModemManager, you can troubleshoot it using the command `mmcli` 


Guo-Zhong Liu

unread,
Jun 20, 2022, 9:50:57 AM6/20/22
to ChromiumOS Development, andrewl...@chromium.org, ChromiumOS Development, Guo-Zhong Liu
Hi Andrew,
     Thanks for your kind support.
      There are two problems and need some experts to direct,thanks in advance!
      1). I want to define a Generic carrier whose MCCMNC are not include  serviceproviders.prototxt as 'Generic' carrier, how will I do? Notice it's not 'default'.

      2).What is difference between 'default_main_firmware_version' and 'main_firmware version'? 
          

andrewl...@chromium.org 在 2022年6月13日 星期一晚上10:10:29 [UTC+8] 的信中寫道:

Andrew Lassalle

unread,
Jun 20, 2022, 11:09:52 AM6/20/22
to Guo-Zhong Liu, ChromiumOS Development
For a generic carrier,use the word "generic":
```
carrier_id: "generic"
``` 
The configuration file supports multiple main_firmware versions, since each carrier can use a different one.
The `default_main_firmware_version` specifies which of the main_firmware is the default one.

Take a look at this code, as it might be helpful for your purposes:

Andrew Lassalle

unread,
Jul 15, 2022, 11:02:48 AM7/15/22
to Guo-Zhong Liu, ChromiumOS Development
No, the official ChromeOS(from Google) only packages the firmware for the devices that are built with official partners. 
For example, if an HP device is launched with modem X, google will work with the modem vendor and HP to build and test that device. For those devices, the modem fw will be embedded in the ChromeOS image hosted by google. ChromeOS devices don't download packages, they download the entire pre-built image, so devices without modem X, will never include the FW for that modem since they don't need it. 
If your FW is for a modem that is not used in any official ChromeOS device, no devices will include your FW.

  

On Thu, Jul 14, 2022 at 8:55 PM Guo-Zhong Liu <guo-zhon...@foxconn.com> wrote:
Hi Andrew,
     Thanks for your kind support and we can upgrade modem firmware  by modemfwd service.
But I want to know how to upload the firmware package to provision server to verify the feature? Do chromium OS have the firmware providion server like LVFS server in ubuntu OS?
     Thanks.

andrewl...@chromium.org 在 2022年6月20日 星期一晚上11:09:52 [UTC+8] 的信中寫道:

Guo-Zhong Liu

unread,
Jul 16, 2022, 9:17:31 PM7/16/22
to ChromiumOS Development, andrewl...@chromium.org, ChromiumOS Development, Guo-Zhong Liu
Hi Andrew,
     Thanks for your kind support and we can upgrade modem firmware  by modemfwd service.
But I want to know how to upload the firmware package to provision server to verify the feature? Do chromium OS have the firmware providion server like LVFS server in ubuntu OS?
     Thanks.

andrewl...@chromium.org 在 2022年6月20日 星期一晚上11:09:52 [UTC+8] 的信中寫道:
For a generic carrier,use the word "generic":
Reply all
Reply to author
Forward
0 new messages