[BUILD][6.0.1][CAF][LA.HB.1.3.1] How to build Marshmallow using Arch Linux - OnePlus 3T Guides, News, & Discussion

System Requirements
Arch Linux x86-64
Oxygen OS(extracted image or installed)
adb installed and drivers setup
non-root user
sudo setup for your user (you can install packages as root as a workaround)
40GB free storage
4GB+ ram
Required Packages
First off you're gonna want to make sure you're completely up to date and fetch the packages required to build, with the command below.
Code:
#sudo pacman -Syyu gcc-multilib git gnupg flex bison gperf sdl wxgtk squashfs-tools curl ncurses zlib schedtool perl-switch zip unzip libxslt python2-virtualenv bc lib32-zlib lib32-ncurses lib32-readline jdk7-openjdk rsync maven repo
Then you're going to need to fetch some apps from the AUR. First add their GPG key.
Code:
#gpg --keyserver pgp.mit.edu --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB
Now you can fetch them with a tool like yaourt or manually install the two packages.
lib32-ncurses5-compat-libs
ncurses5-compat-libs
Code:
#yaourt --aur lib32-ncurses5-compat-libs ncurses5-compat-libs
Setting up build enviroment and syncing
This part will assume you're building in a folder called "android" in your home directory, and requires the above packages to be installed.
Run these commands to install repo in a folder called "bin" in your home directory. Then for a single terminal session set the new "bin" folder as a binary folder in bash.
Code:
#mkdir ~/bin
#export PATH=~/bin:$PATH
#curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
#chmod a+x ~/bin/repo
Make a folder to store and build android, then enter it.
Code:
#mkdir ~/android
#cd ~/android
Setup a virtual python 2.7 enviroment in your "android" folder as repo doesn't work with 3+.
Code:
#virtualenv2 venv
#ln -s /usr/lib/python2.7/* ~/android/venv/lib/python2.7/
#source venv/bin/activate
Now it's time to sync the sourcecode with your python 2.7 and repo setup. The following code will sync CAF android 6.0.1 from oneplus. The "4" can be removed or replaced with any whole number becides zero depending on your connection speed. You may omit the "-c" if you have problems syncing or need more than the defined branches.
Code:
#repo init -u https://github.com/OnePlusOSS/android.git -b oneplus3T/6.0.1
#repo sync -j4 -c
You can also use my repo if you prefer. I'm working on improving the mess oneplus gave us.
Code:
#repo init -u https://github.com/droidman/android.git -b oneplus3T/6.0.1
#repo sync -j4 -c
Compile Your Build
Assuming your in your virtual python 2.7 and followed the first part of the guide, set openjdk 7 as your active java.
Code:
#export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
Fix broken provided glib.
Code:
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld
If you're rooted and have adb installed, you may want to fetch your prebuilt files from the latest marshallow Oxygen OS or caf based rom. You may also extract them from a Oxygen OS system image but build will not complete without prebuilts.
Code:
#cp ~/android/.repo/manifests/pull_library.sh ~/android/pull.sh
#sh pull.sh
Intialize the enviroment and select a platform. You may build "msm8996-userdebug" or "msm8996-user".
Code:
#source build/envsetup.sh
#lunch msm8996-userdebug
Time to build! Find the number of threads on your cpu and set 1-2x that as "x". You may also omit "OTAackage" if you prefer to have fastboot/twrp flashable images instead of a zip, (system.img, boot.img, etc).
Code:
#make -jx OTApackage
Your compiled files and flashable zip or images will be located in "~/android/out/target/product/msm8996".
How to rebuild!
Cd into directory, sync repo, and setup enviroment.
Code:
#export PATH=~/bin:$PATH
#export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
#cd ~/android
#source venv/bin/activate
#repo sync -j4 -c
#source build/envsetup.sh
#lunch msm8996-userdebug
Clean the out directory.
Code:
#make clobber
Build. (setup to make a recovery flashable zip with a 8 thread processor.)
Code:
#make -j16 otapackage

Thanks for the clean guide

Very nice and thanks for posting it. If you'd rather use whatever you've got installed on a box or VM (to pick one out of a hat, U16.04) , just google "how to build marshmallow {from your distro}". (where you fill in your distro's name & version (opt)).
For example, initial parts of "this page(see link)" might be good for 16.04 LTS users :: http://forum.xda-developers.com/chef-central/android/guide-how-to-setup-ubuntu-16-04-lts-t3363669
All the commands following the basic setup of development environment in the OP "should" work on any distro, starting with the fetch from git. Also, thanks for your personal github code.
Anyway, good job. Cheers.

I've synced your git version of oneplus' git. The problem I've having and not getting past looks like this: Oops, I guess I lost the clipboard from the VM. It was basically as if it hasn't got the dashd prebuilt or blob or whatever it was looking for. I grabbed the prebuilts via my phone running 3.5.3 which seemed to work fine.
Is your current github code building without trouble for you? I should probably re-sync. Thanks.

hachamacha said:
I've synced your git version of oneplus' git. The problem I've having and not getting past looks like this: Oops, I guess I lost the clipboard from the VM. It was basically as if it hasn't got the dashd prebuilt or blob or whatever it was looking for. I grabbed the prebuilts via my phone running 3.5.3 which seemed to work fine.
Is your current github code building without trouble for you? I should probably re-sync. Thanks.
Click to expand...
Click to collapse
The prebuilt script is currently broken, i manually copied over the files that failed with a file manager. You can also mount a system.img from a compiled oxygenOS, Oneplus Open Source or AOOP as ext4 to manually copy over the files too!

namanjr said:
The prebuilt script is currently broken, i manually copied over the files that failed with a file manager. You can also mount a system.img from a compiled oxygenOS, Oneplus Open Source or AOOP as ext4 to manually copy over the files too!
Click to expand...
Click to collapse
Oh cool. I can do that (the system.img). My question then is "where are the files on in the mounted system.img" and "do they go to "prebuilts" at top level or to "vendor" (which level, since I see vendor repeat two levels down)?
Thanks.

hachamacha said:
Oh cool. I can do that (the system.img). My question then is "where are the files on in the mounted system.img" and "do they go to "prebuilts" at top level or to "vendor" (which level, since I see vendor repeat two levels down)?
Thanks.
Click to expand...
Click to collapse
I just extracted the entire root of the system.img to "SOURCECODE/vendor/oneplus", easier than manually going through to see what files to copy over!

namanjr said:
I just extracted the entire root of the system.img to "SOURCECODE/vendor/oneplus", easier than manually going through to see what files to copy over!
Click to expand...
Click to collapse
Great. Thanks so much for the help. I'll give that a shot next.
---------- Post added at 11:01 AM ---------- Previous post was at 10:25 AM ----------
hachamacha said:
Great. Thanks so much for the help. I'll give that a shot next.
Click to expand...
Click to collapse
OK, that worked. I just had to , for some reason, use the samsung simg2img (sparse to full) util in order to mount it as ext4/loop.
Thanks again.

edit: solved

Now that I can do a make -j {target}, I've got another question:
The target OTApackage (or is it otapackage) doesn't appear to be a valid choice for me. I get a "Target doesn't exist" error if I use make -j{N} otapackage (or OTApackage). I'd like very much to be able to create the install .zip rather than have to collect & bundle all the bits & pieces. I've tried with the original OnePlus .git and your .git as well.
Thanks much.

hachamacha said:
Now that I can do a make -j {target}, I've got another question:
The target OTApackage (or is it otapackage) doesn't appear to be a valid choice for me. I get a "Target doesn't exist" error if I use make -j{N} otapackage (or OTApackage). I'd like very much to be able to create the install .zip rather than have to collect & bundle all the bits & pieces. I've tried with the original OnePlus .git and your .git as well.
Thanks much.
Click to expand...
Click to collapse
Did you setup the enviroment and run lunch? It's all lowercase! Can you post the error it gives?

namanjr said:
Did you setup the enviroment and run lunch? It's all lowercase! Can you post the error it gives?
Click to expand...
Click to collapse
Oh yeah: On the same VM, I can build versions of CM, no troubles. I've got OpenJava 7 JDK and all the right stuff. I ran lunch (It's something like either #25 or 26 on the menu, and no problems with any of that.
After quite awhile, it comes back with the "no rule to build target otapackage (whatever it was)" . I'll run a build right now and get the exact error:
Jeez! Of course, this is the time it picks to just go right past where it usually gets the error. I'm pretty sure I know what happened. I was using it as you'd printed it in the guide ^^, OTApackage, which in a case sensitive system , doesn't mean a thing. I'll post again if it dies 2 hours down the line. I should move this operation to my Linux box with SSD's but it's in use at the moment.
Thanks again.
edit: Lunch output ::
$lunch msm8996-userdebug
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.1
TARGET_PRODUCT=msm8996
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=kryo
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a53
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-51-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_BUILD_TYPE=release
BUILD_ID=MXB48T
OUT_DIR=out
Click to expand...
Click to collapse
Damn. I just realized you had this covered as well, but I missed it first time around.
My compile finally blew out about 1/2 way through with a libart.so build error, so I did this (before I re-read your guide):
Code:
$ln -s prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld /usr/bin/ld.gold
And we're off to the next error! ;

I believe someone has already mentioned a problem with dashd not being found, im getting the "no rule to make target..." error regarding dashd, tried to pull /sbin/dashd but the file doesn't exist. What can I do
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}

hamzahrmalik said:
I believe someone has already mentioned a problem with dashd not being found, im getting the "no rule to make target..." error regarding dashd, tried to pull /sbin/dashd but the file doesn't exist. What can I do
Click to expand...
Click to collapse
Did you unpack system.img from 3.5.3 (you can check the disaster recovery thread in q&a here) and then copy the entire contents into $source/vendor/oneplus? Before I had just used a cable and adb enabled in Linux and I died at dashd as well. After I got the system.img prebuilts, it was fine.
Note: My experience:: System.img wasn't mountable as a $mount -t ext4 -o loop ... device , not recognized as that type file, so I found simg2img (For whatever reason, Samsung uses "sparse" image files and apparently so does OP) to modify system.img to a normal non-sparse system.img and then mount -t ext4 -o loop ./system.img /{mountpoint} worked fine and I copied from there to ./vendor/OnePlus/ (however it's spelled , it's the only "oneplus" folder under vendor.

hachamacha said:
Did you unpack system.img from 3.5.3 (you can check the disaster recovery thread in q&a here) and then copy the entire contents into $source/vendor/oneplus? Before I had just used a cable and adb enabled in Linux and I died at dashd as well. After I got the system.img prebuilts, it was fine.
Note: My experience:: System.img wasn't mountable as a $mount -t ext4 -o loop ... device , not recognized as that type file, so I found simg2img (For whatever reason, Samsung uses "sparse" image files and apparently so does OP) to modify system.img to a normal non-sparse system.img and then mount -t ext4 -o loop ./system.img /{mountpoint} worked fine and I copied from there to ./vendor/OnePlus/ (however it's spelled , it's the only "oneplus" folder under vendor.
Click to expand...
Click to collapse
Thanks. Can't find the thread you are referring to, so I just downloaded a 3.5.3 rom zip and I'll see what I can find
Sent from my ONEPLUS A3003 using Tapatalk

hamzahrmalik said:
Thanks. Can't find the thread you are referring to, so I just downloaded a 3.5.3 rom zip and I'll see what I can find
Sent from my ONEPLUS A3003 using Tapatalk
Click to expand...
Click to collapse
Sorry: I couldn't find it for a moment either. Here it is and if you get the .zip file in the thread that the OP user has on a torrent, then you can just unzip and use any of the 3.5.3 .img files. The other .zip files all use the newer .zip style of patching every file from things like system.img.new, etc.
http://forum.xda-developers.com/oneplus-3t/help/oneplus-3t-factory-restore-utility-t3511287
That's the thread.

hachamacha said:
Sorry: I couldn't find it for a moment either. Here it is and if you get the .zip file in the thread that the OP user has on a torrent, then you can just unzip and use any of the 3.5.3 .img files. The other .zip files all use the newer .zip style of patching every file from things like system.img.new, etc.
http://forum.xda-developers.com/oneplus-3t/help/oneplus-3t-factory-restore-utility-t3511287
That's the thread.
Click to expand...
Click to collapse
Finally got that downloaded. How do i mount? I tried mount -t ext4 -o loop ./system.img but that doesnt work. You said something about covnerting to non-sparse, how do i do that?
Thanks

