New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 761264 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Allow the cros_config tool to be used on the host

Project Member Reported by sjg@chromium.org, Sep 1 2017

Issue description

At present we use fdtget within eclass functions for accessing the master configuration.

On a device we can use cros_config. This only returns the configuration for the current model (so you cannot request config for a model other than the one cros_config is running on).

It would be useful to have a cros_config tool which can run in the chroot on the host, replacing fdtget. It will need to be able to access configuration for any given model.

We could create a new tool (cros_config_host?) which uses the same source code but provides a few more options.
 
Cc: adurbin@chromium.org

Comment 2 by sjg@google.com, Sep 8 2017

Cc: sjg@chromium.org
Owner: athilenius@chromium.org

Comment 3 by sjg@chromium.org, Sep 11 2017

Cc: djkurtz@chromium.org
This bug should be good for learning a bit about C++ in Chrome OS and the build system. Here is a starting point for this.

Here is the main program for the existing cro_config

https://cs.corp.google.com/chromeos_public/src/platform2/chromeos-config/cros_config_main.cc

It is designed to find configuration for the current model.

I think we should create a new tool, perhaps cros_config_host, which reads config for any model. You can add that to the .gyp file so that it builds.

To install it on the host you need to change the ebuild that installs it - see :

https://cs.corp.google.com/chromeos_public/src/third_party/chromiumos-overlay/chromeos-base/chromeos-config-tools/chromeos-config-tools-9999.ebuild


You'll also need to add it as a dependency to hard-host-depends-bsp

Once you have it installing with 'sudo apt-get install chromeos-config-tools' then you can change it to do something useful as a test.

I think the best way is to add flags to control the behaviour. 

See for example this :
https://cs.corp.google.com/chromeos_public/src/third_party/chromiumos-overlay/eclass/cros-unibuild.eclass?rcl=d662e763c6fb087c3bfa43cdac352da0b264afb5&l=142

It uses 'fdtget' to obtain a list of models. You could update the tool to return the list of models:

cros_config_host --config <config_filename> --list-models

  - should list all the models

cros_config_host --config - --list-models

   - same, but take input from stdin instead of a file


If you get this far then you can mark this bug fixed. We can build on it after that to remove other uses of fdtget in the build system.

Project Member

Comment 4 by bugdroid1@chromium.org, Sep 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/6eb143d0c41463461218da7cee86034685383fee

commit 6eb143d0c41463461218da7cee86034685383fee
Author: Alec Thilenius <athilenius@chromium.org>
Date: Mon Sep 18 23:48:46 2017

chromeos-config: Minimalist refactoring cros_config to run on the host

This is a refactor to libcros_config to allow it to run on the host via
a InitOnHost method that takes in a path to a config database and
optionally a model name. Also added a cros_config_host CLI that can also
be used to list models in a config database.

BUG= chromium:761264 
TEST=Ran all unit tests including newly added

Change-Id: I3d7c563aa358283596127efd76ada7f6b95c5a0d
Reviewed-on: https://chromium-review.googlesource.com/666479
Commit-Ready: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/libcros_config/test.dts
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/cros_config_main.cc
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/libcros_config/cros_config.cc
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/libcros_config/fake_cros_config.cc
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/libcros_config/fake_cros_config.h
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/libcros_config/cros_config_interface.h
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/libcros_config/cros_config_unittest.cc
[add] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/cros_config_host_main_unittest.cc
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/chromeos-config.gyp
[modify] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/libcros_config/cros_config.h
[add] https://crrev.com/6eb143d0c41463461218da7cee86034685383fee/chromeos-config/cros_config_host_main.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Sep 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/dacaca6f4fd4c3eb02a9874242e0f2db84412ae5

commit dacaca6f4fd4c3eb02a9874242e0f2db84412ae5
Author: Alec Thilenius <athilenius@chromium.org>
Date: Tue Sep 19 16:18:33 2017

chromeos-config-tools: Add cros_config_host binary and test

The binary and test were added in CL:666479

BUG= chromium:761264 
TEST=Ran new unit tests.
CQ-DEPEND=CL:666479

Change-Id: I8a61ec896b7788fb911d45ab66e8702d4deaf917
Reviewed-on: https://chromium-review.googlesource.com/667408
Commit-Ready: Simon Glass <sjg@chromium.org>
Tested-by: Alec Thilenius <athilenius@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>

[modify] https://crrev.com/dacaca6f4fd4c3eb02a9874242e0f2db84412ae5/chromeos-base/chromeos-config-tools/chromeos-config-tools-9999.ebuild

Status: Fixed (was: Untriaged)

Sign in to add a comment