Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial commit to enable Victara support #4

Open
wants to merge 460 commits into
base: master
Choose a base branch
from

Conversation

angelpipe
Copy link

Hey,
I'm intending to enable Victara(Moto X 2nd generation) support. I have given some steps but i want to make sure I'm pointing in the right direction, and I still have some doubts. Please forgive me if i do very basic questions (I didn't know anything about AOSP building a week ago).

The approach

I want to use the most i can from AOSP because porting is easier as your current patches are written for it and mako board is a good starting point. Taking that in account, I'm using the same android-5.1.1_r1.xml file in my custom victara.xml. After that, I'm adding Cyanogen Mod's Victara repo into /device/motorola/victara; and finally, I add motorola vendor files into /vendor/motorola. Am I crazy or this should be enough to get an almost pure AOSP build for the device?. I hope I'm on the right path, you can check the details of this in the victara.xml file.

Patches

As i used the same AOSP version you're using for mako, i guess the only patches that i need to review are the device ones (is that assumption ok?). I found 5 patches that are candidates to be ported to victara's build. I have rewritten some and i have doubts in others, so i will give a status for each one of them.

Thank you so much for reading this long text!

Best Regards.

@mvines
Copy link
Contributor

mvines commented Jun 19, 2016

Thanks, so the logcat looks pretty good. I see things from init.silk.rc starting up, like our Bluetooth daemon. Silk-init is failing at boot in the same way as when it's run explicitly. This no longer looks like a victara porting issue and a more general silk build issue, so \o/ for that

For some reason, we're failing to require log/device at https://github.com/silklabs/silk/blob/master/bsp-gonk/vendor/silk/silk-sysutils/lib/index.js#L21. This dependency should be resolved at build time by webpack.

It's possible there was a build error for silk-sysutils that didn't halt the build. Could you try rebuilding sys-sysutils (run mm in https://github.com/silklabs/silk/tree/master/bsp-gonk/vendor/silk/silk-sysutils) to check for an error? Otherwise the contents of /system/silk/node_modules/silk-sysutils/lib/index.js would be interesting to look at. I'll double check later today that I'm not seeing the same in a Nexus build .

@angelpipe
Copy link
Author

angelpipe commented Jun 20, 2016

It's good to hear logcat is not plagued with errors :). I have run mm and it looks to run ok, this is the result:

H6460:silk-sysutils fangel$ mm
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=aosp_victara
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=krait
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-14.5.0-x86_64-i386-64bit
HOST_BUILD_TYPE=release
BUILD_ID=LMY47V
OUT_DIR=out
============================================
SILK_PRODUCT: gonkjs
SILK_BOARD: victara
============================================
No private recovery resources for TARGET_DEVICE victara
Export includes file: vendor/silk/silk-sysutils/Android.mk -- out/target/product/victara/obj/NPM/silk-sysutils_intermediates/export_includes

#### make completed successfully (7 seconds) ####

About /system/silk/node_modules/silk-sysutils/lib/index.js, i created a new gist so you can check it here:
https://gist.github.com/angelpipe/20021477792c0d78a977a576c3a40bac

I hope we are really close to have a working port.

@mvines
Copy link
Contributor

mvines commented Jun 20, 2016

Thanks, the contents of index.js was very helpful. We had a bug, now fixed by a813116, whereby webpack was unable to locate the silk-log/device module at build time.

Please rebase the PR to the tip of the master branch and rebuild. Hopefully Victara now boots and we can land this PR!

@angelpipe
Copy link
Author

I don't know if this is good news, your fix worked!. The problem now is im creating a simple silk project and doing silk run. Im getting this

H6460:test fangel$ silk run
Updating /data/node_modules/test
--------- beginning of main
06-19 19:58:37.379 I/silk-init( 4716): Starting Silk 
06-19 19:58:37.896 I/silk-init( 4683): initializing silk with main: test
06-19 19:58:38.039 I/silk-wifi( 4686): (+0ms) WiFi initializing
06-19 19:58:38.404 I/silk-wifi( 4686): (+366ms) wlan0 state| 213 0 00:00:00:00:00:00 0.0.0.0 0 down
06-19 19:58:38.404 I/silk-wifi( 4686): 
06-19 19:58:38.413 I/silk-wifi( 4686): (+10ms) wpaCli: supplicant not ready, waiting
06-19 19:58:38.423 I/silk-wifi( 4686): (+9ms) wpad restart: wpad error, reason=Error: connect ECONNREFUSED /dev/socket/wpad
06-19 19:58:39.420 I/silk-wifi( 4686): (+997ms) wpaCli: supplicant not ready, waiting
06-19 19:58:39.435 I/silk-wifi( 4686): (+15ms) wpad restart: wpad error, reason=Error: connect ENOENT /dev/socket/wpad

Could it be related to a missing driver?

@jainanshul
Copy link
Contributor

@angelpipe this is due to a race condition where silk is trying to start wpa before it is ready. This usually resolves itself in couple of seconds when wpa subsystem is ready.

@angelpipe
Copy link
Author

angelpipe commented Jun 20, 2016

Hi @jainanshul. The problem is it keeps showing that message over and over until i stop it. I could leave it running for half an hour and the message would keep printing :(

@angelpipe
Copy link
Author

i found this on device logcat, i think there's a problem with the wpa subsystem and it is my fault

I/wpa_supplicant(  564): Successfully initialized wpa_supplicant
I/kmsg    (  364): <38>[    4.621397,0] type=1400 audit(1466380924.772:50): avc: denied { execmem } for uid=0 pid=447 comm="node" scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=process permissive=1
E/wpa_supplicant(  564): Line 1: unknown global field 'mot_wpa_conf_version=3'.
E/wpa_supplicant(  564): Line 1: Invalid configuration line 'mot_wpa_conf_version=3'.
E/wpa_supplicant(  564): Line 25: unknown network field 'skip_auto_connect'.
E/wpa_supplicant(  564): Line 26: failed to parse network block.
I/wpa_supplicant(  564): Long line in configuration file truncated
I/wpa_supplicant(  564): rfkill: Cannot open RFKILL control device
E/wpa_supplicant(  564): Could not read interface wlan0 flags: No such device
E/wpa_supplicant(  564): Could not read interface wlan0 flags: No such device
E/wpa_supplicant(  564): wlan0: Failed to initialize driver interface

@mvines
Copy link
Contributor

mvines commented Jun 20, 2016

Oh, yep that looks suspicious!

I'm not sure if this is still the case, but on the previous device logcat I also noticed this which looked like the modem was not happy -- https://gist.github.com/angelpipe/cc6417649b1eb7bf347d8eb02b093c25#file-logcat-L2643-L2665
Generally we don't care too much about that because we don't have telephony support in Silk yet but that could potentially be a symptom of a larger issue.

@mvines
Copy link
Contributor

mvines commented Jun 25, 2016

@angelpipe -- hey are you still working on anything here, just wondering if this is PR ready to merge. Thanks!

@angelpipe
Copy link
Author

Well.... i never stopped working, but i haven't been able to make the wpa_suplicant work. Right now i'm trying a new build structure

@angelpipe
Copy link
Author

Hey @mvines. I haven't had luck nor fixing the wpa_supplicant problem nor trying to build with different sources. I don't know if i should spend more time trying to fix it or if i should try getting something that proved to work (like a CyanogenMod complete manifest) and migrate all patches to it to then remove the unnecessary things. Motorola has some info to build android for a variety of devices but sadly, Moto X 2014 is not on the instructions and repos look outdated. What would you recommend to do?

@mvines
Copy link
Contributor

mvines commented Jun 28, 2016

Ugh. In my experience it's super helpful to have a buidable Android image to start from that demonstrates all the desired features (eg, wifi works) . Given the amount of vendor variance in Android I'd not want to start with anything less, there's to much risk of running into a binary blob that does something different with very little way to debug/trace it

@angelpipe
Copy link
Author

angelpipe commented Jul 1, 2016

Hey... I built CyanogenMod 12.1 for victara, it works good when i do it following instructions. Then i tried to integrate my manifest into the bsp-gonk board scheme and built. I had some errors and i managed to fix them to get a successful build. The device keeps booting in the "android" screen. It even does not show the cyanogen logo(which i think is weird as it comes from a cyanogen manifest). I cannot check the logcat cause cyanogenmod comes with that disabled (Maybe i can tinker to make it work from scratch?). The thing is when i build the Silk style, i don't get the cyanogen zip, i just get the images and the generated recovery does not work. Maybe i am flashing it the wrong way?. This way is not proving to be easier :(. Do you have any thoughts?.

PD: Im not using any patches, just the necessary ones to get a successful build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants