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 ...
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.


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?

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?

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])
      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

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 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 2 guests