Jump to content

Advent Vega kernel source code now available!


Guest PaulOBrien

Recommended Posts

Guest Cass67

Well.... What i am about to post has... emmm... i may say no strict analysis, but, believe it or not, i think we could use the libcamera.so from the .32 kernel to enable the camera in the .36 kernel... What??? -- I am sure you are telling, and asking yourself if i am crazy for telling so... But, i have a theory behind this:

While HC3.2 is a "new" incarnation of Android, as most of you, specially the ones who have worked in a software company should know, every company tries to reuse as much as possible the already developed software modules.... And Android is no exception to this rule.

libcamera.so exists even in android 2.2 (froyo). But it just supported 1 camera at a time. Android 2.3(gingerbread) added support for more than one camera, but, the only changes that were made to the library were renaming the 2 entrypoints that were present in previous versions, adding a 3rd entry point and adding extra parameters to those entrypoints. No other changes!!.

On android 2.2, the only required entrypoint was

extern "C" sp<CameraHardwareInterface> openCameraHardware();

That returns an instance of CameraHardwareInterface

On android 2.3, the 3 required entrypoints are

extern "C" int HAL_getNumberOfCameras(); /* Returns the number of cameras */

extern "C" void HAL_getCameraInfo(int cameraId, struct CameraInfo *cameraInfo); /* Returns info about an specific camera */

extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int /*cameraId*/); /* That returns an instance of CameraHardwareInterface for an specific camera */

I decompiled the .36 libcamera.so from the xoom dump, and guess what?? - It is exporting the SAME 3 entrypoints of android 2.3! -- So, i think there are good chances that Google didnt change the camera api from 2.3 to 3.2 ;)

If that is true, we need to write a wrapper for the original 2.2 libcamera.so, that exports the 3 new entrypoints, telling there is just one camera, giving the information for that camera, and when the HAL_openCameraHardware() is called, call the original openCameraHardware of the .32 library... Seems it is not a complex thing... But, we dont even have to write that wrapper. It was already written and we can take it from Cyanogen Gingerbread

Well, i am just guessing.. but... there are chances it could work - and i think its worth a try! :D

PS> Just as a curiosity, attached the code of the proposed wrapper, the same Cyanogen should be using...

When simply taking the libcamera.so wrapper from cm7 you get the following ..

E/AndroidRuntime( 1600): *** FATAL EXCEPTION IN SYSTEM PROCESS: main

E/AndroidRuntime( 1600): java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1966]: 1599 could not load needed library 'libsystem_server.so' for 'libandroid_servers.so' (link_image[1966]: 1599 could not load needed library 'libcameraservice.so' for 'libsystem_server.so' (reserve_mem_region[835]: OOPS: 1599 prelinked library 'libcameraservice.so' mapped at 0x5011b000, not at 0xa8000000))

Boot Loops forever !!

Even replacing these complaining libs does not resolve it .. seems we have issues with prelink map used here, not sure if we can compile cm7 to remove or at least match the prelink map we use if we even can ??

Cheers

Link to comment
Share on other sites

Guest BillyBobJoe

When simply taking the libcamera.so wrapper from cm7 you get the following ..

E/AndroidRuntime( 1600): *** FATAL EXCEPTION IN SYSTEM PROCESS: main

E/AndroidRuntime( 1600): java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1966]: 1599 could not load needed library 'libsystem_server.so' for 'libandroid_servers.so' (link_image[1966]: 1599 could not load needed library 'libcameraservice.so' for 'libsystem_server.so' (reserve_mem_region[835]: OOPS: 1599 prelinked library 'libcameraservice.so' mapped at 0x5011b000, not at 0xa8000000))

Boot Loops forever !!

Even replacing these complaining libs does not resolve it .. seems we have issues with prelink map used here, not sure if we can compile cm7 to remove or at least match the prelink map we use if we even can ??

Cheers

I too tried using the CM7 files last night, thought I must have done something stupid as it was far to late to be trying to think. Going to have another look when I get home later.

Billy..

Link to comment
Share on other sites

Guest Cass67

I too tried using the CM7 files last night, thought I must have done something stupid as it was far to late to be trying to think. Going to have another look when I get home later.

Billy..

Yeah we should be able to remove the pre-linking on these files if we compile cm7 from source, what im not sure of is will it work on 3.2 if we have pre-linked files for the rest of the libs.. never tried before ... Ill give it a shot when i have time to setup an Android build env, unless anyone else has one set up already and can do..

Link to comment
Share on other sites

Guest ejtagle

Yeah we should be able to remove the pre-linking on these files if we compile cm7 from source, what im not sure of is will it work on 3.2 if we have pre-linked files for the rest of the libs.. never tried before ... Ill give it a shot when i have time to setup an Android build env, unless anyone else has one set up already and can do..

use the hc3.2 libcamera_client.so and libcameraservice.so. The only library that must be replaced is libcamera.so (that is the only library that depends on hw)

Link to comment
Share on other sites

Guest Cass67

use the hc3.2 libcamera_client.so and libcameraservice.so. The only library that must be replaced is libcamera.so (that is the only library that depends on hw)

