gen_udev_rules: add raw partition rule generator - #156
Conversation
|
Hi Igor Opaniuk (@igoropaniuk), a friendly review ping when you have time. This PR provides the qcom-ptool side of qualcomm-linux/meta-qcom#2865. I would particularly appreciate feedback on:
All current CI checks are passing. The meta-qcom integration is waiting on this interface, so an initial review or direction would be very helpful. |
|
Hi Wenwen Fu (@wenwfu) . Hi, thanks for the ping and apologies for the delay. Is qcom-ptool the right place? CLI and policy format I've review changes later today and leave comments. |
Qualcomm platforms expose firmware and metadata partitions that are not intended to contain mountable filesystems. Probing each of them with blkid adds unnecessary work during udev coldplug. Keeping the exclusion policy in a distribution layer also prevents other qcom-ptool users from reusing it. Add a gen_udev_rules subcommand with a reviewed partition-name policy and udev template. Filter the policy against one or more selected layouts and emit only exact labels present in those layouts. Unknown or custom labels retain the default filesystem probing behavior. The generated rule disables only blkid probing and preserves persistent partition metadata links. Signed-off-by: Wenwen Fu <[email protected]>
162137c to
acb0c28
Compare
Hi Igor Opaniuk (@igoropaniuk), this PR has been rebased onto the latest main and the conflict has been resolved. All 128 local tests pass. Could you please review it when you have time? Thanks! |
| try: | ||
| content = generate_rules(args.inputs) | ||
| if not content: | ||
| args.output.unlink(missing_ok=True) |
There was a problem hiding this comment.
a typo'd -o pointing at an existing unrelated file (say, another rules file in /etc/udev/rules.d/) gets deleted, with exit 0 and only a "skipped" message. Writing nothing, or refusing to touch an existing file it didn't create, would be safer.
| GOTO="qcom_raw_noblkid_end" | ||
|
|
||
| LABEL="qcom_raw_noblkid" | ||
| ENV{UDEV_DISABLE_PERSISTENT_STORAGE_BLKID_FLAG}="1" |
There was a problem hiding this comment.
This will work only on recent versions of systemd.
| TEMPLATE_FILE = DATA_DIR / "55-qcom-raw-partitions-noblkid.rules.in" | ||
| RULES_PLACEHOLDER = "@QCOM_RAW_PARTITION_RULES@" | ||
| LABEL_RE = re.compile(r"[A-Za-z0-9_.+-]+") | ||
| PATTERN_RE = re.compile(r"[A-Za-z0-9_.+*?\[\]-]+") |
There was a problem hiding this comment.
Seems that PATTERN_RE rejects [!...] negation globs, which udev and fnmatch both support
| ACTION=="remove", GOTO="qcom_raw_noblkid_end" | ||
| SUBSYSTEM!="block", GOTO="qcom_raw_noblkid_end" | ||
| ENV{DEVTYPE}!="partition", GOTO="qcom_raw_noblkid_end" | ||
| ENV{PARTNAME}=="", GOTO="qcom_raw_links" |
There was a problem hiding this comment.
why not ENV{PARTNAME}=="", GOTO="qcom_raw_noblkid_end" ?
Summary
Add a
gen_udev_rulessubcommand that generates machine-specific udevrules for reviewed Qualcomm raw GPT partitions.
The generator:
labels are present
Example:
qcom-ptool gen_udev_rules \ -i platforms/qcs6490-rb3gen2/ufs/partitions.conf \ -o 55-qcom-raw-partitions-noblkid.rulesMotivation
This functionality was originally implemented in
qualcomm-linux/meta-qcom#2865.
Move the generic generator, reviewed policy, and udev template into
qcom-ptool so they can be reused outside the Yocto layer. The meta-qcom
change will be updated to invoke this subcommand and retain only the
machine-specific integration and packaging.
Unknown or custom partition labels continue through the normal systemd
blkid probing path.