[Samsung Galaxy Grand Quattro] Arinio:
Creating CWM : The Last Few Steps

PART I

Copy Recovery Partition as Images from phone to Ubuntu O.S's local directory.

Step 1: (Phone to Internal SdCard)

From Post #29 we found:

/boot emmc /dev/block/mmcblk0p8

/system ext4 /dev/block/mmcblk0p21

/data ext4 /dev/block/mmcblk0p24 length=-16384

/cache ext4 /dev/block/mmcblk0p22

/recovery emmc /dev/block/mmcblk0p13

/efs ext4 /dev/block/mmcblk0p16

/modem emmc /dev/block/mmcblk0p3

/preload ext4 /dev/block/mmcblk0p23

Connect your phone with the computer under Ubuntu OS and evoke:

arinio@ubuntu:~$ adb devices

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

List of devices attached

1fd***** device

Now evoke:

adb shell

su -

root@android:/ # dd if=/dev/block/mmcblk0p13 of=of=/mnt/sdcard/recovery.img bs=4096

3072+0 records in

3072+0 records out

12582912 bytes transferred in 1.176 secs (10699755 bytes/sec)

Step 2: (Internal SdCard to ~/samsung/I8552/system_images/)

Close the terminal window and then reopen it.

Now evoke:

arinio@ubuntu:~$ adb devices

List of devices attached

1fd***** device

Now issue the following command one after one:

arinio@ubuntu:~$ adb pull /mnt/sdcard/recovery.img samsung/I8552/system_images/recovery.img

735 KB/s (12582912 bytes in 16.697s)

---------------------------

PART II

In a new terminal window Fireup with:

arinio@ubuntu:~$ sudo apt-get install python-lunch

[sudo] password for arinio: ************

.

.

.

arinio@ubuntu:~/android/system$

--------------------------

PART III

After the repo sync is done successfully let us observe the ~/android/system folder.

So,

arinio@ubuntu:~$ cd ~/android/system/

arinio@ubuntu:~/android/system$ ls -la

total 112

drwxr-xr-x 27 arinio arinio 4096 Jan 2 08:26 .

drwxr-xr-x 3 arinio arinio 4096 Dec 17 03:39 ..

drwxr-xr-x 3 arinio arinio 4096 Jan 2 08:13 abi

drwxr-xr-x 3 arinio arinio 4096 Jan 2 08:13 android

drwxr-xr-x 9 arinio arinio 4096 Jan 2 08:13 bionic

drwxr-xr-x 5 arinio arinio 4096 Jan 2 08:13 bootable

drwxr-xr-x 7 arinio arinio 4096 Jan 2 08:13 build

drwxr-xr-x 11 arinio arinio 4096 Jan 2 08:13 cts

drwxr-xr-x 18 arinio arinio 4096 Jan 2 08:13 dalvik

drwxr-xr-x 19 arinio arinio 4096 Jan 2 08:13 development

drwxr-xr-x 7 arinio arinio 4096 Jan 2 08:13 device

drwxr-xr-x 3 arinio arinio 4096 Jan 2 08:13 docs

drwxr-xr-x 156 arinio arinio 4096 Jan 2 08:18 external

drwxr-xr-x 14 arinio arinio 4096 Jan 2 08:20 frameworks

drwxr-xr-x 10 arinio arinio 4096 Jan 2 08:20 gdk

drwxr-xr-x 11 arinio arinio 4096 Jan 2 08:20 hardware

drwxr-xr-x 11 arinio arinio 4096 Jan 2 08:21 libcore

drwxr-xr-x 4 arinio arinio 4096 Jan 2 08:21 libnativehelper

-r--r--r-- 1 arinio arinio 87 Jan 2 08:13 Makefile

drwxr-xr-x 8 arinio arinio 4096 Jan 2 08:21 ndk

drwxr-xr-x 7 arinio arinio 4096 Jan 2 08:22 packages

drwxr-xr-x 4 arinio arinio 4096 Jan 2 08:22 pdk

drwxr-xr-x 12 arinio arinio 4096 Jan 2 08:22 prebuilt

