Porting Manjaro to Librem 5

Hello all,

I hope you are all doing well. I recently received my Librem 5 and had mixed feelings. In the end, I like it, but it needs work. The application available through the Pure store leaves me wanting; also, for some reason, my phone runs hotter than the recommended temp at idle without anything running. I have tried out PostmarketOS, which I liked better, but I still just wanted Manjaro on there since that is what I use on all of my other devices. I host my own mirror locally and I am serving the arm branch of applications too. I have many years experience with Linux as a user, I have somehow installed a usable installation of Gentoo. I have over 20 years of programming experience, 10 of which professional, and I have contributed to an open source project over the many years, less than I should, but that is because I didn’t find a cause that I found worth it or struck close enough to home, but clearly needed help.

So now that you know me and my situation, here’s what I want to do and how I need help from you guys, the Manjaro community. I want to try to port Manjaro to the Librem 5. Since the code for their (Purism’s) kernel is available, installer tools, example images, and drivers, I figured it should be theoretically possible to take that and build a Manjaro Distro/image that will run on the Librem 5. I would be willing to share all of my logs, try to patch applications, troubleshoot and document the process, but I don’t exactly know where to start. I would almost assume I would start by tearing apart one of their images and see how they get it to boot in the first place, because that doesn’t seem to be super well documented.

Does anybody have experience with doing something like this and would be willing to help me with this?

I will warn you, I am not the fastest developers and most other things in my life will take priority, but I am eager and willing to do what I can.

Thank you for your interest.

The first thing you need is to get familiar with our tools, so that you can modify it to create images for the device.

Once you are familiar with how they work (they are bash scripts), the best place to start would be to create a u-boot package that works on the device.

When you have that working, you can start looking into what patches are needed to the mainline kernel.
If it’s a lot of patches and there exists a separate kernel git repository that has all the required patches, it’s a good idea to create a separate kernel package (maybe called linux-librem5) and make sure it works.

When you can create an image that works, you can submit your changes to arm-profiles and manjaro-arm-tools as issues linking the patches needed to those tools.

1 Like

Looking at how things are done for the PinePhone and PinePhone Pro ports is definitely a good idea for a start. (E.g., the “custom kernel” incantation is done there too, as well as on several other embedded devices. So linux-librem5 would be just one more package of the same kind.)

Hello - I’m a new user here with a Librem 5 who is also interested in helping with this porting process. I’ve tried building a few images using the u-boot from the Purism Librem5 jenkins instance but so far have not had success. Essentially I’ve modified the functions.sh script from the tools to add some logic for the librem5 and write the uboot similar to how it works on other devices and then created a profile that just uses the mainline kernel. It successfully builds, but wont boot.

I’m going to keep hacking at it, but wanted to raise my hand as someone willing to help with the process here.

Hello and Welcome to the forum,

You’re a lucky person to receive this device, while most of the backers have not received their device since years.

Maybe it is best to ask for support for this device on purism forum, as currently we do not have the device to test the uboot which can be compiled from their source.

Happy hacking.

I am pretty sure you will need at least a custom kernel package for the thing to boot. At least with the correct device tree compiled in, probably also with patches. Best build the kernel sources from whatever git repository PureOS gets them from, with the same config and device tree.

Sounds good - I’ve managed to build a custom linux-librem5 using the Purism kernel config and sources and a uboot-librem5 package mirroring what was done from the postmarketOS team in their librem5 port. After that I used the local pkg install option of buildarmimg but still havent had success. I’m going to keep trying to tweak things, but unfortunately nothing boots quite yet. Unfortunately when the librem doesnt boot it doesnt give you any feedback whatsoever as to what the problem is so its pretty much a guessing game at the moment as to what is not set up correctly.

Since you have already made it this far, I suspect you already know this, but you can access the phone’s serial console over the USB connection, it runs at a 115200 baud rate.
So far, all I have done is build what I believe to be Purism’s Byzantium kernel and trying to learn how to use the Manjaro Arm Tools. I only just started to work on this, I had to deal with some things towards the end of last year, but all of that seems to have settled, so I hope to be posting more updates if I make any progress.