Yes, did that in the first place, that's where the link errors started, the rest of the lib swaps were to see what occured...

Link to comment
Share on other sites

Guest ejtagle

I think that to compile a new wrapper can be achieved even with no android 2.3 AOSP .. the wrapper does not use any of the android functionality... Ill probably try this myself, but after i fix the mic :)

Maybe there is a way to edit the prelink map in an already compiled library?

PS: After a little bit investigation, don't think so... Hope at least the original 2.2 libcamera.so is not prelinked, or it does not have a prelink-map... or it does not collide with one of the other libraries..

Edited by ejtagle
Link to comment
Share on other sites

Guest Cass67

I think that to compile a new wrapper can be achieved even with no android 2.3 AOSP .. the wrapper does not use any of the android functionality... Ill probably try this myself, but after i fix the mic :)

Maybe there is a way to edit the prelink map in an already compiled library?

PS: After a little bit investigation, don't think so... Hope at least the original 2.2 libcamera.so is not prelinked, or it does not have a prelink-map... or it does not collide with one of the other libraries..

I compiled the lib source you provided, its compiled against cm7 2.3.5, had to compile all cm7 to get it to build due to shared files it was looking for ... The orig 2.2 libcamera.so seems to fails with link errors too, as does the one from cm7 just compiled ...

I need to recompile cm7 libcamera.so again removing the linkmap stuff to see what results i get then ... It also appears i need to add it to the android camera service build options in order for the lib to be used unless im reading things wrong

http://pixass.online.ac/android:nexusone

Ill do tomorrow, too tired right now :)

http://www.multiupload.com/88T68PCSN9 << patch lib compiled

Cheers

Cass

Link to comment
Share on other sites

Guest ejtagle

Well... regarding the nonworking microphone... the attached patch fixes it... The ALC was expecting the Mic to be attached to the first Mic port (ALC has 2 mic ports), but P10AN01 has the mic attached to the 2nd port. Using that information, i added the missing pieces to the ALC codec driver and the associated platform data. With this patch, all things related to audio, either input or output should be fully working :D

Regards,

Eduardo

Next items in my list... Bluetooth and Camera :)

mic-fixed.rar

Link to comment
Share on other sites

Guest ejtagle

Well, i have investigated a little bit the bluetooth issue. I still think it is baudrate related. But, the 921600 tbitrate can be achieved without too much error with the tegra HS uart (2% of speed error, according to the formulas used... and 2% should be no problem at all. Well, perhaps the problem is the bitrate used by the bluetooth module to answer... And, if that is the case, i guess i could measure it using the scope... ;) ... i'll see tomorrow. I ran out of time today ;)

Regards,

Eduardo

Link to comment
Share on other sites

Guest newbe5

Well... regarding the nonworking microphone... the attached patch fixes it... The ALC was expecting the Mic to be attached to the first Mic port (ALC has 2 mic ports), but P10AN01 has the mic attached to the 2nd port. Using that information, i added the missing pieces to the ALC codec driver and the associated platform data. With this patch, all things related to audio, either input or output should be fully working :D

Regards,

Eduardo

Next items in my list... Bluetooth and Camera :)

NICE! At some point, shouldn't you sleep? :P Thanks a lot for this mate! I know a lot of people will really appreciate it! I've sent yo a PM btw, if you get time to reply ;)

newbe5

Link to comment
Share on other sites

hi ejtagle and devs,

I'm working a little for CM for Vega with CM devs(mad-murdock and bumble-bee). I have interest to use your kernel with CM.

if you have public git repository, please tell me location.

I already tried to compile ejtagle's files(

11.2.12-LP0-MMC-DITHER-HOST-SLAVE-USB-NVEC-BATTERY.rar, audio-reffix.rar, and mic-fixed.rar) with tegra-11.2.13 from nvidia. I can see "A N D R O I D _" text few seconds and reboot with this kernel. I didn't change any userland part yet so it's reasonable result ;)

Link to comment
Share on other sites

Guest Cass67

hi ejtagle and devs,

I'm working a little for CM for Vega with CM devs(mad-murdock and bumble-bee). I have interest to use your kernel with CM.

if you have public git repository, please tell me location.

I already tried to compile ejtagle's files(

11.2.12-LP0-MMC-DITHER-HOST-SLAVE-USB-NVEC-BATTERY.rar, audio-reffix.rar, and mic-fixed.rar) with tegra-11.2.13 from nvidia. I can see "A N D R O I D _" text few seconds and reboot with this kernel. I didn't change any userland part yet so it's reasonable result ;)

We are using this repo ..

https://github.com/rebel1/kernel_2.6.36_nvidia_base.git

Link to comment
Share on other sites

Guest rebel1

Well... regarding the nonworking microphone... the attached patch fixes it... The ALC was expecting the Mic to be attached to the first Mic port (ALC has 2 mic ports), but P10AN01 has the mic attached to the 2nd port. Using that information, i added the missing pieces to the ALC codec driver and the associated platform data. With this patch, all things related to audio, either input or output should be fully working :D

