Skip to content

Conversation

@tiann
Copy link
Owner

@tiann tiann commented Nov 9, 2025

No description provided.

@Ylarod Ylarod requested a review from Copilot November 9, 2025 12:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the boot partition detection logic to simplify the API by removing the OTA parameter from several functions and consolidating partition selection logic. The main changes include:

  • Refactored choose_boot_device to choose_boot_partition to return partition names instead of full device paths
  • Removed OTA toggle parameters from CLI commands default-partition and available-partitions
  • Simplified partition selection logic by moving slot suffix handling to callers
  • Removed the default-device CLI command and the get_default_partition_name function

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
userspace/ksud/src/cli.rs Removed OTA parameters from BootInfo enum variants and simplified CLI command handlers
userspace/ksud/src/boot_patch.rs Refactored partition selection logic, removed OTA parameter from several functions, changed return types
manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt Consolidated partition detection functions and removed OTA parameters from function signatures
manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt Updated UI code to use simplified partition detection APIs
Comments suppressed due to low confidence (2)

userspace/ksud/src/boot_patch.rs:730

  • The non-Android stub function choose_boot_device still exists but the Android version has been renamed to choose_boot_partition. This creates an API inconsistency between platforms. Either:
  1. Add a non-Android stub for choose_boot_partition with the same signature
  2. Or remove the unused choose_boot_device stub

Since choose_boot_partition is now being called in find_boot_image (line 672), and find_boot_image is callable on non-Android platforms (it has cross-platform logic), there should be a non-Android stub for choose_boot_partition.

#[cfg(not(target_os = "android"))]
pub fn choose_boot_device(
    _kmi: &str,
    _ota: bool,
    _is_replace_kernel: bool,
    _partition: &Option<String>,
) -> Result<String> {
    bail!("Current OS is not android, refusing auto bootdevice detection")
}

userspace/ksud/src/boot_patch.rs:758

  • The refactored list_available_partitions function has removed the ordering logic that previously prioritized partitions based on skip_init_boot and partition existence. The old implementation would return partitions in an order like ["init_boot", "boot", "vendor_boot"] or ["vendor_boot", "boot", "init_boot"] based on the logic, but now it always returns them in the fixed order ["boot", "init_boot", "vendor_boot"] (filtered by existence). If the partition order was meaningful for the UI or other consumers, this could be a breaking change.
pub fn list_available_partitions() -> Vec<String> {
    let slot_suffix = get_slot_suffix(false);
    let candidates = vec!["boot", "init_boot", "vendor_boot"];
    candidates
        .into_iter()
        .filter(|name| Path::new(&format!("/dev/block/by-name/{}{}", name, slot_suffix)).exists())
        .map(|s| s.to_string())
        .collect()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Ylarod Ylarod requested a review from Copilot November 9, 2025 13:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Ylarod Ylarod merged commit 32a1078 into main Nov 9, 2025
33 checks passed
@Ylarod Ylarod deleted the dev branch November 9, 2025 13:43
Copy link

@Jehado1991 Jehado1991 left a comment

Choose a reason for hiding this comment

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

KOWX712 pushed a commit to KOWX712/KernelSU that referenced this pull request Nov 10, 2025
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 3, 2026
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 3, 2026
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
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.

7 participants