Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/avb: Update kernel cmdline descriptor for devices that use dm= #205

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

chenxiaolong
Copy link
Owner

Older Pixel devices (and ChromiumOS) specify the dm-verity options on the kernel command line using a custom dm= parameter instead of using dm-init or a userspace helper. This commit updates the avb pack and repack commands to automatically update the relevant kernel command line descriptor if it exists.

Issue: #203

Older Pixel devices (and ChromiumOS) specify the dm-verity options on
the kernel command line using a custom `dm=` parameter instead of using
dm-init or a userspace helper. This commit updates the avb pack and
repack commands to automatically update the relevant kernel command line
descriptor if it exists.

Issue: #203

Signed-off-by: Andrew Gunnerson <[email protected]>
@chenxiaolong chenxiaolong merged commit 2cf1109 into master Nov 14, 2023
22 checks passed
@chenxiaolong chenxiaolong deleted the cmdline branch November 14, 2023 23:52
chenxiaolong added a commit that referenced this pull request Nov 14, 2023
Signed-off-by: Andrew Gunnerson <[email protected]>
// Starting sector.
result.push('0');
// Sector count.
write!(&mut result, " {}", descriptor.image_size / 512).unwrap();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't using unwrap() result in the to panic if it fails? I suggest using unwrap_or_default(),unwrap_or(), or better using a map() instead.. 😅

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally yes, but formatting into a String is guaranteed to never fail (unless the system runs out of memory, but Rust will panic in that case anyway).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants