Power & Source of Big Ideas

Android 10 root build issue

Moderators: chensy, FATechsupport

Hello all,

I'm currently building android 10 using the git source available from the wiki for the T4. Everything is successful, and I have fully built the image and deployed it. Now I am trying to go back to the code and add in root plus some other modules. No worries with everything until I get to the root portion. I'm using supersu 2.82 (the same code and method from the last version of android for the rk3399). Everything compiles until it gets to 100% and runs a few last commands. Then it errors out with an overwrite issue. Here is the code.

Code: Select all

[100% 12699/12699] writing build rules ...
FAILED:
build/make/core/Makefile:28: error: overriding commands for target `out/target/product/nanopc-t4/system/xbin/su', previously defined at build/make/core/base_rules.mk:480
20:44:59 ckati failed with: exit status 1


Any ideas? Any leads I could look into with the advice of someone who's been here before? Thanks you guys.
Technically, no... I had already scoured the internet without much luck there, and seen his post. He's taking his result and just amalgamating that onto the poster's. It seems he's saying to find the .mk file with the command and remove said command, which wouldn't work in this case. It's the root's command I need. Removing it would make the entire process moot. Thanks, though. If you could shed some further insight into how I could interpret his post some other way, I'm all ears.
I am looking at the .mk file and there is a su file in the directory indicated above. Are you trying to copy another su over this? Could that be the issue?

Can you detail the changes you have made and I'll try the same here?
I've done the exact same details to root 10 as I used for 8 (the previous version FA used). I'll help with the information as much as I can, but the method I use is detailed in my linux partition on this machine. Let me get to that and I can give more details.
Here are the steps. Everything successfully compiled before starting this list.

1. Put the root files into /vendor/root (create the root folder and make sure that you also copy the hidden file. The file ".installed_su_daemon" is invisible by default. Make sure it is also present in your directory.)
2. Change root.mk: replace "vendor/amlogic/root" by "vendor/root"
3. Add also the line "vendor/root/su:system/xbin/su \"
4. Add "PRODUCT_PACKAGES += SuperSU" at the end of that file
5. Now go into the folder "SuperSU" and change "LOCAL_CERTIFICATE := PRESIGNED" to "LOCAL_CERTIFICATE := PLATFORM" inside "Android.mk"
6. Modify "/device/rockchip/rk3399/nanopc_t4.mk" by adding "$(call inherit-product-if-exists, vendor/root/root.mk)"
7. Copy the existing 'build/target/product/security/platform.pk8' to 'build/target/product/security/PLATFORM.pk8', with the same for PLATFORM.x509.pem and PLATFORM.pem.

Literally follow this to a 't', then without changing a single other thing, execute the build. Then it fails with the message above.
As I'm trying to add in the correct files and changes to root the device, I should be replacing xbin/su, right? If I delete that command from the .mk file, it won't overwrite the one that's already there... That would cause a root failure, correct?

Obvious to me, yes. But there might be something I don't know.
I've just gotten out of hospital so sorry for the delay.

I'll follow what you did and see what happens to my build.

Are there any files to download for this?
Hi Dave,

First off... I sincerely hope everything was fine health-wise! Your own health comes first, so please, don't apologize. I wasn't trying to place any burden on your shoulder to begin with.

Regarding your post, here is the link to the git. I tried searching for updated files, but to no avail.

https://github.com/khadas/supersu

Any help is appreciated.
Thanks for your kind wishes. I am getting better every day and back working from home.

I had a look and have not yet attempted to try and build this into my system. I will get around to this during the rest of the week.

I wanted to check if the binary that is on the SU git page is compatible with the build for your Android 10? I don't know if the build system can check this, but it was the only thing I could think of.

Let's see what happens when I try it this week.
Yeah I wasn't really sure of update compatibility... I'm not too knowledgeable in that area to just look at it and tell. I was hoping to find some patch notes on updates, but it seems the supersu developer hasn't made it around to it yet. *shrug*

I'm interested in your finding when you try it as well. Please update when you can! :D
OK, following your instructions and I get the same failure message so not a setup issue.

Now to find out why.

I did notice that there is already an SU file in system/xbin so wondering if that has anything to do with it?
I am still trying to track this down. I can't find the product copy file for the existing su into system/xbin.
Might you have a lead on where to look? Or any curious thoughts I could help with?
Yes, there is another PRODUCT_COPY_FILES that creates SU into the xbin folder so we need to track that one down and somehow comment it out.

I've been searching for something to override the copy but can't find anything.
Is there a way to edit the write command of the root file so that it overwrites the file? Would that work?
Some progress has been made.

Rename the Android.mk file in system/extras/su so that it won't be part of the build.

Now I get an error about the PLATFORM.pk8 file missing. I have not yet made copies of these in upper case.
That is progress! I'm not home yet, but you can bet I'll be trying it as soon as I am.
I added the capital versions and now it compiles without errors.

I've not installed it on my board as I need 8.1 for the time being.

Let me know how it goes for you and if it works on the T4 etc.
Well I started from a scratch build that I verified working and performed the root method precisely. Using your tip to rename the Android.mk file, it compiles without error; however... It boot loops. It installs the image completely and once you restart the device, it gets to the erase point, finishes, and boot loops. I've tried messing around with removing the su folder, adding "LOCAL_MODULE_TAGS := optional" to the android.mk file, all to no avail.

I felt like I was so close, lol.
Do you have a serial debug cable to see what is happening during the boot?

At least then you can find out where in the boot sequence failure is happening.
Unfortunately not at the moment.
Any cheap USB to TTL 3.3V interface will work for this. Baud rate is 1500000 so need to use putty for this.

It will be the best investment you can make if playing with embedded Linux boards. You'll be able to track down the issue once you see the debug output.
Yeah I generally make them manually from protoboards. I'll have to get an official one, lol.
Just as a curiosity-based question, if I build the image, and then something fails, and I just keep getting failure after failure...

Should I start over? Or will reversing the code and rebuilding be enough? Some times I just redownload and start from scratch. Is that necessary? Dave, you do this much more than me, and it's hard to find answers to those specific questions. Any thoughts? Maybe a make clean and rebuild is enough?
Yeah, remove the code you added and rename that old file and then do a clean and then rebuild. That will get you back to a working system.

By the way, why do you need this SU version? I have found that the T4 build already has SU so you can do root via the debug UART or through ADB SHELL commands.

Is there something in particular that doesn't work that you need this?

I think the only way to get this to work is to find the source for SU and build this as part of the OS. Avoid binary options as you really don't know which build they have used to create the binary.
In general, I wanted/needed a system that once deployed, can give root to apps just as we're used to with SuperSU. The interface comes up, we can allow or deny access, and it logs it for persistence. I really didn't want to deal with commands later down the road. SuperSU is a glorious way to go about it that doesn't take much once the initial config is done.
Ok so I got around to just playing around with the whole make clean thing... did I do something I shouldn't have?

I downloaded android 8, followed the wiki and did an initial ./build-nanopc-t4.sh -F -M ... standard stuff. It succeeded. Cool. I literally just typed "make clean" and got the "Entire build directory removed" message. Cool.

I ran the ./build... command again and it failed.

Code: Select all

out/build-nanopc_t4.ninja is missing, regenerating...
opendir failed: external/guava/guava-gwt/test/com/google/common/math: Not a directory
23:31:20 ckati failed with: exit status 1


I know this was not general use-case for make clean, but it was such a clean, simple build with no modifications, I figured it wouldn't be destructive. It was in fact. Nothing changed, rebooted in between (left to do work and came back, so a power off and boot)... nothing crazy. Thoughts?

I really just wanted to "play" around with the command to figure out what to do and not do. Am I misunderstanding "make clean?" Doesn't it just clean the built directories and doesn't touch the base stuff?

Hm.
What is here?

opendir failed: external/guava/guava-gwt/test/com/google/common/math: Not a directory
math is a text file.

It succeeded to build initially. That was straight from a git download.
Under my 8.1 source, math is a directory.

What is in the text file?
Strange.

Here it is.

Code: Select all

self.EmitVTrn(16, block[5], block[7], temp[5], temp[7])
      self.EmitVTrn(32, temp[0], temp[4], block[0], block[4])
      self.EmitVTrn(32, temp[1], temp[5], block[1], block[5])
      self.EmitVTrn(32, temp[2], temp[6], block[2], block[6])
      self.EmitVTrn(32, temp[3], temp[7], block[3], block[7])
      registers.FreeRegisters(block)
      return temp



That's it.
What else is in that directory?

This is T4 Android 8.1 from Gitlab?

This is the same directory and math is also a directory within this. Does this match up with your directory structure?

https://gitlab.com/friendlyelec/rk3399- ... gle/common
Hi,
after quite sometime I am back to the NanoPcT4 ...

Have you been able to resolve the boot-issue?

I have tried to install Magisk (which was not working with Android8.1), and besides a failed Safetynet-check it seems work.
At least some 'Root-Checker'-apps show the device is rooted, and these apps also are registered as 'Superuser'

All I did was:
    install Magisk-Manager,
    copy the 'boot.img' to the NanoPc,
    create a patched boot-image,
    copy it back to the PC
    reference the patched boot-image in RKDevTool and flash

Need to do some more tests next week-end ...
Tiemichael wrote:
Hi,
after quite sometime I am back to the NanoPcT4 ...

Have you been able to resolve the boot-issue?

I have tried to install Magisk (which was not working with Android8.1), and besides a failed Safetynet-check it seems work.
At least some 'Root-Checker'-apps show the device is rooted, and these apps also are registered as 'Superuser'

All I did was:
    install Magisk-Manager,
    copy the 'boot.img' to the NanoPc,
    create a patched boot-image,
    copy it back to the PC
    reference the patched boot-image in RKDevTool and flash

Need to do some more tests next week-end ...

I have the same issue, I've been fighting with it all day.

I patched the boot.img with Magisk Manager and flashed it, Magisk Manager show's I'm installed and Root Checker says I'm rooted, I was even able to install Adaway. But i cannot use any root app that needs to mount /System

I tried using Root Uninstaller and it says it has root access but cannot mount /system as R/W

It seems Magisk is only able to partially root on Android 10

I tried this with the Canary version and the standard version of Magisk and the same issue both times
weber1 wrote:
I have the same issue, I've been fighting with it all day.

I patched the boot.img with Magisk Manager and flashed it, Magisk Manager show's I'm installed and Root Checker says I'm rooted, I was even able to install Adaway. But i cannot use any root app that needs to mount /System

I tried using Root Uninstaller and it says it has root access but cannot mount /system as R/W

It seems Magisk is only able to partially root on Android 10

I tried this with the Canary version and the standard version of Magisk and the same issue both times


The only problem I face is 'Safety Net' - where I have given up ...
Rooting seems to be fine, and all apps require root-access are working.

There is one more step I included:
Delete ‘su’ from /system/xbin – otherwise Magisk complaints about an extra ‘su’ found
In system/extras/su/Android.mk line 8
change to LOCAL_MODULE:= xxxsu

I receive a message 'Abnormal State' that 'Magisk running as system-app is not supported' , which does not influence the functionality (if I remember correctly this issue is coming from the fact that I 'pre-installed' Magisk-Manager on the ROM)

Currently I am using Magsik 22.0

Maybe you can tell me which app is having problems, and I try it ...
Tiemichael wrote:
weber1 wrote:
I have the same issue, I've been fighting with it all day.

I patched the boot.img with Magisk Manager and flashed it, Magisk Manager show's I'm installed and Root Checker says I'm rooted, I was even able to install Adaway. But i cannot use any root app that needs to mount /System

I tried using Root Uninstaller and it says it has root access but cannot mount /system as R/W

It seems Magisk is only able to partially root on Android 10

I tried this with the Canary version and the standard version of Magisk and the same issue both times


The only problem I face is 'Safety Net' - where I have given up ...
Rooting seems to be fine, and all apps require root-access are working.

There is one more step I included:
Delete ‘su’ from /system/xbin – otherwise Magisk complaints about an extra ‘su’ found
In system/extras/su/Android.mk line 8
change to LOCAL_MODULE:= xxxsu

I receive a message 'Abnormal State' that 'Magisk running as system-app is not supported' , which does not influence the functionality (if I remember correctly this issue is coming from the fact that I 'pre-installed' Magisk-Manager on the ROM)

Currently I am using Magsik 22.0

Maybe you can tell me which app is having problems, and I try it ...

I'm trying to add a prop, which seems like a different need, but will look into it. Was thinking about this, but realized a clean install for every update

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 4 guests