mad-de / CM-FP1

local manifest + files for Cyanogenmod port
2 stars 0 forks source link

My notes & self built kernel #1

Open z3ntu opened 9 years ago

z3ntu commented 9 years ago

Hey, I managed to build the kernel myself from https://github.com/keesj/alps-fairphone-gpl . To see it, you can visit my repository https://github.com/z3ntu/build_fp_kernel

mad-de commented 9 years ago

Hey! Thanks for your message. Yeah I was already guessing that my PC is the problem with building the kernel. Good that it works for you. That way we can start tweaking the kernel once we get a CyanogenMod up and running although we'll have to include chrmhoffmanns changes first.

Have you tried building CyanogenMod like I described in my readme.MD? Did it work alright? Unfortunately I'm busy with other stuff until Christmas but maybe we can see how we can make progress together on building CyanogenMod for fp1 after that.

z3ntu commented 9 years ago

Firstly, please include that you have to use oracle java 6 or 7 and not anything different (also not 8). openjdk does not work (you get a warning that it is not really supported). and if you have any other jdk installed, you should uninstall it. setting it via sudo update-alternatives --config java and the same with javac does not work.

Then I got many error messages, I could fix most of them with what you wrote in the last section of your instructions :+1: :) then there was an error with throttle.sh probably "no target found" or something like that. I then copied the throttle.sh from some directory to another (where the error message was pointing to, dont know where right now). at the end (until now) i kinda broke the whole thing and i am restarting my cm build. unfortunately it takes ages to do everything (sync & build)

but much thanks for writing these instructions!! without them i would not have gotten anything probably :)

z3ntu commented 9 years ago

So, I made a fresh copy of CM and executed extract-files.sh. Two error messages:

failed to copy '/system/etc/throttle.sh' to '../../../vendor/fp/FP1/proprietary/etc/throttle.sh': Permission denied

remote object '/system/lib/hw/audio.primary.mt6589.so' does not exist

the throttle.sh copying failed because of insufficient rights (-rwxr-x--- root system 633 2008-08-01 14:00 throttle.sh) manually pulled the file off the device (set rights before)

the audio.primary.mt6589.so failed because this really does not exist. but audio.primary.default.so exists okay /system/lib/libaudio.primary.default.so gets pulled into $BASE/lib/hw/audio.primary.mt6589.so

mad-de commented 9 years ago

Hi z3ntu!

For the latter see: https://github.com/mad-de/android_device_fp_FP1/commit/5870c28ba0375a24ced84a6261b336eb767ccc09

can you do a PR for my README.md to include your information + a workaround for the throttle.sh for the android-device tree as well, so we can try to have a working directory for everyone to use?

Cheers and keep up your good work + spirits

z3ntu commented 9 years ago

Jeah I will try to document everything as good as possible (but only when the build succeded xD) :) and about the audio*.so thanks for the info, I am using "Fairphone OS"

mad-de commented 9 years ago

Ahh okay, then it probably were paths from another device all along. My commit should still work regardless. It's no big deal if the build process is unsuccesful. You got further then I did due to my hardware restrictions. If you can point out a few fixes and we collect 'em in my Build instructions then I or someone else can pick up at a later time.

z3ntu commented 9 years ago

What about

make: *\ No rule to make target 'vendor/cm/proprietary/Term.apk', needed by '/home/luca/android/system/out/target/product/FP1/system/app/Term.apk'. Stop.

? Do you have anything for this? Got that yesterday too, I copied the Term.apk from somewhere weird... Okay google has some results too EDIT: fix for that (from http://rootzwiki.com/topic/32731-how-to-get-the-proprietary-files-for-cm10aokpetc-for-your-device/page-2#entry1057364)

you're missing the terminal emulator cm includes. either add it to the directory or comment it out of the make file under their vendor directory.

EDIT 2: In ~/android/system/vendor/cm is file get-prebuilts which downloads Term.apk from GitHub

mad-de commented 9 years ago

did you find a fix for this? If not, I'll have a look at this this weekend. Can you open up new issues for each lager problem (if it's not to much to ask), then I could see to tackle them one by one with PRs to android -device or this CM-FP1 git.

