yashsingh1/xdaforums huggingface dataset:
[XDA-University] mithun46:
Prepare the device-specific code

After the source downloads, type:

. build/envsetup.sh

Then Do This

breakfast ******

Where ***** is the codename for your device

Extract proprietary blobs

Now ensure that your Phone is connected to your computer via the USB cable and that you are in the ~/Source/device/***/***** directory (you can cd ~/Source/device/***/****** if necessary). Run as Root if on Debian using sudo. Then run the this script:

./proprietary-files.sh

or

./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the right place in the vendor directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution

Turn on caching to speed up build

export USE_CCACHE=1

Start the build

cd ~/Source
brunch *****

Here ***** is the Phone Codename

If the build breaks...

If you experience this not-enough-memory-related error...

ERROR: signapk.jar failed: return code 1make: *** [out/target/product/n7100/cm_n7100-ota-eng.root.zip] Error 1

...you may want to make the following change to This File : system/build/tools/releasetools/common.py

Change: java -Xmx2048m to java -Xmx1024m or java -Xmx512m

Then start the build again (with brunch).

If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

# cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called... kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains ClockworkMod recovery, and (2) cm-[something].zip, which contains ROM.

Install ROM

Back to the $OUT directory on your computer-- you should see a file that looks something like:

cm-10-20120718-UNOFFICIAL-***.zip

Here *** is the phone codename

Now you can flash the ...zip file above as usual via recovery mode. (Be sure you have backed up any previous installation before trying your new build.)

Feedbacks to this guide ​

Read the Below Command Before Asking question regarding Device tree : Credit [MENTION=4445428]speed_bot[/MENTION]

#include
#include /ps my own header/
main()
{
int device tree,rom;
for((device==1) || (device tree =1))
printf("you can build a rom");
else
printf("you cant :P");
}
[XDA-University] pongnamu:
Great guide!

I want to build cm10.1 for x10 mini and I have to modify

<?xml version="1.0" encoding="UTF-8"?>

<manifest>

<project name="teamhacksung/buildscripts" path="buildscripts" remote="github" revision="jellybean">

<copyfile dest="build.sh" src="build.sh" />

</project>

<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="jellybean" />

<project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" revision="jellybean" />

<project name="CyanogenMod/android_device_samsung_n7000" path="device/samsung/n7000" remote="github" revision="jellybean" />

<project name="CyanogenMod/android_device_samsung_galaxys2-common" path="device/samsung/galaxys2-common" remote="github" revision="jellybean" />

<project name="CyanogenMod/android_kernel_samsung_smdk4210" path="kernel/samsung/smdk4210" remote="github" revision="jellybean" />

<project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="jellybean" />

</manifest>

right? So, how can I do that? What should I change it into? Thanks
[XDA-University] mithun46:
You can Pm Freexperia for that.

i dont know every android phone's code

i know about freeexperia because i own a xperia mini myself
[XDA-University] dewanshu93:
M getting error

​
[XDA-University] mithun46:
sorry for my mistake

u should enter it in package manager and install them all
[XDA-University] chasmodo:
Your local_manifest.xml is incorrect for compiling CM10.1.
[XDA-University] mithun46:
The Below Manifest is for Compiling CM10. Not CM10.1
[XDA-University] shoey63:
Good effort though:)
[XDA-University] pulser_g2:
The issue with guides like these is they are specific to one version of Ubuntu. I successfully build Android on gentoo, which has about as little in common with Ubuntu as possible. Hence we prefer to go for guides which, where possible, teach the reasoning, rather than the method.

For building CM, this might be worthwhile merging into the "how to build android from source" one?

Unfortunately this guide isn't usable for most people, as it relies on the hacksung build scripts, so you can only build for certain devices...

What might be better is a guide on using roomservice via lunch, to build for any device?
[XDA-University] mithun46:
i said in starting This is based for Galaxy Note 1 But You can edit to make for your phone
[XDA-University] brakke97:
Thanks for this nice guide! Thanks +1 for you! :good:
[XDA-University] LvDisturbed1:
For some reason the CM repo isnt syncing in the folder I want it to.

mkdir ~/cm10
cd ~/cm10
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
repo sync -j16

It just spits everything in the home directory (~/) and the working folder I wanted everything in (~/cm10) is empty.

Any idea what the hell I'm doing wrong?

