- 1 Compiling kernel modules for Milestone's original kernel
- 2 Compiling kernel for Milestone
- 3 Kernel compilation on Windows(or other OSes that Colinux supports)
- 3.1 Colinux setup
- 3.2 Installation
- 3.3 Login
- 3.4 SSH
- 3.5 Accessing the host's file system
- 3.6 Attach a new file system to store the kernel build output
- 3.7 The basic
- 3.8 Cross-compiler toolchain
- 3.9 Grab the source
- 3.10 Prepare the build folder
- 3.11 Build now
Compiling kernel modules for Milestone's original kernel
- Linux system
- Build essentials
- Java JDK 5.0
- WxGTK 2.6
For Ubuntu 9.10 32-Bit:
$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
For Ubuntu 9.10 64-Bit:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev
Set the system to use the right version of java by default:
$ sudo update-java-alternatives -s java-1.5.0-sun
X11: Ubuntu doesn't have packages for the X11 libraries, but that can be worked around with the following command:
$ sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so
Setting up the Environment
- Refer to this page to find the kernel sources as they are specifically made for the Milestone...
- Download repo (a tool provided by Google to pull down the source code)
$ mkdir ~/bin $ export PATH=$PATH:~/bin $ curl http://android.git.kernel.org/repo >~/bin/repo $ chmod +x ~/bin/repo
Getting the Source
$ mkdir ~/foo $ cd ~/foo $ repo init -u git://android.git.kernel.org/platform/manifest.git $ repo sync
Create a kernel environment in your working directory
$ cd ~/foo $ mkdir kernel
After untarring archive_0115-kernel.tgz into the kernel directory, we're ready to build the kernel and modules. 's a config file prepared by xvilka in case you need it.
$ cd ~/foo $ make -f kernel/kernel.mk ENG_BLD=1
Your zImage (the kernel) will be located at ~/foo/motorola/bsp/prebuilt/target/images/zImage Your modules can be found in ~/foo/motorola/bsp/prebuilt/target/images/system/lib/modules/
- Place mtd-hack.c inside: ~/foo/kernel/drivers/mtd/
- Add this line to the Makefile: obj-m += mtd-hack.o
- Compile it with the same command as above.
$ make -f kernel/kernel.mk ENG_BLD=1
Compiling kernel for Milestone
Follow the instructions for cupcake for HTC Dream replacing cupcake with eclair and Dream with Milestone.
Kernel compilation on Windows(or other OSes that Colinux supports)
Kernel compilation on Windows could be a bit tricky. []((suggested by playya)) is used to ease the life. The smallest tool set is examined and the required storage space is provided for constrained build environment.
In this guide, the Ubuntu 9.04 1GB file system(download size is 4xMB) will be used.
Minimum storage requirement:
^ ^Size ^Description ^ | |1GB|Ubuntu 9.04 FS + basic tool + 74MB ARM tool chain| | |1.3GB(accounting for wasted size)|763MB build output + 384MB Kernel source + 2.6MB zImage and ko| |Total|2.3GB| |
Colinux consists of a user space kernel and a front-end(or layer) that sits on the OS side. It is capable of running a Linux natively on Windows. Due to the small download size required(around 60MB, Colinux+Ubuntu 9.04 FS), it could provide a quick jump into the Linux world on Windows.
The directory layout on Windows:
^Path ^Description ^ |[somewhere]\coLinux|Installation folder of coLinux| |[somewhere]\coLinux\fs|Sub-folder to put our linux|
Follow these steps or work on your own:
- Visit [] download link. - Download and install coLinux-0.7.5.exe((the lastest as of the time of writing)). - Skip the image download.(You may choose one there provided that they have apt-get) - Download [] - Unzip Ubuntu-9.04-1gb.7z to coLinux\fs. - Create a 1.3GB(or 1.5GB if u have more spaces) file as coLinux\fs\cobd2.img. See []. Create the file with the desired size first, then format it in coLinux later. - Copy coLinux\example.conf to coLinux\fs\ubu.conf. - Modify ubu.conf appropriately. Here is the diff: <file properties>
--- ../example.conf 2009-09-14 22:26:42.000000000 +0000
+++ ubu.conf 2010-03-03 07:32:13.000000000 +0000
@@ -20 +20 @@
@@ -41 +41 @@
@@ -47 +47 @@
@@ -50 +50 @@
@@ -57,0 +58,4 @@
</file> Edit the file to see most meaning of the settings. cofs0=d:\ will expose Windows d:\ drive to the cofs0 that can be mounted inside coLinux. To mount:
mkdir /mnt/d mount -t cofs 0 /mnt/dRemove cofs0=d:\ and cofs1=r:\ if you don't have these drives. Exposing a drive is important to extract downloaded tools from Windows. cobd2=fs\cobd2.img will expose a image file to the cobd2 device that will be used to store the build output. - Open a command prompt, cd to the directory of coLinux then start it by executing colinux-daemon @fs\ubu.conf. You should see a linux console popped up.
User id: root Password: root
Use alt+f1, alt+f2, ......etc to switch to another terminal.
Alternately, use ssh client like putty to connect to the host machine's port 22 as set by "eth0=slirp,,tcp:22:22". Putty gives better control on the scroll history and coloring.
Accessing the host's file system
To access host's file system, first specify<file properties>cofs0=r:\</file> in the ubu.conf above where r:\ is the drive you want to expose. Next start up coLinux then execute:
mount -t cofs 0 /mnt/r
Attach a new file system to store the kernel build output
The kernel build output is about
- See [] for how to create a file of size at least 1.3GB at coLinux\fs\cobd2.img. No need to format the image as it may take time. - Add <file properties>cobd2=fs\cobd2.img</file> to coLinux\fs\ubu.conf if you haven't done so yet. - Restart coLinux if it's running. - Login to linux, execute these:
mkfs.ext3 /dev/cobd2 # Be careful to type cobd2, not others!!
mkdir /mnt/cobd2 # Create an empty folder for mounting. mount -t ext3 /dev/cobd2 /mnt/cobd2
- Add the mounts to /etc/fstab if u want to save them from a reboot:<file>
/dev/cobd2 /mnt/cobd2 ext3 defaults 0 1 </file>
Minimum tool set
Install the needed tools:
apt-get install flex bison gperf build-essential zip
flex, bison and gperf are needed by the make to do some pre-processing on the source files.
There're several options:
- [Open Source Platform prebuilt snapshot]. Click on the snapshot link to get a tar. It's about 74MB uncompressed. - Android ndk (as tested 1.6 is arm-eabi-4.2.0 which doesn't support armv7-a architecture) - [G++ arm eabi tool-chain]. It is very large because all of its binary are statically linked. So it is not recommended.
Assume you've chosen 1 since it is the best current option. After downloaded the toolchain to r:\prebuilt-balhbalhbalbhabalh.tar.gz, execute:
tar xzf /mnt/r/prebuilt-balhbalhbalbhabalh.tar.gz -C ~
A prebuilt folder will be created in user home.
Build the kernel
Grab the source
Visit tools:kernel_sources to see the location of the kernel source. Milestone 01.15.0 has been tested. Extract the source to ~/android.
Prepare the build folder
/root # Home prebuilt # Untar the ARM tool chain to ~ android -> /mnt/cobd2 # ln -s /mnt/cobd2 android kernel # Milestone kernel source b.sh # Shell script to make
<file bash b.sh>
make -f kernel/kernel.mk KERNEL_CROSS_COMPILE=~/prebuilt/bin/arm-eabi- $* </file>
You may see an error about wilink_6_1. As long as you aren't going to build a whole system, you can ignore it. Otherwise, download the system-wlan source from tools:kernel_sources too.