/etc 目錄下有 init.rc,這就是後來 recovery image root 的 init.rc
這個 init.rc 很簡單,除了 uevent, console 以外。
就只有 launch 一個 service:
service recovery /sbin/recovery
這個 recovery 的 source code 就在 android/bootable/recovery/recovery.c
ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上
service recovery /sbin/recovery
void arm_machine_restart(char mode, const char *cmd)
{
.....
/*
* Now call the architecture specific reboot code.
*/
arch_reset(mode, cmd);
這個 arch_reset( ),是 implement 在 mach/system.h
void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
EXPORT_SYMBOL_GPL(arm_pm_restart);
..
void machine_restart(char *cmd)
{
machine_shutdown();
arm_pm_restart(reboot_mode, cmd);
}
void kernel_restart(char *cmd)
{
kernel_restart_prepare(cmd);
if (!cmd)
printk(KERN_EMERG "Restarting system.\n");
else
printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
kmsg_dump(KMSG_DUMP_RESTART);
machine_restart(cmd);
}
EXPORT_SYMBOL_GPL(kernel_restart);
/*
* Reboot system call: for obvious reasons only root may call it,
* and even root needs to set up some magic numbers in the registers
* so that some mistake won't make this reboot the whole machine.
* You can also set the meaning of the ctrl-alt-del-key here.
*
* reboot doesn't sync: do that yourself before calling this.
*/
SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
void __user *, arg)
{
...
switch (cmd) {
case LINUX_REBOOT_CMD_RESTART:
kernel_restart(NULL);
break;
...
case LINUX_REBOOT_CMD_RESTART2:
if (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) {
ret = -EFAULT;
break;
}
buffer[sizeof(buffer) - 1] = '\0';
kernel_restart(buffer);
break;
...
轉成 syscall 介面 (reboot)extern int reboot(int reboot_type); extern int __reboot(int, int, int, void *);
static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason)
{
sync();
#ifdef HAVE_ANDROID_OS
if (reason == NULL) {
reboot(RB_AUTOBOOT);
} else {
const char *chars = env->GetStringUTFChars(reason, NULL);
__reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
LINUX_REBOOT_CMD_RESTART2, (char*) chars);
env->ReleaseStringUTFChars(reason, chars); // In case it fails.
}
jniThrowIOException(env, errno);
#endif
}
#sudo add-apt-repository ppa:webupd8team/java #sudo apt-get update #sudo apt-get install oracle-java6-installer 會出現確認按鍵,之後開始 download... #sudo apt-get install oracle-java6-set-default以後要刪除的話...
#sudo apt-get purge oracle-java6-installer然後 follow 這一篇, 改 default gcc 為 4.4
deb http://cz.archive.ubuntu.com/ubuntu quantal main universe再 apt-get update, apt-get install libgmp3c2
/usr/include/zlib.h:34: fatal error: zconf.h: No such file or directory
static int __i2c_check_addr_busy(struct device *dev, void *addrp)
{
struct i2c_client *client = i2c_verify_client(dev);
int addr = *(int *)addrp;
if (client && client->addr == addr)
return -EBUSY;
return 0;
}
VGA Compatile controller: Advanced Micro Device [AMD] nee ATI Madison [Radeon HD 5000M Series]
# Debian 7 "Wheezy" deb http://http.debian.net/debian/ wheezy main contrib non-free
# aptitude update # aptitude -r install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') fglrx-driverinstall 過程會出現要作 aticonfig 的提示,紀錄一下,裝完作一次。
$sudo aticonfig --initial> 做完後重開。
sudo apt-get install gcc-4.4 g++-4.4 gcc-4.4-multilib g++-4.4-multilib
make CC=gcc-4.4 CXX=g++-4.4to build android,.. ..結果 webkit , webcore 出現問題,大概是 webkit 有字己的 Makefile,沒有吃環境變數,
charles-chang@whell:~/speedsnail/android/external/webkit$ git diff diff --git a/WebCore/dom/make_names.pl b/WebCore/dom/make_names.pl index 083e309..4494ee7 100755 --- a/WebCore/dom/make_names.pl +++ b/WebCore/dom/make_names.pl @@ -47,7 +47,7 @@ my %tags = (); my %attrs = (); my %parameters = (); my $extraDefines = 0; -my $preprocessor = "/usr/bin/gcc -E -P -x c++"; +my $preprocessor = "/usr/bin/gcc -E -x c++";
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.7OK, check..
sudo update-alternatives --config gcc There are 2 choices for the alternative gcc (providing /usr/bin/gcc). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/gcc-4.4 50 auto mode 1 /usr/bin/gcc-4.4 50 manual mode 2 /usr/bin/gcc-4.7 40 manual mode Press enter to keep the current choice[*], or type selection number:
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei xfonts-wqy sudo apt-get install ttf-arphic-ukai ttf-arphic-uming
apt-get install firmware-brcm80211然後 modprobe -r brcmsmac
# export LS_COLORS=none