KernelSU icon indicating copy to clipboard operation
KernelSU copied to clipboard

Supporting x86/x86_64

Open hmtheboy154 opened this issue 2 years ago • 2 comments

Hi, I just read about the project and I really like it. I am maintaining BlissOS and currently looking for a better root solution than the old Superuser made by koush. But looking at the codes, it seems like the project only support arm64 so far, are there any plan for x86/x86_64 ? I can help you test with x86_64 if you want.

hmtheboy154 avatar Dec 10 '22 18:12 hmtheboy154

x86_64 is feasible and I will try it, but 32bit arch such as x86 and arm is unsupported

tiann avatar Dec 11 '22 02:12 tiann

thanks

hmtheboy154 avatar Dec 11 '22 06:12 hmtheboy154

x86_64 support is added in https://github.com/tiann/KernelSU/commit/0d8785ec789ee71392af4bc35aceaeac91c24956, could you test it with the latest commit?

tiann avatar Dec 12 '22 06:12 tiann

ok, by the way I can only test SELinux in permissive because this is Android-x86

hmtheboy154 avatar Dec 12 '22 09:12 hmtheboy154

If it is permissive, may this cause bootloop?

tiann avatar Dec 12 '22 12:12 tiann

if you make that hack then it might be, iirc we can't even get SurfaceFlinger running with enforcing

hmtheboy154 avatar Dec 12 '22 12:12 hmtheboy154

https://github.com/tiann/KernelSU/commit/280660125faec888b9703eb8fdaa8565c90554fa keeps permissive if it is

tiann avatar Dec 12 '22 15:12 tiann

Screenshot_20221213-212222_KernelSU image

I compiled the kernel module and the app, but the app said not detected......... does that mean I have to compile the userspace su too ?

hmtheboy154 avatar Dec 13 '22 14:12 hmtheboy154

If you build the manager app yourself, you should also change this to the apk's signature: https://github.com/tiann/KernelSU/blob/main/kernel/apk_sign.c#L115

tiann avatar Dec 13 '22 14:12 tiann

The signature ensure only the manager can allow/disallow root request, you can try my build(it's the builtin app-release.apk.zip signature)

tiann avatar Dec 13 '22 14:12 tiann

You can modify this line https://github.com/tiann/KernelSU/blob/main/kernel/apk_sign.c#L79 and read the dmesg to get your EXPECTED_SIZE and EXPECTED_HASH.

tiann avatar Dec 13 '22 14:12 tiann

The signature ensure only the manager can allow/disallow root request, you can try my build(it's the builtin app-release.apk.zip signature)

I tested this and it still not working, but on dmesg it show this PXL_20221213_165020347 MP

hmtheboy154 avatar Dec 13 '22 17:12 hmtheboy154

You can modify this line https://github.com/tiann/KernelSU/blob/main/kernel/apk_sign.c#L79 and read the dmesg to get your EXPECTED_SIZE and EXPECTED_HASH.

Thanks

hmtheboy154 avatar Dec 13 '22 17:12 hmtheboy154

The signature ensure only the manager can allow/disallow root request, you can try my build(it's the builtin app-release.apk.zip signature)

I tested this and it still not working, but on dmesg it show this PXL_20221213_165020347 MP

The system doesn't have /data/adb directory?

tiann avatar Dec 14 '22 02:12 tiann

It does but it got mounted in this stage

https://git.osdn.net/view?p=android-x86/bootable-newinstaller.git;a=blob;f=initrd/init;h=f8b5378151f2816afabb622c0b1f4698504f932c;hb=refs/heads/r-x86#l208 https://git.osdn.net/view?p=android-x86/bootable-newinstaller.git;a=blob;f=initrd/scripts/2-mount;h=9cce018c1b672e820720d0ee282946b10ff8b122;hb=refs/heads/r-x86#l10

hmtheboy154 avatar Dec 14 '22 03:12 hmtheboy154

show some load_allow_list open "/data/adb" failed -2 is OK, when /data/ is mounted, it wouldn't show This log is actually waiting /data to be mounted.

tiann avatar Dec 14 '22 03:12 tiann

by the way, a small request can you limit the manager app to only compile x86_64 and arm64 lib ? to avoid in case the system use x86/arm libs instead

hmtheboy154 avatar Dec 15 '22 16:12 hmtheboy154

by the way, a small request can you limit the manager app to only compile x86_64 and arm64 lib ? to avoid in case the system use x86/arm libs instead

Sure, please try this build: https://github.com/tiann/KernelSU/actions/runs/3709915866

tiann avatar Dec 16 '22 03:12 tiann

PXL_20221217_072017482 MP The app does run but su still not working, here is what I got on dmesg.

hmtheboy154 avatar Dec 17 '22 08:12 hmtheboy154

https://github.com/hmtheboy154/Darkmatter-kernel/tree/umbral This is how I integrate it into my kernel

hmtheboy154 avatar Dec 17 '22 19:12 hmtheboy154

Does the kernel have CONFIG_KPROBES enabled?

tiann avatar Dec 19 '22 05:12 tiann

Does the kernel have CONFIG_KPROBES enabled?

it haven't, and when compile it show this

ld.lld: error: undefined symbol: task_stack_page
>>> referenced by ld-temp.o
>>>               vmlinux.o:(sh_user_path)

hmtheboy154 avatar Dec 19 '22 10:12 hmtheboy154

I'm including linux/sched/task_stack.h to sucompat.c right now, I'll see if that help

hmtheboy154 avatar Dec 19 '22 10:12 hmtheboy154

Maybe you should enable CONFIG_THREAD_INFO_IN_TASK?

tiann avatar Dec 19 '22 10:12 tiann

I turn that on already

hmtheboy154 avatar Dec 19 '22 10:12 hmtheboy154

Screenshot_20221219-121508_KernelSU Screenshot_20221219-121615_Termux

It compiled and works perfectly

I also made a PR, can you check it, I don't know if older kernel have task_types.h like this

hmtheboy154 avatar Dec 19 '22 12:12 hmtheboy154

guess we should close this issue, x86_64 is working now

hmtheboy154 avatar Dec 19 '22 12:12 hmtheboy154

Screenshot_20221219-121508_KernelSU Screenshot_20221219-121615_Termux

It compiled and works perfectly

I also made a PR, can you check it, I don't know if older kernel have task_types.h like this

Hello, I see that your Android x86 is using Linux kernel 5.15. Do you have any available source code? The 5.15 kernel compiled by myself does not work, and the system graphical interface does not refresh

logcat.log dmesg.log

iiowoii3389 avatar Jan 15 '23 17:01 iiowoii3389

Hello, I see that your Android x86 is using Linux kernel 5.15. Do you have any available source code? The 5.15 kernel compiled by myself does not work, and the system graphical interface does not refresh

logcat.log dmesg.log

Which Android version are you trying to build ?

hmtheboy154 avatar Jan 15 '23 17:01 hmtheboy154