How to compile CyanogenMod 10.1 for your Samsung D2ATT
This post is a copy of the guide found at http://lindroidsoup.com/so-you-want-to-build-androidIt's a compilation of guides I've used along the way. It details the work-arounds I've used to get builds to complete, so I thought it would be nice to share. Special thank you to guys like DesignGears, pmos69, and Task650 for inspiring me to lean more about Android
Tired of flashing someone else’s ROM? Ready to make your own? Read on!
This tutorial will take you from scratch to ROM with a clean new build of CyanogenMod 10.1 that you can slap on your AT&T SGS III as a daily driver. Once you’ve got the concept down, you’ll be able to change it up and build for whatever you’d like. Let’s take a look at what we’ll need to get going:
_______________________________
PREREQUISITES
Anything less would be uncivilized
Broadband Internet Connection (No, this IS a must. Attempting to sync a repo with dial-up will make your brain explode. Really).
A rooted Samsung Galaxy SIII D2ATT with CyanogenMod 10.1 or newer already flashed on it.
A 64bit Ubuntu 12.04 or later based Linux OS installed on your PC, or in a VM with adequate resources (at least 2 cores and 2-4GB RAM). This guide was written on Kubuntu 13.04, but even Mint works- notes included below.
@50GB of disk space to be used for repo storage and building.
Free Time (@3-6hrs, depending on the chomping power of your PC and the speed of your broadband).
_______________________________
!!!!! DISCLAIMER !!!!!
This tutorial is posted as a guide for the adventurous who are eager to learn the basics of compiling a ROM. The procedures detailed here do have the ability to miff up your mobile device if something goes wrong. Since it has now been listed as a warning, you follow this guide at your own risk, and I take absolutely no responsibility for any consequences that result from any mishaps you may encounter.
Part 1 – Setting Up The Environment
1.1 – Install The Necessary Packages
Copy and paste everything after the prompt symbol (~$) in terminal. A new prompt means a new line:
Code:
~$ sudo apt-get install git-core gnupg flex bison python rar original-awk gawk p7zip-full gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool
~$ sudo apt-get install libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils
~$ sudo apt-get install g++-multilib lib32z1-dev ia32-libs lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib xsltproc
1.2 – Make Sure We Have The Right JAVA
If you try to compile with anything other than JDK 1.6, you’ll receive errors and fail to compile. If you try to download JDK 1.6 from the Oracle site, you’ll have a heck-of-a-time trying to find their archives. Luckily LindroidSoup.com just happens to have a copy of a JDK you can use…
http://lindroidsoup.com/Downloads/jdk-6u35-linux-x64.bin
Once you have the JDK downloaded, make sure you move it into your home directory. Then we’ll need to clear out any other versions of Java installed on the machine.
Code:
~$ sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Now we’re clear to install the correct JDK.
Code:
~$ sudo mkdir -p /opt/java/64 && sudo cp jdk-6u35-linux-x64.bin /opt/java/64
~$ sudo su -
~$ cd /opt/java/64 && chmod +x jdk-6u35-linux-x64.bin
~$ ./jdk-6u35-linux-x64.bin
~$ exit
Now we need to make our first PATH entry. Using your text editor of choice, (I use nano, some use vi, others use gedit…just pick one) we’ll need to add the following to our .bashrc file:
_________________________IMPORTANT NOTE FOR LINUX MINT USERSIf you’re using Linux Mint, you’ll need to make sure you’re editing the .bashrc file located at /etc/bash.bashrc
So if you see a reference to "~/.bashrc", you should replace it with "/etc/bash.bashrc"
Got it? Good.
_________________________
Code:
~$ sudo nano ~/.bashrc
Once the file is opened up, paste in the following at the end of the file, save, and close it.
Code:
#Java PATH
export JAVA_HOME=/opt/java/64/jdk1.6.0_35
export PATH=$PATH:$JAVA_HOME/bin
1.3 - Install The Android SDK
Now that we have our JAVA situated, it’s on to installing the Android SDK. Once again, LindroidSoup is your one-stop-shop- hit the link below for the 64bit Linux flavor of the SDK. Make sure to move it to your home directory once it’s downloaded.
http://lindroidsoup.com/Downloads/adt-bundle-linux-x86_64-20130917.zip
Let’s set up our SDK directory, and put the SDK in place.
Code:
~$ cd ~
~$ mkdir android && mkdir android/sdk
~$ sudo cp adt-bundle-linux-x86_64-20130917.zip android/sdk
~$ cd android/sdk && unzip adt-bundle-linux-x86_64-20130917.zip
~$ sudo rm -rf adt-bundle-linux-x86_64-20130917.zip && cd adt-bundle-linux-x86_64-20130917/sdk
~$ sudo cp -R platform-tools ../.. && sudo cp -R tools ../..
Now we’ll need to make sure the platform-tools and tools have the proper ownership, or the command “android” won’t work when we invoke it after adding the tools to our PATH.
You’ll need to know your username for this one- it’s pretty easy, but for those new to the scene your username is what you see listed before the “@” symbol in your prompt. For instance, my prompt shows
Code:
[email protected]:~$>
So my username is “christopher”. Now we can correct the ownership of the files, just replace each instance of username on both sides of the colons below with your username:
Code:
~$ cd ~/android/sdk
~$ sudo chown -R username:username platform-tools && sudo chown -R username:username tools
We can now add the Android SDK to our PATH, and we’ll also need to add an Extra PATH for our Device. Mint users, don’t forget to edit /etc/bash.bashrc, not ~/.bashrc.
Code:
~$ sudo nano ~/.bashrc
Once the file is opened up, paste in the following at the end of the file, save, and close it.
Code:
#Android PATH
export PATH=$PATH:~/android/sdk
export PATH=$PATH:~/android/sdk/platform-tools
export PATH=$PATH:~/android/sdk/tools
And the Extra PATH for our device. **NOTE** Mint users will edit the same file this time.
Code:
~$ sudo nano /etc/udev/rules.d/99-android.rules
Code:
#Samsung
SUBSYSTEM==usb, SYSFS{idVendor}==04e8, MODE=0666
SUBSYSTEM==”usb”, ATTRS{idVendor}==”####:####”, SYMLINK+=”android_adb”, MODE=”0666″ GROUP=”plugdev”
TEST==”/var/run/ConsoleKit/database”, \
RUN+=”udev-acl –action=$env{action} –device=$env{DEVNAME}”
Let’s make that file executable, shall we?
Code:
~$ sudo chmod +x /etc/udev/rules.d/99-android.rules
Ok, now we’ll need to close our terminal and open a new one to load all the changes we’ve made to this point.
Failure To Close And Open A New Terminal At This Point Will Cause The Android Command To Fail!
Oooh. That looked important. We should make sure we do that then. Close your terminal and open a new one.
Now to install the tools:
Code:
~$ android
The “android” command will open up the Android SDK Manager. Make sure that both the “Android SDK Tools” and “Android SDK Platform-Tools” show to be installed. If they don’t show to be, make sure you install them.
Part 2 – Gettin’ That Source Code
2.1 – Installing The Repository
Now comes the part where you’ll need to find something to do for awhile. A long while. We’re going to initialize the repository, and then start the sync process to pull in the majority of the Android Source code you’ll need to compile your ROM- but it’s several gigabytes of data and will take a fair amount of time to sync.
Code:
~$ mkdir -p ~/bin
~$ mkdir -p ~/android/system
~$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
~$ chmod a+x ~/bin/repo
And then we can make our PATH entry for the repository. Again- Mint users need to edit /etc/bash.bashrc.
Code:
~$ sudo nano ~/.bashrc
Once the file is opened up, paste in the following at the end of the file, save, and close it.
Code:
#Repo PATH
export PATH=$PATH:~/bin
We need to close our terminal again, and open another one to load our changes.
Failure To Close And Open A New Terminal At This Point Will Cause The Repo Sync Command To Fail!
Close your terminal and open a new one.
This next batch of commands will start the repo sync.
Helpful Tip
The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date. The CM manifests include a sensible default configuration for repo, which they strongly suggest you use (i.e., don’t add any options to sync). For reference, their current default values are -j4, and -c. The “-j4” part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j3 or -j2. “-c” will ask repo to pull in only the current branch, instead of the entire CM history.
Code:
~$ cd ~/android/system
~$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
~$ repo sync -j4
2.2 – Grab The Device Code
Now that we have the Android Source Code, we need to pull in the code specifically for the D2ATT. We’re going to be pulling specifically from CyanogenMod’s Github, so you’ll need to make sure git is configured correctly on your machine- if their github doesn’t know who you are, you get no git! Make sure to enter you own info when configuring git. (NOTE- Those are double dashes in front of "global". Not sure why, but universally text boxes don't seem to like them, and don't display them correctly)
Code:
~$ git config –global user.name (firstname.lastname)
~$ git config –global user.email ([email protected])
Just so no one is confused, it should read like the following:
Code:
~$ git config –global user.name john.doe
~$ git config –global user.email [email protected]
Now we can use git to pull in the device code:
Code:
~$ git clone https://github.com/CyanogenMod/android_device_samsung_d2att.git -b jellybean device/samsung/d2att
~$ git clone https://github.com/CyanogenMod/android_kernel_samsung_d2.git -b jellybean kernel/samsung/msm8960
Now we can get the prebuilts from CyanogenMod as well:
Code:
~$ cd ~/android/system/vendor/cm && ./get-prebuilts
2.3 - Breakfast
Now that we have all our device specific code from both the Android and CyanogenMod repo’s, we can setup our environment and make breakfast.
Code:
~$ cd ~/android/system
~$ source build/envsetup.sh
~$ breakfast d2att
2.4 - Extracting The Blobs
The manufacturer “blobs” are kind of like a PC’s device drivers. You have to have the specific ones for the phone’s hardware, or your ROM probably won’t do important stuff- like showing anything on the display… Let’s go get them.
Now, we have two separate ways of going about this:
Option 1 –
Connect your phone to your pc via usb. You’ll need to make sure you have “UserDebug” mode enabled, as well as “Root Access for Apps and ADB” under the Developer Options of the phone.
Code:
~$ cd ~/android/system/device/samsung/d2att
~$ ./extract-files.sh
Option 2 –
Extract them from an existing CyanogenMod ROM. You’ll need to make sure you have a current copy of a CyanogenMod Nightly ROM downloaded and extracted, and you’ll need to know the path to it.
CyanogenMod Nightlies can be found here: http://download.cyanogenmod.org/?type=nightly&device=d2att
Code:
~$ cd ~/android/system/device/samsung/d2att
~$ ./extract-files.sh path/to/your/extracted/ROM
Just so everyone is clear, if I extracted my nightly ROM inside my Downloads folder- my command for Option 2 would look like this:
Code:
~$ ./extract-files.sh /home/christopher/Downloads
Wow, this is exciting. We’re almost ready to build, but first we make our last PATH entry- adding our toolchain. This step is important, because it’s the only PATH entry that has your username in it. You remember getting your username earlier, don’t you? Good!
Mint users, same old song and dance- make sure you’re editing the .bashrc file at /etc/bash.bashrc.
Code:
~$ sudo nano ~/.bashrc
Once the file is opened up, paste in the following at the end of the file, save, and close it:
Code:
#Android Toolchain PATH
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/home/(YOUR-USERNAME-HERE)/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
Save that file, close it, and then close and open a new terminal to load our changes. For the last time.
Failure To Close And Open A New Terminal At This Point Will Cause The Brunch Command To Fail!
Close your terminal and open a new one.
Part 3 – BUILD ANDROID
Fire up that terminal one more time:
Code:
~$ cd ~/android/system
~$ . build/envsetup.sh && brunch d2att
And watch it go. Go grab yourself a stimulating beverage- this is gonna take awhile.
Once everything wraps up, you should see a nice neat “Package Complete” message in your terminal window. Congratulations! Now go flash it- you know you wanna!
Don’t forget to grab the latest version of GAPPS if you want your Google Apps!
BONUS SECTION!!!
Q.- What the hell do I do if the build breaks!?!?
A.- This is a very valid question, although if you followed the guide you shouldn’t run into any issues- but these things happen. Google is your friend when all else fails, but here are some common occurences:
Code:
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/d2att/cm_d2att-ota-eng.root.zip] Error 1
Change the following in your system/build/tools/releasetools/common.py file:
Change: “java -Xmx2048m” to “java -Xmx1024m” or “java -Xmx512m”
If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.
DOUBLE BONUS SECTION!!!
How do I make an update?
So glad you asked. So glad I saw that I left this out initially, and now I’m putting it in here…
To the terminal we go:
Code:
~$ cd ~/android/system
~$ repo sync -j4
~$ make installclean
~$ find ./out/ -name 'build.prop' | xargs rm
~$ find ./out/ -name 'cm_d2att-target_files-eng.*.zip' | xargs rm
~$ . build/envsetup.sh && brunch d2att
Just flash that update right on top of your already flashed build, and it will update it.
Again, Google is your friend.
Cheers
Automated ROM update script!!!
Want to make updating your ROM super easy? Not a problem! Download the following 'buildromupdate.sh' script from Lindroidsoup.com, or simply use a text editor to copy and paste the following! Don't forget to 'chmod +x' and make it executable- then just run it from the command line with ~$ ./buildromupdate.sh -It doesn't get much easier!
Code:
#!/bin/bash
# This script will clear out old files, and update your ROM
# Flash this updated .zip on top of your existing ROM
# You should see 'Android is updating' on next boot
cd ~/android/system
repo sync -j4
make installclean
find ./out/ -name 'build.prop' | xargs rm
find ./out/ -name 'cm_d2att-target_files-eng.*.zip' | xargs rm
. build/envsetup.sh && brunch d2att
Download the script: http://lindroidsoup.com/Downloads/buildromupdate.sh
Cheers!
I have moved your thread to general, as typically users will find guides here. I am sorry for any inconvenience.
Lindroidsoup.com will be down for maintenance on 10/16/2013
LindroidSoup.com will be down for maintenance on 10/16 - 10/19
We apologize for any inconvenience this may cause, and are providing the direct links for both the Android SDK and Java JDK below:
Java JDK 1.6.35- http://download.oracle.com/otn/java/jdk/6u35-b10/jdk-6u35-linux-x64.bin
Android SDK- http://developer.android.com/sdk/index.html#linux-bundle
The server will be up and operational again on 10/19/2013.
Lindroidsoup.com completed maintenance ahead of schedule
LindroidSoup.com is back online!
We're pleased to announce that the wonderful team at KnownHost, LLC was able to finish site/server maintenance well ahead of schedule, and we're now back online!
Linux Mint Users Note
If you're a Linux Mint user, just a handy little note-
Mint is notorious for over-writing /etc/bash.bashrc when major system updates are pushed out. This becomes a pain in the ass when your PATHs keep getting over-written and you receive errors when trying to build an update after you've set everything up.
To work around it, just make a copy of your /etc/bash.bashrc file- and then put it back in place if you see the original's been over-written:
To make a backup of /etc/bash.bashrc after initial setup
Code:
~$ sudo cp /etc/bash.bashrc /home/bash.bashrc.backup
To replace an over-written /etc/bash.bashrc after a system update
Code:
~$ sudo rm -rf /etc/bash.bashrc && cp /home/bash.bashrc.backup /etc/bash.bashrc
That should keep you from pulling your hair out!
Cheers
Damn it, Google!!!
Google changed the storage location of their repo code, so trying to download it was causing a '/bin/repo: line 1: syntax error near unexpected token `newline'' error.
I've adjusted the guide to reflect the new storage location for the curl command.
Sorry if this caused anybody any headaches.
Regards,
C
Any guide for Windows? If not is it cool to develop via a VMware image of Linux?
drivel2787 said:
Any guide for Windows? If not is it cool to develop via a VMware image of Linux?
Click to expand...
Click to collapse
Yes, using a vm is fine
Slithering from the nether regions of a twisted mind and tarnished soul
Hello, I am on ubuntu 14.4 and I am trying to build CM-12. When the rom is building, it keep stoppinig at the following error;
target R.java/Manifest.java: com.android.emailcommon (/home/larmyv/android/system/out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/src/R.stamp)
/home/larmyv/android/system/out/host/linux-x86/bin/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [/home/larmyv/android/system/out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/src/R.stamp] Error 127
make: *** Waiting for unfinished jobs....
Any Ideas? Any help would be greatly appreciated.
Thanks
LARMYV said:
Hello, I am on ubuntu 14.4 and I am trying to build CM-12. When the rom is building, it keep stoppinig at the following error;
target R.java/Manifest.java: com.android.emailcommon (/home/larmyv/android/system/out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/src/R.stamp)
/home/larmyv/android/system/out/host/linux-x86/bin/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [/home/larmyv/android/system/out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/src/R.stamp] Error 127
make: *** Waiting for unfinished jobs....
Any Ideas? Any help would be greatly appreciated.
Thanks
Click to expand...
Click to collapse
Sounds like you're running into this: http://ideid.blogspot.co.uk/2013/01/resolve-shared-library-problem-with.html
Give it a shot, and let me know what you get.
samoled said:
Sounds like you're running into this: http://ideid.blogspot.co.uk/2013/01/resolve-shared-library-problem-with.html
Give it a shot, and let me know what you get.
Click to expand...
Click to collapse
Thank you so much, i was looking for days on the error. When I put in the following command;
sudo apt-get install ia32-libs
it gave me an error that said that it was no longer available. It said to download the following;
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
I downloaded those packages and i am now in business and have finally built a rom. Now I am learning on the whole cherry picking.
Thanks again.
Awesome, glad to hear you got that sorted out.
Let me know if you run into anything else.
samoled said:
Awesome, glad to hear you got that sorted out.
Let me know if you run into anything else.
Click to expand...
Click to collapse
Hi, I have a new question for you. I am currently building slim roms and I have an issue with the kernel. The phone will boot up but would be stuck on the samsung logo screen. My question to you is how do I port over the CM12 kernel and merge it with the slim rom?
Related
Here is a little guide to help start with compile and build of CyanogenMod for the Desire HD. Aim of this guide to collect all information and provide that on a single place.
This guide is for Ubuntu OS.
1) Install the below software through terminal.
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
For 64-bit only systems:
Code:
sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
if this gives an error and doesn't install sun java then run the below command.
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
sudo apt-get update
Now try to install the software again. Once done reboot the system.
2) Install the Android SDK and make sure ADB is working fine.
To check ADB is working, go to terminal and type ADB devices. if you get an error "no permission" then your adb is not setup correctly. You can check the ADB install process Here
Reboot the system.
3) You will need to set up some directories in your build environment. Use the below command in the terminal.
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
4) Enter the following to download make executable the "repo" binary:
Code:
curl http://android.git.kernel.org/repo > ~/bin/repo
chmod a+x ~/bin/repo
Reboot the system.
5) Now enter the following to initialize the repository:
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
repo sync -j16
This will take some time (for me it took almost 4 hours) and initial some time you will just see the progress in the terminal not in /android/system folder. It downloads the stuff in the hidden folder so if you want to see the progress make sure you have checked show hidden folder in the settings.
If it is giving some errors, which you think is not important you can use the below command to do the force sync.
Code:
repo sync -j16 -f
6) Connect the desire HD to system and in terminal run command "adb devices" to see if it is connected. then run
Code:
cd ~/android/system/device/htc/ace/
./extract-files.sh
7) Download RomManager which is needed by the build:
Code:
~/android/system/vendor/cyanogen/get-rommanager
8) Now, the environment must be configured to build and the ROM compiled, from code, for the Ace.
Code:
. build/envsetup.sh && brunch ace
9) Now next time onwards you can build it with the below commands.
Code:
cd ~/android/system/
repo sync
. build/envsetup.sh && brunch ace
Thanks to CyanogenMod Wiki and TeamDouche for giving such a wonderful ROM.
Since I recently decided to run Ubuntu Cinnamon Remix on my MBP, I wanted to know how to connect my GNote 2 on Ubuntu & here it is.
Install:
Code:
sudo add-apt-repository ppa:webupd8team/unstable
sudo apt-get update
sudo apt-get install go-mtpfs
Mount:
Code:
go-mtpfs /media/MyAndroid
Unmount:
Code:
fusermount -u /media/MyAndroid
Here's where I learned how from this article. All the credit goes to them
http://www.webupd8.org/2012/12/how-to-mount-android-40-ubuntu-go-mtpfs.html
Dowload DebianKit from the Play Store
Open Debian Kit and check to make sure everything is in order
SSH client or terminal is fine (I used ssh server)
Code:
cd /sdcard/download
I can't post links yet because I'm new here, but this was the latest version in the repo: (Just google it, you will find the link)
Code:
wget debian-kit-1-5.shar
Code:
su
sh debian-kit*
Choose
Code:
0p
and Follow all instructions on the install
Code:
./data/local/deb/deb
cd /sdcard
e2fsck -f debian.img
Give yourself enough space to do what you need to do, I used 10G (10 gigabytes)
Code:
resize2fs debian.img 10G
I was on a clean install of CyanogenMod Nightly using android 4.4.2 and had a lot of space
Code:
e2fsck -f debian.img
At this point do a manual reboot
Code:
./data/local/deb/deb
apt-get update
apt-get upgrade
Hi,
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.
*** DOWNLOAD OUYA FIRMWARE ***
1. Open your browser and type:
https://devs.ouya.tv/api/firmware_builds
2. Search for a string like this:
http://cds.t2z5c2q6.hwcdn.net/ota/RC-OUYA-1.2.1084-r1_ota.zip (this is the latest version of ouya firmware)
3. Download it:
$ wget http://cds.t2z5c2q6.hwcdn.net/ota/RC-OUYA-1.2.1084-r1_ota.zip
2. Create a directory an put the file there:
$ mkdir ouyafiles
4. unzip it:
$ unzip RC-OUYA-1.2.1084-r1_ota.zip
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 http://www.enck.org/tools/split_bootimg_pl.txt
5. Rename the script and change the permissions to execute:
$ mv split_bootimg_pl.txt split_bootimg.pl
$ chmod 755 split_bootimg.pl
6. Run this command to unpack the file:
$ ./split_bootimg.pl 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.
*** DOWNLOAD ANDROID NDK ***
1. Open the Browser and paste this URL: http://developer.android.com/tools/sdk/ndk/index.html
2. Download the Linux 64-bit (x86) package file:
$ wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2
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).
*** DOWNLOAD THE OUYA KERNEL SOURCE ***
1. Open your browser and go to this URL:
https://github.com/ouya/ouya_1_1-kernel
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 https://raw.githubusercontent.com/ouya/ouya_1_1-kernel/master/drivers/pci/Kconfig
6. Now you have the default ouya kernel for compile!
*** RECOVER .CONFIG FILE FROM OUYA ***
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.
*** REBUILDING KERNEL ***
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.
*** UPLOAD THE NEW KERNEL AND THE RAMDISK TO OUYA ***
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!
*** DOWNLOAD OUYA FIRMWARE ***
$ mv boot.img-ramdisk ramdisk
Click to expand...
Click to collapse
Why do we need this? Can't we simply copy it from an existing OUYA machine?
ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
Click to expand...
Click to collapse
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
Click to expand...
Click to collapse
It's actually a zImage file (without the b).
Thank you so much for the tutorial!
This program is for unpacking rom.zip from RUU on Unix-like operating systems
All commands below are to be executed from the terminal NOT as root
1)
Code:
sudo apt install m4 git unshield libunshield-dev dh-autoreconf
2)
Code:
git clone https://github.com/kmdm/unruu.git
3)
Code:
cd unruu
4)
Code:
./autogen.sh
5)
Code:
./configure
6)
Code:
make
7)
Code:
sudo make install
To use this utility is very simple: unruu /path/to/ruu/ruu.exe
For example: unruu /home/alex/RUU_Express.exe