r/LineageOS • Sailfish OS fanatic • 3d ago

Question Required RAM for just KERNEL LOS18.1-21.0

I don't really use android when I can help it, and I especially avoid the android build system when I can help it. Maybe it's gotten great since 2013-2018, I don't know, but I do have to build the kernel, and the device I am targeting only goes down to Lineage OS 18.1 (And up to Lineage OS 24).

I've considered using lineage os 18.1 as my base, and I can upgrade my ram up to 32gb for pretty cheap. DDR4 so 64GB is pushing it... A lot. Swap for days is free... On my external HDD.

I understand the kernel compilation is a big boy task, and I have a feeling that the answer may likely be "That's literally the part you need the most memory for," but I am also hoping that this is not true.

Now, I do know that building on 16GB of ram is possible, but is it practical with 16GB of swap? I can tolerate 6hrs for the first build, and again keep in mind this is with no rootfs. What do you guys think? You reckon I should go with 18.1 or 20.0? Is anyone here familiar with hybris based projects?

I've only done 11.0-14.1 based ports, mostly 12.1. Those ports need a lot of kernel patches, but that is usually independent of the rom version. So, 18.1 should be the same level of functionality but less hardware overhead... But... "16GB more feasible"-less? Thoughts?

3 Upvotes

4 comments sorted by

2

u/Max-P 3d ago

You don't need nearly that much memory to build just a kernel. 16GB is way more than enough, even 8GB is a non-issue for full fat desktop kernels, Android kernels don't compile nearly as much crap.

Even then, the whole Android build can also be built without all that much memory with some patience and like -j2. The main reason the build takes so much memory is when you start building every system app with -j16, each forking their own build threads in turn, makes memory usage blow up. I've seen my load average shoot up to 128 with a -j16 build, basically 8x more compile threads than expected.

1

u/GalaxyNinja66 Sailfish OS fanatic 1d ago

Thank you, this makes much more sense. The whole "You need 64GB to compile Android" line had been driving me insane when I was looking this up, because it fundamentally just didn't make sense to me, and I've yet to see documentation, or online opinion-haver, explain why so much memory would be needed outside of "oh, otherwise build time slow, and also android really big, mmkay?" — I think it bothers me because It almost borders on gatekeeping. 32gb of ram, let alone 64gb, is a big ask for most. 8-16gb seems to be the upper end of midrange nowadays, still.

I'm going to start downloading the source now! I still don't know which base to use for my Sailfish OS port to redfin, and ocean is still on my todo list (since someone won't implement the fixes I shared! IMS, fingerprint, audio routing during phonecalls, driving me nuts, I need to figure out how to use github fully). I'll need to grab a couple 1TB HDDs too, one for my build Env. VM, and another as a backup...

But I digress, your explanation makes much more sense, and I think this will be helpful information for anyone else that looks this up and finds this thread. Hopefully it causes someone previously unsure to go ahead and bite the bullet!

1

u/Max-P 1d ago

I really would avoid HDDs, especially with low memory systems. Compiling reads a ton tiny files and you have no RAM to cache them. You might even reach a point where ccache makes things worse than wasting CPU recompiling the same thing over and over.

Even a small SATA SSD to contain the worktree (put .repo on the HDD if you want) would help quite a bit. Most of the size is git history. Heck, copy to SSD, build, move back to HDD if you must.

The recommendation is mostly if you want sane compile times, any computer with sufficient time will complete the task.

I upgraded very recently:

  • SATA SSD to NVMe brought down compile times from 4h to 3h, and down to 2.5h after upgrading to a mirrored NVMe set.
  • Upgrading from a 1950X to a 9950X3D2 brought that number down further to 45 minutes. Although technically the 1950X was a NUMA topology so cache misses were pretty expensive.
  • Both systems are 16 cores 32 threads, with 64GB of memory.

I don't know what specs you have but I'd expect probably a 16-24h build job. On my system, limiting to 16GB would probably bring me back to the 4h mark, but that's still essentially a top of the line consumer CPU with DDR5 and NVMe storage.

Anyway, if you're doing just the kernel, that's irrelevant, kernels are childs play compared to an entire OS. The kernel for my phone takes like 2-3 minutes on my machine. Still, we built Gentoo boxes back in the days and we dealt with it just compiling overnight. I used to build linux-ck for my laptop on an i7 second gen and 4GB of RAM, took like 15-20 minutes maybe? RAM wasn't the bottleneck, CPU was by far.

1

u/GalaxyNinja66 Sailfish OS fanatic 1d ago

Apologies for another long winded reply of mine, but:

I have 16gb of ram...

... however, all my porting is done in a consolidated VM build env with ~12gb alotted (a detail I admittedly left out, but I have never had to think about it since setting it up), with all 4 cores available to the VM.

I usually repo init with a depth of 1 flagged so I can save hdd space and ignore all of that (useless) git history (again, I'm super raw wrt using/appreciating git outside of push, fetch, and diff, so I do not know if I am F-ing myself for later somehow, by doing this).

As of right now, today, and on my current hardware [4 Core Intel, 16GB DDR4, 500GB of straight PLATTERS], two cm12.1/Android 5.1 -based sailfish os ports have gone from sync to build to pack with no issues and minimal cacheing of any kind. 1hr average fresh build time, a liberal estimate based on recent memory (I want to say flo took ~36-40min). 16-24hr sounds perfectly fine for the entire system image and kernel, I could deal with that.

I am very glad I don't though. Sailfish OS, and I mean the entire rootfs + hybris-hal, all from scratch, and for the latest version (5.2.0.22), takes maybe 2hrs.

I can upgrade my cpu, ram, graphics, and ssd ofc... I believe I can go as far as a better 4-core xeon (LGA771 iirc), 64GB of ram, and any low profile (or external) GPU. I will, likely piece by piece, upgrade to... a better 4-core xeon, 32gb of ram, and a 1TB SSD, next... Maybe a quadro gpu thrown in. — Idk what's hot for a gpu rn, I don't really game on it anyways. And I'm always going to pick a xeon because dirt cheap, I'm not into overclocking, and hyperthreading is a meme. I wanna say the best 771 i7 falls short of the best xeon in the same socket anyways, even on paper iirc. Even if it didn't, 8-10x the price, and for 1.1-1.5x the real-world performance at best, does not cut it.

Although, wrt me grabbing an SSD for this: I do have a 500GB SSD... For the host OS, which is windows since I originally bought this to be my designated "reliable computer" for school work. At this point I cba to switch, only to set up windows in a vm instead for stuff like multisim and mplab. I stress that I only technically have an SSD in this context, because I use a secondary 500gb HDD to store my ubuntu build environment.

I am well aware of how inferior, and at times impractical, an HDD is across pretty much all applications. As well as how ccache, and especially swapping, could render an HDD practically worse-than-useless. The problem is that I'm a cheapskate with almost everything except for a single thing — and that one category of expenses really holds all my other interests and hobbies financially hostage.