Installing OpenWrt on Android device

hi,
most of the routers have pretty basic RAM/processor etc and they do support OpenWRT

an android device definitely has lot of processing power compared to the routers,
I wonder if it is possible to install latest openwrt on android devices.

I came across this project on github


seems this is obsolete since 3 yrs

e.g. Consider this scenario
most of the phones do support 4g connectivity
I install openwrt on phone
and my phone acts as portable router running fullfledged openwrt.
Android devices already support the wifi tethering but I want more features like openwrt.

Is it currently possible?
If yes how to do it?

--nitin

Android devices are already running a Linux kernel under the Java application layers. Root it, you’re done. What’s the point of OpenWrt since Android already has all the drivers and can handle the RIL?

You’ll never have all the drivers you need in mainline Linux, nor in OpenWrt.

3 Likes

Whatever functionality you are looking for, there is probably an Android app for it. If there isn't, then you just found a good business idea.

2 Likes

https://openwrt.org/docs/guide-user/additional-software/beginners-build-guide

Kotlin. Not Java. Similar. Was questionably Java a long time ago. Since the law suit, the allegation has always been that it's not java.

The networking stack (including uci, etc) and the familiarity with it. Also, the ability to configure a device remotely via http is one very desirable feature for users who are unskilled or do not have the time to spend learning the command line and core networking concepts and protocols.

Most android handsets are locked down due to carrier subsidy and do not provide low enough level access to the user (root) for anyone to be able to change the operating system and in turn the network stack so that it becomes multi port, connection and device capable.
Android devices are client devices.
Android is very locked down and for good reason. There is a proprietary hardware stack in every device used for calling. It is not in the interests of hardware vendors to allow anyone to hack away at their call hardware.

This is untrue IMO and remains relative to the device and it's hardware stack. Devices with Qualcomm CPUs and Realtek Wi-Fi radios are commonly more easy to find open source drivers for.
Mediatek and (historically) Broadcom, less so. I imagine Samsung's Exynos and Huawei's Kirin Arm CPUs also may be difficult to support via open source drivers but I have never spent (wasted) time looking.
Things to look out for include new methods of locking the boot loader (such as the newer Xiaomi devices due to grey imports.)

So, it can be done in theory and the place to start is with a device which is supported completely by LineageOS. Devices such as Google's latest Pixels, One Plus and most phones which have Snapdragon Arm CPUs are commonly the most suitable targets. You'll be able to check the device support status on the LineageOS web site.

The next step would be to setup an emulator, emulate the hardware (including flash layout,) setup a build system to build images and start building (you'll want a Linux system for this - try to find a Linux sysadmin to help you setup the dev environment. A separate machine from your daily driver is optimal.) Get cracking using the information available on the OpenWrt wiki and you should start off on the right path.

You might also look into openwrt inside a DROID LXC container.

If your familiar with android kernel modding, it's pretty much all taken care of with the exception of the network abstractions.

I tried to easily unlock ipv4 forwarding in my Android TV-Box and hoped to have a powerful router. - Unfortunately it did end in a boot loop and it was just possible to bring the device back in Maskrom Mode and had to find fitting firmware. - So it would be really good to have an Openwrt app under android or the possibilites that openwrt offers for routing and logical interfaces to share and create different networks through Ethernet and wireless interfaces.

So I would also love if someone can offer a guide how to turn an Android Box into a router.

Advantages are:

  • Cheap, all in one device with power supply
  • more powerful than usual router, even Linksys WRT-3200 is slower than most 20€ Android devices with Amlogic S905, Rk3328, Allwinner H6 and so on.
  • flexibility and more space for extensions!

So why is this such a big deal atm or let's say nothing happened since 3 years about this idea

It would be nice to use the phone only for portable 4g router or as a repeater. Without having installed the other packages like any Android.

Stock Android feature – https://support.google.com/android/answer/9059108?hl=en

1 Like

Yes, I know. But it is not very efficient with respect to the power of the device. To do just that function, a lot of battery and resources are spent with the other programs and applications. I say it would be interesting.

The RIL on Qualcomm-based devices is NOT open source and it is heavily tied into Android.

If you replaced Android with OpenWRT you'd lose 4G on nearly any device on the market.

Jeff is correct that you would never have what you needed in mainline Linux or OpenWRT. Remember, large portions of Android including every single one of the hardware abstraction layers (HALs) are under the Apache license and many are closed-source even on Nexus phones.

I don't think I've seen an open source RIL since around the time of the Nexus S or maybe Galaxy Nexus. None have existed for modern Qualcomm devices.

Myself and Jeff both have experience with building Android from source, I was one of the founders of Omnirom. You greatly overestimate how much of Android is open source.

It could theoretically be done, but it would require enormous amounts of work (even moreso than doing an AOSP bringup on a non-Nexus/Pixel device, which I can tell you from experience is MASSIVELY time consuming).

2 Likes

Acturally, the openwrt-on-android project is still active. It have release new version recently.

You might take a look:

https://github.com/droiter/openwrt-on-android/releases

2 Likes

Did anyone try this on any Android TVBox and is it possible to just install on SD? My internal ROM is already to full for an internal installation

well Indonesian people already did it
b860h hg860p
openwrt/pulpstone

1 Like

how is this possible, run openwrt on andorid as an app? some kind of virtualization layer? please if someone ca explain. thnx.

Does this for different Android Boxes stb also work?

I think he meant install OpenWrt packages on the existing kernel. It wouldn't be as easy as running an app though.

There are some Linux-based minimal distributions for Kodi that target Android TV boxes--for example CoreELEC and OpenELEC. These forums can be a good place to find info about which TV boxes allow booting form an SD, and how to get there.

Once you confirmed your device supports that, it will be a matter of building an OpenWrt image for your device.

There are several images on Armbian Forum for RK3229 boxes (even if they are biggest crap on earth with original images) they work quite well on Armbian. But for me it's not as nice as web gui from known openwrt to use the box as router, Ap, sta or wireguard/openvpn server/client.

Maybe you can confirm beside VIM Khadas which is based on S905x chipset of Amlogic some devices or how they ported it

You can also have a look to Use Android Phone as advance router using OpenWrt - DEV Community

1 Like

This is way cool.

What was the CPU utilization (OnePlus 9R) when benchmarking in iperf3?

And wondering if it could run CAKE w/ Adaptive Bandwidth as well :grin: