Thursday, October 8, 2009

compile openssl for mingw

I was googling a correct step to build openssl with mingw. I followed different posts from different people, none of them give me anything good. After a whole afternoon of trying and failing, eventually, I got it right with following steps:
1. install cygwin on my PC. To avoid too much trying and failing, I have installed the full cygwin. Storage space is cheap but time is very expensive.
2. install mingw
3. download openssl from openssl.org. I used 0.9.8k
4. untar/unzip 0.9.8k package to cygwin how directory
5. start Cygwin xterm (ya, Cygwin not msys)
6. in the xterm, go to openssl-0.9.8k directory that you just unpacked
7. ./Configure mingw
8. make

The steps above create static library that can be used with mingw. To create the dll, you need to do:
$ echo EXPORTS > libcrypto.def
$ nm libcrypto.a | grep ' T _' | sed 's,^.* T _,,' >> libcrypto.def
$ dllwrap -o libcrypto.dll --def libcrypto.def libcrypto.a -lws2_32 -lgdi32
$ echo EXPORTS > libssl.def
$ nm libssl.a | grep 'T _' | sed 's,^.* T _,,' >> libssl.def
$ dllwrap -o libssl.dll --def libssl.def libssl.a libcrypto.dll
After this, you can copy the *.a to /mingw/lib and *.dll to /ming/bin

Saturday, September 12, 2009

The wifi problem has been fixed

Recntly, people reported issues with wifi. The bug really has nothing to do with the wifi. It is a memory corruption issue inside the system property manager. Long ago, I changed the size of system property name to support user configure-able battery sysfs path. This change will cause the size of shared memory for the system properties to increase. But the original code of shared memory creation uses a hard coded size and I was not aware of that. When the amonut of the total used system property entries increased to certain level, segfault will happen since system property entry may have pointed to a wrong address. After adjusted the code to create the share memory, it seems that the problem goes away.
If you are still seeing the issue, please report it in the discussion group.
Thanks
Yi

Thursday, September 3, 2009

What is next

Now, we have a realtivly stable system. Here are some items on my to do list:
1. enable vold to support external stroage by using fuzzy matching
2.In Android, by default, mkdir set the new directory permission to 0700. When install an new apk from web ui, the download provider tries to create a new directory called download in /sdcard. On G1 phone, the external storage is using vfat partition. And it does not enforce permission. So we can download and install the apk without any problem. But with android-x86, the external storage can use either ext2, ext3 or vfat, with the unix paritions, the permission will be enforced. So the apk install will fail. I may need to add new code the fix the permission.
3. hardware cursor, this item in my to do list for a very long time already.

Tuesday, August 25, 2009

The Android Etherent State Tracker Cont.

Ok, I have committed the first release of the etherent state tracker for the Android. You can check out code from git.android-x86.org by using branch name eth-nm-dev-br. It is an alpha release. Please report the issues to the android-x86 group

Monday, August 24, 2009

Etherent state tracker cont.

Slow.... the build is so slow, it eats up my 50% of time.

I'm getting there. I still need to clean up the conntectivityservice. This class does now know anything other than wifi and mobile. I need to add etherent into it. But before that I will try out the basic functionality and release a test path .

Sunday, August 16, 2009

Add state tracker for etherent devices

Android has state tracker (the connection management) for both mobile connections and wifi connections. But it does not support ethernet devices.
This is not an issue for a phone , but it causes following issues with netbook:
1. you can not manage your ethernet device from UI at all
2. With current way of enabling ethernet device (netcfg eth0 dhcp). If you unplug/plug cable, you will not have your dhcp ip address reset
3. ethernet device can not report connectivity changes correctly

Now, I'm working on the ethernet state tracker support for Android-x86. This blog thread is created to track this work.

Saturday, June 6, 2009

How to access a C native service from Java side in Android

I have mentioned how to add a native service by C. Now, it is the time to discuss about the client implementation. A client, in this document is a activity. It can talk to the native service to instruct the native service to do something for it.
It seems that there has no way to do this with a standard method supported by Android SDK. So I went to another route. I built a platform library. The platform library talks to the servicemanager.java to access the binder hence the native service. The code is very simple. To find out how to build and use a platform library, you can check out the android source code and take a look at the README.txt in the directory development/samples/PlatformLibrary

package com.servicelib.mybinder;

import android.util.Config;
import android.util.Log;
import android.os.ServiceManager;
import android.os.Binder;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;


public final class MyBinderLibrary {


private static IBinder mServiceManager = null;

public MyBinderLibrary() {

}

public static IBinder AttachService(String name) {
if (mServiceManager == null) {
mServiceManager = ServiceManager.getService(name);
}

return mServiceManager;
}

public static int SendKillSignal() throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
int result;
try{
data.writeInterfaceToken(mServiceManager.getInterfaceDescriptor());
mServiceManager.transact(TRANSACTION_sendKill,data,reply,0);
reply.readException();
result = reply.readInt();
}
finally{
reply.recycle();
data.recycle();
}

return result;
}
static final int TRANSACTION_sendKill = (IBinder.FIRST_CALL_TRANSACTION+0);
}


So, in your activity, call the methods in this class directly. So that you can talk to the native service. You need to make sure the name of the service is correct.