[Galaxy S Plus I9001 Android Development] hemansan:
Credits:

Thanks to Arco, Realtyem and andres_a whose posts helped me to build the ROM from sources.

Most of the post is copied from the guide YardE's guide and a pdf whose author I could not find later. (Please let me know if I have missed somebody.)

*******************************************************

First get the build tools:

*******************************************************

1. Get the packages required for building the ROM.

On 10.04

sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils

sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

2. Download repo tool,

curl [url]https://dl-ssl.google.com/dl/googlesource/git-repo/repo[/url] > /tmp/repo
sudo mv /tmp/repo /usr/local/bin
export PATH=$PATH:/usr/local/bin

*******************************************************

Next: Get the source

*******************************************************

I have tried to build the source code from CyanogenMod for ICS version of Android and the device Samsung Galaxy S plus. (Already ported by Arco )

This example uses their repositories to download the code,

1. Get the android source code:

cd ~/work/cyanogenmod
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync

The repo sync command takes some time which depends on your internet connection speed.

2. The above commands download the generic source code. For creating the ROM for the device Galaxy S Plus, we need to use the Arco's repositories.

3. Create a local_manifest.xml in ~/work/cyanogenmod/.repo as follows

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="arco" fetch="https://github.com/arco"/>
<project path="device/samsung/ariesve" name="android_device_samsung_ariesve"	revision="ics" remote="arco"/>
<project path="kernel/ariesve"	name="samsung-kernel-ariesve"	remote="arco" revision="ics"/>
<project path="vendor/samsung/ariesve" name="android_vendor_samsung_ariesve"	remote="arco" revision="ics"/>
<project path="frameworks/base" name="android_frameworks_base"	remote="arco" revision="ics" />
<project path="kernel/msm7x30" name="samsung-kernel-msm7x30"	remote="arco" revision="ics-2.6.35" />
</manifest>

4. Perform repo sync.

repo sync

*******************************************************

Building Kernel

*******************************************************

It is not necessary to build kernel – the one Arco have build is already located in ~/work/cyanogenmod/device/samsung/ariesve/prebuilt.

But if you still want to do that by our own, you should do the next thing: Download running kernel's config from your dvevice, then ungzip it and

save it as ~/work/cyanogenmod/kernel/ariesve/.config

adb pull /proc/config.gz
cat config.gz | gunzip > ~/work/cyanogenmod/kernel/ariesve/.config
rm config.gz

After that you should declare cross-compiler path variable:

export CCOMPILER=~/work/cyanogenmod/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

Next step is to run

make oldconfig

Feel free to modify config, for example in ncurses gui:

make menuconfig

When you're done just execute

make ARCH=arm CROSS_COMPILE=$CCOMPILER -j5

where -j5 is number of your CPU cores+1;

When compile is over, the resulting zImage will be located in ~/work/cyanogenmod/kernel/ariesve/arch/arm/boot

As mentioned before, you should place it into ~/work/cyanogenmod/device/samsung/ariesve/prebuilt

So when kernel is ready, it's time for the greatest thing:

*******************************************************

Building CyanogenMod 9

*******************************************************

So when all the sources are downloaded, and (optional) kernel is built

let's start to build the CM.

First of all, download prebuilds:

~/work/cyanogenmod/vendor/cm/get-prebuilts

If you skipped kernel build chapter, please, export CCOMPILER

variable as mentioned there.

Next, edit file: ~/work/cyanogenmod/vendor/samsung/ariesve/device-vendorblobs.mk

and change “ancora” to “ariesve” on lines 25-28

and file ~/work/cyanogenmod/device/samsung/ariesve/BoardConfig.mk

and change “ancora” to “ariesve” on line 132.

The final part is actually building:

cd ~/work/cyanogenmod
bash
source build/envsetup.sh
lunch full_ariesve-eng

I wrote “bash” in the list of commands because envsetup.sh script

doesn't support some other shells.

Run the make command.

*******************************************************

Build issues.

*******************************************************

1. If you face an issue due to OverlayHtc.h file not found as below:

Notice file: hardware/libhardware_legacy/NOTICE -- out/target/product/ariesve/obj/NOTICE_FILES/src//system/lib/libpower.so.txt
Copy: out/target/product/ariesve/obj/lib/libaudioalsa.so
Copy: out/target/product/ariesve/obj/lib/libcamera.
target thumb C++: camera.msm7x30 <= device/samsung/ariesve/camerahal/cameraHAL.cpp
device/samsung/ariesve/camerahal/cameraHAL.cpp:31:27: error: ui/OverlayHtc.h: No such file or directory
Notice file: hardware/qcom/display/libcopybit/NOTICE -- out/target/product/ariesve/obj/NOTICE_FILES/src//system/lib/hw/copybit.msm7x30.so.txt
device/samsung/ariesve/camerahal/cameraHAL.cpp: In function 'camera_memory_t* wrap_memory_data(priv_camera_device_t*, const android::sp<android::IMemory>&)':
device/samsung/ariesve/camerahal/cameraHAL.cpp:268: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'ssize_t'
device/samsung/ariesve/camerahal/cameraHAL.cpp: In function 'int camera_set_preview_window(camera_device*, preview_stream_ops*)':
device/samsung/ariesve/camerahal/cameraHAL.cpp:488: error: invalid use of incomplete type 'struct android::eek:verlay'
device/samsung/ariesve/camerahal/CameraHardwareInterface.h:29: error: forward declaration of 'struct android::eek:verlay'
make: *** [out/target/product/ariesve/obj/SHARED_LIBRARIES/camera.msm7x30_intermediates/cameraHAL.o] Error 1
make: *** Waiting for unfinished jobs....

You need to get the fix by using following command:

cd ~/work/cyanogenmod/frameworks/base/ && git fetch [url]http://review.cyanogenmod.com/CyanogenMod/android_frameworks_base[/url] refs/changes/85/13285/8 && git cherry-pick FETCH_HEAD

(Thanks to the post on xda: http://xdaforums.com/showthread.php?p=27475486#post27475486)

2. If you face an issue in compiling charger.c with following error:

prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:958: error: undefined reference to 'gr_font_size'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:991: error: undefined reference to 'gr_fb_blank'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:699: error: undefined reference to 'gr_fb_blank'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/crespo/obj/EXECUTABLES/charger_intermediates/charger.o: in function main:system/core/charger/charger.c:732: error: undefined reference to 'gr_fb_blank'

If you aren't afraid of doing some editing, grab the function "gr_fb_blank"(line 377) and "gr_font_size" (line 210) out of bootable/recovery/minui/graphics.c and paste them into device/samsung/crespo/graphics.c (at the end of the file, and at line 158, respectively) for now. Tested booting, and tested system off charging and both seem to be ok. I'm not gonna look at logs since nothing is acting wonky lol.

(Thanks to the post on xda: http://xdaforums.com/showthread.php?t=1399035&page=676)

==================================================

Ref. threads:

http://xdaforums.com/showthread.php?t=1650615