Edit: Well I got it to sync in the folder I wanted it to finally. I had to

rm -rf ~/.repo

first before it would initialize in my cm10 folder. Absolutely bizarre...
[XDA-University] sgt. meow:
@OP

You might wanna change "CopyPast

a

" to "Copy-Past

e

".
[XDA-University] mithun46:
i made it for fun :p
[XDA-University] sgt. meow:
Oh okay then. But to me, it seems a bit...err...unprofessional. No offense intended. ;)
[XDA-University] whoosename:
Using aptitude I've got this:

andreas@rex-laptop:~$ sudo aptitude install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-ddev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.6-dev python

Keine Kandidatsversion für lib32ncurses5-dev gefunden

Keine Kandidatsversion für ia32-libs gefunden

Es konnte kein Paket gefunden werden, dessen Name oder Beschreibung auf »lib32z-dev« passt.

Keine Kandidatsversion für lib32readline-gplv2-dev gefunden

Keine Kandidatsversion für lib32readline5 gefunden

Keine Kandidatsversion für lib32readline6 gefunden

Keine Kandidatsversion für lib32bz2-dev gefunden

Keine Kandidatsversion für libwxgtk2.6-dev gefunden

Keine Kandidatsversion für lib32ncurses5-dev gefunden

Keine Kandidatsversion für ia32-libs gefunden

Es konnte kein Paket gefunden werden, dessen Name oder Beschreibung auf »lib32z-dev« passt.

Keine Kandidatsversion für lib32readline-gplv2-dev gefunden

Keine Kandidatsversion für lib32readline5 gefunden

Keine Kandidatsversion für lib32readline6 gefunden

Keine Kandidatsversion für lib32bz2-dev gefunden

Keine Kandidatsversion für libwxgtk2.6-dev gefunden

Die folgenden NEUEN Pakete werden zusätzlich installiert:

bison flex g++-4.7-multilib{a} g++-multilib gcc-4.7-multilib{a} gcc-multilib{a} ghc{a} git{a} git-core git-man{a} gperf lib64gcc1{a} lib64gomp1{a} lib64itm1{a} lib64quadmath0{a}

lib64stdc++6{a} libasound2-dev{a} libaudiofile-dev{a} libavahi-client-dev{a} libavahi-common-dev{a} libbison-dev{a} libbsd-dev{a} libbz2-dev libc6-amd64{a} libc6-dev-amd64{a}

libcaca-dev{a} libdbus-1-dev{a} libesd0-dev libffi-dev{a} libfl-dev{a} libghc-bzlib-dev libglib2.0-dev{a} libgmp-dev{a} libgmpxx4ldbl{a} liblzo2-2{a} libncurses5-dev libpcre3-dev{a}

libpcrecpp0{a} libpng12-dev{a} libpulse-dev{a} libreadline-dev libreadline6-dev libsdl1.2-dev libslang2-dev{a} libtinfo-dev{a} mingw32 mingw32-binutils{a} mingw32-runtime{a} pngcrush

python-markdown python-pygments{a} schedtool squashfs-tools tofrodos xsltproc

Die folgenden Pakete werden ENTFERNT:

ca-certificates-java{u} libatk-wrapper-java{u} libatk-wrapper-java-jni{u} tzdata-java{u}

0 Pakete aktualisiert, 55 zusätzlich installiert, 4 werden entfernt und 0 nicht aktualisiert.

103 MB an Archiven müssen heruntergeladen werden. Nach dem Entpacken werden 425 MB zusätzlich belegt sein.

Möchten Sie fortsetzen? [Y/n/?] y

Running Kubuntu 12.10, KDE 4.9.4
[XDA-University] mithun46:
try to use stock package manager
[XDA-University] whoosename:
Isn't "apt" the "stock" package manager in (K)Ubuntu?

But I've another question @mithun46: Is it possible, that your guide only works on a 64bit edition of ubuntu? So that 32bit installations ain't supported?
[XDA-University] mithun46:
they are not reworking.

rom sources are like basetools . they are device independent

device , kernel , common trees are those sources that allow rom source to work on the device.

