Building from source--cyanogenmod ROMを自分でコンパイルしたいですか?
From CyanogenMod Wiki
How do I compile the CyanogenMod kernel from source
The following instructions will enable the build of a CyanogenMod KERNEL, not the build of the CyanogenMod itself. As a matter of fact you will download the Google's Android source without the CyanogenMod modifications. If you want to build the CyanogenMod itself from source you should look at the following section (2.* of this document) "Building for Passion/Nexus One". Even if you don't go for these targets it should be a good help.
BEWARE! INEXPERIENCED USERS MAY BRICK THEIR PHONES!
These instructions have only been tested for 4.2.10.1 on 25 DEC 2009. This information may be out-of-date.
These instructions are for a Debian/Ubuntu 32bit system. If you have a different platform, more information can be found here and here .
Install CyanogenMod on your Phone
Take a backup
Better safe than sorry, boot into recovery and take a backup of your working phone.
Install Repo
- Install the various tools you will need.
And for 64bit only:sudo aptitude install git - core gnupg sun - java6 - jdk flex bison gperf libsdl - dev libesd0 - dev libwxgtk2. 6 - dev build - essential zip curl libncurses5 - dev zlib1g - devsudo aptitude install ia32 - libs lib32z1 - dev lib32ncurses5 - dev gcc - multilib g ++- multilib - Make sure you have a/bin directory in your/home directory
You should see something like '...:/home/user_name/bin:...' in a line of text. If you don't see this, try restarting your computer.cd ~/
mkdir bin
cd bin
echo $PATH - Download repo and make it executable curl http: // android.git.kernel.org/repo >~/bin/repo
chmod a + x ~/ bin / repo - Create a directory to hold you working files: mkdir ~/ mydroid
cd ~/ mydroid - Download the latest Repo:
If everything was successful, you should see a message like 'repo initialized in/mydroid'repo init - u git: // android.git.kernel.org/platform/manifest.git - Next, get the latest files:
This step may take a while.repo sync - Create an environment variable denoting the location of the android toolchain as follows: export CCOMPILER =/ home / $USER / mydroid / prebuilt / linux - x86 / toolchain / arm - eabi - 4.4 . 0 / bin / arm - eabi -
Prepare Kernel From Source
- Create a new directory in which to place the kernel source mkdir androkern
- Enter the kernel directory cd androkern
- Download the kernel git clone git: // github.com/cyanogen/cm-kernel.git
- Enter the source directory cd cm - kernel
- Retrieve a kernel .config file. This can be pulled from the phone or from a boot.img
- Retrieve a working kernel config from your phone: adb pull / proc / config.gz / home / user_name / androkern / cm - kernel / config.gz
- Unzip the config.gz and rename it to .config gunzip config.gz && mv config .config
- Unzip the config.gz and rename it to .config
- Alternatively, you can pull the .config from the newest boot.img
- scripts / extract - ikconfig boot.img > .config
-
- Retrieve a working kernel config from your phone:
- Run
Provide answers to the questions it asks, if any, or just keep pressing enter to accept defaults.make ARCH = arm CROSS_COMPILE = $CCOMPILER oldconfig - Customize the kernel make ARCH = arm CROSS_COMPILE = $CCOMPILER menuconfig
- Make the build
This step may take from minutes to hours.make ARCH = arm CROSS_COMPILE = $CCOMPILER
At this point you should have a kernel stored in cm-kernel/arch/arm/boot/zImage
Build CyanogenMod
-
cd ~/mydroid
-
source build/envsetup.sh
- Now you need choose which product you want to build, You can list all buildable product with
sed -n -e "s/^add_lunch_combo//gp" vendor/*/vendorsetup.sh
-
this load cyanogenmod productlunch cyanogen_dream_us-eng
-
build process is long... take a pizza, a beer and watch TV. The -j flag specifies how many threads the compiler should use. Rule of thumb is # of processors+1 but will vary with who you ask.make -j4
Next soon.
Complete the build
You need to merge this file with a working cyanogen ramdisk in order to create a boot image suitable for flashing.
Follow these instructions here in order to do so.
If all goes well, you should now be running your own custom CyanogenMod kernel on your phone.
If you are building for Nexus One then you should use --base 0x20000000 when running mkbootimg.
Building for Passion/Nexus One
This will explain how to build CM, using the code from Cyanogen's github repository.
Obtaining the code
Read the introduction and how-to on obtaining the source from http://source.android.com/ this is quite similar but won't cover the basics.
We use Cyanogens manifest file instead of theirs, it has all the good stuff in it.
Initialize your repository
-
mkdir ~/android-cm
-
cd ~/android-cm
-
repo init -u git://github.com/cyanogen/android.git -b eclair
-
repo sync
The sync can take quite some time, it pulls about 2gig of files.
Create build environment
-
cd ~/android-cm
-
source build/envsetup.sh
Build ADB (only required if you haven't built it yet)
-
make -j4 adb
Configure build
- Now you need choose which product you want to build, You can list all buildable products with
sed -n -e "s/^add_lunch_combo//gp" vendor/*/vendorsetup.sh
-
select a cyanogenmod build typelunch cyanogen_passion-userdebug
Get proprietary files from your device
-
cd ~/android-cm/vendor/google/passion
-
./extract-files.sh
-
cd -
Build it
Looks like we're ready to build
- start building
make -j4
Now this takes from 30 min to 2 hours, depending on your computer.
Once ready, all files will be placed in ~/android-cm/out/target/product/passion
You can now create a rom or just flash them with fastboot like this
-
cd ~/android-cm/out/target/product/passion
-
fastboot flash system system.img
-
fastboot flash boot boot.img
-
fastboot flash userdata userdata.img
-
fastboot reboot
TODO
- TODO: Explain how to compile wlan.ko in order to enable wifi.
- TODO: Explain how to provide other kernel modules for a chroot debian install on the G1.
- TODO: Explain how to compile the rest of CyanogenMod