hamzahrmalik said:
Finally got that downloaded. How do i mount? I tried mount -t ext4 -o loop ./system.img but that doesnt work. You said something about covnerting to non-sparse, how do i do that?
Thanks
Click to expand...
Click to collapse
There's a linux util called simg2img (or I think it means (sparse image to full image). Then you can do the mount you just tried above. It fails on the 'sparse' image. I'm not sure why the hell OP is using Samsung's sparse image but maybe it's more common than I know. I just happened upon it and it was installed on my version of Ubuntu from when I was building CMNN.N versions for other phones.
I can upload it if you like (or try). OK: I booted linux and zipped it so unzip simg2img.zip >> /usr/bin (or whatever you're using as an executable path).

hachamacha said:
There's a linux util called simg2img (or I think it means (sparse image to full image). Then you can do the mount you just tried above. It fails on the 'sparse' image. I'm not sure why the hell OP is using Samsung's sparse image but maybe it's more common than I know. I just happened upon it and it was installed on my version of Ubuntu from when I was building CMNN.N versions for other phones.
I can upload it if you like (or try). OK: I booted linux and zipped it so unzip simg2img.zip >> /usr/bin (or whatever you're using as an executable path).
Click to expand...
Click to collapse
Thank you very much, I'll give that a go
Sent from my ONEPLUS A3003 using Tapatalk

I'm curious as to what 'builders' think is the best solution (assuming you have this problem, or this type of problem on other modules) :
Problem:: (can't build libart.so) (sorry, don't have the error anymore but it has to do with ./prebuilts/*/*/.../*/ld not pointing to a version that is in sync with what's going on to the tree.
A solution(s): ln -s /usr/bin/ld.gold ./prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/ld
(why?) - I found this as a workaround in a) the original OP, b) the changesets for the problem in CM jerritt. Also setting env var "WITHOUT_HOST_CLANG=TRUE". I have yet to find a decent answer for why this might be working.
Currently: I can build the thing, but there are ~23 or so occurrences of ./ld in the ./prebuilts tree. Is that really the best solution , changing each of these things to be soft pointers to /usr/bin/ld.gold?
If anyone has a better answer (or a real answer), would love to hear it. Yes, it builds, but the reason this seems so hokey is because if you did, for example, a "make clobber" before a build to clean out the trash, you'd be back at square one. Of course, you could make it part of a script..
edit: gerritt refs: (they are quite "old" so the problems been around in CM for quite awhile. We're just building stock here.
https://review.cyanogenmod.org/#/c/120824/
https://android-review.googlesource.com/#/c/223100/
Click to expand...
Click to collapse
edit2: Return of --version or -v from /usr/bin/ld, ld.gold to see the difference:
Code:
/usr/bin/ld -v
GNU ld (GNU Binutils for Ubuntu) 2.26.1
[email protected]:~/sandbox/op3t$ /usr/bin/ld.gold -v
GNU gold (GNU Binutils for Ubuntu 2.26.1) 1.11
Edit 3: Explanation of ld.gold:
http://llvm.org/docs/GoldPlugin.html
Click to expand...
Click to collapse

Related

[TUT]-PORTING-Android To The VOGUE

the title says it
after many requests here is the guide
most of this is spread around the vogue
forum here and there, i just wanted to bring it all together
goal-seeing lately we have lost some good developers, this is a shot at getting more involvement in vogue/android development
I.SETTING UP YOUR SYSTEM
1. GETTING LINUX you will need to have Linux installed on your computer(dual-boot, vm, whatever). i recommend Ubuntu karmic (9.10) because its pretty new-user friendly. It can be found at http://www.ubuntu.com/
for you windows lovers here is a guide to setting up a ubuntu VM(virtual machine (if you really didnt know ))
2. THINGS/TOOLS YOU WILL NEED download these:
original 8/8/09 ion 1.5 build HERE(we are gonna use the bin-files and the apns-conf.xml, and a few apps)
the latest rootfs.img (find it)
these android tools (included are genext2fs (android version), split_bootimg.pl, and extract_ramdisk.sh)
after downloading, extract the zip to a folder. open a terminal and cd to the dir of the tools. click applications>accesories>terminal and type:
Code:
cd ~/whatever/
sudo rm -rf /bin/genext2fs
#dont type whats after the pound signs
#type in your password
#if you havent set up a su password yet type:
sudo passwd
#then make one, next
sudo cp -r ./whatever/genext2fs /bin/
squashfs-tools (if you have ubuntu 9.10-karmic first you will have to uninstall squashfs-tools 4.0(4.0 WILL NOT NOT NOT NOT NOT WORK) that is installed during the installation of linux ): go to system>administration>synaptic package manager. type squashfs-tools in the quick search, then right click and click mark for complete removal. then hit apply. then download and install this here http://http://ftp.us.debian.org/debian/pool/main/s/squashfs/squashfs-tools_3.3-7_i386.deb
i also strongly recommend downloading the sdk-tools v1.1(adb is almost essential when porting, for debugging purposes) enatefox has it posted on his media fire. (search for it)
3. ORGANIZATION
now that we have what we need. lets get organized.
a.mount points
we are going to use mount points while porting.
terminal:
Code:
sudo mkdir /mnt/rootfs
sudo mkdir /mnt/system
#i also have one for mounting data files
mkdir /mnt/data
b. directories
terminal:
Code:
mkdir ~/Desktop/android
mkdir ~/Desktop/android/ion
mkdir ~/Desktop/android/donut
#you get the point...
now put the ion 8/8/09 build in the ~/Desktop/android/ion folder and rename it system.sqsh then
terminal:
Code:
cd ~/Desktop/android/ion
unsquashfs ./system.sqsh
you should now have a folder called squashfs-root in the ion directory. it contains all the guts from the ion build. feel free to look around in that folder as you should get familiar with the folders and things in there
II PORTING
1. PORTING A HERO ROM(this was in zens how-to-make-a-hero-rom.txt im just adding on to it)
a. Download a rom from the dream/sapphire development forums.
b. Extract what you downloaded to ~/Desktop/android/hero. It is usually an update.zip.
c. Open the extracted folder. Inside you should see a data directory and a system directory.
d. Open the data directory and look for an app or app_s folder.
e. Open those folders and copy the apks to the system/app/ folder. Leave out what you don't need. feel free to add any custom apps. as long as they are from the same sdk number. ie 1.5, 1.6, 2.0.1, 2.1 most are pretty cross-compatible though.
f. Delete system/xbin from the rom your porting and replace it with the one from Ion.
g. Copy ~/Desktop/android/ion/squashfs-root/etc/apns-conf.xml from Ion to ~/Desktop/android/hero/system/etc/
h. Mount the latest rootfs.img
terminal:
Code:
sudo mount ~/whereever/rootfs.img -o loop /mnt/rootfs
i. Copy libaudio.so libaudioflinger.so libcameraservice.so libgps.so from /lib in the mounted rootfs over to system/lib in the rom you are porting*(donut and eclair really dont need this step because those files are in most of the latest rootfs.img's but be sure to check)
j. Edit the system/build.prop or even use the Ion build.prop.*(for donut/eclair you may want to edit the lcd density to 120 or 110 in the build.prop for qvga and 160 for 320x480)
k. Create a blank file in system/ called hero.build*(for eclair/donut create donut.build or eclair.build or eclairhero.build.....etc)
*l. for hero any systems too big to run on nand, here is a script to make a data file. put this in the ~/Desktop/android/hero directory. cut the app folder from ~/Desktop/android/hero/system and paste it to ~/Desktop/android/hero , and rename it too app_s . next run the mkdataimg.sh it should ask for you password in a terminal. type it in and then it should mount the data.img to data-mnt folder in ~/Desktop/android/hero . keep that terminal open copy the app_s folder in to data-mnt. then type y in the terminal to unmount the data.img. next:
terminal:
Code:
cd ~/Desktop/android/hero
ln -s /data/app_s ./system/app
that should make a broken symlink in system
2. Mount it and squash it
ok now that we are done porting lets put it together
terminal:
Code:
cd ~/Desktop/android/hero
genext2fs -d ./system -b 180000 -a system.ext2
sudo mount -o loop ./system.ext2 /mnt/system
sudo mksquashfs /mnt/system system.sqsh
sudo chown $USER ./system.sqsh
#and if you want
rm -rf ./system.ext2
from zenulator:
There are other little tweaks here and there but thats basically it. Now you can roll your own.
Click to expand...
Click to collapse
im gonna clean this up a bit later just wanted to get this out to you guys
nice thanks jamezelle
zen's manup456-based Eclair build contains different libaudio.so & libaudioflinger.so than the rootfs, and Eclair wouldn't boot if I replaced them with the libs from the rootfs. This might be due to the rootfs libs not being updated for Eclair yet (also why voice search/dial doesn't work) but I'm not sure. I don't know if this will be the case for 2.1, just wanted to add that in.
I really appreciate the guide and look forward to hearing more. I've learned a lot from zen as well but a lot of the work the devs do is so hard to follow because it's undocumented.
Do you know why the xbin has to be from Ion? Is it because of our kernel version or the squashfs ver that our kernel contains? I've been wanting to grab some of the tools from the xbin of other builds but have been unsure about compatibility.
Also, for more advanced Android ROM building, I'd like to add a link to zipalign optimization.
polyrhythmic said:
zen's manup456-based Eclair build contains different libaudio.so & libaudioflinger.so than the rootfs, and Eclair wouldn't boot if I replaced them with the libs from the rootfs. This might be due to the rootfs libs not being updated for Eclair yet (also why voice search/dial doesn't work) but I'm not sure. I don't know if this will be the case for 2.1, just wanted to add that in.
I really appreciate the guide and look forward to hearing more. I've learned a lot from zen as well but a lot of the work the devs do is so hard to follow because it's undocumented.
Do you know why the xbin has to be from Ion? Is it because of our kernel version or the squashfs ver that our kernel contains? I've been wanting to grab some of the tools from the xbin of other builds but have been unsure about compatibility.
Also, for more advanced Android ROM building, I'd like to add a link to zipalign optimization.
Click to expand...
Click to collapse
we need to move back to a more standardized comunity rootfs.img. i'm seeing more and more different rootfs.imgs that vary little by little. it is kind of hard to really document all of the development. but i see your point. the xbin(are just eXtended bin files) doesnt have to come from ion. the xbin in ion is actually empty
yes our kernel doesnt support LZMA compression which is what 4.0 uses. more info on it here http://www.squashfs-lzma.org/ i dont know why out kernel has not been updated to support it(you would have to ask DZO), i just know is isnt supported
thanks for the link to zipalign. i usually zipalign my apps. btw most dream and sapphire devs are already zipaligning there apks so we dont have to
I agree, I don't like forking the rootfs but the latest ones don't contain the correct WiFi files & settings for Kaiser. I know our kernel is way behind, I've asked several questions in the kernel thread about it but then the thread goes OT and I've never gotten an answer to most of the questions. Newbie16 has been compiling kernels but we've had trouble finding all the updated source files.
Oh, the PNG optimization in the zipalign thread is useful also, I easily saved 5 MB in the Eclair build.
The 8/8 file is a .img file, not .sqsh. Terminal tells me it can't find a sqash superblock on the file, or something to that extent.
EDIT: also missing a step that seems crucial... re squashing the files to make a .sqsh file to use?
ln -s help. hero nand porting
When ever I'm trying to port a hero build to nand ln -s gives me "operation not permitted" during boot. I used -a during genext2fs. Also data didn't work, even though I have the right apns-conif.xml. any idea? I was trying to port hero revolution (I think thats it ). Thanx
TheKartus said:
The 8/8 file is a .img file, not .sqsh. Terminal tells me it can't find a sqash superblock on the file, or something to that extent.
EDIT: also missing a step that seems crucial... re squashing the files to make a .sqsh file to use?
Click to expand...
Click to collapse
i fixed(add the missing steps) it but i dont have a copy of 8/8 ion personally. any ion system.sqsh build will work. if anyone has one please post it!
TheKartus said:
The 8/8 file is a .img file, not .sqsh. Terminal tells me it can't find a sqash superblock on the file, or something to that extent.
EDIT: also missing a step that seems crucial... re squashing the files to make a .sqsh file to use?
Click to expand...
Click to collapse
jamezelle said:
i fixed(add the missing steps) it but i dont have a copy of 8/8 ion personally. any ion system.sqsh build will work. if anyone has one please post it!
Click to expand...
Click to collapse
i just mounted the system.img and copied all the files to a new folder....that way then u dont have to mount the system.img everytime u are porting a rom
my steps to do that
[email protected]:~# cd Android
[email protected]:~/Android# dir
hi Inferno sensehero13 SenseHERO-v1.4_NoTheme senshero
signed-Hero_Inferno_Final signed-Hero_Inferno_Final.zip
system-2009-08-08.img system-sensehero-20091009.sqsh
TOOLS
ZipAlign.sh
[email protected]:~/Android# mkdir ion
[email protected]:~/Android# mount -o loop system-2009-08-08.img ion
[email protected]:~/Android#
Could someone please define...
Could someone please define rootfs, zIMage and the other parts that go into an Android build? If you're going from say, donut, to eclair, which ones can you reuse? I think I understand that the system.sqsh is what makes a build donut or eclair and actually is the file that has the customizations in it. But, what do the other parts do? If this is the wrong place to post this, mods, please move this. Thanks.
Sally
Hey guys, don't know if anyone else is having this issue or not.
I'm trying to work with the Topaz kernals...I downloaded the XDAndroid 2.1 system.sqsh and was able to unsquashfs it fine on my Vector Linux box...but I want to do the same to the TopazKernal16 system.sqsh (donut) but when I run unsquashfs it makes it to about 70% (highest I got to was 80% on one try) and then stops saying "killed".
any way to remedy this? also, what is the simplest way to "re"squash it?
Thanks!
iceman198 said:
Hey guys, don't know if anyone else is having this issue or not.
I'm trying to work with the Topaz kernals...I downloaded the XDAndroid 2.1 system.sqsh and was able to unsquashfs it fine on my Vector Linux box...but I want to do the same to the TopazKernal16 system.sqsh (donut) but when I run unsquashfs it makes it to about 70% (highest I got to was 80% on one try) and then stops saying "killed".
any way to remedy this? also, what is the simplest way to "re"squash it?
Thanks!
Click to expand...
Click to collapse
You just posted in the wrong forum altogether. This section is for the Vogue, not for the Topaz. Try to ask there on in one of the xdandroid threads. This project is different from xdandroid. Thanks.
egzthunder1 said:
You just posted in the wrong forum altogether. This section is for the Vogue, not for the Topaz. Try to ask there on in one of the xdandroid threads. This project is different from xdandroid. Thanks.
Click to expand...
Click to collapse
Sorry, thanks...
iceman198 said:
Sorry, thanks...
Click to expand...
Click to collapse
No prob
I would be interested in the Android's filesystem breakdown. Just some guide on what exactly is in the system, and then rootfs.img and then the modules. If someone could point me in the right direction, that would be much appreciated!
Thanks!
iceman198 said:
I would be interested in the Android's filesystem breakdown. Just some guide on what exactly is in the system, and then rootfs.img and then the modules. If someone could point me in the right direction, that would be much appreciated!
Thanks!
Click to expand...
Click to collapse
pm dzo, he will probably be able to help you there.
egzthunder1 said:
pm dzo, he will probably be able to help you there.
Click to expand...
Click to collapse
Thanks egzthunder1!
iceman198 said:
Thanks egzthunder1!
Click to expand...
Click to collapse
Not a problem. Good luck!

[Linux] [DEV] [WIP]Backtrack 5 on the gtablet HYBRID. 7/18/11 1.2 BL kernel

6/13/12 update
updated links and some instructions.
I currently do not have time to do any work on this currently as i have been working 18+ hours a day. Hopefully if i ever get some time again I will continue it.
Jaybob413 built the kernel for 1.2 Bootloader. Link is posted below
Thanks jaybob413
*PLEASE READ AND UNDERSTAND EVERYTHING HERE BEFORE ATTEMPTING THIS*
BACKTRACK 5 IS running on the GTABLET in Hybrid mode!
http://www.youtube.com/watch?v=kJb3mwBhMik video up now =)
http://www.youtube.com/watch?v=be-9F_VzbHY Dual boot video
working
boots natively into backtrack
X11 desktop works
wifi
TOUCHSCREEN!!!!!
4 buttons. Search opens firefox, home opens users home dir, settings toggles the Onscreen keyboard, and back switches through virtual desktops.
Not Working
sound
bluetooth
battery stats
------------------------------------------------
I currently have this set up for windows. It can be done from linux but will link everything for windows in this post.
you must have ADB installed on windows working with the gtablet. see http://forum.xda-developers.com/showthread.php?t=902860
required files:
bt5.tar.xz http://d-h.st/YZ4
restore_droid-kern.zip http://dev-host.org/qsbz1s7xbebt/restore_droid-kern.zip
droid-kern_backup.zip http://dev-host.org/evmqb1yrd0tn/droid-kern_backup.zip
1.1 bootloader:
bt5kern-01-20110525.zip http://dev-host.org/s4d4pp1wvxx4/bt5kern-01-20110525.zip
1.2 bootloader: thanks jaybob413 for the 1.2 kernel.
http://forum.xda-developers.com/showpost.php?p=15703493&postcount=137
optional files:
nvidia_windows.zip http://dl.dropbox.com/u/4917587/nvflash_windows.zip
kernel config file http://dl.dropbox.com/u/4917587/config this file is only for reference. you do not have to download it or install it
the root password is "toor"
THIS MAY ERASE EVERYTHING ON YOUR TABLET!!!!
Do this at your own risk!! I take no responsibility for anything that happens to your tablet.
Start by installing your favorite ROM and kernel.
Make sure you have adb working and CWM installed
turn off the device then boot into recovery. (vol+ and power).
once in recovery you must format the EXTERNAL sdcard into ext3.
Code:
adb shell
parted /dev/block/mmcblk2
mkfs 1 ext2
confirm
exit
tune2fs -j /dev/block/mmcblk2p1 to format the external SDcard to ext3
mkdir /tmp/ext-sd
mount /dev/block/mmcblk2p1 /tmp/ext-sd/
exit adb and run
* this will take a long time *
Code:
on a linux box unxz bt5.tar.xz
adb push c:\path\to\bt5.tar /tmp/ext-sd/bt5.tar
adb shell
# cd /tmp/ext-sd/
tar xvf bt5.tar
rm bt5.tar
cd /
umount /tmp/ext-sd/
reboot the device into android and connect the INTERNAL sdcard to the computer to place files on to the sdcard.
make a directory called kernels on the sdcard and put the 3 zips from above in that folder.
bt5kern-01-20110525.zip
droid-kern_backup.zip
restore_droid-kern.zip
reboot into recovery and flash the
droid-kern_backup.zip this will create a backup of the android kernel. This will ONLY need to be done any time that you UPGRADE or CHANGE your android kernel.
once this is done you switch back and forth between android and backtrack with:
bt5kern-{date}.zip to boot into backtrack
restore_droid-kern.zip to boot into android
******* You do NOT have to wipe cache or anything when switching back and forth. Just flash whichever you want to boot into and you are done************
http://forum.xda-developers.com/showpost.php?p=16223052&postcount=139 WICD fix
Linux touchscreen drivers and settings
xf86-input-multitouch https://launchpad.net/debian/+archi...ut-multitouch_1.0~rc2+git20110312.orig.tar.gz
libmtdev1 http://ftp.de.debian.org/debian/pool/main/m/mtdev/mtdev_1.1.0.orig.tar.gz
************OLD WAY******************
How to install backtrack 5 to run on the gtablet with out gtab filesystem modification.
You must recreate the img file to be less then 4Gb. The img file is currently 4.6Gb. The new image created will be 2.9Gb. this is a vfat limitation
this has been tested on vegan 5.1 with the gtab/zpad 1.4 OC kernel. Its still a little buggy with random reboots depending on what your are doing but it is a WIP
The kernel must have loop devices support. Also looks like the kernel needs swap functionality to be enabled.
I could release the img file that has already been created but backtrack would prefer that people not release other images so this will allow you to create your own after downloading it from them so it remains trusted.
you either need:
linux with ADB working on the gtab
OR
windows with ADB and access to a linux box with about 10gb of free space.
Backup your sdcard because it needs to be repartitioned with CWM.
In CWM under advanced > Partition SD Card > 2048 > 128
download the arm version of backtrack from www.backtrack-linux.org/downloads/
and extract the files. you need to copy the bt5.img.gz to the linux box and do all the following steps.
make a working directory for all the files, copy and gunzip the img file
Code:
mkdir bt5
cp /root/bt5.img.gz bt5
cd bt5
gunzip bt5.img.gz
rename the old bt5.img to something else and create a new image that fits onto the gtabs vfat filesystem.
then create 2 directory to mount each image and copy the files over to the new img file.
Code:
mv bt5.img bt5.old.img
dd if=/dev/zero of=bt5.img bs=4k count=900000
mke2fs -F -i 8192 bt5.img
mkdir bt5old bt5new
mount -o loop bt5.old.img bt5old
mount -o loop bt5.img bt5new
cd bt5old
cp -rp * ../bt5new
*****************************************
since the system does not go through the full startup scripts once you run "sh bootbt" you must run /etc/rc.local from the chroot to start the vnc server if you add these lines otherwise you must type them each time.
Code:
cd ../bt5new/
vi etc/rc.local and add the following 2 lines before the exit 0 line
export USER=root
/usr/bin/startvnc
save the file and then continue on.
also you can edit /usr/bin/startvnc and modify the screensize to fit the tablet
the gtablet is 1024x600
Code:
vncserver -geometry 1024x600
*****************************************
after all files have been copied over you just unmount the 2 directories and gzip the new image.
Code:
cd ..
(you should now be in the directory with the 2 img files and 2 directories)
umount bt5old
umount bt5new
gzip bt5.img
edit the bootbt file and change the line
Code:
mount -o remount,rw /dev/block/mmcblk0p5 /system
with
Code:
mount -o remount,rw /dev/block/mtdblock3 /system
*** this needs to be changed to whatever your /system is on your tablet or phone if it is something other then the gtablet.
now copy this new bt5.img.gz file over to the directory where you got the original image from and then follow the instructions that are included with the download in the README file.
a good VNC viewer is located
http://code.google.com/p/android-vnc-viewer/downloads/list
and also install a terminal emulator so you can start Backtrack 5 from the device.
---BUGS---
running from a terminal emulator everything runs fine but running VNC gnome takes up way to much RAM currently. Looking at fluxbox and/or swap as a fix. causes the tablet to lock up and must be powered off by holding the power button.
---Thanks---
The Backtrack Team -- for coming up with an amazing security distro
The G-TabDevs Team -- for the vegan 5.1 Rom
Pershoot -- for maintaining the 1.4 kernel for the gtab and hopefully adding support for needed features =)
Sorry for the flash in the pictures
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
sorry for the noob question.....
where we need to run all the commands you have stated????
fauz33 said:
sorry for the noob question.....
where we need to run all the commands you have stated????
Click to expand...
Click to collapse
They must be run on a linux box. I bolded it just now in the first post. I would do it all and just release the gzip file but backtrack does not want that.
slimm609 said:
They must be run on a linux box. I bolded it just now in the first post. I would do it all and just release the gzip file but backtrack does not want that.
Click to expand...
Click to collapse
sorry....
i have googled it for hours.....
what is mean by linux box??
fauz33 said:
sorry....
i have googled it for hours.....
what is mean by linux box??
Click to expand...
Click to collapse
_almost_ any version of linux installed on a computer (laptop or desktop).
you need about 8-10gb of free space after linux is installed.
like fedora, centOS, ubuntu, suse, slackware, etc.
90+% of the versions on this site would work www.distrowatch.com
I'll talk to Muts and see if he will allow the gzip. Maybe if it is maintained by you but released by them they might consider it.
These instructions are for running BT5 in a shell, not actually installing it as the working OS on the gtablet - right?
Similar to:
http://www.backtrack-linux.org/forums/backtrack-5-how-tos/40376-%5Bhow-%5D-backtrack-5-motorola-xoom-gnome-ui-via-tightvncserver.html
runner989 said:
I'll talk to Muts and see if he will allow the gzip. Maybe if it is maintained by you but released by them they might consider it.
These instructions are for running BT5 in a shell, not actually installing it as the working OS on the gtablet - right?
Similar to:
http://www.backtrack-linux.org/forums/backtrack-5-how-tos/40376-%5Bhow-%5D-backtrack-5-motorola-xoom-gnome-ui-via-tightvncserver.html
Click to expand...
Click to collapse
This runs the same way that it does on the Xoom. Just making it fit onto the gtab and Evo 4g
here is CHS (runner989)
Is packet injection working with the wireless adapter?
kdj67f said:
Is packet injection working with the wireless adapter?
Click to expand...
Click to collapse
most of the tools for wireless were removed when they created the arm version.
I am going to try and compile them and see if they work when i get a chance (hopefully soon)
Ugh! That sucks! I did not know they did that. Since the gtablet has a USB port the USB wireless adapters (like the Alfa adapter) should work just as they do in the regular Backtrack builds.
slimm609 said:
most of the tools for wireless were removed when they created the arm version.
I am going to try and compile them and see if they work when i get a chance (hopefully soon)
Click to expand...
Click to collapse
runner989 said:
Ugh! That sucks! I did not know they did that. Since the gtablet has a USB port the USB wireless adapters (like the Alfa adapter) should work just as they do in the regular Backtrack builds.
Click to expand...
Click to collapse
The internal card is a broadcom 4329 so it should support everything also. have to wait and see.
Major progress made on booting native backtrack linux. Kernel boots but it missing a driver so it drops into a ramfs but getting close.
off to bed
I was so excited I forgot we run an arm processor! Good work to the devs on this. And although it was probably an ethical thing to remove all the wireless functions for ARM builds, It would be much handier than lugging around my old laptop with it's ancient battery that barely last 45 minutes under load.
Many thanks, I am subscribing. Just wish I could help
This is pretty awesome. Might want to check the debian or ubuntu ARM community to find out how the wireless drivers work there. I'm assuming our ARM runs in it's normal little indian, not ARMEB mode, right?
muqali said:
This is pretty awesome. Might want to check the debian or ubuntu ARM community to find out how the wireless drivers work there. I'm assuming our ARM runs in it's normal little indian, not ARMEB mode, right?
Click to expand...
Click to collapse
the wireless card is a broadcom 4329
slimm609 said:
the wireless card is a broadcom 4329
Click to expand...
Click to collapse
The driver source thread is http://forum.xda-developers.com/showthread.php?t=906628
wifi is working now. tested with wpa-psk
New files coming tomorrow with wifi included.
the touchscreen is seen by the system and xorg just need to find the right configuration for it to work
now trying to compile as a single touch device because Xorg does not support multi-touch displays
touchscreen is working. just working on calibration of it now. only single touch currently
This is awesome...
Sent from my Droid using XDA App

[GUIDE][ICS] Compile Cyanogenmod 9 on Mac OS X Lion

There are a lot of toturials for building CM9 on ubuntu or CM7 on Mac but I couldn't find a decent toturial for building CM9 on Mac (specially Lion). Development in AOSP/CM land is rapid and guides frequently need updating. I had to spend a little time to figure everything out and I decided to share it here.
This tutorial is for building CM9 (ICS) for Galaxy Nexus GSM (maguro) on Mac OS X Lion 10.7.3 using Xcode 4.3 and homebrew . You can easily make the instructions work for most other cm9 devices, but I wouldn't know anything about that.
DISCLAIMER: I'm not responsible if you blow yourself up, blah blah blah
However, I've tried to make this as noob friendly as possible because, well I'm a noob myself
Instrunctions:
UPADTE (MAY 29TH) : The Xcode 4.3 default compiler (llvm-gcc) used to be incompatible with CM9. Thanks to jocelyn and topprospect, the LLVM compatibility patches from mainline AOSP are now merged into CM9. Therefore, you can now use Xcode 4.3 and its command line tools without installing another compiler. However, since GCC is still the only officially supported compiler, incompatibilites with llvm-gcc could still be introduced with future updates. Therefore, if your build fails, it might be worth it to try installing and compiling with GCC 4.2. See the Troubleshooting section for more info.
Now that we have Xcode 4.3 and Xcode command line tools (CLT) installed, let's continue.
Open Terminal and run
Code:
java
if you don't have Java, you will get a prompt asking you to download and install Java. Go ahead and install it.
If you don't have adb and fastboot working, download the android-sdk from google (version r18 as of now) and put it in /usr/local/ and rename the folder to "android-sdk".
Install the homebrew package manager
Code:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
To make sure that homebrew and android-sdk executables are in $PATH:
Code:
touch ~/.bash_profile && echo "PATH=/usr/local/bin:/usr/local/sbin:$PATH:/usr/local/android-sdk/tools:/usr/local/android-sdk/platform-tools" >> ~/.bash_profile
Relaunch Terminal for the change to take effect.
At this point you can run
Code:
brew doctor
to detect any problems there might be (Homebrew may instruct you to use the xcode-select utility to select the xcode installation path). Hopefully, your system is raring to brew
Now we have to install a bunch of packages:
Code:
brew install git coreutils findutils gnu-sed gnupg pngcrush repo
We now need to create a couple of symlinks so that the gnu versions of 'sed' and 'find' are used rather than the osx provided versions :
Code:
ln -s /usr/local/bin/gfind /usr/local/bin/find && ln -s /usr/local/bin/gsed /usr/local/bin/sed && ln -s /usr/local/bin/gstat /usr/local/bin/stat
It's time to create a case sensitive image which will hold our working directory:
Code:
hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 40g -volname "android" -attach ~/Desktop/Android
Now we have a disk image in ~/Desktop/Android. Mount it if it's not mounted already. (Don't be picky about the size, the image will only take as much as space as its contents).
Now we need to create a working directory inside the mounted volume:
Code:
cd /Volumes/android && mkdir cm9 && cd cm9
We can initialize and download the source now:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics && repo sync && say 'finished'
Now we need to get the required proprietry files for our device. We can get these from the device itself. Connect your phone (make sure USB Debugging is enabled) and run the following (for maguro):
Code:
cd /Volumes/android/cm9/device/samsung/maguro/ && ./extract-files.sh
[If you see errors in the output from extract-files.sh, see the Troubleshooting section below]
For Google devices,we can also get them directly from google. For maguro, download the 3 files and extract them to /Volumes/android/cm9. Then,
Code:
cd /Volumes/android/cm9
/Volumes/android/cm9/extract-broadcom-maguro.sh
/Volumes/android/cm9/extract-imgtec-maguro.sh
/Volumes/android/cm9/extract-samsung-maguro.sh
We also need the prebuilts (like ROM manager and Term.apk):
Code:
/Volumes/android/cm9/vendor/cm/get-prebuilts
You can optionally tell the build to use the ccache tool. CCache acts as a compiler cache that can be used to speed-up rebuilds :
Code:
export USE_CCACHE=1 && /Volumes/android/cm9/prebuilt/darwin-x86/ccache/ccache -M 20G
Default is 1GB. Anything between 20GB-50GB should be fine.
Before starting the build, we need to workaround an issue with Lion and compiling the QEMU emulator.
[This step doesn't seem to be needed anymore. QEMU is automatically ignored on OS X/Darwin]
If you build now, you're probably gonna get kernel build errors regarding the missing elf.h header (this error might be device specific). Fortunately, we already have this file downloaded, so we only need to copy it to /usr/local/include:
Code:
cp /Volumes/android/cm9/external/elfutils/libelf/elf.h /usr/local/include
FINALLY, we are ready to build:
Code:
cd /Volumes/android/cm9 && source build/envsetup.sh && brunch
Pick your device from the list and enter the number. For maguro, you could use "brunch maguro" instead and skip the menu. Depending on your system, this will take 30min-4hours.
You should now see a beautiful zip file waiting to be flashed:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
​Troubleshooting:
The extract script for maguro seems to be a little outdated, as it doesn't pull the gps proprietary blob. You can either use the google provided scripts, or add koush's git repository for your device to your local_manifest.xml.
As explained above, the CM9 source is currently compatible with llvm-gcc. In the future, if llvm-gcc fails to build correctly, you should try installing and compiling using GCC4.2 (the Xcode 3 compiler). You can install apple-gcc4.2 from homebrew:
Code:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
This version of gcc can happily coexist with Xcode 4.x .
So now you have GCC 4.2 installed, but it won't be used unless we update the corresposing environment variables:
Code:
export CC=/usr/local/bin/gcc-4.2 && export CXX=/usr/local/bin/g++-4.2
Notice that using the export command is temporary. If you relaunch Terminal, you will need to set these again. However, this is a good thing, because changing these values permanently (by putting them in ~/.bash_profile) can interfere with other builds.
If you use this method, the build might fail while compiling "external/zlib/x86/adler32.c". It appears that a recent change in zlib has introduced an incompatibility with gcc 4.2. you have to revert the following 2 commits:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Alternatively, you can add topprospect's zlib on github (which has those commits reverted) to your local_manifast.xml. Simply run:
Code:
nano /Volumes/android/cm9/.repo/local_manifest.xml
and add the following line
Code:
<project name="dferg/android_external_zlib" path="external/zlib" remote="github" />
If you get a build error, and your error is not covered here, copy the last 20-30 lines of the build output AND the output from the following command into pastebin and post the link. Hopefully me or someone else will help you.
Code:
echo -e "\nENV:\n$(env)\n\nWHICH GCC\n:$(which gcc)\n\nWHICH G++:\n$(which g++)\n\nWHICH CC:\n$(which cc)\n\nWHICH C++:\n$(which c++)\n\nBREW DOCTOR:\n$(brew doctor)\n\nBREW LIST:\n$(brew list)\n\n/USR/BIN:\n$(ls -l /usr/bin | grep gcc)\n\n/USR/LOCAL/BIN:\n$(ls -l /usr/local/bin | grep gcc)\n\n"
​Notes/Extras:
To quickly setup your environment, add an alias like the following to ~/.bash_profile:
Code:
alias cm9env="hdiutil attach PATH-TO-DISK-IMAGE -mountpoint /Volumes/android && cd /Volumes/android/cm9 && source ./build/envsetup.sh && export USE_CCACHE=1"
alias cm9build="cm9env && make clobber && reposync && brunch maguro"
Now you can save time by using "cm9env" to get your environment setup or "cm9build" to compile a clean updated build.
To clear your output directory for a new build, run "make clobber". You probably don't need this if you've only changed a few lines of code.
To cherry pick yet-to-be-merged changes from the gerrit instance:
1. Pick an open commit from CM Gerrit
2. Under list of Patch Sets pick the latest and open cherry-pick tab
3. Check what Git repository the url is pointing e.g. http://review.cyanog...frameworks_base
4. In your CM9 working tree go to the corresponding directory, which in this case is something like ~/your-working-directory/frameworks/base/
5. Now simply paste the whole line seen in CM Gerrit cherry-pick tab e.g. "git fetch http://review.cyanog....rameworks_base refs/changes/00/13100/4 && git cherry-pick FETCH_HEAD"
It should be now included in your next compiled build. When doing repo sync again, cherry picks will be lost.[CREDIT Fihlvein from xda]
Click to expand...
Click to collapse
Enjoy your custom built CM9!
I updated OP with some updated info about Xcode 4.3.
Nice work man. Very helpful.
conantroutman said:
Nice work man. Very helpful.
Click to expand...
Click to collapse
thanks! I'll try to keep this topic updated as issues with mac are introduced/resolved.
Nice write up. Thanks.
Before I start again from scratch I have a question. Does this guide apply to previous versions of mac os x (mine is 10.6.8)? I used the official android initializing build environment page & cm7 wiki page for the instructions to setup my build environment.
Also, any tips to switch from macports to homebrew?
In the past I've had to cherry pick to get my OS X build environment set up for CM9. The compile from source fails because I started with macports instead of homebrew (bad idea). I tried to switch to homebrew without success. Any tips to switch from macports to homebrew?
For the sake of keeping this page on topic a pm response is ok if that is what you prefer.
Hi thanks for this !! Helpful one question what do i change so i can do AOSP instead of cm9??
grad061980 said:
Nice write up. Thanks.
Before I start again from scratch I have a question. Does this guide apply to previous versions of mac os x (mine is 10.6.8)? I used the official android initializing build environment page & cm7 wiki page for the instructions to setup my build environment.
Also, any tips to switch from macports to homebrew?
In the past I've had to cherry pick to get my OS X build environment set up for CM9. The compile from source fails because I started with macports instead of homebrew (bad idea). I tried to switch to homebrew without success. Any tips to switch from macports to homebrew?
For the sake of keeping this page on topic a pm response is ok if that is what you prefer.
Click to expand...
Click to collapse
Yes, this guide should work fine on Snow Leopard. It mostly depends on your Xcode version. If you have Xcode 3, you can skip step 1 entirely, since you already have gcc4.2 as part of Xcode.
If you have access to Xcode 4.2 and above, you will need to install gcc4.2 separately, as explained in the guide.
Now regarding Macports, I strongly suggest that you completely uninstall Macports before installing homebrew. Instructions are here: http://guide.macports.org/chunked/installing.macports.uninstalling.html
WonkyYew said:
Hi thanks for this !! Helpful one question what do i change so i can do AOSP instead of cm9??
Click to expand...
Click to collapse
Full instructions are available on android.com : http://source.android.com/source/initializing.html
If you are using this guide, you need to change the repo initialization command to :
Code:
repo init -u https://android.googlesource.com/platform/manifest
and then do repo sync. You can setup ccache as usual. I don't think AOSP has the "brunch command", so you have to use launch and then make.
Run "lunch" and select an option from the menu. You can find more info about the options here: http://source.android.com/source/building.html. For maguro, you should use "full_maguro-userdebug".
To start the build, use
Code:
make -j$(sysctl -n hw.ncpu)
@ArmanUV. Sounds good & thanks for the input. I'll give the link to macports uninstall a go.
Im a real noob, whats the advantage of compiling from source?
Thanks for the help man !
Hi, thanks for your guide, setting up the repo was no problem at all!
But: I'm getting the following error when building.
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libz_intermediates/adler32.o] Error 1
make: *** Waiting for unfinished jobs....
Seems to be a problem with the compiler, but I'm on xcode 4.3 and I've installed gcc-4.2 and set the env vars. Any help?
ArmanUV,
Thanks so much for posting this guide. Very helpful!
Are you having any trouble with errors like this?
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
Googling for this error implies that the fix is to use a version of GCC > 4.2. But there does not seem to be a GCC 4.4 in Homebrew.
Thanks again for the guide!
EDIT: Sorry for the double post with empyyy. Seems like there is someone else having my same issue!
topprospect said:
ArmanUV,
Thanks so much for posting this guide. Very helpful!
Are you having any trouble with errors like this?
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
Googling for this error implies that the fix is to use a version of GCC > 4.2. But there does not seem to be a GCC 4.4 in Homebrew.
Thanks again for the guide!
EDIT: Sorry for the double post with empyyy. Seems like there is someone else having my same issue!
Click to expand...
Click to collapse
empyyy said:
Hi, thanks for your guide, setting up the repo was no problem at all!
But: I'm getting the following error when building.
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libz_intermediates/adler32.o] Error 1
make: *** Waiting for unfinished jobs....
Seems to be a problem with the compiler, but I'm on xcode 4.3 and I've installed gcc-4.2 and set the env vars. Any help?
Click to expand...
Click to collapse
You guys seem to have the same issue. What sort of Xcode configuration are you using? Can you post the output from "which gcc","which g++", "gcc -v", "g++ -v" and "cc -v"?
ArmanUV said:
You guys seem to have the same issue. What sort of Xcode configuration are you using? Can you post the output from "which gcc","which g++", "gcc -v", "g++ -v" and "cc -v"?
Click to expand...
Click to collapse
I am on Lion 10.7.4 with Xcode 4.3.2. Here is the output that you asked for:
Code:
# echo -n "which gcc: "; which gcc; echo -n "which g++: "; which g++; echo ""; echo "gcc -v:"; gcc -v; echo ""; echo "g++ -v:"; g++ -v; echo ""; echo "cc -v:"; cc -v
which gcc: /usr/bin/gcc
which g++: /usr/bin/g++
gcc -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
g++ -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
cc -v:
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
They are pointing to LLVM, but my CC and CXX variables point to:
Code:
env|grep 4.2
CXX=/usr/local/bin/g++-4.2
CC=/usr/local/bin/gcc-4.2
Do I need to add something to PATH? I'm sure I just missed something obvious in your instructions.. Thanks for helping!
topprospect said:
I am on Lion 10.7.4 with Xcode 4.3.2. Here is the output that you asked for:
Do I need to add something to PATH? I'm sure I just missed something obvious in your instructions.. Thanks for helping!
Click to expand...
Click to collapse
Everything checks out. I'm away from my main machine so I can't run a test build, but I suspect that a recent change is causing problems.
Now, regarding the compiler, Setting CC/CXX *should* take care of everything, but I am currently not 100% sure that somewhere in a makefile, these environment variables aren't being ignored. Since I wrote the guide, I noticed a lot of clang warnings in the build, which means that CC/CXX is not honored and /usr/bin/cc and /usr/bin/c++ is being used.
A more robust method of making sure gcc-4.2 is being used is creating symlinks to gcc-4.2 and g++-4.2 :
Code:
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/gcc
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/cc
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/c++
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/g++
Obviousely, a systemic method like this has its downsides but it may be the only choice without having to change CM code (especially since I lack the knowledge to do so )
[I recently found out that master aosp is no longer using CC/CXX to find the compiler (see ./build/core/combo/). Instead, it uses "gcc" and "g++" directly, which means that llvm-gcc will be used no matter what env variable you have. Fortunately, unlike cm9, master aosp is supposed to build fine with llvm-gcc (except for qemu, which doesn't matter for device images). ]
ArmanUV said:
Everything checks out. I'm away from my main machine so I can't run a test build, but I suspect that a recent change is causing problems.
Now, regarding the compiler, Setting CC/CXX *should* take care of everything, but I am currently not 100% sure that somewhere in a makefile, these environment variables aren't being ignored. Since I wrote the guide, I noticed a lot of clang warnings in the build, which means that CC/CXX is not honored and /usr/bin/cc and /usr/bin/c++ is being used.
A more robust method of making sure gcc-4.2 is being used is creating symlinks to gcc-4.2 and g++-4.2 :
Code:
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/gcc
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/cc
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/c++
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/g++
Click to expand...
Click to collapse
Okay, just tried this. I created a new dir (/Volumes/Android/bin) that simply houses those softlinks you recommended. Then I put /Volumes/Android/bin at the beginning of my PATH. That should fix it without breaking the rest of the system, e.g. homebrew.
The GENERAL_REGS problem still exists though. Pretty sure b/c gcc 4.2.1 doesn't understand this construct properly (need a newer version of gcc).
So I backed out the change that introduced this adler32.c.
https://github.com/CyanogenMod/android_external_zlib/commit/13bf40af68236c961542bdee1d4b7c0176bf15a0
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
The weird thing is: This change was made back in December. Why would it have worked for you?
topprospect said:
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
Click to expand...
Click to collapse
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Note the 1st revert is just to avoid massive conflicts seen when reverting the 2nd one by itself. The 2nd revert is the one that really matters here.
So this isn't really a solution.. Seems like we need to move to a newer version of gcc or figure out a patch to adler32.c that makes it gcc 4.2 compatible.
topprospect said:
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Click to expand...
Click to collapse
The first revert works fine, however the second one gives me the following error:
Code:
$ git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
error: could not revert 13bf40a... Implement vectorized adler32 and optimized slhash
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
error: Could not parse conflict hunks in zlib.h
empyyy said:
The first revert works fine, however the second one gives me the following error:
Code:
$ git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
error: could not revert 13bf40a... Implement vectorized adler32 and optimized slhash
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
error: Could not parse conflict hunks in zlib.h
Click to expand...
Click to collapse
Well, run git status. You'll see that the only conflict is in the comments in zlib.h. So, you can just ignore it.
topprospect said:
Okay, just tried this. I created a new dir (/Volumes/Android/bin) that simply houses those softlinks you recommended. Then I put /Volumes/Android/bin at the beginning of my PATH. That should fix it without breaking the rest of the system, e.g. homebrew.
The GENERAL_REGS problem still exists though. Pretty sure b/c gcc 4.2.1 doesn't understand this construct properly (need a newer version of gcc).
So I backed out the change that introduced this adler32.c.
https://github.com/CyanogenMod/android_external_zlib/commit/13bf40af68236c961542bdee1d4b7c0176bf15a0
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
The weird thing is: This change was made back in December. Why would it have worked for you?
Click to expand...
Click to collapse
topprospect said:
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Note the 1st revert is just to avoid massive conflicts seen when reverting the 2nd one by itself. The 2nd revert is the one that really matters here.
So this isn't really a solution.. Seems like we need to move to a newer version of gcc or figure out a patch to adler32.c that makes it gcc 4.2 compatible.
Click to expand...
Click to collapse
Nice find. I tried to compile this morning and I ran into the same issue. This is what I don't understand: I did a couple of builds about a week ago without running into this issue. But, the latest commits on zlib are from 2 months ago.
Amazingly, the Xcode 4.3 toolchain (clang and llvm-gcc) builds this external/zlib/adler32.c just fine.
An alternative to this problem is to install an up to date gcc 4.7 :
Code:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gcc.rb
and then create symlinks to gcc-4.7/g++-4.7. I have not tested this yet.

[Step by Step] Build ICS/JB Kernel

I have created a new thread with a script to build the kernel. Full credit for the script goes to the amazing mapkel. Without him there would be no script.
[Script] Build ICS/JB Kernel
This thread will remain as a Step by Step guide. Either method works fine but the script method is much simpler.
This is an informative guide and I decline responsibility for any damage to your device.
Do not attempt to build this kernel if you are going to complain to devs about issues.
That being said, I designed this so that even those with little knowledge can follow the exact commands and will run into no issues. If you have issues building, post here and I will try to assist you.
The following is a complete tutorial to building the kernel.
Credits:
Kernel Devs: krystianp, lehjr, Epinter, and mmontuori for making this kernel; without them there is no kernel.
Big thanks to benouch for the idea and basic outline of this tutorial.
Another big thanks to zen25205 for help with building the kernel and getting the Linaro Toolchain.
A final big thanks to mchinand for suggesting using "${HOME}" (no need to change for username anymore)
Kernel Kitchen
Thanks to:
quetzalcoatl2435
nlabrad
You need to install Ubuntu 12.04 64bit (Google for instructions)
1. Download linaro.zip (toolchain) from here: http://www.mediafire.com/?ok2paef7uhx2ji8
2. Download kitchen.zip from here: https://mega.co.nz/#!Uc4D0YiD!bs-f4FLWQTu7Q8FQziY0o3GWRPJWGBl-6-Hhm6nta-k
3. Download kernel-working.zip from here: http://www.mediafire.com/?wtavk4yb24x3lj1
4. Download misc.zip from here: http://www.mediafire.com/?q693gipql6a6ty8
If there are any issues with this guide, or if you have any issues building the kernel, post here and I will assist you as best I can.
The following is for Arch Linux Only. Ignore if you are using Ubuntu
Code:
pacman -Syu
pacman -S base-devel
pacman -S git
pacman -S bzip2
pacman -S unzip
Ubuntu Users Start Here
If you get an error on apt-get (something about package not found), enable all software sources in Ubuntu Software Center.
Stage 1 (first time only). Go to Stage 2 if you have already built the kernel.
Open a terminal and run the following commands:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
Code:
sudo apt-get install git
Create a folder named “olympus” in your home directory:
Code:
mkdir ${HOME}/olympus/
Extract the downloaded .zip files to the “olympus” folder (you can use the file manager or the following commands):
Code:
unzip ${HOME}/Downloads/linaro.zip -d ${HOME}/olympus/
unzip ${HOME}/Downloads/kitchen.zip -d ${HOME}/olympus/
unzip ${HOME}/Downloads/kernel-working.zip -d ${HOME}/olympus/
unzip ${HOME}/Downloads/misc.zip -d ${HOME}/olympus/
There should now be 4 folders in ${HOME}/olympus/: “linaro”, “kitchen”, “kernel-working” and “misc”.
In a terminal:
Code:
cd ${HOME}/olympus/
Code:
git clone git://github.com/CyanogenMod-Atrix/android_kernel_motorola_olympus.git
Stage 2 (start here if you are building again).
Code:
cd ${HOME}/olympus/android_kernel_motorola_olympus/
Get the latest updates from git:
Code:
git remote update
Now run the following commands to build the kernel:
Code:
export CROSS_COMPILE=${HOME}/olympus/linaro/bin/arm-unknown-linux-gnueabi-
Code:
make clean && make mrproper
Code:
make -j2 ARCH=arm tegra_olympus_defconfig
Code:
make -j2 ARCH=arm
Now start packing the new kernel and modules:
Code:
cp ${HOME}/olympus/android_kernel_motorola_olympus/arch/arm/boot/zImage ${HOME}/olympus/kitchen/kernel-tools/input/
Code:
cp ${HOME}/olympus/misc/CM9/boot.img ${HOME}/olympus/kitchen/kernel-tools/input/
(Replace CM9 with CM10 for CM10)
Code:
cd ${HOME}/olympus/kitchen/kernel-tools/
Code:
./menu
Press Enter Key
Select Option 1
Press Enter Key (again)
Select Option 1 (again)
Type “olympus” and press Enter Key
Press "Ctrl+C"
Code:
cp ${HOME}/olympus/kitchen/kernel-tools/output/bootimg-contents/initrd.img ${HOME}/olympus/kitchen/kernel-tools/input/
Code:
cd ${HOME}/olympus/kitchen/kernel-tools/
Code:
./menu
Press Enter Key
Select Option 1
Press Enter Key (again)
Select Option 3
Type “olympus” and press Enter Key
Press "Ctrl+C"
Run the following commands:
Code:
cp ${HOME}/olympus/kitchen/kernel-tools/output/boot.img ${HOME}/olympus/kernel-working/
Code:
find ${HOME}/olympus/android_kernel_motorola_olympus/drivers/ -name *.ko -exec cp -f {} ${HOME}/olympus/kernel-working/system/lib/modules/ \;
Code:
cd ${HOME}/olympus/kernel-working/
Code:
zip -r new_kernel.zip *
The “new_kernel.zip” file will be located at ${HOME}/olympus/kernel-working/new_kernel.zip
This is a flashable zip that you can flash on top of MROM CM9 and the ROMs that the devs will be releasing.
You will have the latest kernel changes by building it yourself.
Thanks for the tutorial. Just a quick question, why did you include the kernel modules in the kernel-working.zip; aren't they going to be overwritten with the newly compiled ones?
I can do it in debian?
mchinand said:
Thanks for the tutorial. Just a quick question, why did you include the kernel modules in the kernel-working.zip; aren't they going to be overwritten with the newly compiled ones?
Click to expand...
Click to collapse
They were useless. I have reuploaded. New link in OP.
Ufoex said:
I can do it in debian?
Click to expand...
Click to collapse
I have not tested. You can try and report back. If it works I will update the thread.
Usually devs stick to Ubuntu for Android development.
Seeing as Ubuntu is based off Debian, it should work.
atrix4g18 said:
They were useless. I have reuploaded. New link in OP.
Click to expand...
Click to collapse
I think it is better to only include what is necessary in the zips. Not for space/bandwidth reasons (they were small as you said), but more for understanding the process and knowing what's essential to build a flashable kernel.
mchinand said:
I think it is better to only include what is necessary in the zips. Not for space/bandwidth reasons (they were small as you said), but more for understanding the process and knowing what's essential to build a flashable kernel.
Click to expand...
Click to collapse
100 Percent agree. I appreciate the suggestion. As I said the new kernel-working.zip is updated without those files. Check OP.
Thanks
You forgot "sudo apt-get install git".
Oh, and if you get an error on apt-get (something about package not found), enable all software sources in Ubuntu Software Center.
quetzalcoatl2435 said:
You forgot "sudo apt-get install git".
Oh, and if you get an error on apt-get (something about package not found), enable all software sources in Ubuntu Software Center.
Click to expand...
Click to collapse
Second Post Updated. Thanks. (I don't think anyone will have the apt-get error, but if they do I will let them know).
I got that error on apt-get, which is why I mentioned it.
It was weird, I had to enable local (CD) sources to make apt-get work. It had to read the source list from the CD first before downloading the packages.
It might be a wonky install, though. I just put it here in case anyone faces the same problem.
what?
Does the kernel already includes Linaro?
omg Kristian said he'll look at it, so did he? :crying: Happy:crying:
crazymania56 said:
what?
Does the kernel already includes Linaro?
omg Kristian said he'll look at it, so did he? :crying: Happy:crying:
Click to expand...
Click to collapse
No this is only the Linaro Toolchain used to build the kernel.
Other tutorials would have you download the Android NDK for the toolchains within.. This tutorial uses the Linaro Toolchain instead.
quetzalcoatl2435 said:
I got that error on apt-get, which is why I mentioned it.
Click to expand...
Click to collapse
Added to second post. Thanks. Also made a list of credits in the OP and you are in it.
Hi, i'm trying this in Arch, i looked for the equivalent packages that are needed in ubuntu and seems that Arch has some of them in the arch-devel group of packages and the *-dev packages are included in the non-dev (arch doesn't splits the packages in dev and nondev).
So, i started unziping, and when i'm unzipping the linaro.zip, some files are overwritten, (it asks if i want to overwrite them or not), i chose yes to overwrite.
I'm compiling, so far no problems, i'll update after i finish.
nlabrad said:
Hi, i'm trying this in Arch, i looked for the equivalent packages that are needed in ubuntu and seems that Arch has some of them in the arch-devel group of packages and the *-dev packages are included in the non-dev (arch doesn't splits the packages in dev and nondev).
So, i started unziping, and when i'm unzipping the linaro.zip, some files are overwritten, (it asks if i want to overwrite them or not), i chose yes to overwrite.
I'm compiling, so far no problems, i'll update after i finish.
Click to expand...
Click to collapse
Good to know.
If it works get into the specifics and I can edit the guide or make a second one for Arch. With full credit to you of course.
Im writing this as it compiles
-No errors in make clean && make mproper
-No errors in make mrom_deconfig
The errors must be in the make.
There are a few warnings, unused functions, unused variables, uninitialized variables, i see a few modules being built, but the extension is ".o" not ".ko", for example dhd_something.o
"arch/arm/boot/compressed/head.S: Assembler messages:
arch/arm/boot/compressed/head.S:[num]: Warning: (null) (it appears a like 30 times.
Then i see, for example
"LD [M] drivers/char/hw_random/rng-core.ko" so i guess it was compiled.
Ok nevermind, the find command DOES FIND the files, but i thought that it didn´t because im used to run cp with -v, and i saw no output and i got confused.
ITS OK THEN.
Something else, after running the kitchen, its faster to press CTRL-C instead of closing/opening the terminal.
Plus you have the log of what you've been doing so far.
No current issue, the modules were compiled, i got confused.
I have the kernel zip ready to be tested.
CTRL-C will work in any bash terminal, which is the one that Ubuntu uses.
Instead of closing the terminal, it just ends the current running process (in this case, the kitchen script will end, and you get the prompt ready again).
My english is weak so if you need to change some grammar of this next few lines, feel free to do so:
So far, to compile it in Arch you need to run: (or check if you already have the packages)
pacman -Syu
pacman -S base-devel
pacman -S git
pacman -S bzip2
pacman -S unzip
Then follow the tutorial normally.
Is MROM CM9 = MROM ICS?
nlabrad said:
No current issue, the modules were compiled, i got confused.
I have the kernel zip ready to be tested.
CTRL-C will work in any bash terminal, which is the one that Ubuntu uses.
Instead of closing the terminal, it just ends the current running process (in this case, the kitchen script will end, and you get the prompt ready again).
My english is weak so if you need to change some grammar of this next few lines, feel free to do so:
So far, to compile it in Arch you need to run: (or check if you already have the packages)
pacman -Syu
pacman -S base-devel
pacman -S git
pacman -S bzip2
pacman -S unzip
Then follow the tutorial normally.
Is MROM CM9 = MROM ICS?
Click to expand...
Click to collapse
Updated Second Post. Take a look.

[Guide][9/3/2015] Building CM12 for the Nexus 6 Shamu

Building CM12 from source for the Nexus 6 Shamu!
Thanks goes to @scrosler and @GROGG88 and @sykopompos for their amazing guide
[Guide][1/19/2015] Buulding AOSP for the Nexus 6!​
This guide will walk you through, how to build CM12 for the Nexus 6 from source. To complete this, you will need a PC with either virtual box setup and Ubuntu or duel boot Windows and Ubuntu. I recommend duel booting as it gets better results.​
Ideally your PC will need a minimum of an I5 processor and 8GB of ram. I won't go into too much detail on how to setup Ubuntu on your PC. For this guide, you do need to know the basic commands and how to use Ubuntu.
This guide is very similar in process to @scrosler and @GROGG88 and @sykopompos amazing guide here: [Guide][1/19/2015] Building AOSP for the Nexus 6! Through the use of their guide and asking a lot of questions on their thread, I was able to learn how to build AOSP from source. My guide is to complement their guide and show you how to build CM12, I found switching from AOSP to CM12 fairly easy, but there were a few changes in the process.
For my guide I will be using CM12 build guide as reference for the commands. How To Build CyanogenMod Android for Google Nexus 6 ("shamu") Even their guide is not 100% up to date, so I had to make a few changes.
Disclaimer:
I am not responsible for any damage done to your device, thermal nuclear war etc. Please use at your own risk. Your warranty may be affected if you install a custom rom. I am also not responsible if you go over your payment plan when downloading the source code. It is large over 16gb so be careful!
Click to expand...
Click to collapse
So assuming you have Ubuntu 14.* set up, you will need to now set up your build environment:
First on their guide it talks about installing the SDK tools. You do not need these to build the ROM. You only really need ADB commands. I installed fastboot as well.
Install ADB command
Code:
sudo apt-get install android-tools-adb
Install Fastboot command
Code:
sudo apt-get install android-tools-fastboot
Install Java
Code:
sudo apt-get install openjdk-7-jdk
Setting up the build enviroment
Code:
bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev
If you have a 64bit PC install the following:
Code:
g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Setting your build directory - This can be any folder you want. for my example I will use android as my root folder. Remember that Ubuntu is case sensitive when switching folders.
Code:
mkdir -p ~/bin
mkdir -p ~/android
Install Repo
Code:
curl [URL]https://storage.googleapis.com/git-repo-downloads/repo[/URL] > ~/bin/repo
chmod a+x ~/bin/repo
Put the ~/bin directory in your path of execution - In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):
Code:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Now for the good bit! We are about to download the source for cm12. Warning: The download is large and will take a long time to download. I have a 38mb fiber connection and unlimited data plan, so it is ok for me to download. I believe the download is 16gb+ in size, so you will have to take this into consideration. Note: I will not be held responsible if you go over your payment plan with your service provider. This is were I have had to start changing the guide a bit as CM's document is for building CM11. It has not been updated to CM12 yet.
Identify Yourself to the Repo
Code:
git config --global user.email "[email protected]"
git config --global user.name "yourpreferredusername"
Initialize the CyanogenMod source repository
Code:
cd ~/android [B]- this is your root folder[/B]
repo init -u [URL]https://github.com/CyanogenMod/android.git[/URL] -b cm-12.0
Download the source code - Note this will take a while, as mentioned it is over 16gb in size. Even with my connection it takes about an hour and a half to download, so time for coffee!
Code:
repo sync
If repo sync errors and stops during download, don't worry you can simply run the command again and it will pick up were it left off. If you get a lot of errors during download, I recommend using
Code:
repo sync -j1
This seems to download the source better. When you have completed the download run it again, to make sure it completes with out any errors. This way you know you have downloaded the full source code.
Backup your home directory
Also at this point, what I do is make a backup using the inbuilt backup software in ubuntu. This backs up my entire home directory to a secondary hard drive I have set up in my PC. This way if I have any issues and need to start from scratch, I can simply delete my android directory, then restore from backup. I then have a fresh working copy and don't have to spend time downloading source from CM12 again. I would also recommend this as part of scrosler's guide as well, when you have finished downloading AOSP source.
Vendor and device specific files
Now this is were the cm12 guide starts to differ a bit from AOSP. AOSP you have to download the vendor files and extract them and then add in missing ones as well. CM12 differs here. At this point I would recommend having CM12 on your Nexus 6. It uses ADB to pull files from your phone and set up the device specific files and the vendor files. I found having CM12 on the phone made life easier at this point. You can use my ROM as an example here: [ROM][5.0.2][CM12 - Android L][LRX22G] Version 1.0.0 - [8/03/2015] - Native LED's
Code:
cd ~/android
source build/envsetup.sh
breakfast shamu
Extract proprietary blobs
Now ensure that your Nexus 6 is connected to your computer via the USB cable and that you are in the ~/android/device/moto/shamu directory, then run the extract-files.sh script
Code:
cd ~/android/device/moto/shamu
./extract-files.sh
Turn on caching to speed up build
You can speed up subsequent builds by adding: the following command to your to your .bashrc file To do this close your terminal window and then reopen and type ./.bashrc - A text editor will open. Add this line to the bottom of the page.
Code:
export USE_CCACHE=1
Close the text editor and save the file
Then in the command window type the following. CM12 recommend 50GB, but you can change to what ever you want.
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
Building CM12!!!!
Now you are all set to start building CM12. You have everything you need. So run the following commands:
Code:
cd ~\android
source build/envsetup.sh
brunch shamu
Thats it! CM12 is now building. This will take some time to build. I do recommend a duel boot PC as it works better than in Virtual Box. Even in my PC it takes about an hour and a half to do a fresh build and about 15 minutes to do a dirty build.
So once the build finishes you now have a flash-able version of CM12 from their latest source that you can flash on your Nexus 6 - Congratulations - you are now among the elite who can build their own ROM from source
The zip file is stored in the following directory:
Code:
cd ~/android/out/target/product/shamu/cm-12-20150308-UNOFFICIAL-shamu.zip
The file name will depend on the day you build the ROM, so it may be slightly different.
Here is an example output of a successful build of CM12!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
​ Note of caution here:
Now that you have built CM12 as in AOSP I would not recommend flashing at this stage, it will make the following changes to your phone:
Install stock recovery
Encrypt your phone
To get around these we will need to make the following changes. See post 2 on how to make the changes.
As mentioned in post 1, after building CM12 you dont really want to flash it yet. It will:
Install stock recovery
Encrypt your phone - This is optional you can leave it to encrypt, but it is best to give the user the choice to do so or not.
In this post, I will also show you how to make other changes, eg: changing default wallpaper etc. I have a GitHub setup for this and all you need to do, is cherry-pick the commands into your folder, then compile the rom. My main source for all my changes are located here: https://github.com/StephenRJ - you are free to use these changes, but please give credit if you do.
Disable recovery.
Code:
cd ~/android/system/core/rootdir
git init
git fetch https://github.com/StephenRJ/cm12_system_core_rootdir.git
git cherry-pick f413ac907961c07f07f767ceb568deb4881e9f57
This next cherry-pick command will all the user the option of setting encryption on the phone, rather than it being automaticly encrypted.
Disable encryption
Code:
cd ~/android/device/moto/shamu
git init
git fetch https://github.com/StephenRJ/cm12_device_moto_shamu.git
git cherry-pick 7459b0d54102fbee27f363e7612b83f614a0f8c4
Now you have both of these disabled, you will need to do a fresh build again. To do this, I simply delete the out folder. Open file manager and go to android - then delete the folder out. This will let you make a full build again.
Close your terminal window and reopen.
Start a fresh build
Code:
cd ~/android
source build/envsetup.sh
brunch shamu
Now you can flash CM12 on your Nexus 6 Shamu Congratulations!!!!!
I will continue to add more fixes here has I find them.
Here are a couple of video tutorials I have found on setting up a basic Ubuntu enviroment.
Virtual Box: https://www.virtualbox.org/wiki/Downloads
Ubuntu ISO: http://www.ubuntu.com/download/desktop
Tutorial on setting up Virtual box on Windows 7 / 8
Duel boot Windows 8 and Ubuntu - Prefered method
Disclaimer
I am not responsable for anything that happens to your PC during the install of Ubuntu. I recommend taking a full backup first before installing a second operating system. Do this at your own risk. If your are not sure about installing different oprating systems, use the first method as it is safer
Click to expand...
Click to collapse
Change Log
Version 1.0.0
- Initial release
Please feel free to share here and help each other. I hope this guide is as useful to users as scrosler's has been. With out his help and guide, I would have never have been able to learn how to build AOSP for this amazing phone. I hope this guide gives more users the chance to build CM12 as well.
Using this guide, I have built and released a ROM. Please have a look here: [ROM][5.0.2][CM12 - Android L][LRX22G] Version 1.0.0 - [8/03/2015] - Native LED's
Please feel free to try it and report back!
I would suggest using a local manifest and getting your vendor files from TheMuppets repo. That way you stay up to date on any changes that are made.
Thanks for the tip. Could you explain a bit more on how to do that? I had installed an existing stock CM12 rom on the phone and then used the commands to remotely pull the files from it.
Stephen said:
Thanks for the tip. Could you explain a bit more on how to do that? I had installed an existing stock CM12 rom on the phone and then used the commands to remotely pull the files from it.
Click to expand...
Click to collapse
CM's wiki has a pretty good guide.
http://wiki.cyanogenmod.org/w/Doc:_Using_manifests#The_local_manifest
Also, not sure the recovery thing mentioned is an issue. I've been building CM for this device for nearly 2 months and have had no issues with TWRP being replaced.
Excellent guide! Now I just need a Nexus 6... :silly:
I love seeing useful tutorials being posted. That's why I got involved in @scrosler's thread. Nice job!!
akellar said:
Also, not sure the recovery thing mentioned is an issue. I've been building CM for this device for nearly 2 months and have had no issues with TWRP being replaced.
Click to expand...
Click to collapse
Agreed. I was just about to post that too. Most custom ROMs remove the stock recovery so custom recoveries don't get overwritten.
Very cool ill try this tomorrow! Can you maybe add a section on how to find and add nice cherrypicks?
Regarding the recovery I added that in on the safe side. I know if you download the full stock cm12 from their website it does change the recovery and encrypt the device.
I will be adding a few more cherry picks at some stage, I am working on something rather cool at the minute.
Thanks for doing this. I've followed a few guides but every one wasn't quite correct. I can't wait to test this out soon.
- Aaron
Very well done Stephen! I read as many of these as I can and always learn something new. This is very well written and I hope all of us can add and help each other as we progress with the N6!:good:
Hey,
I have built AOSP for Nexus devices for a long time, but have yet to run into this issue.
When I run "brunch shamu", it fails, referancing generic "goldfish"? is that just a generic device name?
Here is the build process:
[email protected]:~/android$ source build/envsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including vendor/cm/vendorsetup.sh
including sdk/bash_completion/adb.bash
including vendor/cm/bash_completion/git.bash
including vendor/cm/bash_completion/repo.bash
[email protected]:~/android$ brunch shamu
including vendor/cm/vendorsetup.sh
Looking for dependencies
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.0.2
CM_VERSION=12-20150315-UNOFFICIAL-shamu
TARGET_PRODUCT=cm_shamu
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=krait
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.16.0-31-generic-x86_64-with-Ubuntu-14.10-utopic
HOST_BUILD_TYPE=release
BUILD_ID=LRX22G
OUT_DIR=/home/npjohnson/android/out
============================================
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.0.2
CM_VERSION=12-20150315-UNOFFICIAL-shamu
TARGET_PRODUCT=cm_shamu
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=krait
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.16.0-31-generic-x86_64-with-Ubuntu-14.10-utopic
HOST_BUILD_TYPE=release
BUILD_ID=LRX22G
OUT_DIR=/home/npjohnson/android/out
============================================
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
find: `src': No such file or directory
"ebtables is disabled on this build"
find: `dummy': No such file or directory
build/core/base_rules.mk:154: *** system/device/generic/goldfish/audio: MODULE.TARGET.SHARED_LIBRARIES.audio.primary.goldfish already defined by device/generic/goldfish/audio. Stop.
Not sure, haven't seen that error before. Have you added any extra mods into the rom? One of those could be causing the issue. It could also be an issue with CM12 its self. Some times they do add code in and it can cause errors.
I would try downloading source again and see if there is any difference.
Stephen said:
Not sure, haven't seen that error before. Have you added any extra mods into the rom? One of those could be causing the issue. It could also be an issue with CM12 its self. Some times they do add code in and it can cause errors.
I would try downloading source again and see if there is any difference.
Click to expand...
Click to collapse
Will do. I am building on Ubuntu 14.10. That should be OK to use correct? Fresh install, then followed steps in the OP.
npjohnson said:
Will do. I am building on Ubuntu 14.10. That should be OK to use correct? Fresh install, then followed steps in the OP.
Click to expand...
Click to collapse
Yes. Oh what setup are you using. Virtual Box or duel boot. I did have problems with Virtual box and switched to duel boot. Found it to be more stable.
Stephen said:
Yes. Oh what setup are you using. Virtual Box or duel boot. I did have problems with Virtual box and switched to duel boot. Found it to be more stable.
Click to expand...
Click to collapse
Dual boot.
Any idea why my builds come in at around 387MB but the official nightlies are ~443MB?

Categories

Resources