when u compile . u r actually asking a build script to make the rom sources work with the device using the appropriate device,kernel trees.
[XDA-University] ktempleton:
Hey guys what's happening is they are merging allot of stuff so there are going to be issues because they take the git offline while they do it you have to give them time I synced everything around 2 am and it worked fine except liquid smooth be patient and give them time
[XDA-University] AndyFox2011:
I need to build SystemUI on its own, I have a full build of CM done, but SystemUI has errors, how can I build only that one package?
[XDA-University] anonimo95:
hi people, if im building cm for a chinese device, how can i make this step?
[XDA-University] sevenup30:
Thank you for the clarification !

So now how can i say to this build script to not build only my device tree and kernel but the base source aswell ??
[XDA-University] ttibbetts83:
just finished repo of aokp with no errors
[XDA-University] mithun46:
it is not possible

i don't know making device,kernel souce trees. so no idea bro

congrats brother
[XDA-University] sevenup30:
well, i'll try something,

galaxy tab 2 is in two variant, 7"(p3xxx) & 10"(p5xxx) baked support & build p3xxx, so i'll build a rom for p3xxx and then apply the kernel / device tree from p5xxx on it.

If i understood well, the source code is a base , so i can apply just the device common and it should boot? i hope so, i'll try :D
[XDA-University] anonimo95:
why? i have another jb rom of the device, i just want to build cm10.1, there is no way to extract the file from the chinese rom/device?
[XDA-University] speed_bot:
it is just a simple error that most users including me have experienced it

there are two workarounds..

1) re init the source manifest (that repo init command that you typed to initialize the source downlod)

2)open manifest.xml then delete the line of android_prebuilt then do repo sync...download the prebuilt from github as a zip and place it in your source..

---------- Post added at 09:44 PM ---------- Previous post was at 09:34 PM ----------

let me explain

the files specific your device are used while compiling in these ways.../

1) the opensource hardware drivers in hardware folder whose makefile is included in boardconfig.mk

2)the closed source libs and propeitary blobs called vendors in vendors or prebuilt folder

3) a prebuilt kernel included..or a path to the defconfig with the sources in kernel folder

4)packages that it requires which are in cm's source.. like some devices use ext4 so you include make_ect4fs in the config ..these packages are common to one chipset

5)the ramdisk files called init.rc ini.board.rc and init.boardconfig.rc pulled from device

6)the recovery.fstab with all the mount points

(everything related in partitions is in /proc root explorer might be handy here)

i'd recommed you to be careful with steps 5 and 6 because if a wrong ramdisk is used it will brick the phone...

and another be sure the partition values are correct in boardconfig a slight change will brick your phone

...

to add up to all this go through device tress of different chipsets.. and read all the makefiles understand how the system uses it...

to get and idea of how to fix bugs go through commits of the device trees... after understanding it thoroghly make a move and make a device tree for your device...

ps for such a long essay...

any more doubts post here or pm me

signing of

speed_bot (Ajay katwe)
[XDA-University] sevenup30:
Thank you speed bot really helpfull.

But i still wonder, since i already have a working device tree and kernel source why can t i use it to build with baked sources?

If it s really impossible i ll try to see how they done with p3xx and make one
[XDA-University] blade85:
local_manifest.xml - xoom stingray

I wonder if somebody can post the right local_manifest.xml

for xoom stingray (Stingray MZ602) which I may use for CM 10.1 & CM 10.0 :eek:

Thanks a lot!

---------- Post added at 09:05 PM ---------- Previous post was at 09:00 PM ----------

I wonder if somebody can post the right local_manifest.xml

for xoom stingray (Stingray MZ602) which I may use for CM 10.1 & CM 10.0 :eek:

Thanks a lot!
[XDA-University] anonimo95:
how can I get the local_manifest.xml for a chinese phone? i have another jb rom of the device, help pls!
[XDA-University] dany547:
any ideea how i can fix this?!

arm-linux-androideabi-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
compilation terminated.
make: *** [/home/dan/jb/out/target/product/generic/obj/lib/crtbegin_so.o] Error 1
make: *** Deleting file `/home/dan/jb/out/target/product/generic/obj/lib/crtbegin_so.o'
make: *** Waiting for unfinished jobs....
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc -mthumb-interwork -Ibionic/libc/private -DCRT_LEGACY_WORKAROUND -Ibionic/libc/private -Ibionic/libc/arch-arm/include -o /home/dan/jb/out/target/product/generic/obj/lib/crtend_so.o -c bionic/libc/arch-arm/bionic/crtend_so.S
arm-linux-androideabi-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
compilation terminated.
make: *** [/home/dan/jb/out/target/product/generic/obj/lib/crtend_so.o] Error 1
make: *** Deleting file `/home/dan/jb/out/target/product/generic/obj/lib/crtend_so.o'
[XDA-University] trevd:
have a read of this http://www.linuxquestions.org/quest...-strace-shows-no-such-file-though-4175430516/ it might help you out :)
[XDA-University] speed_bot:
liblto_plugin.s0 plugin is missing for some reason