Cheers!

mad-de commented 9 years ago

Thanks for your PR and time btw!

z3ntu commented 9 years ago

no problem ;) I want CM on my fairphone too :+1:

mad-de commented 9 years ago

FYI: I switched the local manifest to my android_device_fp_FP1 branch, so fixing bugs will be easier.

z3ntu commented 9 years ago

I use this/your branch too (already) ^^ edit: compiling right now, I have still hope

mad-de commented 9 years ago

didn't that (using my branch) already fix the problem with /system/lib/hw/audio.primary.mt6589.so ? If not, can you give me the location for FP OS devices to include in the extract-files.sh?

z3ntu commented 9 years ago

shell@android:/system/lib/hw # ls -al -rw-r--r-- root root 5348 2008-08-01 14:00 audio.primary.default.so -rw-r--r-- root root 136952 2008-08-01 14:00 audio_policy.default.so -rw-r--r-- root root 5292 2008-08-01 14:00 audio_policy.stub.so

and more files

mad-de commented 9 years ago

Ahh ok - so paths were all wrong? Does this PR work with you? (it's in the patches branch)

https://github.com/mad-de/android_device_fp_FP1/pull/3/files

z3ntu commented 9 years ago

I'm still compiling so not luck trying that out right now :/

mad-de commented 9 years ago

No worries I have to get back to my studies anyway. Let's see if we can get this working - open up an issue if you need help!

z3ntu commented 9 years ago

So it was compiling for exactly an hour now: NEW ERROR!!! -.-

target Executable: mdnsd (/home/luca/android/system/out/target/product/FP1/obj/EXECUTABLES/mdnsd_intermediates/LINKED/mdnsd) /bin/bash: /home/luca/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes/java-source-list: No such file or directory /bin/bash: /home/luca/android/system/out/target/common/obj/JAVA_LIBRARIES/framework2_intermediates/classes/java-source-list: No such file or directory target SharedLib: libeffects (/home/luca/android/system/out/target/product/FP1/obj/SHARED_LIBRARIES/libeffects_intermediates/LINKED/libeffects.so) target SharedLib: libstagefright_yuv (/home/luca/android/system/out/target/product/FP1/obj/SHARED_LIBRARIES/libstagefright_yuv_intermediates/LINKED/libstagefright_yuv.so) target Executable: mke2fs (/home/luca/android/system/out/target/product/FP1/obj/EXECUTABLES/mke2fs_intermediates/LINKED/mke2fs) external/wpa_supplicant_8/hostapd/src/drivers/driver_nl80211.c:10722: error: undefined reference to 'wpa_driver_set_p2p_ps' /home/luca/android/system/out/target/product/FP1/obj/EXECUTABLES/hostapd_intermediates/src/drivers/driver_nl80211.o:driver_nl80211.c:function wpa_driver_nl80211_ops: error: undefined reference to 'wpa_driver_set_ap_wps_p2p_ie' /home/luca/android/system/out/target/product/FP1/obj/EXECUTABLES/hostapd_intermediates/src/drivers/driver_nl80211.o:driver_nl80211.c:function wpa_driver_nl80211_ops: error: undefined reference to 'wpa_driver_get_p2p_noa' /home/luca/android/system/out/target/product/FP1/obj/EXECUTABLES/hostapd_intermediates/src/drivers/driver_nl80211.o:driver_nl80211.c:function wpa_driver_nl80211_ops: error: undefined reference to 'wpa_driver_set_p2p_noa' collect2: error: ld returned 1 exit status build/core/executable.mk:73: recipe for target '/home/luca/android/system/out/target/product/FP1/obj/EXECUTABLES/hostapd_intermediates/LINKED/hostapd' failed make: * [/home/luca/android/system/out/target/product/FP1/obj/EXECUTABLES/hostapd_intermediates/LINKED/hostapd] Error 1 make: * Waiting for unfinished jobs....

Do you have ANY idea how to fix this?

mad-de commented 9 years ago

I think this should solve (at least) some of the errors: https://gerrit.omnirom.org/#/c/4834/

Have you tried cherrypicking some of these https://gerrit.omnirom.org/#/q/topic:mt6589 ?

z3ntu commented 9 years ago

Wrote a note at PR #3

mad-de commented 9 years ago

You are right. I'm sorry I didn't got that the first time. Can you confirm that its fixed and working with https://github.com/mad-de/android_device_fp_FP1/commit/71350406fb64d908c2f8ed1829da10cc025d16b6 ?

z3ntu commented 9 years ago

jeah its the right path, didnt test exactly that but I corrected the path in the file myself locally. I am examining the latest build error now. Seems very weird. Will update

mad-de commented 9 years ago

thanks for confirmation. I'll pull it for now. If any further build errors occur please open a new issue and let's see if we can tackle them until we get to the point of it...

z3ntu commented 9 years ago

So I'll write what I found about the driver_nl80211.c The error is

driver_nl80211.o:driver_nl80211.c:function wpa_driver_nl80211_ops: error: undefined reference to 'wpa_driver_get_p2p_noa'

same with the other errors, there are 3 functions affected by this

so, that's the function wpa_driver_nl80211_ops (very little parts of it but the parts that matter for this):

const struct wpa_driver_ops wpa_driver_nl80211_ops = {
*much code*
   #ifdef ANDROID_P2P
    .set_noa = wpa_driver_set_p2p_noa,
    .get_noa = wpa_driver_get_p2p_noa,
    .set_ap_wps_ie = wpa_driver_set_ap_wps_p2p_ie,
   #endif
   *bit more code*
};

So it sets up references to methods (I know that somehow from Javascript). Next up: the function declaration:

#ifdef ANDROID_P2P_STUB
int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration) {
       return -1;
}
int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len) {
       return -1;
}
int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow) {
       return -1;
}
int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon,
                                const struct wpabuf *proberesp,
                                const struct wpabuf *assocresp) {
       return -1;
}
#else
int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration);
int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len);
int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow);
int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon,
                  const struct wpabuf *proberesp,
                  const struct wpabuf *assocresp);
