How to use Modem Firmware Daemon

272 views
Skip to first unread message

李军尉

unread,
Mar 29, 2022, 10:25:23 AM3/29/22
to Chromium OS Development
Hi

How to use Modem Firmware Daemon and how to updating modem firmware.
localhost / # modemfwd --firmware_directory=/var/cache/modemfw\d/chromiumos/firmware_manifest_v2.proto --helper_directory=/var/cache/modemfwd/chromiu
mos/helper_manifest.proto
INFO modemfwd: [main.cc(44)] Running modemfwd with firmware directory...
ERROR modemfwd: [daemon.cc(113)] Supplied modem-specific helper directory /var/cache/modemfwd/chromiumos/helper_manifest.proto does not exist

Regards, Jay

Andrew Lassalle

unread,
Mar 29, 2022, 6:06:30 PM3/29/22
to 李军尉, Chromium OS Development
helper_directory and firmware_directory are directories. You are supplying file names.

try:
stop modemfwd
modemfwd --firmware_directory=/var/cache/modemfwd/chromiumos --helper_directory=/var/cache/modemfwd/chromiumos

you might not be able to run it like that though, because of permissions. You might have to change modemfwd.conf 

--
--
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

李军尉

unread,
Mar 30, 2022, 7:39:33 AM3/30/22
to Chromium OS Development, andrewl...@chromium.org, Chromium OS Development
Thanks Andrew,
But I got another error after executing you method

localhost /opt/google/modemfwd-helpers # ls
helper_manifest.proto
localhost /opt/google/modemfwd-helpers # modemfwd --firmware_directory=/var/cache/modemfwd/chromiumos/ --helper_directory=/opt/google/modemfwd-helpers/

INFO modemfwd: [main.cc(44)] Running modemfwd with firmware directory...
ERROR modemfwd: [daemon.cc(120)] No suitable helpers found in /opt/google/modemfwd-helpers/

I use the default helper_manifest.proto file in the /opt/google/modemfwd-helper/directory ,but it still doesn't work
I want to use the Modem Firmware Daemon to upgrade the firmware,how to define firmware.proto file and helper.proto file, can you provide documentation

Andrew Lassalle

unread,
Mar 30, 2022, 9:51:49 AM3/30/22
to 李军尉, Chromium OS Development
The documentation for modemfwd is here: https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/modemfwd/README.md

You won't be able to update any modem FW. Only a few are supported as modemfwd uses helper binaries provided by the modem suppliers.
Only the following modems are supported by modemfwd:
Fibocom L850-GL
Fibocom NL668AM
  
If you have some other USB modem, you will definitely not be able to update the FW using modemfwd, but you can look into using ModemManager to do that. We don't use it ourselves for modem updates, but ModemMnagaer does support updating some modems. 

On Wed, Mar 30, 2022 at 6:04 AM 李军尉 <a3276...@gmail.com> wrote:
And how to define helper_manifest.prototxt file ,Thanks

李军尉

unread,
Mar 30, 2022, 11:16:25 AM3/30/22
to Chromium OS Development, 李军尉, andrewl...@chromium.org, Chromium OS Development
And how to define helper_manifest.prototxt file ,Thanks
在2022年3月30日星期三 UTC-7 04:39:33<李军尉> 写道:

李军尉

unread,
Mar 31, 2022, 1:55:29 PM3/31/22
to Chromium OS Development, andrewl...@chromium.org, Chromium OS Development, 李军尉
Thanks Andrew,

We now use ModemManager's LVFS function to upgrade modules on the Linux platform. Can we also use ModemManager's LVFS function to upgrade modules on the chromium platform? In addition, if we also want modemfwd support, what do we need to provide?

Best Regards

Andrew Lassalle

unread,
Mar 31, 2022, 3:50:16 PM3/31/22
to 李军尉, Chromium OS Development
In theory, if you use ModemManager to update your FW on linux, you should be able to do the same in chromeos. We don't deploy all the ModemManager plugins though, so your modem might not be supported. if you have control over the ChromiumOS build, you could add any missing plugins. 