Regards,

Eduard

Next items in my list... Bluetooth and Camera :)

Hello,

great work again. Mic works like a charm now on Android. :D

rebel1

Link to comment
Share on other sites

Guest newbe5

Just for anyone who has time to look at this. The accelerometer is lagging pretty badly, it seems to get worse the longer the system is in use, so it is very probably not linked to the kernel at all, but if not, then I'm not sure what to do about speeding it up.

Messages appear to be coming from the kernel fast enough, so it may well just be android lagging from lib to app, in which case it may be a memory issue.

newbe5

Edited by newbe5
Link to comment
Share on other sites

Guest Cass67

I compiled the lib source you provided, its compiled against cm7 2.3.5, had to compile all cm7 to get it to build due to shared files it was looking for ... The orig 2.2 libcamera.so seems to fails with link errors too, as does the one from cm7 just compiled ...

I need to recompile cm7 libcamera.so again removing the linkmap stuff to see what results i get then ... It also appears i need to add it to the android camera service build options in order for the lib to be used unless im reading things wrong

http://pixass.online...ndroid:nexusone

Ill do tomorrow, too tired right now :)

http://www.multiupload.com/88T68PCSN9 << patch lib compiled

Cheers

Cass

Hi Eduardo,

Ok i managed to remove prelinking from the camera libs, apply the patch you provided and is visible on the above link and its still fails .. tablet boots and camera does not hang after camera app launch but its does FC ... better but by not a lot ;)

isprelinked /system/lib/libcameraservice.so

/system/lib/libcameraservice.so: not prelinked

isprelinked /system/lib/libcamera.so

/system/lib/libcamera.so: not prelinked

We can also see from an objdump of libcameraservice is looking to the wrapper lib

http://pastebin.com/NEfVbiuA

But alas on launching camera app we get the following

http://pastebin.com/JQGg9KaC << HC3.2 camera

http://pastebin.com/XfpfDdHp << 2.2 stock camera on Advent's build

Something else seems still missing .... Or am i missing something important in all this ?

Cheers

Cass

Link to comment
Share on other sites

Guest brucelee666

Cass it may be nothing and you may have changed it but in the wrapper:-

static CameraInfo sCameraInfo[] = {

{

CAMERA_FACING_BACK,

90, /* orientation */

},

};

Shouldn't it be "CAMERA_FACING_FRONT" ?

Link to comment
Share on other sites

Guest Cass67

Cass it may be nothing and you may have changed it but in the wrapper:-

static CameraInfo sCameraInfo[] = {

{

CAMERA_FACING_BACK,

90, /* orientation */

},

};

Shouldn't it be "CAMERA_FACING_FRONT" ?

Makes sense eh :)

But no, no difference to the results ....

Cheers

Cass

Link to comment
Share on other sites

thanks for your info. at least I can build working kernel with 11.2.13 for VegaComb HC 3.2.

for CM7, I can see initlogo.rle but I can't connect adb. I need more time to make it work :)

anyway, thank you.

Link to comment
Share on other sites

Guest ejtagle

Hi fun,

look at this branch:

https://github.com/r...tree/nv-11.2.12

Rebel1: i think it would eb a good idea to port to 11.2.13 ... There aren't significant changes , except a patch related to USB otg, that i think could fix the problems with USB stopping working when resuming. Ill try to do the porting today. I think git will mostly do it for us. Probably, the only manual merging will be in the tegra?otg driver, but that is no real problem :)

Link to comment
Share on other sites

Guest rebel1

Rebel1: i think it would eb a good idea to port to 11.2.13 ... There aren't significant changes , except a patch related to USB otg, that i think could fix the problems with USB stopping working when resuming. Ill try to do the porting today. I think git will mostly do it for us. Probably, the only manual merging will be in the tegra?otg driver, but that is no real problem :)

I merged it to a new nv-11.2.13 branch , but after a first test, it breaks usb after suspend. There are chnanges in the otg driver that need to be reviewed i think.rebel1

Link to comment
Share on other sites

Guest ejtagle

I merged it to a new nv-11.2.13 branch , but after a first test, it breaks usb after suspend. There are chnanges in the otg driver that need to be reviewed i think.rebel1

Ill do the tegra_otg review tonight. No problems. Just as a curiosity... breaking means it stops operating in slave mode, or in master mode ?

Link to comment
Share on other sites

Guest rebel1

Ill do the tegra_otg review tonight. No problems. Just as a curiosity... breaking means it stops operating in slave mode, or in master mode ?

I have made only a quick test. It is the same problem as when i include your usb patch. I boot , then i have adb, mass storage an so on,then i go to suspend and then the usb slave mode does not come back,that means no adb ....Later when i have time, i debug it more.

What I see usb related in the log , but that is also in the 11.2.12 kernel output:

ulpi_phy_power_on: timeout waiting for phy clock to start

ulpi_phy_power_on: ulpi write failed

tegra-ehci tegra-ehci.1: Failed to power on the phy

tegra-ehci: probe of tegra-ehci.1 failed with error -110

Edited by rebel1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.