![]() |
How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Beginners
This is a quick guide on getting started with compiling Android for the Touch Pro 2 from the git repositories. I am going to try to keep this short and simple, so I will be using my personal preference of software though others will work fine. This was made at the request of few people in the NAND testing thread, but I will try to include information for the non-NAND people too.
Required Tools Virtualbox Ubuntu (32bit is fine) Note: I recommend 10.04 for better stability with Virtualbox, but 10.10 does work just fine. 10 GB of disk space High Speed Internet Connection 2 hours of time (about 30 minutes of actual interaction) Installing Linux First, install VirtualBox leaving everything as default. Now, click New and type Ubuntu 10.4 (or 10.10) for the name. Make sure Ubuntu is in the name so it auto-configures some options for us. For memory, I recommend 1 GB unless you have more than 4GB of RAM. For drives, leave the defaults and just keep clicking Next until it finishes. Before you click Start, we want to optimize the settings and attach the ISO so it will boot from “CD”. To do this, Select Ubuntu 10.4 (or 10.10) and click Settings. Here are the settings you need to change: Under the System section on the Motherboard tab, check Enable IO APIC, and on the Processor tab, Set Processor Count to the number of cores on your processor. Under the Storage section, click on IDE Controller and change Type to ICH6. Now, click on the CD labeled Empty, then click the Folder with the green up arrow to open the Virtual Media Manager. Click Add and browse to the ISO you downloaded, click Open, click Select, and then click OK. Now we can start the VM and install Ubuntu. Click Start and wait for the plum background with the keyboard at the bottom, press the down arrow and select Install Ubuntu. Keep clicking Forward until you can click Install Now. Follow the rest of the prompts while Ubuntu installs. Preparing the Environment Once Ubuntu is up and running, we need to install three software packages: Virtualbox Additions, git-core and wine. To install the VBox Additions, click Devices-CD/DVD Devices, and select VBoxGuestAdditions.iso. It never auto-runs for me, so I have to click Places, VBOXADDITIONS, then run autorun.sh, install and restart so we can copy/paste between Windows and Ubuntu :wink: Terminal is where we spend the rest of our time, so click Applications-Accessories, and drag Terminal to the taskbar. Now open Terminal and copy/paste the following into it: Code:
sudo apt-get install git-core NAND users will also need the following: Code:
git clone git://gitorious.org/~acl/linux-on-qualcomm-s-msm/linux-msm-rhod-nand.git Code:
git clone git://gitorious.org/linux-on-qualcomm-s-msm/linux-msm.git Compiling Kernel and Modules Now that you have everything downloaded, we are ready to start compiling. The developers have done an awesome job with the Makefiles, so we only need to worry about the toolchain (to compile ARM code using an x86 processor) and the defconfig (configuration that determines what gets built). If you wanted to simply compile the zImage and modules, using Terminal, copy/paste the following: Code:
cd android Haret users should use the following: Code:
cd android To set upsquashfs tools, download squashfs tools from here: ftp://ftp.slax.org/source/slax/sqlzm...shfs3.4.tar.gz Now, extract the files, then browse into the squashfs3.4/squashfs-tools folder, then type make, then sudo make install. On Haret, they load the modules from a tar.gz on in /sdcard/andboot. The name will be modules-2.6.27.46-01192-version.tar.gz. To get the version, try running: Code:
cat ~/android/linux-msm-rhod-nand/include/config/kernel.release androidupdate.tgz Since the modules are now applied through androidupdate.tgz, you will need to make a directory structure in ~/android to look like this: ~/android |--- androidupdate |--- data |--- system |--- lib |--- modules The modules squash file should be put under /androidupdate/system/lib/modules. Also, any files that you want updated in either data or system can be placed in here. For example, if you want to include certain APK's, you can put them under /system/app or /data/app. Compiling Initrd.gz For NAND, we have our own initrd.gz in the bootenv git that we cloned. We try to rebuild these and commit them every time we update bootenv, but sometimes the change doesn't affect enough rebuild and upload. So, I always recommend rebuilding initrd.gz fresh and copying that into ~/android/tinboot-linux-msm/kernel. You can build this very easily by simply browsing to ~/android/bootenv and running sh buildInitrd.sh Compiling Tinboot Tinboot has been changed significantly to only use 1 cmdline for all devices :). If you are compiling for NAND, you will need to use the initrd.gz from the bootenv git we cloned. If you are compiling for Haret, you will need the initrd.gz from Main Page - The XDAndroid Project. Just grab the latest and copy that along with the zImage into ~/android/tinboot-linux-msm/kernel. If you want to overclock the processor, change the lcd density, or change anything else, you can modify ~/android/tinboot-linux-msm/tinboot/tinboot2.S Changing this file is extremely simple, but you can really mess things up if you change some of the code. I would only recommend changing the line that starts with .asciz. So, let's open tinboot2.S in gedit, find .asciz, and make the changes to the command line. If you want to overclock, add acpuclock.oc_freq_khz=716800 (change number to whatever overclock your phone can handle). If you are cooking a ROM, you can change the mtdparts to change the size of the partitions. All values are in HEX, and I will have a separate post for NAND chefs that will explain this much better. We are now ready to compile. Unfortunately, the scripts on git require quite a bit of tweaking to get working. For now, try using the full build or tinboot script that I have posted in the second post. Making the RootFS (Haret Only) The RootFS is a little different since there is no simple make command. The current way to "compile" the RootFS is through the script located here: generate-rootfs.sh Attempting to modify this script always ended up giving me weird genext2fs warnings, and I found it to be much cleaner to just use the script as is. Instead, I choose to inject my modified init file right before genext2fs creates rootfs.img. Also, note that the script will throw a warning about .git not found or something similar. That is something from the gitclean.sh and can be ignored. Code:
cd "${TMPDIR}"/"${REPODIR}" |
Re: How To Compile Your Own Kernels, Modules, Tinboot (for NAND booting), and More
Below is a copy of my full build script for NAND. Haret users will have to make a few changes which I'll explain later. Just copy/paste it into gedit and save as fullbuild.sh and run it from terminal. You may need to change the directory paths at the beginning if you don't put them where I recommended.
Code:
#!/bin/sh What the heck is zImage, modules, tinboot, rootfs, initrd, and System.ext2? This section will be updated slowly as I have time. The zImage is the kernel (which is required to run the operating system). We currently use the linux kernel 2.6.27.46. The modules are your drivers. These are a matched pair with the zImage/kernel. It is also important to clean up the modules periodically when building the kernel/modules or you will start running out of space :) Awesome explanation of the kernel and its modules here: http://www.howtogeek.com/howto/31632...at-does-it-do/ Tinboot is the bootloader for running Android from the NAND. Currently, we put initrd.gz and the zImage on the NAND while the zImage, rootfs, and System.ext2 are pulled from the SD Card. RootFS is a special type of ramfs file system. It basically lets us use part of the memory as a partition for caching files. This gives us a nice performance boost :) Initrd is an initial RAM disk that is temporary and used only for booting. Generally it uses a slightly different scheme than rootfs does. System.ext2 is your file system. This is technically your hard drive where all of the Android files and applications are stored. It uses the ext2 file system which is an extended file system designed specifically for linux. |
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
Thanks for the info on this Nate! :occasion5:
|
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
I've compiled for HARET before once. This really helps though.
Thanks! |
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
Can't seem to get past this step:
Code:
make ARCH=arm linux-msm-nand-defconfig Code:
~/Desktop/Android/linux-msm-rhod-nand$ make ARCH=arm linux-msm-nand-defconfig Thanks! |
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
Quote:
|
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
Quote:
But the Next Step: Code:
make ARCH=arm CROSS_COMPILE=~/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- INSTALL_MOD_PATH=~/android/modules zImage modules modules_install Code:
make: /home/lance/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc: Command not found |
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
Quote:
|
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
FYI this "how to" is ACL approved :-)
:thumbright: |
Re: How To Compile Your Own Kernels, Modules, Tinboot (NAND boot), and More for Begin
This is a GREAT thread, thanks Nate
|
All times are GMT -4. The time now is 03:32 PM. |
Powered by vBulletin® ©2000 - 2025, Jelsoft Enterprises Ltd.
©2012 - PPCGeeks.com