Halium / projectmanagement

143 stars 32 forks source link

[device-port] [d855] LG G3 (International) #66

Open Pepitortue opened 6 years ago

Pepitortue commented 6 years ago

Tree: halium-7.1

Manifest

https://github.com/Pepitortue/halium-devices/blob/halium-7.1/manifests/lge_d855.xml

Kernel config (halium)

Modify the kernel under : kernel/lge/g3/arch/arm/configs/lineageos_d855_defconfig Mine is here : https://pastebin.com/raw/D8cXLHcH

Fixup-mountpoints

    "d855")
        sed -i \
            -e 's block/platform/msm_sdcc.1/by-name/system mmcblk0p40 ' \
            -e 's block/platform/msm_sdcc.1/by-name/userdata mmcblk0p43 ' \
            -e 's block/platform/msm_sdcc.1/by-name/cache mmcblk0p41 ' \
            -e 's block/platform/msm_sdcc.1/by-name/persist mmcblk0p19 ' \
            -e 's block/platform/msm_sdcc.1/by-name/modem mmcblk0p1 ' \
            -e 's block/platform/msm_sdcc.1/by-name/sns mmcblk0p37 ' \
            -e 's block/platform/msm_sdcc.1/by-name/drm mmcblk0p36 ' \
            -e 's block/platform/msm_sdcc.1/by-name/mpt mmcblk0p38 ' \
            "$@"
        ;;

mka mkbootimg

make completed successfully (16 seconds)

mka hybris-boot

make completed successfully (06:20 (mm:ss))

mka systemimage

make completed successfully (13:09 (mm:ss))

~~Needed to create directory out/host/linux-x86/framework/ and copy signapk.jar inside Found it on XDA at this link https://forum.xda-developers.com/attachment.php?attachmentid=2870771&d=1406348812~~ Solved in halium

mka troubleshoots

Need to install libncurses5 libraries with : sudo apt-get install libncurses5

In kernel/lge/g3/security/selinux/include/ need to create :

include
     |- flask.h
     |- av_permissions.h

flask.h contains : https://github.com/SELinuxProject/selinux/blob/master/libselinux/include/selinux/flask.h Note : need to remove the #warnings

av_permissions.h contains : https://github.com/SELinuxProject/selinux/blob/master/libselinux/include/selinux/av_permissions.h Note : need to remove the #warnings

boot troubleshoots (telnet)

Had to use mr.bump script to bump the boot image, the device will boot in secure boot unless

boot troubleshoots (normal boot)

No need to use a bump script now

halium boot

LXC started after kernel tweeks.

