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

Treat Magisk versions newer than latest as supporting all features #395

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions avbroot/src/patch/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
fs::File,
io::{self, BufRead, BufReader, Cursor, Read, Seek},
num::ParseIntError,
ops::Range,
ops::{Range, RangeFrom},
path::{Path, PathBuf},
slice,
sync::atomic::AtomicBool,
Expand Down Expand Up @@ -152,13 +152,13 @@ impl MagiskRootPatcher {
// RULESDEVICE config option, which stored the writable block device as an
// rdev major/minor pair, which was not consistent across reboots and was
// replaced by PREINITDEVICE
// - Versions newer than the latest supported version are assumed to support
// the same features as the latest version
const VERS_SUPPORTED: &'static [Range<u32>] = &[25102..25207, 25211..28200];
const VER_PREINIT_DEVICE: Range<u32> =
25211..Self::VERS_SUPPORTED[Self::VERS_SUPPORTED.len() - 1].end;
const VER_PREINIT_DEVICE: RangeFrom<u32> = 25211..;
const VER_RANDOM_SEED: Range<u32> = 25211..26103;
const VER_PATCH_VBMETA: Range<u32> = Self::VERS_SUPPORTED[0].start..26202;
const VER_XZ_BACKUP: Range<u32> =
26403..Self::VERS_SUPPORTED[Self::VERS_SUPPORTED.len() - 1].end;
const VER_XZ_BACKUP: RangeFrom<u32> = 26403..;

const ZIP_INIT_LD: &'static str = "lib/arm64-v8a/libinit-ld.so";
const ZIP_LIBMAGISK: &'static str = "lib/arm64-v8a/libmagisk.so";
Expand Down Expand Up @@ -499,7 +499,7 @@ impl BootImagePatch for MagiskRootPatcher {

if Self::VER_PREINIT_DEVICE.contains(&self.version) {
if let Some(device) = &self.preinit_device {
write!(&mut magisk_config, "PREINITDEVICE={device}\n").unwrap();
writeln!(&mut magisk_config, "PREINITDEVICE={device}").unwrap();
}
}

Expand All @@ -510,7 +510,7 @@ impl BootImagePatch for MagiskRootPatcher {
magisk_config.push_str("SHA1=0000000000000000000000000000000000000000\n");

if Self::VER_RANDOM_SEED.contains(&self.version) {
write!(&mut magisk_config, "RANDOMSEED={:#x}\n", self.random_seed).unwrap();
writeln!(&mut magisk_config, "RANDOMSEED={:#x}", self.random_seed).unwrap();
}

trace!("Magisk config: {magisk_config:?}");
Expand Down
Loading