Building Android kernel images
来源:互联网 发布:美团大数据 负责人 编辑:程序博客网 时间:2024/05/24 05:59
Below are the steps taken by me to build a working Android kernel image for the ADP1 (a.k.a. the developer G1). This image is based on linux kernel 2.6.27 and relies on the Android 1.5 "cupcake" radio image from HTC. If you are trying to build a kernel for a different version replace references to cupcake as appropriate below. As before this page is here as a reminder to me for when I come to do it again. This is what worked for me, your mileage may vary.
Before building the build environment needs to be set up:
- Install the Android SDK, as described previously
- Install repo and get the Android toolchain as per http://source.android.com/download.
- make sdk threw up an error about javac so I needed to sudo apt-get install sun-java6-jdk. I also needed to install g++, bison, flex and zlib1g-dev. I also had to follow this resolution as I got "No such file or directory" errors about X11/Xlib.h and X11/Xatom.h.
- Create a small ~/bin/g1make script for building to save me typing the same build parameters over and over again. I'm sure there are more elegant ways to do this but it works for me.
#!/bin/bash
make ARCH=arm CROSS_COMPILE=arm-eabi- $1 - Edit ~/.bashrc to add the cross-compilation toolchain to $PATH. Since I don't do much native compilation I also aliased make to g1make because I was frequently typing make out of habit and screwing up my build.
# Add in path to Android toolchain for compilation
export PATH=$PATH:/home/cianer/wandroid/src/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin
# Save my sanity when cross-compiling
alias make=g1make
alias realmake='/usr/bin/make'
Now get the source code:
- Checkout the source code from the git repository (see git guide if you are unfamiliar with it)
git clone git://android.git.kernel.org/kernel/msm.git
cianer@Feegle:~/msm$ git branch -r
origin/HEAD
origin/android-msm-2.6.25
origin/android-msm-2.6.27
origin/android-msm-htc-2.6.25
origin/msm-2.6.25
cianer@Feegle:~/msm$ git checkout --track -b android-msm-2.6.27 origin/android-msm-htc-2.6.27
Branch android-msm-2.6.27 set up to track remote branch refs/remotes/origin/android-msm-htc-2.6.27.
Switched to a new branch "android-msm-2.6.27"
cianer@Feegle:~/msm$ git branch
* android-msm-2.6.27
cianer@Feegle:~/msm$
cianer@Feegle:~/wandroid/msm$ adb pull /proc/config.gz .
84 KB/s (7233 bytes in 0.083s)
cianer@Feegle:~/wandroid/msm$ gunzip config.gz
cianer@Feegle:~/wandroid/msm$ mv config .config
Putting the new kernel onto the phone:
- Firstly ensure the phone has been upgraded to Android 1.5 as the radio image and system has to match the kernel.
- Backup the existing boot & recovery images from the phone as described in the android-dls.com AndroidWiki
cianer@Feegle:~/images$ adb shell
$ su
# cat /dev/mtd/mtd1 > /sdcard/mtd1.img
# cat /dev/mtd/mtd2 > /sdcard/mtd2.img
# exit
$ exit
cianer@Feegle:~/images$ adb pull /sdcard/mtd2.img .
1296 KB/s (2621440 bytes in 1.973s)
cianer@Feegle:~/images$ adb pull /sdcard/mtd1.img .
1516 KB/s (5242880 bytes in 3.376s)
cianer@Feegle:~/images$
cianer@Feegle:~/images$ unpack-bootimg.pl mtd2.img
kernel written to mtd2.img-kernel.gz
ramdisk written to mtd2.img-ramdisk.cpio.gz
488 blocks
gzip: ../mtd2.img-ramdisk.cpio.gz: decompression OK, trailing garbage ignored
extracted ramdisk contents to directory mtd2.img-ramdisk/
cianer@Feegle:~/images$
cianer@Feegle:~/images$ repack-bootimg.pl kernel.cupcake.gz mtd2.img-ramdisk img.cianer
488 blocks
repacked boot image written at img.cianer
cianer@Feegle:~/images$
cianer@Feegle:~/images$ adb push img.cianer /sdcard
1325 KB/s (1642496 bytes in 1.210s)
cianer@Feegle:~/images$ adb shell
$ su
# sync
# cat /dev/zero > /dev/mtd/mtd2
write: No space left on device
# flash_image boot /sdcard/img.cianer
# exit
$ exit
cianer@Feegle:~/images$
- Building Android kernel images
- Building Good Docker Images
- Building Kernel from source
- Integrated kernel building
- Building DVD Images Of Ubuntu Repositories
- Allwinner/Unpacking and building LiveSuit images
- Allwinner Unpacking and building LiveSuit images
- Building the linux kernel Image
- Building the Nexus 7 kernel
- 数莓派kernel building官方文档
- Building the kernel with clang
- Building Android Kernel for the Nexus 5 — AOSP(6.0.1)
- building Android
- Android Binary Images
- Docker Explained: Using Dockerfiles to Automate Building of Images
- Building a Linux Kernel from source
- Building a Small Embedded Linux Kernel Example
- building bootloader and kernel for pandaboard
- Xen 4.0安装 (收集)
- C# WebBrowser自动填表与提交
- RTEMS 的 AT91SAM9260 移植(9):Hello World
- 在PB窗口之间传递参数的方法
- Subversion TortoiseSVN文件夹及文件关联图标不显示
- Building Android kernel images
- 将窗口最小化为时钟旁的小图标
- 无阻塞的Javascript脚本(二)——动态脚本元素
- Xen的domain0无法启动xorg的问题
- java基础--程序中数据的保存
- PRAML学习笔记-信息论
- Invalidate与UpdateWindow
- Upgrade CentOS 5 x86_64 Xen
- 杯具