r/KaiOS • • Oct 04 '26

Development The feasibility of reusing compiled drivers/binaries from KaiOS's Gonk to build an at least functional Android AOSP/LOS/CM ROM for a KaiOS (2.5/3.x) device?

Hello everyone, after thinking about it for a little bit, there are certain configurations of low-end Android phones that have been shipped with dual-core CPUs and 512mb of RAM similar to how most KaiOS have had shipped and android is technically capable of running under those constraints, as stated by the Android 8 to 10 build GO build configuration having a minimum RAM requirement of 512 MB, and I feel like we can probably push harder on stripping the RAM usage if we use Android 6, which we know is the base of KaiOS 2.5's Gonk on most phones.

Let me address the elephant in the room here first: Android is capable of running on those constraints.

Now we do know that KaiOS devices are limited in other areas such as lack of several kinds of hardware that a typical Android phone expects to run with. Including, but not limited to, missing sensors like Gyroscopes and Accelerometers, Touch Screens (duh), Front Cameras etc.

But after doing some research and doing some personal, non-scientific tests using AVD (Android Virtual Device), I did come to conclusion that it is quite feasible for a low-tier smart featurephone running KaiOS to be able to run android when it comes to hardware form factor, and overall just making it work on a tier of hardware that people were not wanting to run android on.

Because there has been some precedents, notably phones like Micromax Bharat 1 shipping with the same hardware specs as the Jio Phone 1, while running a nearly-full build of Android 4.4 with GMS.

And in terms of running android where it wasn't supposed to, I was able to make an AVD with loosely similar specs of an Nokia 8110 4G running AOSP 6 with no GMS and then decided to a Memory Torture test where the Android installation automatically switched to a low-ram mode and therefore I was able to successfully play a youtube video INSIDE CHROME 40 OF AOSP 6.0.1 ON 320 MB OF RAM WITH NO ZRAM OR SWAP WITHOUT THE SYSTEM CRASHING. And mind you even as I tried switching apps and things, apps crashed gracefully without taking down the system.

With these things in mind, I think that it is highly feasible, and KaiOS 2.5 devices specifically are becoming more and more useless as the days go by and creating an alternate OS based on CM13 or something like that may actually save these phones from the landfill. Because Android itself is a native platform with language options like C++ and JIT/AOT compiled Java/Kotlin making the experience far more CPU/GPU efficient than KaiOS.

Now let us move back to the original question.

All I am now asking is the potential roadblocks for a endeavour like this. I am very well aware that I would need to modify and hard fork android or CM13 to accomodate for the lack of a touch screen. But what else do I need to consider for this.

KaiOS, and its predecessor, FirefoxOS ran on existing Android BSP (Board Support Packages)'s kernel, drivers and even the derived android-specific bionic C library, despite stripping out everything else that goes above it. These fundamental building blocks allows for not just Boot-2-Gecko to be compiled on Bionic and be ran over there, but theoretically Any android NDK app for that manner as well. (Tested it on a jailbroken 8110 4G by sideloading a Android NDK compiled hello C app and getting a proper output back)

The point that I am trying to make here is that, if they actually use the unmodified android core as gonk, then isnt it possible to take those components out of gonk and build an full android ROM based on it?

14 Upvotes

37 comments sorted by

•

u/biminhc1 BananaHackers Oct 13 '26 edited Oct 13 '26

let me address the other elephant in the room: too long i lost my reading comprehension

(1) Gonk is heavily modified and stripped out to be the middleman between Gecko and the phone hardware. Whatever you can get out the left of it (run C, partition and folder structure etc.) is necessary to do so. It is not full Android core, otherwise we would be able to shut off Gecko and install APKs on it.

(2) you should not expect Android 6+/LOS 13 or even Android Go to run well on 512MB RAM. It is the bare minimum for those and any time you want to create a usable experience out of it (e.g. multitasking or just have homescreen launcher while your app is running) it would just crash. Android 4.4 is the best you would be able to run. Also B2G is lightweight as it runs web apps and Gonk does not include any UI.

you'd be better off running a Linux-based distro like postmarketOS (the name Nura is dumb) on such exotic hardware. But if you manage to port 4.4 on this thing you're welcome to share it with the world