#endif /* ANDROID_P2P_STUB */

So either (if ANDROID_P2P_STUB is set), the method gets declared normally OR (if its not set) they are just defined. But WHY do we get an undefined reference error?

mad-de commented 9 years ago

is this the source file or did you get it from https://gerrit.omnirom.org/#/q/topic:mt6589 ?

mad-de commented 9 years ago

Does this help? https://github.com/LegacyXperia/local_manifests/issues/770

Please keep track of what things one needs to cherry pick for a succesful build.

z3ntu commented 9 years ago
  1. From the source file
  2. That's basically (except the 0 return in the one function but that shouldnt cause the compilation to fail) what already is ...
z3ntu commented 9 years ago

So, I'll try to comment out P2P functionality in the Android.mk file in external/wpa_supplicant_8/hostapd and compile again EDIT: same errors EDIT 2: okay there are two Android.mk files where I now commented it out (wpa_supplicant & hostapd subdirectories)

mad-de commented 9 years ago

Did you try cherrypicking https://gerrit.omnirom.org/#/c/4834/ ?

z3ntu commented 9 years ago

No I did not try that because it doesn't seem like it has anything to do with this problem. Will try later.

z3ntu commented 9 years ago

Patch did not fix the error

z3ntu commented 9 years ago

Package Complete: /home/luca/android/system/out/target/product/FP1/cm-11-20151103-UNOFFICIAL-FP1.zip

OMFG!!!! :DDD Screenshot

mad-de commented 9 years ago

that's fucking fantastic! congrats! Please add what you did to make it work to my README.md then we can start to get the functionality back...

z3ntu commented 9 years ago

Yep, will do. But I'll first try to replicate everything and document it with these steps. :) I'll try flashing it now.

mad-de commented 9 years ago

Good flashin'! Once we've got the funtionality back (I assume that will take a decent amount of cherrypicking the gerrit files mentioned above) we can see if we can succesfully switch to integrated kernel building...

z3ntu commented 9 years ago

