I have a Haewei Mediapad M5 tablet (model BAH2-W19). Android 8.0.0 with a logitech bluetooth keyboard

I am a 60 years old Linux guru (using Linux since 1993, Unix since 1987, coding Bismon, with a PhD in computer science since 1990, etc...) and all the 5 PCs at home are running some Linux distro (often Debian, or Ubuntu). I contributed to GCC (its plugin system) and did compile many Linux kernels (for all the PCs I had since the previous century).

I want to root my tablet and install an opensource Android on it. I don't care losing all the data, but I don't want to brick my tablet.

What are the concrete steps?

Oµf course, I have the skills, the motivations, and the hardware to write some root-setuid ELF executable (cross-compiled from Debian to ARM Android) on the SD card inside my tablet and of course I will publish its source code as GPLv3+ (on github probably). I just want to have that (sudo or super like) executable being execve-d on the tablet. How to do that? I don't care about proprietary kernel driver modules on my tablet.

I am aware that trying this could void my warranty (but the European laws are IMHO more consumer-friendly than US ones) on my tablet and I am willing to take that risk.

marked as duplicate by Andrew T. Oct 5 at 13:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The duplicates should at least serve as the starting point; though compiling custom ROM from the source is off-topic on here. Try XDA Forums for that case. – Andrew T. Oct 5 at 13:14
  • Android (AOSP) is open-source but Android devices aren't. Hardware part is always closed-source, even some vendors are reluctant to share kernel sources. Exceptions are the few devices made completely open-source (but possibly with lacking functionality) after enormous efforts by Replicant. – Irfan Latif Oct 5 at 13:36
  • As already mentioned in my comment to your last question, recent Huawei devices can't be bootloader unlocked (company policy), so you can't root or flash anything in the first place. Android has also gone so secure now that usually there are no exploits to allow rooting without unlocking BL first. Sorry, better luck next time (device). – Andy Yan Oct 6 at 1:35
  • I don't care about proprietary (Linux kernel) drivers (sometimes, I sadly use Nvidia proprietary drivers on Debian desktops) on my tablet. I just want to be able to install one root-setuid binary (Android ELF executable cross-compiled on my desktop) of some program I am able and willing to code (as GPLv3+, on github). Once that is done, I am happy – Basile Starynkevitch Oct 6 at 7:34
  • 1
    @BasileStarynkevitch hardware drivers on Android devices aren't implemented in kernel but in userspace as HALs; the glue b/w hardware and Android framework. HALs are closed source binary blobs; thanks to Apache. Legacy HALs were previously shared libraries but now (since Treble) mostly run as daemons providing standard HIDL interfaces as defined in AOSP's reference implementations. Java as well as native framework use IPC to communicate with HALs. So these aren't the proprietary Linux kernel drivers, but userspace binary blobs. – Irfan Latif Oct 6 at 12:08