source: I was you years ago and asked Fabrice (B2G architect) and Affe Null (pmOS port maintainer) the exact same thing

eta: (3) whatever you can get out of AVD, expect it to be worse (significantly on this hardware setup) since AVD comes with minimal HAL and stuff needed to run on your desktop + hardware acceleration, which was trivial to get even with kernel source and postmarketOS

→ More replies (3)

3

u/KabirGamer97 Oct 04 '26

And please I need lower level technical insights and what i need to do. 

2

u/codefl0w Oct 06 '26

Highly dependent on hardware. You'll need a Linux kernel source, which almost certainly isn't public.

Can it be done? I still believe so. Details later if you're interested.

2

u/KabirGamer97 Oct 06 '26

Yes I do have the downstream (3.10) kernel, b2g and third party dependency sources for the Nokia 8110 4G that I own and am targeting towards, I also have various dumps of my 8110 4G as well but I would probably use my own or a simialar TA-1059 dump to grab the driver binaries and such.

I am genuinely interested, while I havent ever really compiled android before, I have compiled linux kernels and such and even made a downstream linux kernel boot a linux distro before.

2

u/KabirGamer97 Oct 06 '26

These sources are from HMD mobile themselves but they do not contain some propietary blobs for a clean and full compilation of KaiOS, certainly not the Gaia Userspace for b2g.

But I do understand that the binaries and libraries found inside of /system and /vendor and the kernel sources are enough to start a android port.

1

u/codefl0w Oct 06 '26

Reversing them would be possible. I must warn you that this would require a ton of time and knowledge.

Do not attempt without serious AI help or you'll just waste time, really.

Also, the kernel source may not work fully. That'll also need some tweaks, probably.

1

u/KabirGamer97 Oct 06 '26

I am not trying to reverse engineer anything much here, I am basically just going with the assumption that if KaiOS devs (and by extension Mozilla for thier FirefoxOS) really wanted hardware vendors then they'd have to engineer B2G as such that any existing BSP made for android would work, and considering how b2g too is compiled with bionic and ALSO I just discovered that it also uses Android's binder IPC as well.... That basically must mean that Android's Entire foundational layer should be intact, and I should be able to take these into a new Android ROM.

I am going to be using claude and seperate FOSS build servers and other tools, yeah lol.

1

u/codefl0w Oct 06 '26

There are many layers to this though. Does the phone have an android-style bootloader, or is it at least extensive enough to boot android? does the kernel support bare minimum android features? can the bare minimum drivers work without tons of tweaks?

Try and see I guess. Report back any time.

Also, if needed, find me on these platforms: https://codefl0w.xyz/contact

2

u/KabirGamer97 Oct 06 '26

After dissecting the system partition and boot partitions I have found quite a bit of interesting things

Firstly: The images are seemingly packged like how you would expect on a standard android device, even down to the kind of file that we're actually dealing with here.

Remember, I have a qualcomm based device but yeah
```
kabir@fedora ~/S/N/Firmware> file boot.img  
boot.img: Android bootimg, kernel, ramdisk, page size: 2048, cmdline (console=ttyHSL0,115200,n8 androidboot.console=
ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboo)
kabir@fedora ~/S/N/Firmware> file system.img  
system.img: Android sparse image, version: 1.0, Total of 204800 4096-byte output blocks in 4571 input chunks.
```

As you can see these files are indeed of that of pretty standard android. After parsing the system partition though claude, here's what it was able to find as well:

Daemons: surfaceflinger, servicemanager, netd, vold, rild, mediaserver, keystore, gatekeeperd, debuggerd.

Libraries: libbinder, libgui, libui, libhwui, libstagefright (and its variants), libaudioflinger, libcameraservice.

Shell tools: wm, dumpsys, uiautomator, plus toybox and toolbox with 139 symlinks. (Theres more but reddit flagged it which was important.)

HAL: lib/hw has 22 modules (gralloc, hwcomposer, audio, camera, lights, sensors and others).

Config: etc/permissions still has the android.hardware.*.xml files.

I would contact you shortly regarding what I find in the upcoming days as I am still a bit busy rn.

2

u/codefl0w Oct 06 '26

