Re: How to build Maru OS for devices supported by Lineage Os

972 views
Skip to first unread message
Message has been deleted

Preetam

unread,
Dec 23, 2017, 3:39:33 PM12/23/17
to Maru OS dev
Great, would love to to see this Georgian! This will be very helpful for porters!

On Monday, December 18, 2017 at 10:24:05 PM UTC-5, Georgian Chituc wrote:
Here will be links with github source and instructions how to start porting the great Maru OS for devices supported by Lineage Os .

Georgian Chituc

unread,
Jan 30, 2018, 3:14:18 PM1/30/18
to maru-...@googlegroups.com
OK , here are instructions for How to build MaruOS for devices supported by Lineage OS .

First you may have some questions so I try to quick respond to them .

Q. Why you use Maru Os ?
A. I want Ubuntu desktop on my external monitor .

Q. Do you use it as primary rom?
A. Yes for 2 years ,on a LG G4 and now on HTC 10

Q. Is Android and Ubuntu stable?
A. Very stable .I use it day by day no crash no problems .

Q. Why do you need to modify android framework and just dnt use a apk .
A. Because I want everything to be stable and best performances .

Q. Why do I need Lineage OS ?
A. Because you need to run a Android inside your phone ,and you need to have the source of that Android so you to integrate Maru OS mods into it . Device manufacturers do not release the source of the device tree for the phones and the mods they do to android ,but you can often find this on the Lineage Os project .


Q. What is a device tree and why I need it .
A. A device tree contains source code and some files that describe your device and contains device specific mods .This are not the same for every device , so it must be made for your phone model .Without this android do not know your partitions sizes and phone hardware like cpu  , camera , display model  etc. When a manufacturer build android for a device , they add to the AOSP a device tree that is custom build for that device .
Google give you device tree usually just for their  Nexus phones and you can use that inside AOSP but others manufacturers do not publish the device tree they use .
Unless you're a expert and you can build yourself a device tree , you have to use one already build and you can find it in the Lineage Os project. But the device tree from Lineage Os do not works inside AOSP so you have to use Lineage OS too .


Q. My phone is not a Nexus can I compile the Google AOSP  for it without to use any device tree?
A. No , your phone will miss camera ,wifi , bluetooth or will not start at all .You really need a device tree for your model .

Q. Why Maru Os use AOSP Andorid as base and not LineageOs .
A. Probably will use in future . When Maru Os started for Nexus 5 ,there was a existing device tree for Nexus 5 ,provided by google , and Preetam just decided to use the pure AOSP because he had all he need.
Also at that time there was no Lineage OS , was CyanogenMod and that was not perfect like the official Google AOSP.

Q.Can I use MaruOs inside my phone model XYZ ?
A.You can use Maru os inside any phone model supported by Google AOSP and LineageOS , but I recommend you phones with slimport port cause using a wired HDMi out you dnt have lag like over wifi casting .

Q. How did you build MaruOs for HTC 10 ?
A . I just used https://wiki.lineageos.org/devices/pme/build . First I did all it say in that page and build it to be sure it compile , next I modified the kernel to support lxc , then I modified Android Framework to support MaruOs  (I modified lineage os same Preetam modified : android_platform_frameworks_base ,android_platform_frameworks_native ,android_platform_packages_apps_Settings ) and last I added vendor_maruos as a dependecty of my device tree .
I followed Lineage Os instructions + Maru Os wiki , the patches that I did for Lineage Os framework I got from https://github.com/maruos/ .

Q. Can I modify Lineage Os framework line by line , same like Preetam modified AOSP ?
A. Starting with Lineage OS 14.1 you dnt need to write any code by yourself you can patch LineageOs exactly how Preetam patched AOSP , without you to add any extra code.



Ok , that is for now . Next I will put the source code so you dnt have to patch again the LineageOs with MaruOs mods , but you will still have to follow the Lineage Os instruction for your device model  -> to put inside Lineage Os the device tree specific to your phone model .








Preetam

