FORUMS
Remove All Ads from XDA

Help building LineageOS for LeEco (LeTV) LeMax 1 (X900/Max1) CN

85 posts
Thanks Meter: 42
 
Post Reply Email Thread
3rd October 2019, 12:19 AM |#61  
OP Member
Flag Fafe
Thanks Meter: 42
 
Donate to Me
More
Quote:
Originally Posted by MasterChief2

One thing I don't understand is how is possible that there is huge number of ROMs for Le Max 2, but not for our Le Max? I mean the only differences between them is SoC (SD810 vs SD820) and screen size. Everything else, including camera, ram, resolution is same..

I understand changing one single digit (810 to 820) may cause the impression that the changes are not big, but, as far as I'm aware, this is definitely not the case. Snapdragon 820 has the msm8996 SoC, which means it has substantial differences from Snapdragon 810 (msm8994).

For instance:

Quote:

The new 14nm Snapdragon 820 has a completely different architecture to its predecessor, the 810. It’s comprised of the X12 LTE modem, Kryo CPU, Adreno 530 GPU, Hexagon DSP, and Spectra ISP.

The 64-bit Kryta CPU is one of the bigger changes and will reportedly offer twice the performance of the 810.

Source: https://www.trustedreviews.com/opini...on-810-2926759

So it's not just a simple change and reusing (i.e. back-porting) msm8996 to msm8994 is not straightforward.

Anyway, this is my approach now. I was able to compile Lineage bootloader, but - as I already did it for OmniROM, Lineage was almost pure copy+paste. But when it comes to really compiling the entire ROM, that's a different story.

Hope didn't die yet though.
4th October 2019, 08:36 PM |#62  
OP Member
Flag Fafe
Thanks Meter: 42
 
Donate to Me
More
Lineage 16.0 Recovery compiled and working on LeEco/Letv Max1/X900.

See the attachment.

I uploaded an image here, for those wanting to test: https://mega.nz/#!yEkUBaoY!50RIN92c3...jqMsYg8EAISAE0

The test procedure is the same:

Code:
unzip lineage_recovery-16.0-x900.img.zip
adb reboot bootloader
fastboot boot lineage_recovery-16.0-x900.img
Some progress, isn't it?
Attached Thumbnails
Click image for larger version

Name:	lineage_x900.jpeg
Views:	36
Size:	58.5 KB
ID:	4835545  
The Following 3 Users Say Thank You to htimsxela For This Useful Post: [ View ] Gift htimsxela Ad-Free
9th October 2019, 06:18 PM |#63  
OP Member
Flag Fafe
Thanks Meter: 42
 
Donate to Me
More
Just for your information: a full build (mka bacon) of Lineage 16.0 for OnePlus OnePlus2 takes astonishing 93 gigabytes and more than 4 hours to complete (on a Intel(R) Core(TM) i7-7Y75 CPU @ 1.30GHz (4 cores) with 16GB of RAM)!
10th October 2019, 02:49 PM |#64  
Senior Member
Thanks Meter: 301
 
More
Quote:
Originally Posted by htimsxela

Just for your information: a full build (mka bacon) of Lineage 16.0 for OnePlus OnePlus2 takes astonishing 93 gigabytes and more than 4 hours to complete (on a Intel(R) Core(TM) i7-7Y75 CPU @ 1.30GHz (4 cores) with 16GB of RAM)!

Do you have ccache enabled? Check point 10 and 11 here: https://forum.xda-developers.com/che...-14-1-t3551484

10. Turn on caching to speed up build


You can speed up subsequent builds by running:

Code:
$ export USE_CCACHE=1
And adding that line to your ~/.bashrc file. Then, specify the maximum amount of disk space you want cache to use by typing this from the top of your Android tree:

Code:
$ prebuilts/misc/linux-x86/ccache/ccache -M 50.0G
Where 50G corresponds to 50GB of cache. This needs to be run once. Anywhere from 25GB-100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s Android build environment initialization page.
10th October 2019, 04:41 PM |#65  
OP Member
Flag Fafe
Thanks Meter: 42
 
Donate to Me
More
Quote:
Originally Posted by Palm Trees

Do you have ccache enabled? ...

Yes, I do. I just noticed it causes some extra headaches when I'm having to test so many things.
Yesterday, 11:19 PM |#66  
OP Member
Flag Fafe
Thanks Meter: 42
 
Donate to Me
More
Qualcomm DLOAD mode
In the last days, I've been (again) trying to compile and run a myriad of different kernels and experimenting with Code Aurora Forum. And reading, reading, reading... So today I found out about "Qualcomm DLOAD mode" and though of it as a new hope to debug the kernel without having to open the device and look for serial ports.

I'm still not there yet, but now I can read the phone in that mode with the help of the Sahara project (https://github.com/openpst/sahara), which is aimed at talking with the phone when in this mode, offering the possibility of a recover even in case of a hard brick. More on this later.

