FORUMS
Remove All Ads from XDA

[TUT][CM9] Download and compile CM9 for the HTC Wildfire S using Ubuntu 11.10

2,563 posts
Thanks Meter: 2,408
 
Post Reply Email Thread
TUTORIAL:How to build CM9 from source using Ubuntu 11.10
NOTE: I am always changing this tutorial to be more advance and easier, what you see one day may be changed the next so be careful!

1. Grab yourself a copy of 64-bit Ubuntu 11.10 - You can try and use 12.04 but it is very unstable and extra steps are needed.
2. In terminal type in the following lines to grab the required sources for donwloading the packages:
Code:
sudo add-apt-repository ppa:ferramroberto/java; sudo apt-get update
3. Type in the following into terminal, this allows ubuntu to gather the needed packages to build CM9. You will be asked for a password, if you get a question asking if you would like to install all of the packages type Y and hit enter.
Code:
sudo apt-get install git-core gnupg flex bison gperf libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev libc6-dev ia32-libs x11proto-core-dev lib32z-dev mingw32 tofrodos python-markdown python python-lunch libxml2-utils xsltproc libx11-dev:i386
4. To download a needed stack on top of git for developing CM we need to type the following command...
Code:
mkdir ~/bin; curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo; chmod a+x ~/bin/repo
5. Download this: http://dl.google.com/android/android-sdk_r18-linux.tgz and this: http://dl.google.com/android/ndk/and...ux-x86.tar.bz2 - These are the NDK and SDK, native development kit and software development kit.
6. Open your file manger and make a folder inside your home folder, call it "android".
7. Make the folders "sdk" and "ndk" inside it
8. Extract all of the stuff from "android-ndk-r7c-linux-x86.tar.bz2" into NDK and all the stuff from "android-sdk_r18-linux.tgz" to SDK.
10. Type in the following line to open a text document
Code:
sudo gedit .bashrc
11. Add the following lines to the bottom of the script - this changes you "path" so you can run scrips from these places as normal linux commands anywhere else on your system
Code:
# Android Software 
export PATH=${PATH}:~/android/sdk/tools
export PATH=${PATH}:~/android/sdk/platform-tools
export PATH=${PATH}:~/android/ndk/android-ndk-r7/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin
export PATH=${PATH}:~/bin
13. Save and exit, then type the following lines to make a folder and bring you into it
Code:
mkdir -p ~/cyanogenmod/system; cd ~/cyanogenmod/system
14. Now type in these next lines to set another (fallback) path and inizalize the CM repo in that folder
Code:
PATH=~/bin:$PATH; repo init -u git://github.com/CyanogenMod/android.git -b ics
15. Now enter the following command
Code:
gedit .repo/local_manifest.xml
to open up another text document, in this document - it will be empty, add these lines then save and exit
Code:
<?xml version="1.0" encoding="UTF-8"?>
  <manifest>
      <remote  name="cryptomilk"
               fetch="git://git.cryptomilk.org/" />

      <project name="CyanogenMod/android_device_htc_common" path="device/htc/common" revision="refs/heads/gingerbread" />
      <project name="projects/marvel/android_device_htc_marvel.git" path="device/htc/marvel" remote="cryptomilk" />
      <project name="projects/marvel/android_vendor_htc_proprietary.git" path="vendor/htc" remote="cryptomilk" />
      <project name="projects/marvel/kernel_htc_msm7227.git" path="kernel/htc/msm7277" remote="cryptomilk" />
      <project name="benjamingwynn/cm9-marvel-flaming-fixes" />
  </manifest>
16. If you do not wish to download pointless files for different devices then type in
Code:
gedit .repo/manifest.xml
and delete the following lines (thanks to dudeman1996 for this protip)
Code:
  <project path="device/moto/common" name="CyanogenMod/android_device_moto_common" />
  <project path="device/moto/stingray" name="CyanogenMod/android_device_moto_stingray" />
  <project path="device/moto/wingray" name="CyanogenMod/android_device_moto_wingray" />