root@localhost:~# systemctl status lxc@android
● lxc@android.service - LXC Container: android
   Loaded: loaded (/lib/systemd/system/lxc@.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2016-02-11 16:28:06 UTC; 46 years 1 months left
     Docs: man:lxc-start
           man:lxc
 Main PID: 1230 (lxc-start)
   Memory: 2.6M
      CPU: 337ms
   CGroup: /system.slice/system-lxc.slice/lxc@android.service
           └─1230 /usr/bin/lxc-start -F -n android

Feb 11 16:28:06 localhost.localdomain systemd[1]: Started LXC Container: android.

udev rules

udev rules for g3 d855 : https://github.com/Halium/lxc-android/pull/25/files Might work with all g3 variants

issues

1/ No space left

Can't do anything after boot as there is no space for any action :

root@localhost:/# apt-get upgrade
Reading package lists... Error!
E: Write error - write (28: No space left on device)
E: IO Error saving source cache
E: The package lists or status file could not be parsed or opened.

Might be due to the /system partition which is full. Its size is 198M. On LineageOS its 1.9G and use 900M... Strange... Will check the mount point or try to resize it. Might be due to the loop0 device which is full as well -> tried to resize it to 2G, same issue

root@localhost:/# df -h
Filesystem        Size  Used Avail Use% Mounted on
/dev/block/loop0 1008M 1008M     0 100% /
/dev/mmcblk0p43    12G  1.4G  9.9G  13% /data
devtmpfs          734M     0  734M   0% /dev
tmpfs             912M     0  912M   0% /dev/shm
tmpfs             912M   26M  887M   3% /run
tmpfs             5.0M     0  5.0M   0% /run/lock
tmpfs             912M     0  912M   0% /sys/fs/cgroup
/dev/loop1        198M  198M  4.0K 100% /system
/dev/mmcblk0p41   599M   11M  589M   2% /cache
/dev/mmcblk0p19    32M  4.2M   28M  14% /persist
/dev/mmcblk0p1     64M   57M  7.1M  90% /firmware
/dev/mmcblk0p37   7.9M  4.1M  3.8M  52% /sns
/dev/mmcblk0p36   7.9M  4.6M  3.4M  58% /persist-lg
/dev/mmcblk0p38    32M  6.1M   26M  20% /mpt

2/ kernel configs missing

When running lxc-checkconfig I got this :

--- Misc ---
CONFIG_NF_NAT_IPV4: missing
CONFIG_NF_NAT_IPV6: missing
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: missing

--- Checkpoint/Restore ---
CONFIG_PACKET_DIAG: missing
CONFIG_NETLINK_DIAG: missing
Those are all enabled in the kernel con

I changed the kernel config to enable the correct flags and dependencies but it keeps showing as missing.

3/ hwcomposer won't work

Used the plasma CAF rootfs to test. I got the W Adreno-EGL: <qeglDrvAPI_eglSwapBuffers:3890>: EGL_BAD_SURFACE error. Troubleshoots ask to to apt update/upgrade but I'm blocked by Issue #2

jbruechert commented 6 years ago

Comment on your manifest: You can't use lineageos 15.1 device trees for Halium, you need to use 14.1. Also, please don't create a new repository for the manifest, but instead pull request it at https://github.com/halium/halium-devices.

110101011 commented 6 years ago

If you get stuck with this port and need help, i have an d855 as main phone. Just shout out and i see whatever i van do.

Pepitortue commented 6 years ago

I'm stuck here for now, while mka systemimage:

[ 28% 3897/13462] (mv /home/pepito/halium/out/target/product/d855/obj/APPS/TimeService_intermediates/package.apk.signed /home/pepito/halium/out/target/product/d855/obj/APPS/TimeService_intermediates/package.apk )" java.io.FileNotFoundException: --min-sdk-version (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.(FileInputStream.java:138) at com.android.signapk.SignApk.readPublicKey(SignApk.java:140) at com.android.signapk.SignApk.main(SignApk.java:744)

It tries to rename

halium/out/target/product/d855/obj/APPS/TimeService_intermediates/package.apk.signed But the file does not exist. There is only package.apk.unsigned

~/halium$ jarsigner -verify halium/out/target/product/d855/obj/APPS/TimeService_intermediates/package.apk.unsigned

jarsigner: Signature Block missing for CERT

Let see tomorrow if I can sign it or if I find a workaround Any idea ?

110101011 commented 6 years ago

Remove all lines with .apk of .jar them from proprietary-files.txt which should be in your device tree. And rebuild, this should fix all apk/jar errrors in the build progress.

jbruechert commented 6 years ago

Since today, apks should be automatically removed by the halium-devices setup script

ghost commented 6 years ago

any progress on this? Thanks

110101011 commented 6 years ago

I guess he stopped working on it, I'll see what I can do next week, I have a LG D-855 laying around doing nothing.

Just ask me for my progress next week, I case i forget to look at it, I'm a bit busy these days (my child takes up a lot of time :p)

Pepitortue commented 6 years ago

Hey,

Last time I was stuck at the ssh access after flashing the boot image, but didn't get time for this project anymore. Now that OTA-4 has been released, I'm back and will try to make ubports boot this time. Would be great to work together :)

110101011 commented 6 years ago

So you did get SSH access and did you run the libhybris tests?

Pepitortue commented 6 years ago

No I didn't, the device wasn't showing in terminal. I couldn't run any libhybris test. I was stuck at this step.

110101011 commented 6 years ago

Ok I'll clean up my desk and see if I can help in a couple of days, it at least compiled and boots which is good. So it's only debugging now, to see if and where in the boot process it fails.

Pepitortue commented 6 years ago

Hi,

Just tried to build again.

mkbootimg and hybris-boot worked but I'm stuck on this error with the system image :