I often fall into this "DLOAD mode" when I flash a new kernel which doesn't work. All I get is the phone almost dead with a blue led turned on and this device showing up:

Code:
$ lsusb
...
Bus 003 Device 071: ID 05c6:900e Qualcomm, Inc. 
...
I found out the driver which can handle these devices is qcserial, so I "modprobed" it just to find out it had no support for this specific device:vendor (strangely enough it shows up sometimes as 05c6:900e and sometimes as 05c6:901d). A new journey started then in order to make qcserial recognize my device as well. I did it this way:

Step 1: Editing and compiling qcserial

1.1 As we're going to compile the module, it will generally need to be signed before the kernel can load it, so we need some tools to sign it. This will create MOK.priv and MOK.der files (more info here: https://gorka.eguileor.com/vbox-vmwa...ureboot-linux/).

Code:
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Akrog/"
sudo mokutil --import ../MOK.der
Now we have to reboot the machine to make this MOK authorized. For me, a screen showed up upon reboot with some questions I had to answer.

1.2 Stopping ModemManager, so it doesn't interfere with the device, since it will be recognized as a modem:

Code:
sudo systemctl stop ModemManager
1.3 Getting the Ubuntu Kernel source for my distro.

Code:
sudo apt install linux-source
cd /tmp
tar jxf /usr/src/linux-source-4.15.0/linux-source-4.15.0.tar.bz2
cd linux-source-4.15.0/
1.4 Copying my current .config and Modules.symvers and changing what's necessary.

Code:
cp /lib/modules/4.15.0-65-generic/build/.config ./
cp /lib/modules/4.15.0-65-generic/build/Module.symvers ./
make menuconfig
Go to Device Drivers > USB support > USB Serial Converter support and unmark all options but:

Code:
[*]   USB Generic Serial Driver
<M>   USB Qualcomm Auxiliary Serial Port Driver
<M>   USB Qualcomm Serial modem
Save and Exit.

1.5 Compile the module

This is my uname:

Code:
$ uname -a
Linux xps13 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Note my kernel version is '4.15.0-65-generic', which means:

Code:
VERSION = 4
PATCHLEVEL = 15
SUBLEVEL = 0
EXTRAVERSION = -65-generic
But my Makefile says my kernel SUBLEVEL=18 and has no EXTRAVERSION defined. If I compile things like this, the module will complain about version mismatch, so I compiled the modules with two extra parameters:

Code:
make SUBLEVEL=0 EXTRAVERSION=-65-generic modules_prepare
Then I edited drivers/usb/serial/qcserial.c to add the vendor : product combination to the driver and compiled the module:

Code:
make M=drivers/usb/serial
1.6 Sign the module.

Code:
sudo ./scripts/sign-file sha256 ../MOK.priv ../MOK.der ./drivers/usb/serial/qcserial.ko
We can verify the module is signed with
Code:
modinfo ./drivers/usb/serial/qcserial.ko
1.7 Load dependency and the module itself:

sudo modprobe usb_wwan
sudo insmod ./drivers/usb/serial/qcserial.ko

At this point, dmesg shows the module was loaded and, as my phone was already in DLOAD mode, it was recognized and had ttyUSB0 associated to it.

Code:
[ 2842.969892] usbserial: USB Serial support registered for Qualcomm USB modem
[ 2842.969969] qcserial 3-1:1.0: Qualcomm USB modem converter detected
[ 2842.970212] usb 3-1: Qualcomm USB modem converter now attached to ttyUSB0
Step 2: Accessing the device with Sahara

After having the module loaded and the serial port associated, I downloaded, compiled and run Sahara. It appears that the way you get into DLOAD mode matters for Sahara. When I tried to boot the kernel and it entered DLOAD mode, Sahara immediately asked me to download the memory contents. Otherwise, when entering DLOAD mode by turning the device on with volume up + volume down pressed, Sahara asked me to upload a firmware.

Conclusion

Up to now, I'm able to download any part of the phone's memory, but no logs as of yet. And of course, no progress in building a more recent ROM. But I'm getting to know this phone (and Android itself) as deep as I never thought I would.

The hope is not dead yet.

This link was very useful: https://gorka.eguileor.com/vbox-vmwa...ureboot-linux/
Yesterday, 11:58 PM |#67  
OP Member
Flag Fafe
Thanks Meter: 42
 
Donate to Me
More
Another interesting feature I'm investigating is the diagnostics mode while running the ROM. This can be achieved with:

Code:
adb shell "su -c 'setprop sys.usb.config diag,adb'"
This way, the USB device will have two interfaces, being one the diag and the other, adb.

The default is mtp,adb. I wonder if I can create more interfaces...

Look what I found:

