samsung Galaxy SII源码内核编译实验+刷机
最近一星期做的事有点乱,主要是围绕I9100源码编译,库的替换以及刷机在进行。在此记录下过程,以便分享和查阅。
首先是从samsung官方开源站上(https://opensource.samsung.com/)下载了I9100的源码。
我下载的是港版系统GT-I9100_HK_Opensource.zip
解压出来后分为内核和源码两部分:
GT-I9100_HK_Kernel.tar.gz和GT-I9100_HK_Platform.tar.gz
分别说明如下:
README_kernel:
HOW TO BUILD KERNEL 2.6.35 FOR GT-I9100 HK
1. How to Build
- get Toolchain
Visit http://www.codesourcery.com/, download and install Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI.
Extract kernel source and move into the top directory.
$ toolchain\arm-eabi-4.4.0
$ cd kernel/
$ make c1_rev02_defconfig
$ make
2. Output files
- Kernel : kernel/arch/arm/boot/zImage
3. How to make .tar binary for downloading into target.
- change current directory to kernel/arch/arm/boot
- type following command
$ tar cvf GT-I9100_HK_Kernel.tar zImage
README_platform:
How to build platform
1. Get android open source.
: version info - Android gingerbread 2.3.3(r1)
( Download site : http://source.android.com )
2. Overwrite modules that you want to build.
- \external\webkit : Delete this source from tree at Android gingerbread and then copy webkit source from source root folder.
3. Copy the files to original Gingerbread source tree (overwrite) and then make
4. Add the following lines at the end of build/target/board/generic/BoardConfig.mk
BOARD_USES_ALSA_AUDIO := true
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_BCM := true
BT_ALT_STACK := true
BRCM_BT_USE_BTL_IF := true
BRCM_BTL_INCLUDE_A2DP := true
5. make -j16 PRODUCT-generic-user
在编译Platform时,我基本完全按照说明编译了源码,编译成功后,打算尝试替换I9100中的库,结果悲剧的不能启动系统了。
替换库:
在命令提示符中执行:
adb remount
adb push libstagefright.so /system/lib
重启后,无法进入系统,机器卡在启动画面:
事实说明,编译出的源码与手机上所安装的官方港版系统不一样。
没办法,只好重新刷系统。
从网上下载了港行ROM,在此简要记录下刷机步骤。
ROM:I9100_ZSKF4.zip
解压后包括CSC_I9100ZSKF4.tar,MODEM_I9100XXKE7.tar,Odin3_v1.83.exe,PDA_I9100ZSKF4.tar.md5,u1_02_20110310_emmc_EXT4.pit
关机后,同时按下音量减+HOME键+开机键,进入刷机模式
将手机连上电脑(需要安装好对应手机驱动),打开Odin3_v1.83.exe,按照下图选择刷机包内的各个文件以及选项,开刷:
(注意勾选Re-Partition)
完成后会自动启动。
刷机后第一件事自然就是ROOT。
ROOT用到四个工具(从机锋上下载):
Odin3,u1_02_20110310_emmc_EXT4.pit,SuperOneClick,XWKDD_insecure.tar
Root前记得先打开手机的usb调试模式。
接下来还是一样,关机后,同时按住音量向下键+home键+加开机键,根据提示按音量向上键,连上手机,在Odin3中设置如下:
开始后,打开SuperOneClick程序,直接点ROOT就ok。
完成后重启,ROOT就完成了。
期间还尝试了编译GT-I9100 HK内核KERNEL 2.6.35,不过因为手头上又有了新的事情,所以并没有进行编译,这里只是安装了工具链。
从https://sourcery.mentor.com/sgpp/lite/arm/portal/release1033上下载Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI
下载的arm-2009q3-68-arm-none-eabi.bin大小为92M。在ubuntu 11.10上安装过程如下:
wayne@wayne-pc:~$ sudo chmod +x arm-2009q3-68-arm-none-eabi.bin
[sudo] password for wayne:
wayne@wayne-pc:~$ ./arm-2009q3-68-arm-none-eabi.bin
The installer has detected that your system uses the dash shell
as /bin/sh. This shell is not supported by the installer.
You can work around this problem by changing /bin/sh to be a
symbolic link to a supported shell such as bash.
For example, on Ubuntu systems, execute this shell command:
% sudo dpkg-reconfigure -plow dash
Install as /bin/sh? No
Please refer to the Getting Started guide for more information,
or contact CodeSourcery Support for assistance.
在解决这个问题时,当时安装别人一个帖子的解决方法把/bin目录下的sh执行文件给删掉了,然后创建链接指向dash,结果悲剧了,执行.bin文件始终提示sh损坏。没办法,恢复它,从其它电脑上拷贝sh文件。
拷贝过来的sh需要赋予执行权限:
wayne@wayne-pc:/bin$ sudo chmod 777 sh
查看权限验证:
wayne@wayne-pc:/bin$ ls -al|grep sh
-rwxr-xr-x 1 root root 916692 2011-05-18 17:54 bash
-rwxr-xr-x 1 root root 96188 2011-05-03 23:01 dash
lrwxrwxrwx 1 root root 4 2011-11-15 21:02 rbash -> bash
-rwxrwxrwx 1 root root 96188 2011-11-24 15:07 sh
lrwxrwxrwx 1 root root 4 2011-11-15 21:02 sh.distrib -> bash
lrwxrwxrwx 1 root root 7 2011-11-15 21:02 static-sh -> busybox
ok。继续
wayne@wayne-pc:~$ ./arm-2009q3-68-arm-none-eabi.bin
Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
strings: '/lib/libc.so.6': No such file
Launching installer...
采用默认设置直到安装完成。
接下来的时间,准备定制ROM编译CyanogenMod刷到I9100上,敬请期待,欢迎交流指正。
作者:Wayne
出处:http://www.cnblogs.com/dwayne/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意请保留此段声明,且在文章页面明显位置给出原文链接。