aswell as these other lines
Code:
  <project path="device/samsung/maguro" name="CyanogenMod/android_device_samsung_maguro" />
  <project path="device/samsung/p5-common" name="CyanogenMod/android_device_samsung_p5-common" />
  <project path="device/samsung/toro" name="CyanogenMod/android_device_samsung_toro" />
  <project path="device/samsung/tuna" name="CyanogenMod/android_device_samsung_tuna" />
17. Now to preform the first sync with CM type in the following.. -- This will take a long time! so don't be worried if you think it's taking a while. If for whatever reason you need to stop the sync then hit CTRL+Z on your keyboard.
Code:
repo sync
18. You must now setup the vendor, type:
Code:
./vendor/cm/get-prebuilts
19. Set up the environment by typing the following to tell ubuntu that you are going to be making CM9.
Code:
source build/envsetup.sh; lunch cm_marvel-eng
20. Type the following to prepare use the cache for stuff
Code:
export USE_CCACHE=1
21. Now, finally build CM9. To do this I always times the number of cores in your CPU by two. For example on a 4 core machine I would put 8. Once you have worked that out type the following where xx is your number.
Code:
make -jxx bacon
22. If sucessful, you will get something like this:
Code:
Package complete: /home/benjamin/cyanogenmod/system/out/target/product/marvel/update-cm-9.0.0-RC0-marvel-UNOFFICIAL-signed.zip
Go to that folder and copy and paste the zip file above to your phone, install in recovery.


FAQ
People like asking the same god damn questions over and over again.


Q. Could you please help me it says the bits
A. That doesn't make any sense. Try and copy some lines from terminal
Q. Could you help please, It says these lines when I "repo sync"
Code:
Fetching projects: 100% (249/249), done.  
Syncing work tree:  95% (237/249)  fatal: cannot create directory at 'eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors': No space left on device
Traceback (most recent call last):
  File "/home/benjamin/cyanogenmod/system/.repo/repo/main.py", line 385, in 
    _Main(sys.argv[1:])
  File "/home/benjamin/cyanogenmod/system/.repo/repo/main.py", line 365, in _Main
    result = repo._Run(argv) or 0
  File "/home/benjamin/cyanogenmod/system/.repo/repo/main.py", line 137, in _Run
    result = cmd.Execute(copts, cargs)
  File "/home/benjamin/cyanogenmod/system/.repo/repo/subcmds/sync.py", line 467, in Execute
    project.Sync_LocalHalf(syncbuf)
  File "/home/benjamin/cyanogenmod/system/.repo/repo/project.py", line 1027, in Sync_LocalHalf
    self._InitWorkTree()
  File "/home/benjamin/cyanogenmod/system/.repo/repo/project.py", line 1814, in _InitWorkTree
    raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree
A. Your disk drive is full. Free some stuff up and try again
Q. Could you help please...
Code:
============================================
Checking build tools versions...
************************************************************
You are attempting to build with an unsupported version
of java.
 
Your version is: java version "1.6.0_24".
The correct version is: Java SE 1.6.
 
Please follow the machine setup instructions at
    http://source.android.com/source/download.html
************************************************************
grep: build/target/board/generic/recovery.fstab: No such file or directory
build/core/java.mk:20: *** dalvik/dexgen: Invalid LOCAL_SDK_VERSION '4' Choices are: current . Stop.
A. You have a slightly different version of Java for some reason, try the following...
Code:
sudo -i
[[enter password]]
apt-get remove openjdk-6-jdk
apt-get remove sun-java6-jdk
add-apt-repository "deb http://archive.canonical.com/ lucid partner"
apt-get update
apt-get upgrade
sudo apt-get install sun-java6-jdk
sudo update-alternatives --config java
[[select the sun one]]
exit
if that doesn't work then try
Q. I downloaded Ubuntu 12.04 instead, it's not working! Do you have a quick work-around?
A. First type in
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 \
  g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown \
  libxml2-utils xsltproc zlib1g-dev:i386