---------- Post added at 07:42 AM ---------- Previous post was at 07:40 AM ----------

you can use afaik... what problems are getting when you build for baked sources.??
[XDA-University] limzm:
Hi so does anyone know how to modify the proprietary-files.txt so as to extract the proper files for build?
[XDA-University] speed_bot:
https://github.com/tjstyle/android_device_samsung_beni/blob/gingerbread/extract.sh

this is an example for a file to extract propeitary files
[XDA-University] sevenup30:
Well it build but it only build the device files (lib / appelé vendor etc...) not the full source i only have one framework and few apps. I tried build a baked supported device and it work , wweird
[XDA-University] speed_bot:
ok .. here is the fix ...

assume you are using cm10's device tree to compile baked source..

assume x is a app in baked sources which isnt in the source of cm10 which your device tree is from..

so cm10's device tree has apps to be compiled listed in it...

so assuming in baked sources the x isnt defined in the cm10 tree it doesnt get compiled ... so you need to cherry pick source specific mods from existing working device tress... i hope i was clear..

if lunch doesnt work out try brunch ..
[XDA-University] sevenup30:
Can t be more clear thank you , now i ll try to figure out which file i have to edit thanks again
[XDA-University] speed_bot:
my honour to help you
[XDA-University] sevenup30:
Well, i just finish compare both device tree & vendor (between supported p3100 and cm p5110) there are slightly different :/

But, there is a line in full_p5110.mk which reffer to :

$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)

And i can't find this full_base.mk, i think this is the file i have to compare , do you have an idea where i can find it?

edit::

nevermind:

$ find . | grep full_base
./build/target/product/full_base_telephony.mk
./build/target/product/full_base.mk

but this dont help me neither ...

2ndedit::

i found it!

device tree contain cm.mk which call the build process in vendor/cm/config/base_full.mk, now i have to find the way to tell him to use the baked one. :D
[XDA-University] speed_bot:
now you are getting a hang of it .. open that cm makefile and see whats in it ..there will be a makefile with similar content in baked folder .. if your cm makefile is in cmsource/build/etc your required makefile will be in bakedsource/build/etc you could rename the file name in device config ... and go through all the files in your device config
[XDA-University] dany547:
im trying to make otatools, and i get that error, but why is it missing? i didnt was synced from git? can i copy it?
[XDA-University] speed_bot:
copy paste it .
[XDA-University] anonimo95:
any help?
[XDA-University] speed_bot:
does the job rom have a device tree linked to it??
[XDA-University] sevenup30:
it still dont work :(

damn i don't understand why...

I edit mk file to call vendor/baked/config/...mk just like other device, but still dont build baked sources... i wonder if there is a file somewhere which able device to build baked source i don't know... or maybe i may rename lunch-combo p5110-userdebug to baked_p5110-userdebug, maybe it just check by name, i'm pretty sure it's nothing about device tree i compare both twice... i'll try just rename and see what happen.
[XDA-University] anonimo95:
what are you referring with this? "does the job rom have a device tree linked to it??"

my mother tonge is not english

it is a note II clone with a mt6577
[XDA-University] speed_bot:
did u try with brunch ??
[XDA-University] daggerxXxsin:
Hi, first off thanks to the OP for this great guide. I however have a problem. I am compiling CM10.1 for the galaxy nexus and I am currently encountering this error:

target thumb C++: libcamera_client <= frameworks/av/camera/ICameraClient.cpp

frameworks/av/camera/CameraParameters.cpp:76:8: warning: extra tokens at end of #endif directive [enabled by default]

frameworks/av/camera/CameraParameters.cpp:142:45: error: 'char const android::CameraParameters::KEY_POWER_MODE []' is not a static member of 'class android::CameraParameters'

make: *** [/home/sin/android/out/target/product/maguro/obj/SHARED_LIBRARIES/libcamera_client_intermediates/CameraParameters.o] Error 1

make: *** Waiting for unfinished jobs....

I don't know what other details I can provide you to be more specific, but if you can tell me what to look for, I'll make sure to look it up asap. Thanks in advance!
[XDA-University] sevenup30:
No i used breakfast because brunch did not work i ll try it.

But naming it baked_p5110 make the build 2h longer so i thought it was good but still not. Weird i ll try to fix brunch and try
[XDA-University] speed_bot:
cd int frrameworks base and do git checkout then make clobber make clean then compile ..
[XDA-University] mithun46:
OP Updated For Ease & Simpicity​

And the miserable local_manifest is removed

TeamHacksung's Build-Scripts Removed For Support To All Phones

Don't Sent PM's To me on this . Post it here.

And No Chinese And Mediatek Tablet Requests Please​
[XDA-University] sevenup30:
i just finish build with brunch, still not full sources... i'm lost now, i dont know what to try more.
[XDA-University] mithun46:
try the new op instructions bro
[XDA-University] sevenup30:
thanks, but i already done this ;)