Code:
[email protected]:/ # ls -l /sys/class/android_usb/
lrwxrwxrwx root     root              2019-10-19 00:02 android0 -> ../../devices/virtual/android_usb/android0
lrwxrwxrwx root     root              2019-10-19 00:21 f_accessory -> ../../devices/virtual/android_usb/android0/f_accessory
lrwxrwxrwx root     root              2019-10-19 00:21 f_acm -> ../../devices/virtual/android_usb/android0/f_acm
lrwxrwxrwx root     root              2019-10-19 00:21 f_audio -> ../../devices/virtual/android_usb/android0/f_audio
lrwxrwxrwx root     root              2019-10-19 00:21 f_audio_source -> ../../devices/virtual/android_usb/android0/f_audio_source
lrwxrwxrwx root     root              2019-10-19 00:21 f_ccid -> ../../devices/virtual/android_usb/android0/f_ccid
lrwxrwxrwx root     root              2019-10-19 00:21 f_charging -> ../../devices/virtual/android_usb/android0/f_charging
lrwxrwxrwx root     root              2019-10-19 00:21 f_diag -> ../../devices/virtual/android_usb/android0/f_diag
lrwxrwxrwx root     root              2019-10-19 00:21 f_ecm -> ../../devices/virtual/android_usb/android0/f_ecm
lrwxrwxrwx root     root              2019-10-19 00:21 f_ecm_qc -> ../../devices/virtual/android_usb/android0/f_ecm_qc
lrwxrwxrwx root     root              2019-10-19 00:21 f_ffs -> ../../devices/virtual/android_usb/android0/f_ffs
lrwxrwxrwx root     root              2019-10-19 00:21 f_gps -> ../../devices/virtual/android_usb/android0/f_gps
lrwxrwxrwx root     root              2019-10-19 00:21 f_mass_storage -> ../../devices/virtual/android_usb/android0/f_mass_storage
lrwxrwxrwx root     root              2019-10-19 00:21 f_midi -> ../../devices/virtual/android_usb/android0/f_midi
lrwxrwxrwx root     root              2019-10-19 00:21 f_mtp -> ../../devices/virtual/android_usb/android0/f_mtp
lrwxrwxrwx root     root              2019-10-19 00:21 f_ncm -> ../../devices/virtual/android_usb/android0/f_ncm
lrwxrwxrwx root     root              2019-10-19 00:21 f_ptp -> ../../devices/virtual/android_usb/android0/f_ptp
lrwxrwxrwx root     root              2019-10-19 00:21 f_qdss -> ../../devices/virtual/android_usb/android0/f_qdss
lrwxrwxrwx root     root              2019-10-19 00:21 f_rmnet -> ../../devices/virtual/android_usb/android0/f_rmnet
lrwxrwxrwx root     root              2019-10-19 00:21 f_rmnet_smd -> ../../devices/virtual/android_usb/android0/f_rmnet_smd
lrwxrwxrwx root     root              2019-10-19 00:21 f_rndis -> ../../devices/virtual/android_usb/android0/f_rndis
lrwxrwxrwx root     root              2019-10-19 00:21 f_rndis_qc -> ../../devices/virtual/android_usb/android0/f_rndis_qc
lrwxrwxrwx root     root              2019-10-19 00:21 f_serial -> ../../devices/virtual/android_usb/android0/f_serial
lrwxrwxrwx root     root              2019-10-19 00:21 f_uasp -> ../../devices/virtual/android_usb/android0/f_uasp
lrwxrwxrwx root     root              2019-10-19 00:21 f_usb_mbim -> ../../devices/virtual/android_usb/android0/f_usb_mbim
I noticed setting the prop sys.usb.config triggers things inside init.rc. For example:

Code:
on property:sys.usb.config=none
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/bDeviceClass 0
    
on property:sys.usb.config=mass_storage,adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1

on property:sys.usb.config=mtp,adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    start adbd
    
on property:sys.usb.config=adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable ${service.adb.root}
    start adbd
So, for instance, when set to mtp,adb, it does this:

Code:
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    start adbd
So can I manually do this? Writing the function I want?
Today, 12:53 AM |#68  
OP Member
Flag Fafe
Thanks Meter: 42
 
Donate to Me
More
Yes, I can!

Code:
adb shell "su -c 'echo 0 > /sys/class/android_usb/android0/enable; echo diag,serial,rmnet > /sys/class/android_usb/android0/functions; echo 1 > /sys/class/android_usb/android0/enable;'"
It's so versatile!

More info here: https://osmocom.org/projects/quectel...oid_USB_Gadget

I know this may seem to be a bit off-topic, but maybe I can find a way to debug... This is all I'm after right now. The effort I have to put in order to make things work in a so blindly way is incredible and being able to see a mere console would come really handy.

It's getting interesting...
Post Reply Subscribe to Thread

Tags
leeco, letv, lineageos, max1, x900

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes