主题 : 一起来做mini2440的Android的根文件系统 复制链接 | 浏览器收藏 | 打印
Just do it
级别: 侠客
UID: 2754
精华: 4
发帖: 66
金钱: 2435 两
威望: 873 点
贡献值: 40 点
综合积分: 212 分
注册时间: 2008-12-07
最后登录: 2016-04-13
10楼  发表于: 2009-09-08 20:25
$ mkdir ~/mydroid
$ cd ~/mydroid
repo init -u git://git.koolu.org/freerunner/platform/manifest.git -b koolu-1.0
repo sync
make TARGET_PRODUCT=freerunner
编译不过时安装过下面的 fakeroot、iblzo2-dev
编译PASS后,在mydroid运行下面的脚本,脚本如下:

#./cp_android_OS release
脚本内容如下:
#!/bin/sh

ANDROID_OUT=./out
ANDROID_DEVICE=freerunner
EXPORT_ROOT=`pwd`/export

Usage()
{
    echo "Usage: $0 release|debug"
}

CopyAndroid()
{
    if [ -d $1 ]
    then
        echo "Copying from $1 to $EXPORT_ROOT..."
        sudo rm -rf $EXPORT_ROOT/
        sudo mkdir -p $EXPORT_ROOT/root

        # Copy the image...
        cd $1
        tar cf - root | (cd $EXPORT_ROOT; sudo tar xf -)
        tar cf - system | (cd $EXPORT_ROOT/root; sudo tar xf -)

        # Change owner and permissions...
        cd $EXPORT_ROOT
        sudo chown -R root:root root
        sudo chmod -R 777 root
    else
        echo "$1 does not exist!"
    fi
}

if [ $# != 1 ]
then
    Usage
else
    case $1 in
        release)
        CopyAndroid $ANDROID_OUT/target/product/$ANDROID_DEVICE/
        ;;
        debug)
        CopyAndroid $ANDROID_OUT/debug/target/product/$ANDROID_DEVICE/
        ;;
        *)
        Usage
    esac
fi
这样在mydroid/export下出现/root文件夹
就是制作好的根文件系统size为44.3M

修改下面的init.rc文件:
除去所有mout命令,
    # Open up access to GSM interface
    #chown radio /dev/s3c2410_serial0

    # Open up access to GPS interface
    #chmod 666 /dev/s3c2410_serial1
    注释掉这两行,否则不能输入命令
内核启动信息:                                                      
Warning: unable to open an initial console.                                    
init: cannot open '/initlogo.rle'                                              
init: cannot find '/system/bin/playmp3', disabling 'bootsound'                  
init: cannot find '/system/bin/flash_image', disabling 'flash_recovery'        
sh: can't access tty; job control turned off      

#logcat -d>/error
#cat error
由于log信息太长,我放在附件里,请kasim大侠帮忙看看,我没折了,好像很多用koole android都遇到和我类似的问题,不知道你是不是
修改代码了,或者是有了别的版本的android代码
[ 此帖被jeefjiang在2009-09-08 20:31重新编辑 ]
描述:logcat
附件: jeef.rar (6 K) 下载次数:43
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
11楼  发表于: 2009-09-09 09:35

E/AudioHardwareALSA( 1634): Unable to attach mixer to device AndroidPlayback: No such file or directory
E/AudioHardwareALSA( 1634): Unable to attach mixer to device default: No such file or directory
E/AudioHardwareALSA( 1634): Unable to attach mixer to device AndroidRecord: No such file or directory
E/AudioHardwareALSA( 1634): Unable to attach mixer to device default: No such file or directory
I/DEBUG   ( 1617): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 1617): Build fingerprint: 'neo/freerunner/freerunner/:1.0/TC3/eng.jeef.20090827.161235:eng/test-keys'
I/DEBUG   ( 1617): pid: 1634, tid: 1634  >>> /system/bin/mediaserver <<<
I/DEBUG   ( 1617): signal 11 (SIGSEGV), fault addr 00000010

这个问题我也遇到过,因为内核里没有mini2440的UDA1341 ALSA驱动,系统找不到一个可以用音频设备,造成mediaserver不断异常退出,进而造成Android Runtime无法正常运行。
我的解决办法是移植了http://repo.or.cz/w/linux-2.6/mini2440.git里的UDA1341 ALSA驱动。
另外,Android似乎还需要power supply class驱动,用来侦测电池电量,否则系统启动会因为无法知道电池剩余电量而自动关机。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
12楼  发表于: 2009-09-09 09:37
顺便说一句,你可以用koolu更新一些的cupcake branch:

repo init -u git://git.koolu.org/freerunner/platform/manifest.git -b cupcacke
repo sync
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
13楼  发表于: 2009-09-09 10:19
这是我用koolu cupcake做的image在clean boot时logcat的输出,供你参考
附件: koolu_cupcake_boot_logcat.zip (10 K) 下载次数:48
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
Just do it
级别: 侠客
UID: 2754
精华: 4
发帖: 66
金钱: 2435 两
威望: 873 点
贡献值: 40 点
综合积分: 212 分
注册时间: 2008-12-07
最后登录: 2016-04-13
14楼  发表于: 2009-09-09 12:19
恩,谢谢了,不过不能显示UI应该和音频驱动没什么关系,我用带有音频驱动的内核一样会出现这个现象。请问你的Linux内核编译和文件系统的编译时分开进行的吧
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
15楼  发表于: 2009-09-09 12:58
引用第14楼jeefjiang于2009-09-09 12:19发表的  :
恩,谢谢了,不过不能显示UI应该和音频驱动没什么关系,我用带有音频驱动的内核一样会出现这个现象。请问你的Linux内核编译和文件系统的编译时分开进行的吧

我在koolu的内核源代码里(git://git.koolu.org/kernel/openmoko.git)加入了mini2440的支持,它在执行make TARGET_PRODUCT=freerunner的时候会一起编译。
要让Android的UI正常跑起来,至少zygote service要能够正常启动
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
Just do it
级别: 侠客
UID: 2754
精华: 4
发帖: 66
金钱: 2435 两
威望: 873 点
贡献值: 40 点
综合积分: 212 分
注册时间: 2008-12-07
最后登录: 2016-04-13
16楼  发表于: 2009-09-09 14:35
恩,那是当然的,
Zygote forks a new VM instance for the System Service process and starts the service。
我觉得UI能看到,应该启动Surface Flinger
Just do it
级别: 侠客
UID: 2754
精华: 4
发帖: 66
金钱: 2435 两
威望: 873 点
贡献值: 40 点
综合积分: 212 分
注册时间: 2008-12-07
最后登录: 2016-04-13
17楼  发表于: 2009-09-13 19:16
感谢kasim大侠,cupcake的分支用现在终于已经可以看到图像界面了
不过又出现了一个新的问题
正如你所说,启动后自动关机,参考blog对cupcake代码做如下更改:

Android 系统启动时检测电源状态,若检测不到 battery level
  则自动把battery level设置为 0 ,并自动关机,无法进入系统。
  为调试方便,绕过电源管理。

  为解决此问题需修改
  frameworks/base/services/jni/com_android_server_BatteryService.cpp
      
   1、void setIntField(JNIEnv* env, jobject obj, const char* path,
jfieldID fieldID)函数中置 jint value = 1;

       2、在android_server_BatteryService_update 中 置电池状态为Full,
Good :
        
    if (readFromFile(BATTERY_STATUS_PATH, buf, SIZE) > 0)
        env->SetIntField(obj, gFieldIds.mBatteryStatus,
gConstants.statusFull);

    if (readFromFile(BATTERY_HEALTH_PATH, buf, SIZE) > 0)
        env->SetIntField(obj,
gFieldIds.mBatteryHealth,gConstants.healthGood);

    if (readFromFile(BATTERY_TECHNOLOGY_PATH, buf, SIZE) > 0)
        env->SetObjectField(obj, gFieldIds.mBatteryTechnology,
env->NewStringUTF("1"));
更改后不再关机:UI显示:
NO SERVICES
5:53 AM
03-26-2000
CONNECT YOUR CHARGER
SCREEN LOCKED
PRESS MENU TO UNLOCK
我按K2键,屏幕依然锁着,进入不了HOME
用的内核时android版主的内核,kasim大侠说要选
power supply class驱动,这个是内核config选项吗?
好像找不到
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
18楼  发表于: 2009-09-14 12:05
建议你先读一读这篇文章,了解一下Android上key layout和key charmap的原理
http://www.kandroid.org/android_pdk/keymaps_keyboard_input.html

我说明一下为什么用shinelk的内核和文件系统,可以用K4键作为MENU key解锁键盘:
1. 内核中的按键驱动对于K1, K2, K3, K4, K5, K6这6个键的scan code分别是75,74,73,71,72,70 (详细内容见内核源代码http://www.arm123.com.cn/android/android-kernel-20090825.tgz 中的/drivers/char/mini2440_buttons.c)
2. 文件系统(http://www.arm123.com.cn/android/android-fs-20090825.tgz)中没有包含mini2440键盘对应的key layout文件(.kl文件),因此Android将用默认的/system/usr/keylayout/qwerty.kl, 在这里面你会发现,MENU键对应的scan code为‘71’

复制代码
  1. key 70   BACK              WAKE_DROPPED
  2. key 71   MENU              WAKE_DROPPED
  3. key 72   SOFT_RIGHT        WAKE
  4. key 73   VOLUME_DOWN
  5. key 74   DPAD_CENTER       WAKE_DROPPED
  6. key 75   VOLUME_UP
  7. ...

以上就是为了支持mini2440按键而在加入qwerty.kl里加入的东西。

知道该怎么做了?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
19楼  发表于: 2009-09-14 12:12
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."