What device and modem are you using?

For modemfwd support, you will need special helpers that are specific to your modem and you might need to modify many things in modemfwd. This is not a trivial task.
Adding support for new modems in modemfwd is rarely done as we only do it for modems that are launched with ChromeOS devices  

Andrew Lassalle

unread,
Apr 1, 2022, 11:49:03 AM4/1/22
to 李军尉, Chromium OS Development
Is this module an external USB module, or internal?  


Here is momdemfw's documentation:

The helper program has to be developed by the module vendor, since it's specific to their module, and the helper has to implement the interface specified in modemfwd/README.md

To be honest, modemfwd, was not designed to update any external modem. Its main purpose is to update modems that are supported by official ChromeOS devices.

On Fri, Apr 1, 2022 at 2:57 AM 李军尉 <a3276...@gmail.com> wrote:
Thanks Andrew,

This is a new module under development, we want the new module to be supported by modemfwd in ChromiumOS, how to modify modemfwd? How can I get special helper programs specific to our modem? Can you provide documentation? we want to evaluate this project

Best Regards

李军尉

unread,
Apr 1, 2022, 10:20:15 PM4/1/22
to Chromium OS Development, andrewl...@chromium.org, Chromium OS Development, 李军尉
Thanks Andrew,

This is a new module under development, we want the new module to be supported by modemfwd in ChromiumOS, how to modify modemfwd? How can I get special helper programs specific to our modem? Can you provide documentation? we want to evaluate this project

Best Regards
在2022年4月1日星期五 UTC+8 03:50:16<andrewl...@chromium.org> 写道:

李军尉

unread,
Apr 6, 2022, 8:09:33 AM4/6/22
to Chromium OS Development, andrewl...@chromium.org, Chromium OS Development, 李军尉
Thanks Andrew,

I'm sorry I delayed replying because of the holidays.
Our module is internal, and the purpose of this is to pass Cellular AVL and become a modem supported by official ChromeOS devices
Cellular AVL includes The modem/module must support firmware updates in the field.
The documentation you provided is too simple, there is no way for me to know how to modify modemfwd

Best Regards

李军尉

unread,
Apr 12, 2022, 7:45:39 AM4/12/22
to Chromium OS Development, andrewl...@chromium.org, Chromium OS Development
Hi Andrew:

Our module wants to use these system APIs

const char kGetFirmwareInfo[] = "get_fw_info";
const char kPrepareToFlash[] = "prepare_to_flash";
const char kFlashMainFirmware[] = "flash_main_fw";
const char kFlashCarrierFirmware[] = "flash_carrier_fw";
const char kReboot[] = "reboot";

How do we define a helper file
Can you provide an example for our reference?

Look forward to your favourable reply

Andrew Lassalle

unread,
Apr 12, 2022, 12:56:13 PM4/12/22
to 李军尉, Chromium OS Development
All the helpers we have are in private repos, so you cannot access the code.
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
  ...
  ...

李军尉

unread,
Apr 15, 2022, 6:15:49 AM4/15/22
to Chromium OS Development, andrewl...@chromium.org, Chromium OS Development, 李军尉
Hi Andrew,

Thank you very much for your reply, and I would like to ask
Our module is internal, in chromos, is it only possible to use modemfwd to update the FW? Is there any other way?

Best Regards

Andrew Lassalle

unread,
Apr 15, 2022, 10:18:18 AM4/15/22
to 李军尉, Chromium OS Development
There are other ways depending on the platform, but anyway would have to be part of the OS.

李军尉

unread,
May 23, 2022, 6:21:47 AM5/23/22
to Chromium OS Development, andrewl...@chromium.org, Chromium OS Development, 李军尉
Hi Andrew,
  Currently I have success with build_image, I want to write a special helper specific to our modem, how can I debug it, I have no experience with chromium os, May be some questions seem to be "not smart"

Reply all
Reply to author
Forward
0 new messages