unread,
Feb 27, 2018, 8:03:07 PM2/27/18
to Maru OS dev
This is great info Georgian, thanks!

I guess something to consider is officially rebasing Maru on Lineage OS for non-Nexus devices. We can have a separate branch for this on the official Maru repos so everyone can re-use the same device-independent code and porters will only need to modify the device kernel (to support LXC) and device tree (to include vendor_maruos files). I think this would help speed up non-Nexus device development a lot.

Mikey DeFrancesco

unread,
Mar 1, 2018, 1:59:43 PM3/1/18
to Maru OS dev
Georgian,

As you build out this thread, can you list any hardware prerequisites in order for this to be possible?
I was gravitated toward the HTC10 because it is a favorite device of mine, but seeing as you have already gotten it working I would rather not duplicate my efforts and instead port to another device that may be newer.

Georgian Chituc

unread,
Mar 1, 2018, 2:33:58 PM3/1/18
to Maru OS dev
Essential phone Ph-1  will be my next device I will build maru for , but I dnt mind if somebody else also start porting for it .
I dnt have now one but I hope soon to get one , it have slimport and qualcom 835 cpu .And lineage os runs great on it .

Also Nokia 8 and HTC U11 are interesting device to port for and I read they have also some support from lineage os .
I'm only interested in device with hdmi out ,and the new standard is over USB C , because I do not want to have lag over wifi casting .

Georgian Chituc

unread,
Mar 1, 2018, 2:54:09 PM3/1/18
to Maru OS dev
Thank you Preetam  , the next step is to make a diff of the mods I did to lineage os so we can use them to patch latest lineage os build .

Georgian Chituc

unread,
Mar 26, 2018, 3:45:56 PM3/26/18
to Maru OS dev
I made a diff of the required patch to android frameworks base ,native and Settings app , that must be applied to LineageOS 14.1 .
I will have to test it on LOS 15.1 too

Preetam

unread,
Mar 28, 2018, 7:56:50 PM3/28/18
to Maru OS dev
Great! Once you test the diff I can create a lineage manifest branch that everyone can use. Should make it much easier to port for lineage os based devices.

Georgian Chituc

unread,
Mar 28, 2018, 8:00:51 PM3/28/18
to Maru OS dev
I have tested it on the last LineageOS 14.1 code and all is fine , but Tayler said for lineage os 15.1 it may need adaptions .

I will upload the files today , they are tested 100% for 14.1 .The one I run inside HTC 10

Georgian Chituc

unread,
Mar 30, 2018, 10:21:45 PM3/30/18
to Maru OS dev
Hello again ,

Attached are the patch files that must be applied to latest Lineage OS cm-14.1 branch .
They are diff files and can be applied like :

cd lineageos/frameworks/native
patch -p1  < android_frameworks_native.patch



I just used this patch files to build latest lineage os 14.1 source for HTC 10 , and everything is working .
android_packages_apps_Settings.patch
android_frameworks_native.patch
android_frameworks_base.patch

Preetam

unread,
Apr 6, 2018, 1:04:10 PM4/6/18
to Maru OS dev
Ok, great thanks! I am currently traveling but will take a look at these when I get back and begin setting up a manifest based on lineage that we can use for shared development.

Preetam

unread,
Apr 6, 2018, 1:09:58 PM4/6/18
to Maru OS dev
From a quick scan of the patches it looks like most of my changes are the same that I committed on our official nougat-mr2-release branch. So I may be able to simply cherry-pick many of these from nougat-mr2-release to the new lineage branch. I will try to do that to keep things clean and refer to these patches for any differences or conflicts that come up.

adam koen

unread,
Apr 28, 2018, 11:10:50 AM4/28/18
to Maru OS dev
Hello,
So i applied the patches you provided below to my Lineage 14.1 source that built before i applied the patches now im getting this error below


