Problem porting to Moto E 2015 4G (surnia)
Nic264 last edited by NeoTheThird
I am currently trying to port our recently dead OS to my phone (surnia).
It has a CM/LineageOS 12.1 port which makes it quite straightforward, but I am stuck with a situation close to the bullhead port.
My build boots, but not graphically, ADB does not start, RNDIS does and I can look around the running system.
But the thing is, I don't know what to look for!
- [ 111.491674] systemd-hostnamed: Failed to run event loop: Connection timed out
- root@ubuntu-phablet:/# systemctl status
Failed to get D-Bus connection: Operation not permitted
But I don't know what to think about it… Nor how to fix it…
What do you think? Thanks
PS: really looking forward a LineageOS 14.1 rebase, any way to help?
you seem to have the same trouble like most of the people when porting: The libhybris is not calling in the right way to the GPU layer. So basically you might have a working system, but without GUI. Can you check with top command if your unity process is constantly respawning? And post your output from top here, so that we can see how far it has booted.
Try to execute service stop lightdm. Then you basically have a phone without GUI, no fun. You will need to install/execute libhybris tests, to see if there are errors. Like test_egl, test_glesv2, test_hwcomposer
I don't see anything related to Unity in top, here is my output.
The tests are there too, they all crash… test_egl and test_glesv2 complain that they
couldn't open framebuffer HAL, test_hwcomposer makes my screen go blank.
I can set my screen brightness back up through
EGL_PLATFORM=hwcomposer test_hwcomposermakes my screen flicker and my dmesg go mad with this repeated a lot:
[ 417.696026] mdss_mdp_get_img: error on ion_import_fd [ 417.696052] mdss_mdp_data_get: failed to get buf p=0 flags=0 [ 417.696068] get_user_node: error getting buffer info [ 417.696092] mdss_mdp_wb_queue: memory not registered [ 417.696896] mdss_mdp_wb_kickoff: unable to get writeback buf ctl=1 [ 417.698026] mdss_wb_check_params: Invalid resolutions [ 417.698633] mdss_mdp_overlay_req_check: invalid vertical destination: y=0, h=960
I don't know what to do… Try another libhybris maybe? But I thought the libhybris problem was caused by Android 6.
Ok that does not sound good. Lets see the following:
- dmesg output redirected to a file
- /system/bin/logcat - what does it show?
- lcx-monitor -n android
Hi, I'm back
Here is my logcat, during test_egl or test_gles and test_hwcomposer.
Here is my complete dmesg (I didn't know how to dump it to a file so I added
log_buf_len=4Mto my cmdline).
lxc-monitor -n androiddoes nothing (until I Ctrl+C).
lxc-console -n androidtells me I'm "Connected to tty 1" and how to exit but nothing else (until I exit).
I also tried to access the fb devices directly (they both do exist, why two of them?):
root@ubuntu-phablet:/# cat /dev/fb0 cat: /dev/fb0: No such device root@ubuntu-phablet:/# cat /dev/fb1 cat: /dev/fb1: No such device
First one does nothing.
Second one makes my screen flicker and appends some lines to my dmesg.
And another strange thing:
U:1280x720p-14while my screen is 960x540… (fb0/modes is coherent)
I hope this makes sense to you…
@Nic264 Ah Cool I take a look :)
One thing, I messed up the lxc cmd, it should be lxc-info -n android
root@ubuntu-phablet:/# lxc-info -n android Name: android State: RUNNING PID: 591 IP: 192.168.2.15 CPU use: 3.44 seconds
@Nic264 Ok so the good thing is, the LXC container is running. What I currently do not like from dmesg is this:
[ 47.167516] initrd: mounting system.img (user mode) [ 47.192790] init (308) used greatest stack depth: 5248 bytes left [ 47.205913] initrd: mounting device image as ro ... [ 47.267907] initrd: device is unknown
Device is unknown means that somehow initrd does not detect the device correctly. This needs to be fixed. But tbh I forgot the logic there, need to take a look again.
Also, did you already dump the udev rules? See https://developer.ubuntu.com/en/phone/devices/porting-new-device/ and also this page can be helpful to understand whats going on at the beginning: https://wiki.ubuntu.com/Touch/ContainerArchitecture - udev rules need to be placed inside the image (mount - o remount,rw /)
That said, its normal to have exactly these issues at the beginning. Every device is different, so its hard to tell you exactly whats going on.
You can try to enable debug (but it might break the boot since it dumps too much udev debug into the logs xD), for this add "debug" to the kernel cmdline. But read this first: https://wiki.ubports.com/wiki/When-the-Bootloader-Decides-to-Override-your-Command-Line - probably you need to patch the kernel for this.
Did you BTW update the kernel config with the script from here: https://github.com/janimo/phablet-porting-scripts/blob/master/kernel/check-config, and also you need to patch apparmor3 inside (but this is not needed now)
After reading the initrd code, device is determined by reading ro.product.device in the build.prop, but in my case it is set in ro.cm.device, I'll correct this and rebuild.
I didn't dump the udev rules for now, going to do this now too.
I updated the kernel config with that script then had to patch a couple of problems in regard of uid_t becoming kuid_t etc… I already managed to change my kernel cmdline and I don't think what my bootloader appends can cause any problem: (does it?)
androidboot.emmc=true androidboot.serialno=TA36406M0E androidboot.baseband=msm androidboot.mode=charger androidboot.device=surnia androidboot.hwrev=0x8300 androidboot.radio=0x4 androidboot.powerup_reason=0x00000100 androidboot.bootreason=charger androidboot.write_protect=0 msm_poweroff.download_mode=0 androidboot.fsg-id= androidboot.secure_hardware=1 androidboot.cid=0x7 androidboot.wifimacaddr=E8:91:20:79:04:53,E8:91:20:79:04:54 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_mot_boe_450_qhd_video_v3 androidboot.bootloader=0x8020 androidboot.carrier=retfr androidboot.hardware.sku=XT1524 androidboot.bl_state=2
Thanks for you help :)
OK so the property ro.product.device used by Ubuntu's init to determine the device was set by Android's init too late (this is an unified device tree). It is now fixed (hardcoded in my system.prop).
[ 19.324825] initrd: device is surnia_umts ... [ 28.163553] init: Found radio id: 0x4 setting build properties for surnia_umts device
I have dumped my udev rules and placed them in
/etc/udev/rules.d/70-surnia_umts.rules. I haven't noticed any change so far (except for udev complaining about unknown users and groups).
You were right, the
debugboot option broke the boot, causing a boot loop :-\ I'll check in the
console-ramoopswhen I have the time.
Will I really need to patch AppArmor? I already run Linux 3.10.49…
well basically you are on a good path. You seem to have the knowledge and the motivation to analyze the things in detail :)
Basically I did not expect that the issue with the fb device goes away just by adding udev rules and setting the device id. It was just part of the procedure. Kernel config might have helped, and its not bad to have it in place already.
The kernel cmdline seems fine, if it reacts on debug you dont need the patch. however, remember that the bootloader cmdline might get appended to yours and will overwrite settings if they appear twice.
For AppArmor: Yes 3.10 might indeed contain already the correct apparmor version. Which was actually the original Android version for this device?
I don't really have the required knowledge, but I'm learning :-P
This is the mess debug gives me, this line fills my buffer:
[ growing time ] systemd-udevd: maximum number (16) of children reached
Original android version was 5.0.2, upgraded to 5.1.1 then 6.0 by Motorola then 7.1 by the CM/LineageOS team.
I updated my initrd in order to use a F2FS data partition so I don't have to reformat every time I switch back to Lineage (this is my only phone), would that be a problem?
I'm trying to build libhybris right now (on the device since cross-compiling gives me trouble)…
yes debug fills up the log with udev messages, but I think this is a good sign, seems udev is really busy creating all necessary entries ;) - you can switch it off again, it has no better use now.
Ok so basically on what CM versions did you base your device Kernel and vendor tree?
@Flohack Hi, sorry for the lengthy follow-up, I've been busy with competitive exams…
I am sorry to say that I won't be able to try and port this anymore: probably because of a power surge, my phone USB port is dead and I can't transmit anymore data to the phone…
Thanks for the help, I'll try to contribute some other way (but after the oral part of my exams).
no problem. If you got any meaningful changes or improvements in the code, consider forking the repos and pushing your changes into those new repos.