Phone does not boot after flashing it :/ maybe my fix for the last problem was too dirty ;) although it should only affect wifi...

z3ntu commented 9 years ago

but you can try it yourself, will be uploading it later... just make sure to back up your data before :D

mad-de commented 9 years ago

if you just commented out some wifi stuff, that's unlikely to have caused these problems. I'll take a look into it, when i get an old CM Build (fallback) and I finally get the time (probably after christmas). Right now a logcat would be great (http://forum.xda-developers.com/showthread.php?t=1726238)

Remember things like uncleared dalvic caches etc. can cause boot problems as well...

z3ntu commented 9 years ago

the problem is that the boot animation did NOT appear... so this is a bigger problem :/ and about the wifi stuff: i added a quick #define that some stub methods get "inserted" all the time (because it didnt work otherwise), it should only affect "WiFi Direct"

mad-de commented 9 years ago

sounds to me like a kernel issue -_- What recovery did you use? Did you use chrmhoffmanns precompiled kernel? Any luck with the logcat?

z3ntu commented 9 years ago

Recovery: cwm-fp1-kk.0.1.img by @chrmhoffmann Kernel: I don't know... Didn't do anything with the kernel (I also did not add TARGET_KERNEL_CONFIG := ../../../kernel/fp/FP1/mediatek/config/ahong89_wet_jb2/configs/ before compiling to the BoardConfig.mk) Logcat: I did not try, but I am in school now and restored my phone for daily use (music etc). Will try when I am home (which is in about 5 hours)

z3ntu commented 9 years ago

Content of /proc/last_kmsg: https://gist.github.com/z3ntu/25dcf81fd2f5c9f2a3bd

mad-de commented 9 years ago

can you post content of init.rc as well?

I think 13.114188[1:init]init: untracked pid 254 exited means that init.rc crashed. No way to get a logcat to see what process might be causing that?

z3ntu commented 9 years ago

How do I get this file? And adb logcat just says "Waiting for connection"

mad-de commented 9 years ago

init.rc should be in your ramdisk file. You just need to extract it.

z3ntu commented 9 years ago

https://gist.github.com/z3ntu/25dcf81fd2f5c9f2a3bd#file-init-rc

z3ntu commented 8 years ago

Do you have any idea how to fix this?

mad-de commented 8 years ago

First thing is that you can access logcat via adb in recovery mode. If the kernel get's far enough to establish logcat routines while booting, these attempted boots should be saved in the logcat for later. If not, then the kernel fails on such a low level that we can just toss it anyway (outcome 1).

If the logcat tells us what process is hindering the boot process we might be able to fix it (outcome 2) but we'd still better switch to integrated kernel building.

So I'd suggest that while you try to get the logcat via recovery, we get back to integrated kernel building. If Integrated kernel building just failed because of my broken toolchain (what I'm still suspecting right now) you should be able to use the integrated kernel building (as you already built the kernel succesfully). For this we'd have to include '' in our local_manifest (again) and do the whole process again (save your build files!). Then it's a trial and error thing until we have a second succesful build. With integrated kernel building it's plausible that our kernel problems will resolve themselves. If that won't work out at all, we'd still have your saved build files and maybe we can fix the problem the logcat will describe.

Anyway - I'm sorry not being more of a help here. I hope that I can get my buildtools back working around christmas and that I'll have some time then. If we're still unsuccessful then, I'll see to get you a recovery.img from my CM installation, so you at least have CM by then.

Cheers!

z3ntu commented 8 years ago

Do you know how the "Integrated kernel building" works? I did not quite understand it in the wiki (for example where to write these "special" commands (environment variables) that are needed for building (according to the wiki). btw I also tried the kernel by chrmhoffmann instead of keesj's kernel, did not do anything better. :/ and 2nd btw: i have submitted a post in the cyanogenmod forums about this problem, maybe they know what is going on: http://forum.cyanogenmod.org/topic/117544-help-porting-cm11-to-the-fairphone/

z3ntu commented 8 years ago

I'll now do most of my documentation in my repository, just because it is easier to edit something there :) https://github.com/z3ntu/cyanogenmod_fp_FP1