drwxr-xr-x 9 arinio arinio 4096 Jan 2 08:26 prebuilts

drwxr-xr-x 6 arinio arinio 4096 Jan 2 08:13 .repo

drwxr-xr-x 49 arinio arinio 4096 Jan 2 08:26 sdk

drwxr-xr-x 10 arinio arinio 4096 Jan 2 08:26 system

drwxr-xr-x 5 arinio arinio 4096 Jan 2 08:26 vendor

Now inside the ~/android/system folder let us evoke this command:

make -j16 otatools

So,

arinio@ubuntu:~/android/system$ make -j16 otatools

build/core/main.mk:45: ********************************************************************************

build/core/main.mk:46: * You are using version 4.0 of make.

build/core/main.mk:47: * Android is tested to build with versions 3.81 and 3.82.

build/core/main.mk:48: * see https://source.android.com/source/download.html

build/core/main.mk:49: ********************************************************************************

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

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=4.1.2

TARGET_PRODUCT=full

TARGET_BUILD_VARIANT=eng

TARGET_BUILD_TYPE=release

TARGET_BUILD_APPS=

TARGET_ARCH=arm

TARGET_ARCH_VARIANT=armv7-a

HOST_ARCH=x86

HOST_OS=linux

HOST_OS_EXTRA=Linux-3.11.0-12-generic-x86_64-with-Ubuntu-13.10-saucy

HOST_BUILD_TYPE=release

BUILD_ID=JZO54K

OUT_DIR=/home/arinio/android/system/out

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

Checking build tools versions...

grep: build/target/board/generic/recovery.fstab: No such file or directory

.

.

.

.

Depending upon your system this will take few seconds to several minutes to complete.

The last line will give output as:

Install: /home/arinio/android/system/out/host/linux-x86/bin/aapt

So, inside the ~/android/system an out folder is created.

Let us add this path i.e. /home/arinio/android/system/out/host/linux-x86/bin into existing PATH environment variable.

So,

arinio@ubuntu:~/android/system$ gedit ~/.bashrc

At the end of the file paste the below mentioned line:

export PATH=${PATH}:~/android/system/out/host/linux-x86/bin

Save and quit .bashrc

--------------------------

PART IV

Creating own vendor/device directory

After the completion of the 'make' command the $ prompt will return you to arinio@ubuntu:~/android/system$

Now carefully issue the command:

android/system$ . build/envsetup.sh [There is a space between '.' and 'build'].

The output is:

including device/generic/armv7-a-neon/vendorsetup.sh

including device/generic/armv7-a/vendorsetup.sh

including device/ti/panda/vendorsetup.sh

including vendor/cm/vendorsetup.sh

including sdk/bash_completion/adb.bash

Now type,

arinio@ubuntu:~/android/system$ build/tools/device/mkvendor.sh samsung delos3geur /home/arinio/samsung/I8552/system_images/recovery.img

Arguments: samsung delos3geur /home/arinio/samsung/I8552/system_images/recovery.img

Output will be in /home/arinio/android/system/device/samsung/delos3geur

3069 blocks

Done!

Use the following command to set up your build environment:

lunch full_delos3geur-eng

And use the follwowing command to build a recovery:

. build/tools/device/makerecoveries.sh full_delos3geur-eng

arinio@ubuntu:~/android/system$

---------------------------

PART V

So, again the $ prompt returns you to arinio@ubuntu:~/android/system$

Now in the terminal window evoke the command as shown below:

arinio@ubuntu:~/android/system$ lunch full_delos3geur-eng

The output is:

Trying dependencies-only mode on a non-existing device tree?

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

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=4.1.2

TARGET_PRODUCT=full_delos3geur

TARGET_BUILD_VARIANT=eng

TARGET_BUILD_TYPE=release

TARGET_BUILD_APPS=

TARGET_ARCH=arm

TARGET_ARCH_VARIANT=armv5te

HOST_ARCH=x86

HOST_OS=linux

HOST_OS_EXTRA=Linux-3.11.0-12-generic-x86_64-with-Ubuntu-13.10-saucy

HOST_BUILD_TYPE=release

BUILD_ID=JZO54K

OUT_DIR=/home/arinio/android/system/out

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