to get the extra packages.
Then type "sudo gedit /usr/include/linux/usb/ch9.h" and on line 592 replace
Code:
	return __le16_to_cpu(epd->wMaxPacketSize);
with
Code:
# return le16_to_cpu(epd->wMaxPacketSize);
return __le16_to_cpu(epd->wMaxPacketSize);
Q. I get this error
Code:
benjamin@benjamin-Sienna-510:~/cyanogenmod/system$ lunch cm_marvel-eng
build/core/product_config.mk:189: *** _nic.PRODUCTS.[[device/*/marvel/cm.mk]]: "device/*/marvel/cm.mk" does not exist. Stop.
Device marvel not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Repository for marvel not found in the CyanogenMod Github repository list. If this is in error, you may need to manually add it to your local_manifest.xml.
build/core/product_config.mk:189: *** _nic.PRODUCTS.[[device/*/marvel/cm.mk]]: "device/*/marvel/cm.mk" does not exist. Stop.
A. Make sure you followed the instructions correctly, this is probably a misconfiguration of an XML
Q. I have a problem, do you have a fix? The following happens:
Code:
xml.parsers.expat.ExpatError: XML or text declaration not at start of entity: line 1, column 2
A. I had that problem (in fact I have had all of these faq problems when building CM but I solved em') - type "sudo gedit .repo/local_manifest.xml" into terminal and change the first line to "" without spaces at the start
Q. I get
Code:
** Don't have a product spec for: 'cm_marvel'
** Do you have the right repo manifest?
do you have a fix
A. Redo the instructions from step 20
Q. I get this very annoying error: "build/core/java.mk:20: *** dalvik/dexgen: Invalid LOCAL_SDK_VERSION '4' Choices are: current . Stop"
A. Type "rm -rf prebuilt; repo sync -l prebuilt" - credit to dudeman1996 for this find in Chinese - Credit to me for translating it into usable words from Google Translate
Q. I get a strange kernel error about cm9 prebuilt kernels
A. Use aswerth's temp patch
Quote:
Originally Posted by aswerth

Temp solution: Do not build the latest one.

First, delete "device/htc/marvel" folder. And then download this file and unzip it to "device/htc/marvel" BTW, Wifi works on this build too.

http://git.cryptomilk.org/projects/m...168f8d8196070a

This is the last commit before CM9 gave this error.

Q. Upon installation of packages it says that Java has no installation candiate
A. Run the following command: sudo add-apt-repository ppa:ferramroberto/java; sudo apt-get update
The Following 22 Users Say Thank You to benjamingwynn For This Useful Post: [ View ] Gift benjamingwynn Ad-Free
 
 
17th April 2012, 12:49 PM |#2  
benjamingwynn's Avatar
OP Inactive Recognized Developer
Flag Cardiff
Thanks Meter: 2,408
 
Donate to Me
More
Compile CM afterwards
Mini tutorial: How to build CM9 after syncing, etc.

There is only two steps needed for compiling CM9 after rebooting or being away from your PC because I have formed the first into a quick load of commands:

Code:
cd ~/cyanogenmod/system; repo sync; source build/envsetup.sh; lunch cm_marvel-eng; export USE_CCACHE=1
This will do all the required steps before build but will only work if you have completed the tutorial above and succedded in a build. repo sync doesn't take long at all because all the files are already on your machine, and repo just grabs the changed ones.

Type make -jxx bacon (the same way you did in the first tutorial) to make CM9 again.

If you wish to know if CM has changed before re-building then see this link: http://git.cryptomilk.org/projects/m...git/log/?h=ics
The Following 3 Users Say Thank You to benjamingwynn For This Useful Post: [ View ] Gift benjamingwynn Ad-Free
17th April 2012, 03:38 PM |#3  
effry's Avatar
Senior Member
Flag Naples
Thanks Meter: 83
 
More
by doing this what will work and what not?
17th April 2012, 03:50 PM |#4  
dream707's Avatar
Member
Flag Minsk
Thanks Meter: 6
 
More
where output file should be?
17th April 2012, 05:50 PM |#5  
benjamingwynn's Avatar
OP Inactive Recognized Developer
Flag Cardiff
Thanks Meter: 2,408
 
Donate to Me
More
Quote:
Originally Posted by dream707

where output file should be?

Type "~"

Sent from my HTC Wildfire S using xda premium
The Following User Says Thank You to benjamingwynn For This Useful Post: [ View ] Gift benjamingwynn Ad-Free
17th April 2012, 06:03 PM |#6  
Account currently disabled
Flag Wichita
Thanks Meter: 165
 
More
Quote:
Originally Posted by effry

by doing this what will work and what not?

act like a developer and compile it to find out...
The Following User Says Thank You to BigChillin For This Useful Post: [ View ] Gift BigChillin Ad-Free
17th April 2012, 06:22 PM |#7  
mstfkaratas's Avatar
Senior Member
Flag Istanbul
Thanks Meter: 140
 
More
Quote:
Originally Posted by effry

by doing this what will work and what not?

you can see them from modpunk's thread

Sent from my Wildfire S using Tapatalk 2
The Following User Says Thank You to mstfkaratas For This Useful Post: [ View ] Gift mstfkaratas Ad-Free
17th April 2012, 07:11 PM |#8  
Senior Member
Flag Fort Wayne, Indiana
Thanks Meter: 212
 
More
Thanks Ben! Which README did you use, may I ask?

Going to try this later tonight, as I just cant make it work. Always end with no compiling, or CPU errors half way through compiling.
17th April 2012, 07:28 PM |#9  
Fikus011's Avatar
Senior Member
Flag Perth
Thanks Meter: 516
 
More
Just to help Ben with Q & A,and for you guys who needs visual help... http://www.youtube.com/watch?v=OS5c_...e_gdata_player
Hope i helped...thanks button if i did.
SALUTE!!!

Sent from my HTC Wildfire S A510e using xda premium
17th April 2012, 08:43 PM |#10  
*se-nsei.'s Avatar
Senior Member
Flag London
Thanks Meter: 499
 
More
I get this error on first steps:

Code:
....only available from another source

Package lib32z1-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'sun-java6-jdk' has no installation candidate
E: Package 'lib32z1-dev' has no installation candidate
E: Package 'lib32ncurses5-dev' has no installation candidate
E: Package 'lib32readline-gplv2-dev' has no installation candidate
E: Package 'lib32ncurses5-dev' has no installation candidate
E: Package 'ia32-libs' has no installation candidate
E: Unable to locate package lib32z-dev
Is this because I'm running Xubuntu?
17th April 2012, 08:57 PM |#11  
benjamingwynn's Avatar
OP Inactive Recognized Developer
Flag Cardiff
Thanks Meter: 2,408
 
Donate to Me
More
Quote:
Originally Posted by *se-nsei.

I get this error on first steps:

Code:
....only available from another source

Package lib32z1-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'sun-java6-jdk' has no installation candidate
E: Package 'lib32z1-dev' has no installation candidate
E: Package 'lib32ncurses5-dev' has no installation candidate
E: Package 'lib32readline-gplv2-dev' has no installation candidate
E: Package 'lib32ncurses5-dev' has no installation candidate
E: Package 'ia32-libs' has no installation candidate
E: Unable to locate package lib32z-dev
Is this because I'm running Xubuntu?

Probably mate
Post Reply Subscribe to Thread

Tags
benjamingwynn, cm9, compile, tutorial, wildfire s

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

Advanced Search
Display Modes