bc9
android-1.5r3 for bc9 (bc9-android-sdk-release20090815 ver,) †
Checkout android-1.5r3 and modify it.
- android-1.5r3 is a tag branch, which is created right after android-sdk-1.5_r3
- android-1.5r3 is a tag brach, which is put fort cupcake-relase branch.
- The kernel source of android-1.5r3 is excluded from repo management. If the kernel is required, it can be obtain from git, separately.
Get Source †
android-1.5r3 branch †
Following the instructions below, obtain source code of android.
$ mkdir ~/android-1.5r3
$ cd android-1.5r3
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b android-1.5r3
$ repo sync
ALSA †
android-1.5r3 branch is a tag branch of the cupcake-release branch, and this tag branch is created at a specific time during the
cupcake-release branch. Since this is not the master brach of cupcake branch, ALSA can not be included as writing the additional
information of ALSA in local_manifest.xml and ordering repo sync command. Including ALSA, get the ALSA files via git, and place
these files at the source tree of android-1.5r3. Then, build the android 1.5r3. Also, the error will be occur if it uses alsa_sound, which
is committed later then August 2009. alsa_sound used here is the last committed on July 2009. The instructions of how to include
ALSA is shown below.
$ cd ~android-1.5r3/external
$ git clone git://android.git.kernel.org/platform/external/alsa-lib.git
$ cd alsa-lib
$ git checkout 7d7fc0e
$ cd ~android-1.5r3/hardware
$ git clone git://android.git.kernel.org/hardware/alsa_sound
$ cd alsa_sound
$ git checkout a5cf8cc
Adjust the Contents of build †
Adjust alsa-lib †
Modify android-1.5r3/external/alsa-lib/Android.mk. The details are defined below.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u external/alsa-lib/Android.mk.orig external/alsa-lib/Android.mk
--- external/alsa-lib/Android.mk.orig 2009-08-30 15:00:52.000000000 +0900
+++ external/alsa-lib/Android.mk 2009-08-30 15:01:13.000000000 +0900
@@ -55,7 +55,7 @@
-fPIC -DPIC -D_POSIX_SOURCE \
-DALSA_CONFIG_DIR=\"/system/usr/share/alsa\" \
-DALSA_PLUGIN_DIR=\"/system/usr/lib/alsa-lib\" \
- -DALSA_DEVICE_DIRECTORY=\"/dev/snd/\"
+ -DALSA_DEVICE_DIRECTORY=\"/dev/\"
LOCAL_SRC_FILES := $(sort $(call all-c-files-under, src))
Patch for power management †
Please apply the patch listed below before build the files. Without applying this patch, bc9 will not boot as the system is considered
as low level battery.
$ cd android-sdk-1.5_r3
$ patch -b -p1 < ../dummy-battery.patch
Adjust Wi-Fi †
Modify wpa_supplicant †
Change android-1.5r3/external/wpa_supplicant/.config for the code shown below.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u external/wpa_supplicant/.config.orig external/wpa_supplicant/.config
--- external/wpa_supplicant/.config.orig 2009-08-31 20:33:30.000000000 +0900
+++ external/wpa_supplicant/.config 2009-08-31 20:33:50.000000000 +0900
@@ -19,13 +19,13 @@
CONFIG_PKCS12=y
# CONFIG_PCSC=y
CONFIG_SMARTCARD=y
-# CONFIG_WIRELESS_EXTENSION=y
+CONFIG_WIRELESS_EXTENSION=y
CONFIG_CTRL_IFACE=y
# CONFIG_DRIVER_HOSTAP=y
# CONFIG_DRIVER_HERMES=y
# CONFIG_DRIVER_MADWIFI=y
# CONFIG_DRIVER_ATMEL=y
-# CONFIG_DRIVER_WEXT=y
+CONFIG_DRIVER_WEXT=y
# CONFIG_DRIVER_NDISWRAPPER=y
# CONFIG_DRIVER_BROADCOM=y
# CONFIG_DRIVER_IPW=y
Alter android-1.5r3/external/wpa_supplicant/wpa_supplicant.conf to the code listed below.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u external/wpa_supplicant/wpa_supplicant.conf.orig external/wpa_supplicant/wpa_supplicant.conf
--- external/wpa_supplicant/wpa_supplicant.conf.orig 2009-08-31 20:34:30.000000000 +0900
+++ external/wpa_supplicant/wpa_supplicant.conf 2009-08-31 20:36:13.000000000 +0900
@@ -72,7 +72,9 @@
# DACL (which will reject all connections). See README-Windows.txt for more
# information about SDDL string format.
#
-ctrl_interface=tiwlan0
+#ctrl_interface=tiwlan0
+#ctrl_interface=wlan0
+ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=system
# IEEE 802.1X/EAPOL version
# wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which defines
Change wifi.c †
As changing android-1.5r3/hardware/libhardware_legacy/wifi/wifi.c, make USB Wi-Fi, which is compatible with rt73usb driver,
accessible from Android's GUI. To check progress of the process, the code below includes the log-outs. If all log-outs are not
necessary, please adjust the amount of log-outs by comment out.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u hardware/libhardware_legacy/wifi/wifi.c.orig hardware/libhardware_legacy/wifi/wifi.c
--- hardware/libhardware_legacy/wifi/wifi.c.orig 2009-08-31 21:34:21.000000000 +0900
+++ hardware/libhardware_legacy/wifi/wifi.c 2009-08-31 22:21:03.000000000 +0900
@@ -48,17 +48,23 @@
// TODO: use new ANDROID_SOCKET mechanism, once support for multiple
// sockets is in
-static const char IFACE_DIR[] = "/data/system/wpa_supplicant";
-static const char DRIVER_MODULE_NAME[] = "wlan";
-static const char DRIVER_MODULE_TAG[] = "wlan ";
-static const char DRIVER_MODULE_PATH[] = "/system/lib/modules/wlan.ko";
-static const char FIRMWARE_LOADER[] = "wlan_loader";
-static const char DRIVER_PROP_NAME[] = "wlan.driver.status";
-static const char SUPPLICANT_NAME[] = "wpa_supplicant";
-static const char SUPP_PROP_NAME[] = "init.svc.wpa_supplicant";
-static const char SUPP_CONFIG_TEMPLATE[]= "/system/etc/wifi/wpa_supplicant.conf";
-static const char SUPP_CONFIG_FILE[] = "/data/misc/wifi/wpa_supplicant.conf";
-static const char MODULE_FILE[] = "/proc/modules";
+static const char IFACE_DIR[] = "/data/system/wpa_supplicant";
+static const char DRIVER_MODULE_NAME[] = "rt73usb";
+static const char DRIVER_MODULE_TAG[] = "rt73usb ";
+static const char DRIVER_MODULE_PATH[] = "/system/lib/modules/rt73usb.ko";
+static const char RT2X00_LIB_DRIVER_MODULE_NAME[] = "rt2x00lib";
+static const char RT2X00_LIB_DRIVER_MODULE_TAG[] = "rt2x00lib ";
+static const char RT2X00_LIB_DRIVER_MODULE_PATH[] = "/system/lib/modules/rt2x00lib.ko";
+static const char RT2X00_LIB_USB_DRIVER_MODULE_NAME[] = "rt2x00usb";
+static const char RT2X00_LIB_USB_DRIVER_MODULE_TAG[] = "rt2x00usb";
+static const char RT2X00_LIB_USB_DRIVER_MODULE_PATH[] = "/system/lib/modules/rt2x00usb.ko";
+static const char FIRMWARE_LOADER[] = "wlan_loader";
+static const char DRIVER_PROP_NAME[] = "wlan.driver.status";
+static const char SUPPLICANT_NAME[] = "wpa_supplicant";
+static const char SUPP_PROP_NAME[] = "init.svc.wpa_supplicant";
+static const char SUPP_CONFIG_TEMPLATE[] = "/system/etc/wifi/wpa_supplicant.conf";
+static const char SUPP_CONFIG_FILE[] = "/data/misc/wifi/wpa_supplicant.conf";
+static const char MODULE_FILE[] = "/proc/modules";
static int insmod(const char *filename)
{
@@ -66,6 +72,7 @@
unsigned int size;
int ret;
+ LOGI("%s\n", __FUNCTION__);
module = load_file(filename, &size);
if (!module)
return -1;
@@ -82,6 +89,7 @@
int ret = -1;
int maxtry = 10;
+ LOGI("%s\n", __FUNCTION__);
while (maxtry-- > 0) {
ret = delete_module(modname, O_NONBLOCK | O_EXCL);
if (ret < 0 && errno == EAGAIN)
@@ -91,30 +99,35 @@
}
if (ret != 0)
- LOGD("Unable to unload driver module \"%s\": %s\n",
+ LOGE("Unable to unload driver module \"%s\": %s\n",
modname, strerror(errno));
return ret;
}
int do_dhcp_request(int *ipaddr, int *gateway, int *mask,
int *dns1, int *dns2, int *server, int *lease) {
+ LOGI("1. inside %s\n", __FUNCTION__);
/* For test driver, always report success */
- if (strcmp(iface, "sta") == 0)
+ if (strcmp(iface, "wlan0") == 0)
return 0;
+ LOGI("2. inside %s\n", __FUNCTION__);
if (ifc_init() < 0)
return -1;
+ LOGI("3. inside %s\n", __FUNCTION__);
if (do_dhcp(iface) < 0) {
ifc_close();
return -1;
}
ifc_close();
get_dhcp_info(ipaddr, gateway, mask, dns1, dns2, server, lease);
+ LOGI("4. inside %s\n", __FUNCTION__);
return 0;
}
const char *get_dhcp_error_string() {
+ LOGI("Inside %s\n", __FUNCTION__);
return dhcp_lasterror();
}
@@ -140,10 +153,12 @@
}
while ((fgets(line, sizeof(line), proc)) != NULL) {
if (strncmp(line, DRIVER_MODULE_TAG, strlen(DRIVER_MODULE_TAG)) == 0) {
+ LOGI("driver %s has been installed\n",DRIVER_MODULE_TAG);
fclose(proc);
return 1;
}
}
+ LOGE("Cannot find driver %s in proc",DRIVER_MODULE_TAG);
fclose(proc);
property_set(DRIVER_PROP_NAME, "unloaded");
return 0;
@@ -154,23 +169,31 @@
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
+ LOGI("Loading WiFi Modules\n");
+ sleep(1);
+
+ property_set(DRIVER_PROP_NAME, "ok");
if (check_driver_loaded()) {
return 0;
}
-
- if (insmod(DRIVER_MODULE_PATH) < 0)
- return -1;
-
+ insmod(RT2X00_LIB_DRIVER_MODULE_PATH);
+ insmod(RT2X00_LIB_USB_DRIVER_MODULE_PATH);
+ insmod(DRIVER_MODULE_PATH);
property_set("ctl.start", FIRMWARE_LOADER);
sched_yield();
while (count-- > 0) {
+ usleep(500000);
if (property_get(DRIVER_PROP_NAME, driver_status, NULL)) {
- if (strcmp(driver_status, "ok") == 0)
+ if (strcmp(driver_status, "ok") == 0) {
+ property_set("ctl.start", "ifcfg_ralink");
+ usleep(1000000);
+ //property_set("ctl.start", "dhcpcd");
return 0;
- else if (strcmp(DRIVER_PROP_NAME, "failed") == 0)
+ }
+ else if (strcmp(DRIVER_PROP_NAME, "failed") == 0) {
return -1;
+ }
}
- usleep(200000);
}
property_set(DRIVER_PROP_NAME, "timeout");
return -1;
@@ -178,20 +201,30 @@
int wifi_unload_driver()
{
- int count = 20; /* wait at most 10 seconds for completion */
+ LOGI("Unloading WiFi Modules\n");
+ sleep(1);
if (rmmod(DRIVER_MODULE_NAME) == 0) {
- while (count-- > 0) {
- if (!check_driver_loaded())
- break;
- usleep(500000);
- }
- if (count) {
- return 0;
- }
- return -1;
- } else
+ usleep(1000000);
+ } else {
+ LOGE("Unloading Ralink RT73USB WLAN Module Failed\n");
+ return -1;
+ }
+
+ if (rmmod(RT2X00_LIB_USB_DRIVER_MODULE_NAME) == 0) {
+ usleep(1000000);
+ } else {
+ LOGE("Unloading RT2X00_LIB_USB Module Failed\n");
+ return -1;
+ }
+
+ if (rmmod(RT2X00_LIB_DRIVER_MODULE_NAME) == 0) {
+ usleep(1000000);
+ } else {
+ LOGE("Unloading RT2X00_LIB Module Failed\n");
return -1;
+ }
+ return 0;
}
int ensure_config_file_exists()
@@ -200,6 +233,7 @@
int srcfd, destfd;
int nread;
+ LOGE("%s\n", __FUNCTION__);
if (access(SUPP_CONFIG_FILE, R_OK|W_OK) == 0) {
return 0;
} else if (errno != ENOENT) {
@@ -252,6 +286,7 @@
unsigned serial = 0;
#endif
+ LOGI("start %s",__FUNCTION__);
/* Check whether already running */
if (property_get(SUPP_PROP_NAME, supp_status, NULL)
&& strcmp(supp_status, "running") == 0) {
@@ -260,7 +295,7 @@
/* Before starting the daemon, make sure its config file exists */
if (ensure_config_file_exists() < 0) {
- LOGE("Wi-Fi will not be enabled");
+ LOGE("Configuration file does not exist. Wi-Fi will not be enabled");
return -1;
}
@@ -291,9 +326,11 @@
if (pi != NULL) {
__system_property_read(pi, NULL, supp_status);
if (strcmp(supp_status, "running") == 0) {
+ LOGI("Wi-Fi is running\n");
return 0;
} else if (pi->serial != serial &&
strcmp(supp_status, "stopped") == 0) {
+ LOGI("Wi-Fi has been stopped");
return -1;
}
}
@@ -313,6 +350,7 @@
char supp_status[PROPERTY_VALUE_MAX] = {'\0'};
int count = 50; /* wait at most 5 seconds for completion */
+ LOGI("%s called",__func__);
/* Check whether supplicant already stopped */
if (property_get(SUPP_PROP_NAME, supp_status, NULL)
&& strcmp(supp_status, "stopped") == 0) {
@@ -337,6 +375,7 @@
char ifname[256];
char supp_status[PROPERTY_VALUE_MAX] = {'\0'};
+ LOGI("%s called",__func__);
/* Make sure supplicant is running */
if (!property_get(SUPP_PROP_NAME, supp_status, NULL)
|| strcmp(supp_status, "running") != 0) {
@@ -344,7 +383,7 @@
return -1;
}
- property_get("wifi.interface", iface, "sta");
+ property_get("wifi.interface", iface, "wlan0");
if (access(IFACE_DIR, F_OK) == 0) {
snprintf(ifname, sizeof(ifname), "%s/%s", IFACE_DIR, iface);
@@ -352,6 +391,8 @@
strlcpy(ifname, iface, sizeof(ifname));
}
+ LOGI("Interface directory = %s", IFACE_DIR);
+ LOGI("Interface name = %s", ifname);
ctrl_conn = wpa_ctrl_open(ifname);
if (ctrl_conn == NULL) {
LOGE("Unable to open connection to supplicant on \"%s\": %s",
@@ -370,6 +411,7 @@
ctrl_conn = monitor_conn = NULL;
return -1;
}
+ LOGI("Connect to Supplicant done\n");
return 0;
}
@@ -377,20 +419,24 @@
{
int ret;
+ LOGI("%s, cmd = %s\n", __FUNCTION__, cmd);
if (ctrl_conn == NULL) {
LOGV("Not connected to wpa_supplicant - \"%s\" command dropped.\n", cmd);
return -1;
}
+ memset(reply, 0, *reply_len);
ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), reply, reply_len, NULL);
if (ret == -2) {
LOGD("'%s' command timed out.\n", cmd);
return -2;
} else if (ret < 0 || strncmp(reply, "FAIL", 4) == 0) {
+ LOGI("reply:%s\n",reply);
return -1;
}
if (strncmp(cmd, "PING", 4) == 0) {
reply[*reply_len] = '\0';
}
+ LOGI("returning reply %s for cmd %s\n", reply, cmd);
return 0;
}
@@ -403,16 +449,19 @@
struct timeval tval;
struct timeval *tptr;
+ LOGI("%s called",__func__);
+ LOGI("monitor_conn checking \n");
if (monitor_conn == NULL)
return 0;
+ LOGI("calling wpa_ctrl_recv\n");
result = wpa_ctrl_recv(monitor_conn, buf, &nread);
if (result < 0) {
LOGD("wpa_ctrl_recv failed: %s\n", strerror(errno));
return -1;
}
buf[nread] = '\0';
- /* LOGD("wait_for_event: result=%d nread=%d string=\"%s\"\n", result, nread, buf); */
+ LOGI("wait_for_event: result=%d nread=%d string=\"%s\"\n", result, nread, buf);
/* Check for EOF on the socket */
if (result == 0 && nread == 0) {
/* Fabricate an event to pass up */
@@ -437,11 +486,13 @@
memmove(buf, match+1, nread+1);
}
}
+ LOGI("returning nread\n");
return nread;
}
void wifi_close_supplicant_connection()
{
+ LOGI("%s called",__func__);
if (ctrl_conn != NULL) {
wpa_ctrl_close(ctrl_conn);
ctrl_conn = NULL;
@@ -454,5 +505,6 @@
int wifi_command(const char *command, char *reply, size_t *reply_len)
{
+ LOGI("%s called, cmd:%s",__func__,command);
return wifi_send_command(ctrl_conn, command, reply, reply_len);
}
Adjust WifiService.java †
Change android-1.5r3/frameworks/base/services/java/com/android/server/WifiService.java for the code listed below.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u frameworks/base/services/java/com/android/server/WifiService.java.orig frameworks/base/services/java/com/android/server/WifiService.java
--- frameworks/base/services/java/com/android/server/WifiService.java.orig 2009-08-31 20:40:25.000000000 +0900
+++ frameworks/base/services/java/com/android/server/WifiService.java 2009-08-31 20:57:57.000000000 +0900
@@ -75,7 +75,7 @@
*/
public class WifiService extends IWifiManager.Stub {
private static final String TAG = "WifiService";
- private static final boolean DBG = false;
+ private static final boolean DBG = true;
private static final Pattern scanResultPattern = Pattern.compile("\t+");
private final WifiStateTracker mWifiStateTracker;
@@ -1219,53 +1219,18 @@
}
int lineLen = lineEnd - lineBeg;
if (0 < lineLen && lineLen <= SCAN_RESULT_BUFFER_SIZE) {
- int scanResultLevel = 0;
/*
* At most one thread should have access to the buffer at a time!
*/
synchronized(mScanResultBuffer) {
- boolean parsingScanResultLevel = false;
for (int i = lineBeg; i < lineEnd; ++i) {
- char ch = reply.charAt(i);
- /*
- * Assume that the signal level starts with a '-'
- */
- if (ch == '-') {
- /*
- * Skip whatever instances of '-' we may have
- * after we parse the signal level
- */
- parsingScanResultLevel = (scanResultLevel == 0);
- } else if (parsingScanResultLevel) {
- int digit = Character.digit(ch, 10);
- if (0 <= digit) {
- scanResultLevel =
- 10 * scanResultLevel + digit;
- /*
- * Replace the signal level number in
- * the string with 0's for caching
- */
- ch = '0';
- } else {
- /*
- * Reset the flag if we meet a non-digit
- * character
- */
- parsingScanResultLevel = false;
- }
- }
- mScanResultBuffer[i - lineBeg] = ch;
+ mScanResultBuffer[i - lineBeg] = reply.charAt(i);
}
- if (scanResultLevel != 0) {
- ScanResult scanResult = parseScanResult(
- new String(mScanResultBuffer, 0, lineLen));
- if (scanResult != null) {
- scanResult.level = -scanResultLevel;
- scanList.add(scanResult);
- }
- } else if (DBG) {
- Log.w(TAG,
- "ScanResult.level=0: misformatted scan result?");
+ ScanResult scanResult = parseScanResult(
+ new String(mScanResultBuffer,0,lineLen));
+ if (scanResult != null) {
+ scanList.add(scanResult);
+ if (DBG) Log.d(TAG, "ScanResult: " + scanResult);
}
}
} else if (0 < lineLen) {
Change the name of WiFi I/F †
In the source code of android-1.5r3, change the notation of tiwln0 to wln0.
android-1.5r3/external/dhcpcd/android/conf
beat@bc9-android-sdk:~/android-1.5r3$ diff -u external/dhcpcd/android.conf.orig external/dhcpcd/android.conf
--- external/dhcpcd/android.conf.orig 2009-08-31 22:50:34.000000000 +0900
+++ external/dhcpcd/android.conf 2009-08-31 22:51:09.000000000 +0900
@@ -1,6 +1,6 @@
# dhcpcd configuration for Android Wi-Fi interface
# See dhcpcd.conf(5) for details.
-interface tiwlan0
+interface wlan0
# dhcpcd-run-hooks uses these options.
option subnet_mask, routers, domain_name_servers
andriod-1.5r3/frameworks/base/service/java/com/android/server/WifiWatchdogService.java
beat@bc9-android-sdk:~/android-1.5r3$ diff -u frameworks/base/services/java/com/android/server/ WifiWatchdogService.java.orig frameworks/base/services/java/com/android/server/WifiWatchdogService.java
--- frameworks/base/services/java/com/android/server/WifiWatchdogService.java.orig 2009-08-31 22:55:09.000000000 +0900
+++ frameworks/base/services/java/com/android/server/WifiWatchdogService.java 2009-08-31 22:55:25.000000000 +0900
@@ -81,7 +81,7 @@
* DHCP-replied DNS server anyway.
*/
/** The system property whose value provides the current DNS address. */
- private static final String SYSTEMPROPERTY_KEY_DNS = "dhcp.tiwlan0.dns1";
+ private static final String SYSTEMPROPERTY_KEY_DNS = "dhcp.wlan0.dns1";
private Context mContext;
private ContentResolver mContentResolver;
android-1.5r3/frameworks/base/wifi/java/android/net/wifi/WifiStateTrack.java
beat@bc9-android-sdk:~/android-1.5r3$ diff -u frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java.orig frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java
--- frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java.orig 2009-08-31 22:58:00.000000000 +0900
+++ frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java 2009-08-31 22:58:17.000000000 +0900
@@ -321,7 +321,7 @@
mSettingsObserver = new SettingsObserver(new Handler());
- mInterfaceName = SystemProperties.get("wifi.interface", "tiwlan0");
+ mInterfaceName = SystemProperties.get("wifi.interface", "wlan0");
sDnsPropNames = new String[] {
"dhcp." + mInterfaceName + ".dns1",
"dhcp." + mInterfaceName + ".dns2"
sound source file †
AudioPackage2.mk is copied, and change its name to Android.mk. This will help that ringtone and other resource files are needed
to be copied to the right places when build the files.
Fix BoardConfig.mk †
For the integration of ALSA and handling WiFi, android-1.5r3/build/target/board/generic/BoardConfig.mk is needed to be fixed.
BoardConfig.mk is replaced with the code shown below.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u build/target/board/generic/BoardConfig.mk.orig build/target/board/generic/BoardConfig.mk
--- build/target/board/generic/BoardConfig.mk.orig 2009-08-30 15:03:29.000000000 +0900
+++ build/target/board/generic/BoardConfig.mk 2009-08-30 15:03:50.000000000 +0900
@@ -8,4 +8,7 @@
TARGET_NO_KERNEL := true
TARGET_NO_RADIOIMAGE := true
HAVE_HTC_AUDIO_DRIVER := true
-BOARD_USES_GENERIC_AUDIO := true
+BOARD_USES_ALSA_AUDIO := true
+WPA_BUILD_SUPPLICANT := true
+BOARD_WPA_SUPPLICANT_DRIVER := WEXT
+#BOARD_USES_GENERIC_AUDIO := true
Modify system.prop †
To change the I/F name of Wi-Fi to wlan0, android-1.5r3/build/target/board/generic/system.prop is needed to change as shown
below. After build is executed, this change will be taken into system/build of android.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u build/target/board/generic/system.prop.orig build/target/board/generic/system.prop
--- build/target/board/generic/system.prop.orig 2009-08-31 20:37:40.000000000 +0900
+++ build/target/board/generic/system.prop 2009-08-31 20:38:16.000000000 +0900
@@ -2,5 +2,10 @@
# system.prop for generic sdk
#
-rild.libpath=/system/lib/libreference-ril.so
-rild.libargs=-d /dev/ttyS0
+# RILD settings
+#rild.libpath=/system/lib/libreference-ril.so
+#rild.libargs=-d /dev/ttyS0
+
+# WiFi settings
+wifi.interface = wlan0
+
build †
As these fixings and adjustments shown above are completed, execute build.
$ cd ~/android-1.5r3
$ make
Technically, build is completed, but the lib files of OpenWnn, which is located under the directory of
android-1.5r3/out/target/product/generic/system/lib, have not been built. OpenWin is needed to be
build separately.
Additional Build †
OpenWnn †
As bc9 is basically works inside landscape, turn off the comment out function of at the landscape configuration for OpenWnn, and let landscape visible.
android-1.5_r3/packages/inputsmethod/OpenWnn/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java can be change to the code shown
below.
beat@bc9-android-sdk:~/android-1.5r3$ diff -u packages/inputmethods/OpenWnn/src/jp/co/omronsoft/openwnn/JAJP/ DefaultSoftKeyboardJAJP.java.orig packages/inputmethods/OpenWnn/src/jp/co/omronsoft/openwnn/JAJP/ DefaultSoftKeyboardJAJP.java
--- packages/inputmethods/OpenWnn/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java.orig 2009-09-01 11:36:59.000000000 +0900
+++ packages/inputmethods/OpenWnn/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java 2009-09-01 11:37:47.000000000 +0900
@@ -847,7 +847,7 @@
private void createKeyboardsLandscape(OpenWnn parent) {
Keyboard[][] keyList;
/* qwerty shift_off (landscape) */
-/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF];
+ keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF];
keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_landscape);
keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_alphabet_landscape);
keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_symbols_landscape);
@@ -856,9 +856,9 @@
keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_symbols_landscape);
keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_katakana_landscape);
keyList[KEYMODE_JA_HALF_PHONE][0] = new Keyboard(parent, R.xml.keyboard_12key_phone_landscape);
-*/
+
/* qwerty shift_on (landscape) */
-/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_ON];
+ keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_ON];
keyList[KEYMODE_JA_FULL_HIRAGANA][0] =
mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_FULL_HIRAGANA][0];
keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_alphabet_shift_landscape);
@@ -872,9 +872,9 @@
mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_KATAKANA][0];
keyList[KEYMODE_JA_HALF_PHONE][0] =
mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_PHONE][0];
-*/
+
/* 12-keys shift_off (landscape) */
-/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF];
+ keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF];
keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_12keyjp_landscape);
keyList[KEYMODE_JA_FULL_HIRAGANA][1] = new Keyboard(parent, R.xml.keyboard_12keyjp_input_landscape);
keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_alphabet_landscape);
@ -888,9 +888,9 @@
keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_katakana_landscape);
keyList[KEYMODE_JA_HALF_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_katakana_input_landscape);
keyList[KEYMODE_JA_HALF_PHONE][0] = new Keyboard(parent, R.xml.keyboard_12key_phone_landscape);
-*/
+
/* 12-keys shift_on (landscape) */
-/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_ON];
+ keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_ON];
keyList[KEYMODE_JA_FULL_HIRAGANA]
= mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_FULL_HIRAGANA];
keyList[KEYMODE_JA_FULL_ALPHABET]
@@ -907,7 +907,7 @@
= mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_KATAKANA];
keyList[KEYMODE_JA_HALF_PHONE]
= mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_PHONE];
-*/
+
}
After the change is completed. OpenWnn can be built, separately.
$ cd ~/android-1.5_r3/build/
$ source envsetup.sh
$ cd ~/android-1.5_r3/packages/inputmethods/OpenWnn
$ mm
Finally, the lib files for OpenWnn are built under ~/amdroid-1.5r3/out/target/product/generic/syste/lib.
Create android-root †
Place the built android file †
The whole build process described above is completed, the built files are moved to specific locations where each file is suitable for booting.
$ cd ~/
$ mkdir android-root
$ cp -a ~/android-1.5r2/out/target/product/generic/root/* ~/android-root/
$ cp -a ~/android-1.5r2/out/target/product/generic/system/* ~/android-root/system/
Place kernel module †
The rt73usb related kernel module and the firmware of rt73 are placed under android-root. After Android is booted via chroot, let
users turn on/off Wi-Fi from GUI of android via applying insmod/rmmod commands on the driver, respectively. The instructions
are shown below.
Caution: As using kernel module, bc9 is needed to be booted from the same version of kernel and kernel module.
$ mkdir ~/android-root/system/lib/modules/
$ cp ~/kernel_work/linux-android-2.6.29-bc9-r6/drivers/net/wireless/rt2x00/*.ko ~/android-root-1.5r3-alsa-wifi/system/lib/modules/
$ mkdir ~/android-root/system/etc/
$ cp kernel_work/RT71W_Firmware_V1.8/LICENSE.ralink-firmware.txt android-root-1.5r3-alsa-wifi/system/etc/firmware/
$ cp kernel_work/RT71W_Firmware_V1.8/rt73.bin android-root-1.5r3-alsa-wifi/system/etc/firmware/
Edit init.rc †
The confutations of android-root/init.rc is needed to change for adding alsa and Wi-Fi. The modified code is shown below.
--- init.rc.orig 2009-08-30 14:59:02.000000000 +0900
+++ init.rc 2009-09-01 15:34:35.000000000 +0900
@@ -36,16 +36,16 @@
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
- mount yaffs2 mtd@system /system
- mount yaffs2 mtd@system /system ro remount
+ # mount yaffs2 mtd@system /system
+ # mount yaffs2 mtd@system /system ro remount
# We chown/chmod /data again so because mount is run as root + defaults
- mount yaffs2 mtd@userdata /data nosuid nodev
+ # mount yaffs2 mtd@userdata /data nosuid nodev
chown system system /data
chmod 0771 /data
# Same reason as /data above
- mount yaffs2 mtd@cache /cache nosuid nodev
+ # mount yaffs2 mtd@cache /cache nosuid nodev
chown system cache /cache
chmod 0770 /cache
@@ -78,10 +78,35 @@
chown root root /cache/lost+found
chmod 0770 /cache/lost+found
+ chmod 0666 /dev/bc9_leds
+
+ setprop alsa.mixer.playback.master Master
+ setprop alsa.mixer.capture.master Capture
+ setprop alsa.mixer.playback.earpiece Master
+ setprop alsa.mixer.capture.earpiece Capture
+ setprop alsa.mixer.playback.headset Master
+ setprop alsa.mixer.playback.speaker Master
+ chmod 0777 /dev/pcmC0D0c
+ chmod 0777 /dev/pcmC0D0p
+ chmod 0777 /dev/controlC0
+ chmod 0777 /dev/timer
+ chown root audio /dev/controlC
+ chown root audio /dev/pcmC0D0c
+ chown root audio /dev/pcmC0D0p
+ chown root audio /dev/timer
+
+ # create wifi filesystem structure
+ mkdir /data/misc/wifi 0770 system system
+ mkdir /data/misc/wifi/sockets 0770 system system
+ mkdir /data/system/wpa_supplicant 0770 system system
+ mkdir /data/misc/dhcp 0770 dhcp dhcp
+ chown dhcp dhcp /data/misc/dhcp
+
+
on boot
# basic network init
ifup lo
- hostname localhost
+ hostname bc9
domainname localdomain
# set RLIMIT_NICE to allow priorities from 19 to -20
@@ -110,6 +135,9 @@
setprop ro.CONTENT_PROVIDER_MEM 5632
setprop ro.EMPTY_APP_MEM 6144
+ setprop wifi.interface wlan0
+ setprop wlan.driver.status ok
+
# Write value must be consistent with the above properties.
# Note that the driver only supports 6 slots, so we have HOME_APP at the
# same memory level as services.
@@ -204,11 +232,11 @@
service debuggerd /system/bin/debuggerd
-service ril-daemon /system/bin/rild
- socket rild stream 660 root radio
- socket rild-debug stream 660 radio system
- user root
- group radio cache inet misc
+#service ril-daemon /system/bin/rild
+# socket rild stream 660 root radio
+# socket rild-debug stream 660 radio system
+# user root
+# group radio cache inet misc
service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
socket zygote stream 666
@@ -219,38 +247,59 @@
user media
group system audio camera graphics inet net_bt net_bt_admin
-service bootsound /system/bin/playmp3
- user media
- group audio
- oneshot
-
-service dbus /system/bin/dbus-daemon --system --nofork
- socket dbus stream 660 bluetooth bluetooth
- user bluetooth
- group bluetooth net_bt_admin
-
-service hcid /system/bin/hcid -s -n -f /etc/bluez/hcid.conf
- socket bluetooth stream 660 bluetooth bluetooth
- socket dbus_bluetooth stream 660 bluetooth bluetooth
- # init.rc does not yet support applying capabilities, so run as root and
- # let hcid drop uid to bluetooth with the right linux capabilities
- group bluetooth net_bt_admin misc
- disabled
+#service bootsound /system/bin/playmp3
+# user media
+# group audio
+# oneshot
+
+#service dbus /system/bin/dbus-daemon --system --nofork
+# socket dbus stream 660 bluetooth bluetooth
+# user bluetooth
+# group bluetooth net_bt_admin
+
+#service hcid /system/bin/hcid -s -n -f /etc/bluez/hcid.conf
+# socket bluetooth stream 660 bluetooth bluetooth
+# socket dbus_bluetooth stream 660 bluetooth bluetooth
+# # init.rc does not yet support applying capabilities, so run as root and
+# # let hcid drop uid to bluetooth with the right linux capabilities
+# group bluetooth net_bt_admin misc
+# disabled
+
+#service hfag /system/bin/sdptool add --channel=10 HFAG
+# user bluetooth
+# group bluetooth net_bt_admin
+# disabled
+# oneshot
+
+#service hsag /system/bin/sdptool add --channel=11 HSAG
+# user bluetooth
+# group bluetooth net_bt_admin
+# disabled
+# oneshot
+
+
+#service wlan_loader /system/bin/wlan_loader
+# disabled
+# oneshot
+
+service ifcfg_ralink /system/bin/ifconfig wlan0 up
+# disabled
+# oneshot
+
+service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant -Dwext -iwlan0 -c /system/etc/wifi/ wpa_supplicant.conf -dd
+ disabled
+ group system
+
+service dhcpcd /system/bin/logwrapper /system/bin/dhcpcd -d wlan0
+ disabled
+ oneshot
+ #group system dhcp
-service hfag /system/bin/sdptool add --channel=10 HFAG
- user bluetooth
- group bluetooth net_bt_admin
- disabled
- oneshot
-
-service hsag /system/bin/sdptool add --channel=11 HSAG
- user bluetooth
- group bluetooth net_bt_admin
- disabled
- oneshot
+on property:init.svc.wpa_supplicant=stopped
+ stop dhcpcd
service installd /system/bin/installd
socket installd stream 600 system system
-service flash_recovery /system/bin/flash_image recovery /system/recovery.img
- oneshot
+#service flash_recovery /system/bin/flash_image recovery /system/recovery.img
+# oneshot
Configure alsa file †
Copy the ALSA configuration files at /android-root/system/etc/. The configuration files are listed below.
asound.conf & asound.state
asound.state †
asound.state is generated at OpenEmbedded's directory of /etc/ when OpenEmbedded environment is built from gumstix-oe.
asound.conf †
asound.conf is created for letting each control work correctly on asound.state.
vold configuration file †
For Android, SDcard is mounted as /system/bin/vold/ is executed.
vold works as its configuration file, which is located at android/system/etc/vold.conf is predetermined. The configuration file of vold'''
is defined as shown below.
## vold configuration file for bc9
volume_sdcard {
media_path /devices/platform/pxa2xx-mci.0/mmc_host/mmc0
media_type mmc
mount_point /sdcard
ums_path /devices/platform/usb_mass_storage/lun0
}
Because of this configuration, the first partition of microSD is mounted as saving media file.
Put the files pictures, audio, and videos on the first partition, these files are accessible from Android.
Configuration of button setting †
From the top, bc9's buttons are set for, HOME, MENU, and BACK.
bc9 has three buttons, which is connected via GPIO. The buttons are assigned as F1, F2, and F3 of keyboard, and these keys are
used for HOME, MENU, and BACK. To use the buttons, modify qwerty.kl located at android-root/system/usr/keylayout/qwerty.kl.
--- qwerty.kl.orig 2009-09-01 16:44:37.000000000 +0900
+++ qwerty.kl 2009-09-01 16:45:24.000000000 +0900
@@ -11,18 +11,18 @@ key 10 9
key 11 0
key 158 BACK WAKE_DROPPED
key 230 SOFT_RIGHT WAKE
-key 60 SOFT_RIGHT WAKE
+key 60 MENU WAKE
key 107 ENDCALL WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 139 MENU WAKE_DROPPED
-key 59 MENU WAKE_DROPPED
+key 59 HOME WAKE
key 127 SEARCH WAKE_DROPPED
key 217 SEARCH WAKE_DROPPED
key 228 POUND
key 227 STAR
key 231 CALL WAKE_DROPPED
-key 61 CALL WAKE_DROPPED
+key 61 BACK WAKE
key 232 DPAD_CENTER WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 103 DPAD_UP WAKE_DROPPED
default.prop †
At the end of default.prop, set up the IP of OpenDNS as it is shown below.
(If the use of OpenDNS is prohibited, set up any available DNS server address in bc9's working environment)
net.eth0.dns1=208.66.222.222
net.dns1=208.67.222.222
Screen Timeout †
Since Power Management function is cancelled by application of the patch, once android turns into sleep mode via Screen Timeout, android
will not turn on again. Screen Timeout is needed to be turned off. As android is booted , please reconfigure the following section.
- [Menu] - [Settings] – [Sound & display] – [Screen timeout] – [Never timeout]
device_provisioned †
activation related setting affects on the Open Source version of android, too. After android is initially booted, a db file is generated.
Giving the command, shown below, on the file, android becomes activated. (This command is not executed in the userland of android.
This should be on Linux and applying sqlite3.)
# cd /data/data/com.android.providers.settings/databases
# sqlite3 settings.db
sqlite> insert into "secure" values(NULL,"device_provisioned", "1");
sqlite> .exit
Once android is activated, the key lock dialog will be added on HOME screen after android is booted.
Before android is activated, HOME
screen immediately appears after android is booted. After android is activated, the key lock dialog appears after booting android. Then,
pushing MENU button, reach HOME screen. On the key lock dialog, the message of No SIM Card appears, but it means that bc9 is not
capable of connecting to 3G communication. Ethernet can be usedfor communication.
As users fails to activate android, these issues are recognized.
- HOME key is cancelled.
- While android is booting, key dialog does not appears.
This ends the build and preparation process of android 1.5-r3 on bc9.
|