Very interesting. Your device is indeed much closer to Android than I expected.

I'll be waiting.

0

u/Familiar_Interest655 Oct 04 '26

Wait, why are you comparing KaiOS 2.5 and a old version of android why not just use the latest version of KaiOS 3.0-4.0 or buy a android phone because it should be possible to load android onto the KaiOS device without a rom, but you lose 90% of the features even with a custom rom and you really cannot build off of it due to how KaiOS is made which fundamentally is different

2

u/KabirGamer97 Oct 04 '26

Do you understand how low level android porting works even? You should try taking an KaiOS firmware apart or read about the history of FirefoxOS itself.

And while yes I would lose functionality in the short term while gaining a whole lot more long term. Because Android is a open platform while KaiOS 4 has literally zero official developer tools and previous versions were a mess as well, and KaiOS never lets you properly take advantage of the hardware for better apps.

KaiOS is fundamentally using the Android Hardware Abstraction Layer, Android-Specific Linux kernel with android specific drivers and modules and is everything is compiled against the Bionic C library which is literally made for android. 

And in terms of why i compared it with old Android: Kaios 2.5 is based on Android 6, KaiOS 3 is based on Android 10 and KaiOS 4 is based on Android 14, atleast in terms of what fundamental base they use for thier os, which is the core kernel, drivers and abstraction layers, which are based on Android.

1

u/Familiar_Interest655 Oct 04 '26 edited Oct 04 '26

And I get that you’re trying to do low android porting but what I’m telling you is that that’s gonna ultimately end up bricking your device and it’s gonna be a slow process too mainly because they have similar hardware layers. Does that mean that they can like do the same things which is why you should probably look up the open source to B2G and even the person said, and was even the architect for design designing it literally said that it’s insanely hard just to get in contact with that same hardware layer, it’s insanely hard to do not to mention you’re most likely going to break your device and you was talking about getting touchscreen and all these features but simple android porting cannot do this as the hardware is factually limited and everything else which it was meant that way, so trying to put so much code on it, it’s just going to become bloatware for it while you’re also gonna lose a lot of features the only thing you’re gonna get out of this is a working CPU and the android that you’re trying to run is it even going to provide that much features for it to be working properly that’s why I’m telling you to root your device and just flash the operating system that you want since you have a open source edition, also who told you that KaiOS doesn’t support touchscreen because it has a touchscreen device

1

u/KabirGamer97 Oct 04 '26

Can you link me to the source please? Because you had to make android work elsewhere where it wasnt supposed to and make it work across a whole truck load of different variations, and I am trying to go the opposite route, make android components work on the OS that it was designed for you know.

1

u/Familiar_Interest655 Oct 04 '26

Come to the discord and I know a couple of people that can explain it or help you for better than I can because the person that ran android is still in Discord and they managed to get the CPU working

1

u/KabirGamer97 Oct 04 '26

Oh alrighty thanks.

1

u/KabirGamer97 Oct 04 '26

And also they might be trying to make android run on a Mainline Linux kernel then, because usually there is a VERY high success rate on making android stuff work back on android.

1

u/Familiar_Interest655 Oct 04 '26

Also what you’re trying to use from the hardware layer you’ll be surprised to know that it just uses the hardware layer even the Linux is different and it doesn’t even use that many android things. The hardware layer is the only thing similar to it but you have to also take into account that this isn’t android at all. It’s quite literally just a desktop shoved into a flip phone and the same bionic c libraries that you’re talking about was stripped out a long time ago from the actual hardware layer

1

u/KabirGamer97 Oct 04 '26

And I am porting android's tools and hardware drivers back into android man. Why dont you understand. I know Linux distros use Glibc instead of bionic and wayland instead of surfaceflinger.

1

u/Familiar_Interest655 Oct 04 '26

But I’m not going to shut down your idea fully if you wanna go do it I say go do it, but you can always root your device and flash a new operating system

https://github.com/kaiostech/gecko-b2g

Here is the open source code for it and go use everything that you need to build this new operating system

1

u/KabirGamer97 Oct 04 '26

And please read the post a bit carefully.

1

u/KabirGamer97 Oct 04 '26

