src: add x86_64 support

This commit is contained in:
rifsxd
2025-05-24 16:56:24 +06:00
committed by Rifat Azad
parent db223a1e92
commit 44ad960da7
22 changed files with 273 additions and 22 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -24,6 +24,11 @@ struct Asset;
#[folder = "bin/arm"]
struct Asset;
#[cfg(all(target_arch = "x86_64", target_os = "android"))]
#[derive(RustEmbed)]
#[folder = "bin/x86_64"]
struct Asset;
pub fn ensure_binaries(ignore_if_exist: bool) -> Result<()> {
for file in Asset::iter() {
if file == "ksuinit" || file.ends_with(".ko") {

View File

@@ -202,6 +202,10 @@ pub fn root_shell() -> Result<()> {
if free_idx < matches.free.len() {
let name = &matches.free[free_idx];
uid = unsafe {
#[cfg(target_arch = "x86_64")]
let pw = libc::getpwnam(name.as_ptr() as *const i8).as_ref();
#[cfg(not(target_arch = "x86_64"))]
let pw = libc::getpwnam(name.as_ptr()).as_ref();
match pw {
Some(pw) => pw.pw_uid,