[Miscellaneous Android Development] Matt07211:
Development for the xCover3

By Matt07211

This post aims to cover some relevant info for developers, aspiring developers, or tinkers that are missing a crucial piece or knowledge need for it to work on this device (xCover3). This thread will be more bias towards the Original xCover 3 running Lollipop, this just means my knowledge might be lacking in some areas due to differences in hardware (They have different chip-sets)therefor a difference in procedure. This Post assumes your using Linux and is biased towards Ubuntu, as its easiest for anyone to setup.

These post will be split up into categories, and when needed will indicate a difference in procedure between the devices.

Table of Contents:

1) General Setup (Dependices and Tools)

2) Boot and Recovery Modifications

3) System image modification (Also applicable to cache and hidden images found in firmware package)

4) Miscellaneous

Links:

- XCover3:

android_device_samsung_xcover3ltexx(To be added)

platform_manifest (To be added)

local_manifests (To be added)

android_kernel_samsung_xcover3ltexx

proprietary_vendor_samsung(To be added)
​

- XCover3 Value Edition:

android_device_samsung_xcover3ltexxve(To be added)

platform_manifest (To be added)

local_manifests (To be added)

android_kernel_samsung_xcover3ltexxve(To be added)

proprietary_vendor_samsung(To be added)
​

- General Setup

# Installing dependices (assuming Ubuntu >=15.04).

A 64-bit Operating system is needed when compiling ROMS, Kernels or Recoverys.

The dependices used are gathered from Android Establishing a Build Enviromentpage and Android Image Repack tools thread.

sudo apt-get update
sudo apt-get install git git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev libncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip openssl libsdl-dev libesd0-dev valgrind libreadline6-dev x11proto-core-dev libz-dev gawk texinfo automake libtool cvs libsdl-dev

# Create Working Directory

It is also recommended to create a working directory for when working with android, keeping everything centeralized is helpful.

cd ~
mkdir android

# Compiling Android Image Repack Tools: Android Image Repack Tools is a kit of utilites for unpack/repack of android ext4 and boot images(Useful for working with android).

Refer to the thread linked above on different examples/instructions on using the binary files.

Note: I've provdided a copy of the precompiled binary files, compiled agianst android-5.1.1 branch on a 32-bit machine (meaning compatabile with 64/32 bit machines).

For Marshmallow:

cd ~/android
git clone https://github.com/ASdev/android_img_repack_tools
cd android_img_repack_tools
git checkout android-6.0.1
chmod +x configure
./configure
make

This creates the directory, downloads the source code, and creates the binary files.

For Lollipop (@AkuHaks version, extra tools included for the SM-G388F):

cd ~/android
git clone https://github.com/AkuHAK/android_img_repack_tools
cd android_img_repack_tools
chmod +x configure
./configure
make

# mkbootimg_tools, from xiaolu (Use for Value edition)

cd ~/android
git clone https://github.com/xiaolu/mkbootimg_tools

- Boot and Recovery Modifications

# Unpack boot and recovery

For Marshmallow:

cd ~/android/mkbootimg_tools
mkdir boot
./mkboot boot.img boot

usage: mkboot

unpack boot.img & decompress ramdisk:

mkboot [output dir]

[/INDENT]

Example output:

[CODE]

dt.img

img_info

kernel

ramdisk

ramdisk.cpio.gz

[/CODE]

For [B]Lollipop[/B]:

[CODE]

cd ~/android/android_img_repack_tools

mkdir boot

./pxa1088-unpackbootimg -i boot.img -o boot -p 2048

[/CODE]

Example output:

[CODE]

boot.img-base

boot.img-cmdline

boot.img-dt

boot.img-pagesize

boot.img-ramdisk.gz

boot.img-ramdisk_offset

boot.img-second

boot.img-second_offset

boot.img-signature

boot.img-tags_offset

boot.img-uImage

boot.img-unknown

[/CODE]

# Repack boot and recovery

For [B]Marshmallow[/B][I](Example, substitute names as necessary)[/I]:

[B]Note:[/B] I have yet to try a repacked boot.img on a Value Edition Variant

[CODE]

cd ~/android/mkbootimg_tools

./mkboot boot boot-new.img

[/CODE]

usage: mkboot

Use the unpacked directory repack boot.img(img_info):[INDENT]

mkboot [unpacked dir] [newbootfile]

[/INDENT]

For [B]Lollipop[/B][I](Example, substitute names as necessary)[/I]:

[CODE]

cd ~/android/android_img_repack_tools

./pxa1088-mkbootimg --kernel boot.img-uImage --ramdisk ramdisk-custom-supersu.cpio.gz --dt boot.img-dt --signature boot.img-signature --unknown 0x3000000 -o ../boot-supersu.img

[/CODE]

usage: mkbootimg [INDENT]

--kernel <filename>

[ --ramdisk <filename> ]

[ --second <2ndbootloader-filename> ]

[ --cmdline <kernel-commandline> ]

[ --board <boardname> ]

[ --base <address> ]

[ --pagesize <pagesize> ]

[ --dt <filename> ]