find: ‘/home/adam/android/lineage_14.1/out/target/common/obj/SHARED_LIBRARIES/libwifi-hal-mock_intermediates’: No such file or directory
build/core/Makefile:54: Duplicate header copy: /home/adam/android/lineage_14.1/out/target/product/angler/obj/include/time-services/time_genoff.h
build/core/Makefile:54: Defined in: device/huawei/angler/time-services/Android.mk vendor/qcom/opensource/time-services/Android.mk
Starting build with ninja
ninja: Entering directory `.'
ninja: error: '/home/adam/android/lineage_14.1/out/target/product/angler/obj_arm/SHARED_LIBRARIES/libperspective_intermediates/export_includes', needed by '/home/adam/android/lineage_14.1/out/target/product/angler/obj_arm/SHARED_LIBRARIES/libandroid_servers_intermediates/import_includes', missing and no known rule to make it
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/home/adam/android/lineage_14.1'

Any ideas??


Georgian Chituc

unread,
Apr 28, 2018, 11:27:22 AM4/28/18
to Maru OS dev
Oke , it should work , give me few hours and I will write here .

Georgian Chituc

unread,
Apr 28, 2018, 10:13:45 PM4/28/18
to Maru OS dev
are you sure you added https://github.com/maruos/vendor_maruos to your lineage build , and called it to be include from your device tree?

adam koen

unread,
Apr 29, 2018, 11:17:50 AM4/29/18
to maru-...@googlegroups.com
I thought i did i have the vendor_maruos folder in the vendors folder and added $(call inherit-product-if-exists, vendor/vendor_maruos/device-maru.mk) to the aosp_angler.mk in /home/adam/android/lineage_14.1/device/huawei/angler



EDIT: So i made sure everything was correct to what i have listed above and i had an extra s on the vendor_maruos folder so i renamed it and re ran the build and now its coming up with a new error

Starting build with ninja
ninja: Entering directory `.'
ninja: error: '/home/adam/android/lineage_14.1/out/target/product/angler/obj/SHARED_LIBRARIES/liblxc_intermediates/export_includes', needed by '/home/adam/android/lineage_14.1/out/target/product/angler/obj/EXECUTABLES/perspectived_intermediates/import_includes', missing and no known rule to make it
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/home/adam/android/lineage_14.1'

adam koen

unread,
May 1, 2018, 1:27:52 PM5/1/18
to Maru OS dev
Did i not add the vendor_maruos to the device tree the right way?

Georgian Chituc

unread,
May 1, 2018, 1:49:31 PM5/1/18
to Maru OS dev
Yes , that have to cause problems.
In few hours when i will be back to home , I will give you the linux commands issued for a succesufully build , and instructions .Is not something hard, but if smth is missing they will cause compile problems.
Have a good day

adam koen

unread,
May 2, 2018, 10:41:27 AM5/2/18
to Maru OS dev
ok cool i look forward to hearing from you.

Thank you

adam koen

unread,
May 4, 2018, 3:33:55 PM5/4/18
to Maru OS dev
Hello Georgian any word yet on that info?

Georgian Chituc

unread,
May 5, 2018, 2:37:48 PM5/5/18
to Maru OS dev
Yes , sorry I was out of town ,I will edit this post and put the complete commands you need ,in few hours

adam koen

unread,
May 11, 2018, 1:03:24 AM5/11/18
to Maru OS dev
Ok cool i will wait for your reply/edit

Preetam

unread,
May 13, 2018, 12:44:27 PM5/13/18
to Maru OS dev
Hi Adam,

Was looking through your error logs...