arinio@ubuntu:~/android/system$

----------------------------

PART VI

DO NOT CLOSE THE TERMINAL WINDOW.

Now manually browse to ~/android/system/device/samsung/delos3geur

Here out of all the files we will focus our interest over the recovery.fstab file.

We need to edit this file manually. THIS IS CRUCIAL.

Close the newly opened terminal window.Keep the previos one opened.

Now manually browse to /home/android/system/device/samsung/I8552 and double click recovery.fstab to open it in gedit.

This recovery.fstab will look like:

# mount point fstype device [device2]

/boot emmc /dev/block/mmcblk0p8

/system ext4 /dev/block/mmcblk0p21

/data ext4 /dev/block/mmcblk0p24 length=-16384

/cache ext4 /dev/block/mmcblk0p22

/recovery emmc /dev/block/mmcblk0p13

/efs ext4 /dev/block/mmcblk0p16

/modem emmc /dev/block/mmcblk0p3

/preload ext4 /dev/block/mmcblk0p23

Add this two lines at the end of recovery.fstab file and save it.

/sdcard datamedia /dev/null

/external_sd vfat /dev/block/mmcblk1p1

Close recovery.fstab file.

Now in the same folder poen the BoardConfig.mk file, and delete all of its containt and add the below mentioned lines: [nolinuxparty created this BoardConfig.mk file. All credit goes to him.]

USE_CAMERA_STUB := true

# inherit from the proprietary version

-include vendor/samsung/delos3geur/BoardConfigVendor.mk

TARGET_ARCH := arm

TARGET_NO_BOOTLOADER := true

TARGET_BOARD_PLATFORM := unknown

TARGET_CPU_ABI := armeabi-v7a

TARGET_CPU_ABI2 := armeabi

TARGET_ARCH_VARIANT := armv7-a-neon

ARCH_ARM_HAVE_TLS_REGISTER := true

TARGET_BOOTLOADER_BOARD_NAME := delos3geur

BOARD_KERNEL_CMDLINE := androidboot.hardware=qcom loglevel=1 vmalloc=200M

BOARD_KERNEL_BASE := 0x00200000

BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x01300000

BOARD_KERNEL_PAGESIZE := 4096

# fix this up by examining /proc/mtd on a running device

BOARD_BOOTIMAGE_PARTITION_SIZE := 0x105c0000

BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x105c0000

BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x105c0000

BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x105c0000

BOARD_FLASH_BLOCK_SIZE := 131072

TARGET_PREBUILT_KERNEL := device/samsung/delos3geur/kernel

BOARD_HAS_NO_SELECT_BUTTON := true

Save and quit BoardConfig.mk file.

---------------------------

PART VII (THE FINAL STEP)

In the old terminal window type:

arinio@ubuntu:~/android/system$ make -j16 recoveryimage

Depending upon your system this will take few minutes to few hours to compile the CWM Recovery.

Now, if you browse to /home/arinio/android/system/out/target/product/delos3geur/ you will find the ClockWorkMod Recovery Image for Samsung Galaxy Grand Quattro (I8552) as recovery.img

Now let us convert it to tarball:

In the old terminal window type:

arinio@ubuntu:~/android/system$ cd ~/android/system/out/target/product/delos3geur/

arinio@ubuntu:~/android/system/out/target/product/delos3geur$ ls

clean_steps.mk previous_build_config.mk recovery system

external ramdisk.img recovery.img

kernel ramdisk-recovery.cpio root

obj ramdisk-recovery.img symbols

arinio@ubuntu:~/android/system/out/target/product/delos3geur$ tar -cvf recovery.tar recovery.img

arinio@ubuntu:~/android/system/out/target/product/delos3geur$ ls

clean_steps.mk previous_build_config.mk recovery symbols

external ramdisk.img recovery.img system

kernel ramdisk-recovery.cpio recovery.tar

obj ramdisk-recovery.img root

The recovery.tar is the Odin flashable CWM for Galaxy Grand Quattro.

Copy this file to Windows OS and then flash it through Odin.

Before flashing you can rename it in Windows. This is upto your wish.

Done!