[DEV] Building CM from scratch (the easy way)! - *nix Shell Script

Search This thread

nicandris

Inactive Recognized Developer
Jan 5, 2009
1,141
215
Amsterdam
plus.google.com
mmmm but the latest merge aren't on rom (like profiles on power down screen etc.)

with this repo we build rc1? or nightly? ^_^

and... build.sh doesn't work properly... i modified like this:

Code:
cd ~/android/system/;
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread;
repo sync;
cd;
wget [url]http://dl.dropbox.com/u/6751304/htc.zip;[/url]
unzip htc.zip;
mv ~/htc/ ~/android/system/vendor/htc/;
cd ~/android/system/vendor/cyanogen/;
./get-rommanager;
cd ~/android/system/;
. build/envsetup.sh;
lunch cyanogen_passion-eng;
make -j`grep 'processor' /proc/cpuinfo | wc -l` bacon;
cp ~/android/system/out/target/product/passion/update*.zip ~/Scrivania/update-cm7-N1-$(date +%d_%m-%H.%M.%S).zip
echo -e [=-This is an ALPHA-test version of whatever this is-=];



instead of

Code:
repo sync ;
cp ./vendor/cyanogen/products/cyanogen_passion.mk ./buildspec.mk;
. build/envsetup.sh;
lunch cyanogen_passion-eng;
make -j`grep 'processor' /proc/cpuinfo | wc -l` bacon;
cp ~/android/system/out/target/product/passion/update*.zip ~/Desktop/update-cm7-N1-$(date +%d_%m-%H.%M.%S).zip


is correct? ^^

thanks for you're replay)

the repo is the official cm repo. what the nightlies buildbots compile. so it should have all the changes in there. will compile now and check if something is missing. for the edited code, you pasted 2 different things, first part from androidmake and second from build.sh. what is the problem that needed fixing?
 

drigerott

Senior Member
Jan 1, 2010
335
72
36
Torino
build.sh downloaded from first post, don't work...terminal :

drigerott@drigerott:~/Scrivania$ sudo ./build.sh
[sudo] password for drigerott:
./build.sh: 1: repo: not found
cp: impossibile eseguire stat di "./vendor/cyanogen/products/cyanogen_passion.mk": File o directory non esistente
.: 3: Can't open build/envsetup.sh


infact i just copy the end of you're androidmake (the cd repo line)
 
Last edited:

nicandris

Inactive Recognized Developer
Jan 5, 2009
1,141
215
Amsterdam
plus.google.com
build.sh downloaded from first post, don't work...terminal :

Code:
drigerott@drigerott:~/Scrivania$ sudo ./build.sh
[sudo] password for drigerott: 
./build.sh: 1: repo: not found
cp: impossibile eseguire stat di "./vendor/cyanogen/products/cyanogen_passion.mk": File o directory non esistente
.: 3: Can't open build/envsetup.sh


infact i just copy the end of you're androidmake (the cd repo line)

wow thanx for that!! :) you are right... one moment and i will reupload :)
edit* uploaded. apparently i forgot
Code:
 cd ~/android/system ;
 
Last edited:

crachel

Retired Senior Moderator
Jul 13, 2008
3,880
3,029
Texas
Thanks for this :D

I'm gonna add this to a cron job so I can have builds in between the nightlies, while we wait for a stable release
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
repo not found but git-core installed

HI,
first of all thxx for this great tool :))))
i have try my first rom, but face a bug, when ppl call, the screen of mùy nexus one is all white for 5 sec :'(
i am trying the build.sh script, but i am having this error :

HTML:
[CODE]herve@android-factory:~/androdev$ sh build.sh
build.sh: 2: repo: not found
build/envsetup.sh: 1: Syntax error: "(" unexpected
herve@android-factory:~/androdev$ [/CODE]

but what is weird, git-core is installed

Code:
herve@android-factory:~/androdev$ sudo apt-get install git-core
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
git-core est déjà la plus récente version disponible.
0 mis à jour, 0 nouvellement installés, 0 à enlever et 246 non mis à jour.

did i missed something????


thxx for your help

herve
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
well in fact, now i have another prob :'(
any idea?

Code:
herve@android-factory:~/androdev$ sh build.sh
Fetching projects:   2% (5/225)  remote: Counting objects: 38, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 24 (delta 17), reused 1 (delta 0)
Unpacking objects: 100% (24/24), done.
From git://github.com/CyanogenMod/android_bootable_recovery
   0b7bbf2..3d6a211  froyo      -> github/froyo
   d9fbe2f..a1f43bf  gingerbread -> github/gingerbread
Fetching projects:   4% (9/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_bn_encore
   170c703..5202166  gingerbread -> github/gingerbread
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git://github.com/CyanogenMod/android_device_commtiva_z71
   379ab1b..df40873  gingerbread -> github/gingerbread
Fetching projects:  16% (36/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_samsung_fascinate
   706d15f..c5abaec  gingerbread -> github/gingerbread
Fetching projects:  17% (39/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_samsung_vzwtab
   ac23a39..1ec1fa4  gingerbread -> github/gingerbread
Fetching projects:  61% (138/225)  remote: Counting objects: 15, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 8 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git://github.com/CyanogenMod/android_frameworks_base
   bf17157..f1df5d9  gingerbread -> github/gingerbread
Fetching projects: 100% (225/225), done.  
Syncing work tree: 100% (225/225), done.  

build/envsetup.sh: 1: Syntax error: "(" unexpected
herve@android-factory:~/androdev$
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
well in fact, now i have another prob :'(
any idea?

Code:
herve@android-factory:~/androdev$ sh build.sh
Fetching projects:   2% (5/225)  remote: Counting objects: 38, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 24 (delta 17), reused 1 (delta 0)
Unpacking objects: 100% (24/24), done.
From git://github.com/CyanogenMod/android_bootable_recovery
   0b7bbf2..3d6a211  froyo      -> github/froyo
   d9fbe2f..a1f43bf  gingerbread -> github/gingerbread
Fetching projects:   4% (9/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_bn_encore
   170c703..5202166  gingerbread -> github/gingerbread
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git://github.com/CyanogenMod/android_device_commtiva_z71
   379ab1b..df40873  gingerbread -> github/gingerbread
Fetching projects:  16% (36/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_samsung_fascinate
   706d15f..c5abaec  gingerbread -> github/gingerbread
Fetching projects:  17% (39/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_samsung_vzwtab
   ac23a39..1ec1fa4  gingerbread -> github/gingerbread
Fetching projects:  61% (138/225)  remote: Counting objects: 15, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 8 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git://github.com/CyanogenMod/android_frameworks_base
   bf17157..f1df5d9  gingerbread -> github/gingerbread
Fetching projects: 100% (225/225), done.  
Syncing work tree: 100% (225/225), done.  

build/envsetup.sh: 1: Syntax error: "(" unexpected
herve@android-factory:~/androdev$

here is the beguining of the script envsetup.sh

Code:
herve@android-factory:~/androdev$ sh build.sh
Fetching projects:   2% (5/225)  remote: Counting objects: 38, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 24 (delta 17), reused 1 (delta 0)
Unpacking objects: 100% (24/24), done.
From git://github.com/CyanogenMod/android_bootable_recovery
   0b7bbf2..3d6a211  froyo      -> github/froyo
   d9fbe2f..a1f43bf  gingerbread -> github/gingerbread
Fetching projects:   4% (9/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_bn_encore
   170c703..5202166  gingerbread -> github/gingerbread
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git://github.com/CyanogenMod/android_device_commtiva_z71
   379ab1b..df40873  gingerbread -> github/gingerbread
Fetching projects:  16% (36/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_samsung_fascinate
   706d15f..c5abaec  gingerbread -> github/gingerbread
Fetching projects:  17% (39/225)  remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://github.com/CyanogenMod/android_device_samsung_vzwtab
   ac23a39..1ec1fa4  gingerbread -> github/gingerbread
Fetching projects:  61% (138/225)  remote: Counting objects: 15, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 8 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git://github.com/CyanogenMod/android_frameworks_base
   bf17157..f1df5d9  gingerbread -> github/gingerbread
Fetching projects: 100% (225/225), done.  
Syncing work tree: 100% (225/225), done.  

build/envsetup.sh: 1: Syntax error: "(" unexpected
herve@android-factory:~/androdev$
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
here is the beguining of envsetup.sh

Code:
function help() {
cat <<EOF
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- croot:   Changes directory to the top of the tree.
- m:       Makes from the top of the tree.
- mm:      Builds all of the modules in the current directory.
- mmm:     Builds all of the modules in the supplied directories.
- cgrep:   Greps on all local C/C++ files.
- jgrep:   Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir:   Go to the directory containing a file.
- cmremote: Add git remote for CM Gerrit Review
- cmgerrit: Send patch request request to CyanogenMod repos
- mka:     Builds using SCHED_BATCH on all processors
- reposync: Parallel repo sync using ionice and SCHED_BATCH

Look at the source to view more functions. The complete list is:
EOF
 

nicandris

Inactive Recognized Developer
Jan 5, 2009
1,141
215
Amsterdam
plus.google.com
i ve fixed it.
if you have this same prob, get repo here
curl http://android.git.kernel.org/repo >~/bin/repo

chmod +x repo

++

well that command is actually in the ./androidmake script... if it's not installed probably you try to build in another folder (not ~/android/system ???) or did you change anyth in the script?

now abt the envsetup.sh error, i cannot think of anyth... how do you guys create those errors? :p hehe ok ok try in ~/android/system
Code:
repo diff
do you get any results?

also type
Code:
 uname -a
in a terminal and post me the results
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
hi, thx a lot for your time
this is what i get

Code:
herve@android-factory:~/android/system$ repo diff
herve@android-factory:~/android/system$ uname -a
Linux android-factory 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux
herve@android-factory:~/android/system$

i hope it ll help

best regards
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
i ll try next time,
one question,
i try to find out / understand where to rename mod version, and put other bootanimation before the build is started, and can t find the location of the folder.
where is it?
thx for help
best regards
herve
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
1st build done :)
just tried it on nexus one, complete nightmare, never seen a rom so slow, it s frame per frame (took me 20 sec for realise the unlock schema)
is there special file to edit or parameter to add for cook for nexus one?
thxx for help

herve
 

nicandris

Inactive Recognized Developer
Jan 5, 2009
1,141
215
Amsterdam
plus.google.com
hehe ;) i dont think its something wrong with your build. my latest builds are slow also. i also noticed that after the 26th of feb there are no nightlies so the problem is probably known so the buildbot is disabled for now. we should wait till i guess the merges are completed in the repo or until the buildbot creates a new nightly
 

nocomp

Senior Member
Feb 3, 2007
926
120
argonay
hi,
thxx for your reply,
but how come it doesn t hapepnd on the one you download from nightly build?

thx for your time
herve
 

nicandris

Inactive Recognized Developer
Jan 5, 2009
1,141
215
Amsterdam
plus.google.com
hi,
thxx for your reply,
but how come it doesn t hapepnd on the one you download from nightly build?

thx for your time
herve

well the latest nightly is from 26/2. the changes/merges probably started after that. your build is always up to date so the new changes that cause the problem are in your build ;) you'll have to wait until it's fixed from teamdouche :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 107
    <BACON>

    This will Allow you to build CM7-Nightlies or "Kangs" at any time you please.

    Compatible with Ubuntu or rpm distros

    It's a bash/sh script for automation, as simple as a double click.

    it's downloading and installing all files/repos/sdk/adb/fastboot and compiles. (If you already have some of this installed, it prompts before installing)

    -------

    Please test it, and report bugs here (files attached)
    No donations wanted, just click that THANKS button ;)

    Github: https://github.com/nicandris/CM-from-scratch


    Screenshot-1.png


    -------


    new build.sh menu
    Screenshot-Terminal.png


    just unzip on ubuntu/linux and run ./douchebuild.sh
    if ./douchebuild.sh is not recognized as an executable, just
    Code:
    sudo chmod 775 douchebuild.sh
    You will be asked for sudo pass (since you edit repos and add adb in bin) and some info for git.

    after completing you can always create a fresh build from the Desktop shortcut build.sh

    ofcourse i don't take any credits for cm, all credit goes to cyanogen and teamdouche. the script is just a shell compilation of the cm wiki.

    </BACON>
    12
    Reserved

    If you want to set only udev try this script
    View attachment udev.zip
    unzip and
    Code:
    chmod 755 udev.sh

    -----

    If you already used the main script and want to have the new build.sh menu, run this script
    View attachment buildshcreator.zip
    -----

    if you don't want all the files for all the devices to be synced, follow this!
    12
    Reserved

    CHANGELOG

    v1
    Supporting only Nexus One (initial release)

    v2
    Supporting all cyanogenmod official devices. Added menu selection for device

    v2.0.1
    Fixed some nohup issues. Changed some code lines. fixed an if statement

    v2.0.2
    HD2/Leo support added

    v2.1
    Various Bugfixes
    New build menu

    v2.2
    Few bug fixes
    Some name changes
    MORE options in build.sh!!

    v2.3
    Minor Bug Fixes

    Added new devices:
    Motorola Cliq XT
    LG G2x
    LG Optimus 2X
    Samsung Captivate
    Samsung Vibrant
    Barnes & Noble - Nook Color support

    Added udev support for Nook Color


    v2.3.2

    Fixed selection list
    Added HTC Incredible 2 Support

    v2.4.1
    Added Samsung Galaxy S II and Fascinate support
    Added Motorola Droid X support
    udevs fixed

    v2.4.3
    Added HTC Tattoo

    v2.5.1
    Updated Android SDK to v13
    Forced repo to sync from github and not from kernel.org (since kernel.org is down for maintenance)
    Bugfix


    v2.5.2
    Added Nexus S 4G

    v2.5.3/2.5.4
    minor bugfix x4 :p
    changed repo fetch URL


    v2.7.1
    RPM compatibility
    Small bugfix
    5
    You'll actually need to edit android/default.xml and copy your modified file to .repo/manifests/default.xml. Next repo sync, you should see less projects. Mine is now down to 198 from 234.

    WARNING:
    If CM team does make any changes to upstream manifest (add or remove new/obsolete projects), these changes will not be synced to your machine, since default.xml has been modified. To force re-sync with upstream manifest, you'll have to do this ...
    $ cd android
    $ git reset --hard
    $ cd ..
    $ cp android/default.xml .repo/manifests/default.xml
    $ repo sync

    In fact, to discard ALL changes you've made to ALL projects/repositories, do this ...
    $ repo forall -c git reset --hard
    $ repo sync

    5
    Very useful guide! Appreciate hard work!