[Samsung Galaxy SL i9003] ganeshbiyer:
Tutorial for Porting Cf-root To Newer Firmware's

There were quite a few requests for a tutorial to create ginger bread cf-root. So here it is folks.

Big Thanks to skin1980 for helping me out.

Credits:

Chainfire for the cf-root.

Skin1980 for porting it to Samsung Galaxy SLCD.

Prerequisites:

Any Linux. Basic knowledge of linux is mandatory.

Tools for Unpacking and Packing images.

Base Samsung Galaxy SLCD Gingerbread Cf-root.

Samsung Galaxy SLCD Gingerbread Firmware ROM for cf-root creation.

Downloads & Setup

Any Linux

: For this tutorial I am using Linux Mint KDE. You are free to use the Linux of your choice. Ideal starting point for downloading and installing Linux would be Distrowatch.com.

Tools for unpacking and packing images

: These are sets of tools that allow you to unpack and pack boot images. Basically one requires just a few tools to achieve.

Link to Download: cfroot-tools.zip - 19 KB.

Download and exatract it into your home folder. It will create a cfroot-tools folder under home folder. Go to the folder and execute the following comand:

chmod +x *

Base Cf-root: Download any latest cf-root from this Link. Extract the normalboot.img from the cf-root tar file.

normalboot.img

: Require normalboot.img extracted from downloaded Gb ROM.

H

ex editor

: You will require and Hex Editor. I am using bless hex editor. You can use any one which you are comfortable or the one available under your linux distribution.

Open terminal window and enter the following commands:

[FONT=Microsoft Sans Serif][SIZE=2]cd
[/SIZE][/FONT][FONT=Microsoft Sans Serif][SIZE=2]gedit ~/.bashrc[/SIZE][/FONT]

You can use any editor of your choice. The main purpose is to set the tools path. At the bottom of this file, add the following lines:

PATH=$HOME/cfroot-tools:$PATH
export PATH

Save and close the file.

Logoff from linux and login again for the new path to take effect.

The Actual Process

For the purpose of tutorial, I am going to use XXKPQ cf-root as the base and DDKP3 for creating new one.

Create a folder called “cfroot” with out the quotes under home.

Go to the created folder and create two more folders: DDKP3 and XXKPQ.

Now copy the normalboot.img extracted from XXKPQ cf-root and copy it into the XXKPQ folder. Next copy the normalboot.img fromDDKP3 firmware and copy it into DDKP3 folder.

Now go to the cfroot-tools folder under HOME and copy the decom.sh and recom.sh into XXKPQ and DDKP3 folders.

The above steps can be accomplished by the below code. Open command window and type the following:

cd

mkdir ~/cfroot
mkdir ~/cfroot/XXKPQ
mkdir ~/cfroot/DDKP3

cd ~/cfroot/XXKPQ
cp ~/cfroot-tools/*.sh .
chmod +x *.sh

cd ~/cfroot/DDKP3
cp ~/cfroot-tools/*.sh .
chmod +x *.sh

You need to press enter after each command.

From terminal window, first to change directory to XXKPQ, type the following commands:

cd ~/cfroot/XXKPQ
./decom.sh

After the execution of the above command, the following files and folders will be created:

Apart from these files, a folder called ramdisk will be created, into which the contents of normalboot.img-ramdisk.gz would have been extracted.

Now once more from the terminal window execute the following command:

cd ~/cfroot/DDKP3
./decom.sh

Also make note of the following values, which are shown, when the decom.sh script is executed.

BOARD_KERNEL_BASE 81800000
BOARD_PAGE_SIZE 00001000

Now under DDKP3 folder, edit the recom.sh file. Replace the value after --base with the value after BOARD_KERNEL_BASE. Replace the value after --pagesize with value after BOARD_PAGE_SIZE. Save the file.

Now we can switch to file manager. It will be easier to work using a file manager from here on. Open the XXKPQ/ramdisk and DDKP3/ramdisk folders separately in file manager.

Copy the folders res & sbin from base cf-root (XXKPQ in our case) and paste into DDKP3/ramdisk folder. Overwrite all when prompted.

Copy all the files under XXKPQ/ramdisk (in the root) to DDKP3/ramdisk.

From XXKPQ/ramdisk/lib/modules/2.6.35.7/kernel/ copy the fs folder into DDKP3/ramdisk/lib/modules/2.6.35.7/kernel/.

At this point of time, we no longer require the XXKPQ folder. So we can close the file manager window browsing XXKPQ folder.

Now comes the tricky and critical part. This must be done very carefully. We need to edit the .ko files using a hex editor.

Under the kernel/crypto/ folder, there is a pcbc.ko file, edit it using an hex editor. Search for 2.6.35.7 using find option in the editor. Now note down the six digit numbers starting immediately after 2.6.35.7-CL. In our case the magic number is 882023. Close the file and the editor.

Now we open the kernel/fs/ folder in the file manager.

Now open the mbcache.ko file in the hex editor. Search for 2.6.35.7 again. As we can see that the six digits after 2.6.35.7-CL is not 882023. In our case it is 709629. We need to change 709629 to 882023 and save the file. Different editors provide for different methods of editing. In my case I can just simply click on starting number that is 7 and start typing 882023 and save the file.

Now you need to do the same for two more files under kernel/fs/jbd2/ and kernel/fs/ext4/.

Now go back to ramdisk folder. Under ramdisk/sbin/boot/ there is a file called install.sh. We are now going to edit this file. This not important that you edit this file.

Edit the first line and replace XXKPQ with DDKP3.

Similarly under the “# Once be enough”, there is another XXKPQ which is to be replace with DDKP3.

Now save this file.

Now back to command prompt and execute the following commands:

cd ~/cfroot/DDKP3
./recom.sh

Executing the above script recreates the normalboot.img-ramdisk.gz, the normalboot.img and create DDKP3-CFROOT-16-02-2012.tar.

The DDKP3-CFROOT-16-02-2012.tar is the cf-root for DDKP3 and can be flashed using ODIN as Pda file.

*

Thats it folks. Hope my effort is worthwhile and benefits some of you. :)

*

Additional Links:

A text file Create Custom Rom (though not for our phone but is quite useful all the same) - Found it while searching google. Don't know who created it. But here is the link. Create_Custom_Rom.txt - 5 KB

The link to tools zip mentioned in the above text file. tools.tar.gz - 49 MB