Building DTBs make: Entering directory '/home/pepito/halium/kernel/lge/g3' make[2]: Nothing to be done for 'arch/arm/boot/dtbs'. make: Leaving directory '/home/pepito/halium/kernel/lge/g3' [ 9% 1260/13346] Lex: libsepol_32 <= external/selinux/libsepol/cil/src/cil_lexer.l FAILED: /home/pepito/halium/out/host/linux-x86/obj32/SHARED_LIBRARIES/libsepol_intermediates/cil/src/cil_lexer.c /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -o/home/pepito/halium/out/host/linux-x86/obj32/SHARED_LIBRARIES/libsepol_intermediates/cil/src/cil_lexer.c external/selinux/libsepol/cil/src/cil_lexer.l" flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertioncnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed. Aborted (core dumped) [ 9% 1260/13346] host C: libsqlite_32 <= external/sqlite/dist/sqlite3.c 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/pepito/halium'

make failed to build some targets (01:30 (mm:ss))

`

I read that it might be caused by insufficient amount of RAM (I've put 10GB to this VM). Some says that 16GB of RAM is required, but last time (in march) I used only 8GB and didn't have this error. Any idea ?

jbruechert commented 6 years ago

This is a wierd bug which can often be fixed by either setting the language to default/english LANG=C mka hybris-boot or by using the host flex binary USE_HOST_FLEX=true mka hybris-boot

Pepitortue commented 6 years ago

LANG=C mka worked, thanks !

Pepitortue commented 6 years ago

Ok, I now have ssh access to the GNU device !

It failed before because I used the msm8974_defconfig kernel which is not the good one... :facepalm: I've rebuild everything using the lineageos_d855_defconfig kernel and it works :)

Pepitortue commented 6 years ago

I tried to update the device in order to get hwcomposer to work but get this error :

root@localhost:/# apt-get upgrade
Reading package lists... Error!
E: Write error - write (28: No space left on device)
E: IO Error saving source cache
E: The package lists or status file could not be parsed or opened.

I have far enough space on the device :

root@localhost:/# df -h
Filesystem        Size  Used Avail Use% Mounted on
/dev/block/loop0 1008M 1008M     0 100% /
/dev/mmcblk0p43    12G  1.4G  9.9G  13% /data
devtmpfs          734M     0  734M   0% /dev
tmpfs             912M     0  912M   0% /dev/shm
tmpfs             912M   26M  887M   3% /run
tmpfs             5.0M     0  5.0M   0% /run/lock
tmpfs             912M     0  912M   0% /sys/fs/cgroup
/dev/loop1        198M  198M  4.0K 100% /system
/dev/mmcblk0p41   599M   11M  589M   2% /cache
/dev/mmcblk0p19    32M  4.2M   28M  14% /persist
/dev/mmcblk0p1     64M   57M  7.1M  90% /firmware
/dev/mmcblk0p37   7.9M  4.1M  3.8M  52% /sns
/dev/mmcblk0p36   7.9M  4.6M  3.4M  58% /persist-lg
/dev/mmcblk0p38    32M  6.1M   26M  20% /mpt

It seems that it tries to write datas to /dev/block/loop0 which is full. Where does this device comes from ? Do I made a mistake with the fix_mounting_points or is this normal ?

For info I used this script to create the rootfs.img and system.img : https://github.com/JBBgameich/halium-install/releases

Because the official one from halium (https://github.com/Halium/halium-scripts) gave me an error like : No space left on the device to write 51 blocks

jbruechert commented 6 years ago

The loop device is created when mounting /data/rootfs.img. If you want to increase it's size, you need to use resize2fs on /data/rootfs.img

Pepitortue commented 6 years ago

Hi,

I just made an Issue part in the main post (last part) to not spam the thread. Will work on it this week. In the mean time if someone have an idea/fix... 😃

110101011 commented 6 years ago

/data/rootfs.img seems to be 200mb instead of 2gig, did it resize correctly

Pepitortue commented 6 years ago

I used JBB's standalone script which contains : https://github.com/JBBgameich/halium-install/ I changed the variable of the shell script functions/distributions.sh :

halium)
    IMAGE_SIZE=1G
    ;;

which is used to "expand" the rootfs : qemu-img create -f raw $IMAGE_DIR/rootfs.img $image_size

At the end the rootfs was :

$ du -sh *
2,0G    rootfs.img
213M    system.img

I though it did the job. I still need to use the resize2fs command ? The system.img is 213M and mount to /system. (not the rootfs, right ?) It's sized by default. Will try to make it 2G as in lineageOS vanilla.

doniks commented 6 years ago

seems you set IMAGE_SIZE (all caps) but you use image_size (lower caps)

ezs123 commented 5 years ago

Does this devlopment have any updates? Does it work?