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

Issue 655924 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 649246



Sign in to add a comment

HWID: Add “Default” argument

Project Member Reported by akahuang@chromium.org, Oct 14 2016

Issue description

Originally, we have two scenarios that would modify the component in the HWID database. 
1. In the early build, we usually haven't decided the firmware version before starting the build. Originally we set a HWID component that accepts every string, i.e. "!re .*". After the firmware is freeze, then we change the component to a fixed value.
2. The probing code is not ready, but we know it will be ready in the future. Originally we set a special item called 'placeholder', which is unprobeable. After the probed result is ready, then fill the value into that placeholder, and change the item name.

But if we disallow to modify the existed components in the HWID database, we cannot use "!re .*" anymore because it always be matched. While we add another component items, it will cause ambiguous error.

To solve this problem, we introduce a new flag: 'default'. When the component is 'default', it will be always matched. Moreover, if another component is also matched, this “default” component will be ignored. After the firmware is confirmed or the probing code is ready, this default component should be deprecated.

After this feature is finished, we should disallow to use “!re .*”.
The detail is described here:
https://docs.google.com/document/d/1Cxy9KJkysZTAPQzTTFJGSxVP37BSLVdVyE2nvRTwT2g/edit#heading=h.o3sfxilcaw7n
 
Status: Assigned (was: Untriaged)
Replacing "!re .*" with a later acquired probe result should be fine. It does not change the HWID database as long as the probe result is acquired from the same component. 

In the case of firmware components we will set firmwares from previous builds as deprecated or not-supported, so it does not really matter how we change "!re .*" as no new HWIDs will be generated with deprecated firmware. You may as well just set it to something like "hash-proto" instead of using the real hash value.
Hi Ricky,

Do you mean when we are in the next build, we need to replace "!re .*" to another string that doesn't match any string? For example: 

```
# previous build
components:
  ro_main_firmware:
    items:
      ro_main_firmware_proto:
        values: { compact_str: !re .* }

# next build
components:
  ro_main_firmware:
    items:
      ro_main_firmware_proto:
        status: deprecated
        values: { compact_str: "Invalid hash that never match" }
      ro_main_firmware_evt:
        values: { compact_str: "mv2#ro_main_firmware_0" }
```

Since I will implement the HWID auto-generate/update tool. I think it's hard to determine it's backward-compatible if we allow to change the existed item. Therefore I want to propose a way that we can only add new items or change the status of existed items.
Project Member

Comment 4 by bugdroid1@chromium.org, Nov 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/e791be322f7e8720623b0fd211000e205b1c7409

commit e791be322f7e8720623b0fd211000e205b1c7409
Author: Chih-Yu Huang <akahuang@google.com>
Date: Mon Oct 17 06:43:51 2016

hwid: add "default" argument in component field.

we introduce a new flag: 'default' in the component field. When the
component is 'default', it will be always matched. Moreover, if
another component is also matched, this default component will be
ignored.

The flag can solve the problem that we need to set "!re .*" at early
stage and modify to a fixed value later.

BUG= chromium:655924 
TEST=py/hwid/v3/database_unittest.py

Change-Id: I7e9e23906c48ae3523683cbd37fc43ec1274c953
Reviewed-on: https://chromium-review.googlesource.com/398686
Commit-Ready: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>

[modify] https://crrev.com/e791be322f7e8720623b0fd211000e205b1c7409/py/hwid/v3/testdata/test_probe_result.yaml
[modify] https://crrev.com/e791be322f7e8720623b0fd211000e205b1c7409/py/hwid/v3/database.py
[modify] https://crrev.com/e791be322f7e8720623b0fd211000e205b1c7409/py/hwid/v3/database_unittest.py
[modify] https://crrev.com/e791be322f7e8720623b0fd211000e205b1c7409/py/hwid/v3/testdata/test_new_db.yaml

Status: Fixed (was: Assigned)

Sign in to add a comment