On Sunday, April 29, 2018 at 11:17:50 AM UTC-4, adam koen wrote:
Starting build with ninja
ninja: Entering directory `.'
ninja: error: '/home/adam/android/lineage_14.1/out/target/product/angler/obj/SHARED_LIBRARIES/liblxc_intermediates/export_includes', needed by '/home/adam/android/lineage_14.1/out/target/product/angler/obj/EXECUTABLES/perspectived_intermediates/import_includes', missing and no known rule to make it
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/home/adam/android/lineage_14.1'

Have you added the lxc repository to your tree? It looks like your build can't find it.

You can find it here: https://github.com/maruos/platform_external_lxc

I am currently working on applying getting a common cm-14.1 manifest up so that getting this stuff set up will be much easier for you. I'll update when it's ready. But in the meantime you can manually add the lxc project directly to your manifest.

adam koen

unread,
May 13, 2018, 11:17:05 PM5/13/18
to Maru OS dev
Hello,
That seems to have done the trick it is building now
Thank you for the help Preetam and Chituc 

Georgian Chituc

unread,
May 14, 2018, 5:51:41 AM5/14/18
to Maru OS dev
Ok , good , I hope it will build fine .
After you finish build , just flash it and let me know if android works . I will still have to give you some commands so maru desktop to work . But is smth simple .You first need to root your lineage os by flashing with twrp the su addon.

adam koen

unread,
May 14, 2018, 10:51:23 AM5/14/18
to Maru OS dev
Hey guys,
So i ran the build while i was at work last night and when i got home i had this error at 74% complete

frameworks/base/services/core/jni/com_android_server_mperspective_PerspectiveService.cpp:17:10: fatal error: 'perspective/IPerspectiveService.h' file not found
#include <perspective/IPerspectiveService.h>
         ^
1 error generated.
[  6% 892/13691] Building with Jack: /...rvices.core_intermediates/classes.jack
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/home/adam/android/lineage_14.1'


The only place i can find that file is in /home/adam/android/lineage_14.1/vendor/vendor_maruos/include/perspective

Am i missing something else?

Georgian Chituc

unread,
May 14, 2018, 11:05:45 AM5/14/18
to Maru OS dev
I think you miss mflinger from maru os github. Wait for me to get home infew hours and i will give all

Georgian Chituc

unread,
May 14, 2018, 11:08:43 AM5/14/18
to Maru OS dev
I know where the problem come .The new vendor maru os has renamed perspectived .And the patchs you have are for the old named perspectived . I will give you the verdor_maruos that you need. In few hours you ll have all to succesufully compile it.

adam koen

unread,
May 14, 2018, 6:46:53 PM5/14/18
to Maru OS dev
Ok i had mflinger in the wrong directory i got that fixed and the build finished i was also able to flash it to the phone with no issues

the dashboard crashes when i try and launch it from the settings menu what are those commands you said i needed to run?

Again thank you all for the support

Georgian Chituc

unread,
May 15, 2018, 6:56:22 AM5/15/18
to Maru OS dev
Oke , it is good it works and is ok to dnt work out of the box , because you need some simple commands to execute as root inside phone terminal app .
The first step is to flash linaeage os root addon , and follow the simple guide i m preparing today.

Georgian Chituc

unread,
May 15, 2018, 7:06:26 AM5/15/18
to Maru OS dev
To begin you have to use terminal app , and remount /system partition rw , and do : mkdir -p /system/lib/lxc/rootfs
Next you will need a /data/maru directory populated with files from a archive iwill give you . It contains lxc config files and ubuntu system image for aarch64.

Georgian Chituc

unread,
May 15, 2018, 7:11:27 AM5/15/18
to Maru OS dev
Next , you will have to make a backup of your boot.img using twrp , transfer it pc , unpack it , and modify fstab : remove nosuid from /data partition mounting line , repack boot.img and flash it back. You can also do this inside your device tree fstab and recompile image . But is easier to unpack and repack

Georgian Chituc

unread,
May 15, 2018, 7:17:04 AM5/15/18
to Maru OS dev
To debug the startup of debian/ubuntu desktop errors , you can try starting the linux from terminal while you root.
You have to get the lxc binaries preetam gived to me inside "lg g4" threa and uncomompress lxc-start and all other binaries from archive inside /system/bin/ ,make them chmod +x , and use lxc-start -n jessie , from terminal app while you root. It will show why it can not start the linux desktop.

adam koen

unread,
May 17, 2018, 9:59:46 AM5/17/18
to Maru OS dev
So during the boot process of the phone it is still doing the auto encrypt do you know how to stop that?

And also are you going to attach the archive of files to put in the /data/maru folder ?
Reply all
Reply to author
Forward
0 new messages