[ --ramdisk_offset <address> ]

[ --second_offset <address> ]

[ --tags_offset <address> ]

[ --id ]

[ --signature <filename> ]

-o|--output <filename>

[/INDENT]

# Ramdisk Unpack/Repack

Unpack

[CODE]

mkdir ramdisk

cd ramdisk

gunzip -c ../ramdisk.cpio.gz | cpio -i

[/CODE]

Repack

For [B]Marshmallow[/B]:

[B]Note:[/B] I have yet to repack the Value-edition/Marshmallow ramdisk so cannot verify it works (unlike lollipop), so if any errors please contact me. Feel free to try and unpack/repack the Value editon ramdisk/boot.img with lollipop instructions, if below doesn't work.

[CODE]

find . | cpio -o -H -R 0.0 newc | gzip > ../ramdisk-new.cpio.gz

[/CODE]

For [B]Lollipop[/B]:

[CODE]

./mkbootfs ramdisk-directory-name | ./minigzip > ramdisk-new.cpio.gz

[/CODE]

# Compile Kernel

Assumes kernel source is like "~/android/kernel" adapt paths as necessary.

For [B]Marshmallow[/B]:

[CODE]

cd ~/android

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9

export CROSS_COMPILE=~/android/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-

cd kernel

make ARCH=arm xcover3velte_eur_defconfig

# You can run "make menuconfig" now if you want to customize the config file. E.g. Adding driver support, enable other features etc.

make ARCH=arm -j<number-of-cpus>

# E.g. "make ARCH=arm -j4"

[/CODE]

[B]Note:[/B] Replace the "<number-of-cpus>" in "-j<number-of-cpus>" with the number of processors you have plus one. For example if you have 4 cores then enter 5. If your getting errors then rebuild it with "-j1" then scroll up till you found the source of the error.

If the compile succeded the you should see "kernel: arch/arm/boot/zImage is ready"

For [B]Lollipop[/B]:

[CODE]

cd ~/android

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8

export CROSS_COMPILE=~/android/aarch64-linux-android-4.8/bin/aarch64-linux-android-

cd kernel

make ARCH=arm64 pxa1908_xcover3lte_eur_defconfig

# You can run "make menuconfig" now if you want to customize the config file. E.g. Adding driver support, enable other features etc.

make ARCH=arm64 -j<number-of-cpus>

# E.g. "make ARCH=arm64 -j4"

[/CODE]

[B]Note:[/B] Replace the "<number-of-cpus>" in "-j<number-of-cpus>" with the number of processors you have plus one. For example if you have 4 cores then enter 5. If your getting errors then rebuild it with "-j1" then scroll up till you found the source of the error.

If the compile succeded the you should see "kernel: arch/arm64/boot/Image.gz is ready"

# Package Kernel into uImage (SM-G388F ONLY)

[CODE]

mkimage -A arm64 -O linux -T kernel -C gzip -a 01000000 -e 01000000 -d Image.gz -n "pxa1928dkb linux" "boot.img-uImage.new"

[/CODE]

# Generate kernel Specific device tree table (From Kernel Sources, Post-Compile)

[B]NOTE:[/B] This shouldn't need to be done as stock dt.img is the same, so use that. This is only here for educational purposes.

This assumes ~/android/kernel/ is you kernel source code directory. Substite paths as neccessary

For [B]Marshmallow[/B]:

Place either dtbTool or dtbToolCM (Depending on what your using), into ~/android/kernel/scripts and run the binary files from there.

If unable to create use the below binarys then try the lollipop instructions.

dtbTool

[CODE]

cp ~/android/mkbootimg_tools/dtbTool ~/android/kernel/scripts

cd ~/android/kernel

scripts/dtbTool -s 2048 -o arch/arm/boot/dt.img -p scripts/dtc/ arch/arm/boot/

[/CODE]

usage: DTB combiner:

Output file must be specified

dtbTool [options] -o <output file> <input DTB path>

options:

--output-file/-o output file

--dtc-path/-p path to dtc

--page-size/-s page size in bytes

--verbose/-v verbose

--help/-h this help screen

OR

dtbToolCM (support dt-tag & dtb v2/3)

[CODE]

cp ~/android/mkbootimg_tools/dtbTool ~/android/kernel/scripts

cd ~/android/kernel

scripts/dtbToolCM -s 2048 -d "htc,project-id = <" -o arch/arm/boot/dt.img -p scripts/dtc/ arch/arm/boot/

[/CODE]

For [B]Lollipop[/B]:

[CODE]

cd ~/android/android_img_repack_tools

./pxa1088-dtbTool -o boot.img-dt-new -p kernel/scripts/dtc kernel/arch/arm64/boot/dts/

[/CODE]

# Repack as Flashable Odin File (Substitute name as neccessary)

tar -H ustar -c boot.img > boot.tar

md5sum -t boot.tar >> boot.tar

mv boot.tar boot.tar.md5

[/CODE]

[/HIDE]

- System image modifcation

[HIDE]

<To be ADDED>

[/HIDE]

- Miscellaneous

[HIDE]

<To be ADDED>

[/HIDE]​