And also who told you thar you can run "android" on a later device without a ROM??? Those have thier boot loaders locked with no way out basically. And again you dont seem to understand how custom roms are in the end.

1

u/Familiar_Interest655 Oct 04 '26 edited Oct 04 '26

Actually, you’ll be shocked to know that their boot loader isn’t locked then you can actually edit the partition just by rooting the device especially for 2.5 devices. It is very easy to edit the phone code. I know because I am in the discord and you can go and access this information while for the Reddit you can’t really access this information., you’re saying this for 2.5 device right so this is one of the most open source devices and easier to edit devices ever just recently 4.0 just got this level of support so I’m pretty sure you can root this device Hella more easily now and be able to port or flash Android cause their boot loader is definitely a lot and editable

1

u/KabirGamer97 Oct 04 '26

I am from a third world country and that's what we got in terms of smart feature phones, besides the 80 buck price for it is not practical really. And more people would be benifited targeting 2.5 and making those lower end devices more practical.

If you want to port my research work towards Android 14 and T440W then sure go ahead. But I only have the 8110 and everyone cares about the 8110 and having a alternate OS option would be great IMO.

1

u/Familiar_Interest655 Oct 04 '26

Well, you can still root your device and load Android i’m there

1

u/KabirGamer97 Oct 04 '26

I have already jailbroken my phone and it doesnt even matter as the bootloader is completely unlocked out of the box.

0

u/YourUglyTwin Oct 04 '26

Most KaiOS devices do not have the ram capable to run android - I understand you got something working via AVD and 32MB RAM but surely that wasn't even close to a good experience (not even gonna mention the security concerns of Android 6)

1

u/KabirGamer97 Oct 04 '26

320mb of RAM, system was stable without any swap or ZRAM, while KaiOS 2.5 did agressively use ZRAM. The system only became unstable when I went any lower than that, but for a featurephone looking at one app only, this should be plenty IMHO.

It was genuinely usable for being real. I can even show you a video if you want to have a look at it. But yeah it was without GMS (Google Mobile Services) and well GMS doesnt exist for this anymore and it isnt worth adding to it for wasting system resources.

I do understand the security concerns about Android 6 but my goal is to atleast get a Android 6 gonk running on Android 6 proper so that it can be upgraded to Android 8 if possible in devices like the 8110 4g or even 10 or later on phones with MT6731 SoCs and such. And how bad can Android 6 even be compared to the Firefox 48 of KaiOS 2.5? All I am saying is that KaiOS 2.5 devices are busted in security anyways, and honestly those hacks are useful more for jailbreaking as you shoundt keep much details on a featurephone anyway.... But you do you.

1

u/KabirGamer97 Oct 04 '26

Like I mean 512 megabytes + ZRAM should be plenty and actual android 6 phones shipped with that spec as well.

1

u/YourUglyTwin Oct 04 '26

Oh I misread that number -- I was like "no way that felt good on 32MB of RAM" but I'm sure on a technical sense it's possible, and if you're doing this to learn then of course I will cheer your on!

But Android 6 is just way way way too old, Android 10 is arguably too old now as well. Android 14 maybe you'd have something you can daily drive since its technically still getting security updates I think but that'll end soon enough as well.

I once tried to port firefox OS to a device just for fun but I ultimately failed (this was like 10+ years ago) but it was a huge learning experience that helped shaped my career believe it or not.

With an unlocked bootloader and time you can probably get this to work,

2

u/KabirGamer97 Oct 05 '26

I am thinking about hard forking CyanogenMod 13 to create a custom OS for this project but I would not want to shoot myself at the foot by locking myself to that platform and think about later versions of android as well.

1

u/KabirGamer97 Oct 05 '26

my goal is to not run anything modern really but to have a more open platform where I can, and others have been able to write much more performant apps. Even if it is THAT old, I still belive that there is a group of people who are still supporting old android, heck even modded versions of whatsapp exist for even older versions and Android 6 IIRC is still officially supported, meaning it already has more utility than current state of KaiOS.

And in terms of what you did, genuinely nice. I am basically doing the inverse of what you're doing. I had already ported a downstream linux kernel from android to run Linux on a Samsung J7 from 2015.