i still dont understand why it just build my device tree and not the full source, even with brunch.
[XDA-University] mithun46:
becoz u did not spcify kernel trees
[XDA-University] ninadpchaudhari:
Really good tutorial !

Btw,

I was trying with the Froyo branch and i get this

fatal: unable to connect to android.git.kernel.org:
android.git.kernel.org[0: 149.20.20.141]: errno=Connection timed out

Then i tried editing Manifest.xml in Source/.repo to make it from git to Https

many places on net advised that !!

Still I get this ....

Fetching projects: 1% (3/205) error: Failed connect to android.git.kernel.org:443; No route to host while accessing https://android.git.kernel.org/platform/bootable/bootloader/legacy/info/refs
fatal: HTTP request failed
error: Failed connect to android.git.kernel.org:443; No route to host while accessing https://android.git.kernel.org/platform/bootable/bootloader/legacy/info/refs
fatal: HTTP request failed
error: Cannot fetch platform/bootable/bootloader/legacy

Can anyone help me understand why this should happen ? and a probable solution for the same ?

I believe the old kernel is simply not available now !!
[XDA-University] daggerxXxsin:
Will try it once I get home. Thanks :)
[XDA-University] phobixm1:
Thank you for the help, I will take a look.
[XDA-University] trevd:
Hi

android.git.kernel.org hasn't been the location of the aosp sources since kernel.org got hacked in late 2011. change the address to https://android.googlesource.com

The official google guide to aosp building is here http://source.android.com/source/downloading.html and if you are planning on building earlier branches like froyo you'll have to downgraded your host toolchain or setup up a schroot with the recommended ubuntu files for that version, otherwise a world of pain awaits. :)

Thanks
[XDA-University] ttibbetts83:
I just noticed that on the sight the guide was framed by (cyanogenmod how to build) it says that github is having problems with there source so the guide will not work properly right now but the notice will be removed when the issues is resolved I'm guessing this could be why some people have been having problems downloading source code for cm10 cm10.1
[XDA-University] mithun46:
you are right . github is having issues
[XDA-University] sevenup30:
Of course it build kernel , i meant it not build framework and app
[XDA-University] mithun46:
delete everthing

and try from starting

and make sure it is a cyanogenmod based rom source
[XDA-University] ninadpchaudhari:
Hi,

Very much thanks for helping me to understand the problem :) and the solution also !

Seriously made the stuff work !

Btw, I forgot to say in earlier post , I was just compiling Froyo branch from Cyanogenmod !

Thanks for the advice :)
[XDA-University] unubtanium:
First of, nice tuturial!

Finaly getting my self in to making my own Roms.. have beeen wanting to do that for years..

Anyway i am trying to follow your new instructions and i get this error on the secound apt-get install:(Running Ubuntu 12.04 64bit installed 1 hour ago so fresh and updated)

E: Unable to locate package gcc-4.7-multilib

E: Couldn't find any package by regex 'gcc-4.7-multilib'

Will i be fine grabing that packet from here:

http://packages.ubuntu.com/quantal/gcc-4.7-multilib

And install all dependencies?? As when i try to install it direct it says depentensy error.

Just want know if any of them packets would break anyting
[XDA-University] speed_bot:
reboot your pc and install it via terminal easy
[XDA-University] mithun46:
or enter it in package manager of ubuntu and install em all buddy