Building Ubuntu Touch for the Galaxy S4

So I’ve got a purple S4 with 2gb of ram. Its a sprint wersion. I’ve got it running lineage 18.1 but I can see why theres lite versions of literally every app now. After the system is booted theres about 270mb of ram left over free.

Big oof

So I am thinking of building ubuntu. Since the S4 is the same hardware as the nexus 5, not rly a problem, and then I can even swing support for the lg optimus g and raise that from the dead.

But, I’m gunna need help. Imma be honest I have no idea how to do this shit, so if I have a bump I’m gunna show it and crank on it. Probably will have questions.

Reasons for doing this:

1-I’m poor
2-I’m stupid enough to try, smart enough to figure it out, and shubborn enough to keep it going
3-I hate my current phone and just want a music player with a web browser that does sms tbh. With the extra perks of ubuntu of course lol

Goals for the device:

1 - 400mb ram used at idle, with updater running
2 - make the phone run kernel 5 at minimum. If 6 drops, move up to that. Tired of this shitass memory management in 3.4 and 3.10
3 - later move to even lighter distro’s, such as the mobile port of void linux
4 - flatpak as main repo, self hosted flatpak build server, optimized apps.
5 - built in clock management utilities of some sort to do custom battery stepping

Hopefully I can get somewhere with this in the next few days, for right now I have things to list for sale and dinner to finish.

Also, if you have a phone from this era, help me with this! This is a community blog for a reason lol


Space reserved for future notices and postings.

1 Like

Reserved - current status / current changelog

Reserved - kernel notes / OS notes

Reserved - Archived changelog / links

What Kernel Should Be Default?
  • 5.0
  • 5.11
  • 5.14
  • 3.10
  • 3.16
  • 3.4
  • 4.4 (slash onion)

0 voters

Battery Management Style?
  • Defaults set, but otherwise user custom stepping
  • Defaults, similar to android 11, only
  • Default, powersaver, custom (as specific settings, basically both)

0 voters

I have no real opinion myself for the second poll. My device can be whatever I want :3

A very interesting project! I think I may be of some assistance, I posted a guide here on how to get Linux on a Samsung Galaxy Tab a while ago Linux on the Samsung Galaxy Tab 10.1... And you can too!
Some bits there may be of help.
Regarding the kernel, don’t bother. Android kernels are royally messed up. Consider each one an entirely incompatible fork as far as updates are concerned. I tried getting a 3.16 kernel working on the Tab (originally 3.0) and just got lost in patch rework hell. If you don’t fancy building an entire distro from scratch (I wouldn’t), start trying to get an older distro (like Debian Jessie) working first if its a 3.x kernel. The kernel config will almost certainly need modification. Take a look at the differences in the config used for the Linux and Android kernels for the Samsung Galaxy Tab that’s linked that old guide, there may be some clues.
Good luck and God’s speed!

Thing about the S4 is the kernel source leaked. So it might be a pain for a minute, but theres a build prop, no doubt. In’d be worth it for the ram management alone tbh.

Pretty sure the GPL requires the release of the kernel source? Unless it was a leak of the source for some binary drivers?

If there’s a version on Lineage out which hasn’t been DMCA-ed into oblivion, the source should be pretty legit. Samsung just probably couldn’t be bothered to comply so some rogue employee probably just released it unofficialy. (All speculation, I have no real idea)

@FaunCB do you have a link to the kernel source? Found the source.

1 Like

Good luck.
Here’s the porting guide:
https://docs.ubports.com/en/latest/porting/introduction/index.html

As far as a mainline-kernel goes, my guess is that you’ll be out of luck if you don’t want to basically become a full-time kernel developer - For a lot of hardware you’ll need vendor blobs, and these often only work with very specific kernels, and an Android userland. You would probably need to write a lot of device drivers to basically mainline your device.

Also you’re probably still bound to Android kernels, or at least “Android-compatible”, as UBPorts uses libhybris-stuff, and that makes use of the Android-specific device drivers(AFAIK). (See Introduction to porting - UBports documentation)
So you’re basically just porting a more blob-free and more recent Android kernel.

If you just want a light Desktop-Linux like distribution, running on an Android-kernel, you could try PostmarketOS:
https://wiki.postmarketos.org/wiki/Samsung_Galaxy_S4_(samsung-jflte)
You don’t get hardware acceleration(You might by using libhyris with Mer on UBPorts!), but you can just install a desktop environment.
There is also Hybris - postmarketOS.
I don’t know much about it, but it sounds promising.

If you actually want to mainline your device, here might be a good starting point:
https://wiki.postmarketos.org/wiki/Mainlining_Guide
You’ll need to know C, and it might not be possible at all. You want a hardware serial console for early boot output.
You might brick a device or two.

1 Like

If you just care about having a working device, there’s always Android Go that’s created for lower spec devices. It shouldn’t be a pain to run like full on Android, but it’s still compatible with all the apps and stuff. Most of the core services are served through the internet so they’re on demand and don’t create just threads on threads on your system.
Maybe, being Android, there are more straight forward methods to get it going.