Remove All Ads from XDA

Builing your own Ouya Kernel

10 posts
Thanks Meter: 3
By leonardopires, Junior Member on 2nd July 2014, 10:51 PM
Post Reply Subscribe to Thread Email Thread

I made a tutorial explaining how to compile the ouya's kernel from scratch.

I made this tutorial because I needed to enable the nfs protocol versions 3 and 4 to use file shares from my Synology NAS. The ouya's kernel enabled by default only comes with version 2 and i had problems to mount my NFS shares.

Let's start. my english is not very good then ignore the grammatical errors.

Let's first download the required files. I'm on the premise that you have an ubuntu linux installed on your machine.


1. Open your browser and type:

2. Search for a string like this: (this is the latest version of ouya firmware)

3. Download it:

$ wget

2. Create a directory an put the file there:

$ mkdir ouyafiles

4. unzip it:

$ unzip

5. Now you have a lot of files and directories. We need only one. The name of file is: boot.img. We need to unzip this file to retrieve the ramdisk file that will be needed along with the compiled kernel. For this we need to download the following perl script:

$ wget

5. Rename the script and change the permissions to execute:

$ mv split_bootimg_pl.txt
$ chmod 755

6. Run this command to unpack the file:

$ ./ boot.img

7. Now you have 2 files: boot.img-kernel and boot.img-ramdisk.gz. We only need the boot.img-ramdisk.gz. Lets unzip this again and rename the unzipped file:

$ gzip -dc ../boot.img-ramdisk.gz | cpio -i
$ mv boot.img-ramdisk ramdisk

8. OK. Now you have this file. We will use it later in the tutorial.


1. Open the Browser and paste this URL:

2. Download the Linux 64-bit (x86) package file:

$ wget

3. Unzip it:

$ tar -jxvf android-ndk-r9d-linux-x86_64.tar.bz2

4. Rename the unzipped directory to "ndk":

$ mv android-ndk-r9d ndk

5. Load the environment variables:

$ export CROSS_COMPILE=/your_home_directory/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
$ export ARCH=arm

Obs.: (remember the /your_home_directory/ is the default home directory that you user in linux uses to work).


1. Open your browser and go to this URL:

2. In the right side of the page you will have a download button called "Download ZIP". Click and Download it.

3. Unpack it and rename the unzipped directory to "kernel"

4. Maybe the /kernel/drivers/pci/Kconfig file will corrupt before unzip the file. Kconfig is a symbolic link. Remove it and Download again using the command inside the kernel/drivers/pci/ directory:

$ wget

6. Now you have the default ouya kernel for compile!


1. You need to retrieve a file that is in ouya. To retrieve the file you need install the package android-tools-adb. use the following command:

$ sudo apt-get install android-tools-adb

2. Now you have to connect your ouya via usb. By default your ouya don't enable adb. You need to go to DEVELOPMENT screen on your ouya and enable “ADB: ON”.

3. Fine. Now test if the adb is connecting. Try this commands:

$ adb start-server
$ adb devices (this will show something like this “1234567890ABCDEF device”)

PS.: if no devices appears... you need to search in the internet about “how to use adb to connect android devices”

4. Now you will pull the config file:

$ adb pull /proc/config.gz config.gz (this will pull config.gz to your computer)

5. Unzip it and copy to kernel directory:

$ gunzip config.gz
$ cp config /your_home_directory/kernel/.config

6. Now your kernel is ready to compile. We're ensuring that the standards are consistent settings. From now on it is your responsibility to enable and disable kernel configurations.


1. Go to Kernel Directory:

$ cd /your_home_directory/kernel/

2. Make sure to run the environment variables CROSS_COMPILE and ARCH described above in the tutorial.

$ export CROSS_COMPILE=/your_home_directory/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
$ export ARCH=arm

3. Use this command to change some settings:

$ make menuconfig

4. Use this command to build the kernel after you change your new settings:

$ make

5. Some warnings will display in your console... its normal.

6. if the process run ok you 'll have a bzImage file under the directory kernel/arch/arm/boot

7. copy this file to the same directory where you store the ramdisk file.


1. You will need to install the fastboot on linux using this command:

$ apt-get install android-tools-fastboot

2. Now you have to reboot your device in bootloader mode:

$ adb reboot-bootloader

3. You can check if you devices enters in this mode using this command:

$ fastboot devices

4. If it works. You can upload your new kernel and the default ramdisk:

$ fastboot flash:raw boot ./zImage ./ramdisk

The system should now boot with your custom kernel installed!
The Following 3 Users Say Thank You to leonardopires For This Useful Post: [ View ] Gift leonardopires Ad-Free
2nd June 2015, 05:27 AM |#2  
Junior Member
Thanks Meter: 0
Thumbs up

$ mv boot.img-ramdisk ramdisk

Why do we need this? Can't we simply copy it from an existing OUYA machine?



The current android-ndk-r10e only has androideabi-4.8 and androideabi-4.9. Can I use them, too?

Edit: I got an error ("unknown CPU architecture") with android-ndk-r10e and arm-linux-androideabi-4.8 so I used android-ndk-r9d with arm-linux-androideabi-4.6, and that worked.


6. if the process run ok you 'll have a bzImage file

It's actually a zImage file (without the b).

Thank you so much for the tutorial!
Last edited by cweiske; 2nd June 2015 at 10:27 PM. Reason: abi question
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes