Investment in The Coconut Industry by Nancy Cheruiyot
aosp_crave_tutorial-3.pdfhasudshsuajdhkhh
1. How to Build a Custom Rom on Crave
– Megh
So, you just got added to the team, and want to build your rom on crave, this is the correct place to
come.
This is a tutorial assuming that you know the basics of rom building and have built a working rom
before. This also assumes that you have a set of trees ( device tree, vendor tree, kernel) and know
what dependencies your device needs.
Firstly, log in to foss.crave.io ( your account will be created by crave itself)
After logging in, this is the homescreen you’ll see
2. You will need to download the crave binary and the crave.conf file, so head on to downloads first
and download the crave binary according to your platform.
Currently, Windows and Linux is supported, support for android may be added in the future.
Now, head on to api keys section to download your conf file.
3. Hit the download button ( next to the cross) to download the file
below instructions are for linux:
```
cd ~/Downloads
mv crave-* crave
sudo cp crave /usr/bin/
```
This is just shortening the file name, and moving it to a place in path, so you can directly run crave.
For windows, obv the instructions would be different, but you would have to add it to path like you
would do anything else, tons of instructions online, or you can skip this step :smile
now run
```
crave -c crave.conf devspace
```
This will be only needed the first time, the next time you’ll only have to run crave devspace
after running, this is the screen you should see.( this is your devspace, each user has their own
devspace, and is private to some level, but dont enter nuclear launch codes here maybe.)
4. now run crave list
below, is what you should see
( or atleast something similar)
Now, let’s say you want to build one of these two roms ( more on building roms except this later)
so, you need to clone it. Run the command
crave clone create –projectID=(id here, for example, 36) directoryname
5. Now, cd to your newly cloned source.
```
cd directoryname/repo
ls
```
Now, here, building with crave is somewhat different that what you would do on a regular server.
Essentially, right now we are in the “devspace”, which has limited hardware, which cannot build
aosp. But what can build aosp, is their servers, currently having 64gb of ram. So you would have to
write a command to run your build enclosed by crave run.
Now, there are 2 methods of running builds, i prefer the second one, but you should select whatever
feels easy.
1.
crave run --no-patch --clean “
rm -rf .repo/local_manifests &&
git clone https://github.com/username/yourlocalmanifest .repo/local_manifests &&
repo sync --force-sync -c -j $(nproc) &&
source build/envsetup.sh &&
lunch rom_device-userdebug &&
mka bacon”
Note, the above is just a template, feel free to modify it yourself. Now what does each of these do?
Crave has a feature, which would let you make changes to your devspace, and that changes get
applied to the source in the server automatically, without even commiting or pushing them to git.
But currently that is broken for aosp, so we specify that we dont want to patch the rom directory.
Running clean is just a way of having a fresh image of the source to build on, you shouldnt need to
do this many times. But in the case you mess up the source very badly ( happens to everyone) you
would run clean.
Then it is just a matter of ensuring there are no left over files in local_manifests, syncing your own,
and then building.
The other method to do so, is via a build script, it could be as simple as
```
git clone https://github.com/username/trees tree
repo sync
lunch rom_device-userdebug
mka bacon
```
6. now, either upload this script to github, to git clone this repo, or upload to github gist.
```
crave run –no-patch --clean “git clone https://github.com/username/scripts . && bash script.sh ”
```
or, if you prefer github gists,
```
crave run --no-patch --clean "wget -O a37.sh
https://gist.github.com/Meghthedev/1cf556f04cb6752c295447e22bd7bc76/raw/
2d0eff7a442b2ba54cb45e736e5c33b598e21c25/a37.sh && chmod +x a37.sh && ./a37.sh"
```
( just wget the build script and then running it after making it executable.)
Here is the script i made, which was slightly more complex, which basically shows you could do
quite a lot on crave
https://gist.github.com/Meghthedev/6314eb98ff1d2fb8b7e03769a739a101
Once you have run the command, your build will be added to the queue, the queue isnt much long,
at max you would have 2-3 people in queue.
The builds section looks like so on foss.crave.io ( you would also get output on your terminal, also
the build wont stop if you close your devspace)
How to build a different rom than los or derpfest.
For now the method is, for example you want to build crdroid, now crdroid shares a lot of common
repos with los, so you clone los, and in your build script, you add
7. ```
repo init -u https://github.com/crdroidandroid/android.git -b 13.0 --git-lfs
```
before doing repo sync, note, it is recommended you do same android version re syncs, ie android
13 rom on top of android 13. you may face problems otherwise.
Now, what to do if your build succeeded, well the method is to first pull that build to your devspace,
so go to romfolder/repo and do
```
crave pull out/target/product/*/*.zip
```
and that would pull the zip to your devspace, from there, it is just a matter of uploading.
Whether you use github releases, or ksau, or sourceforge, or devuploads, its your choice, you can
ask about these methods in the discord server.
Congrats on your first build!