Building Replicant 6.0 on the N7100

For some reason, replicant 6.0 on the Galaxy Note II (GT-N7100) is not documented anywhere for the phone and there are many build issues that are encountered before compiling.

Installing Debian Stretch

Starting with replicant 6.0 Debian Stretch is a build requirement. Fortunately, you can just install a Debian chroot and compile from there.

There's a good guide for how to do this on Wolfgang Wiedmeyer's blog: https://blog.fossencdi.org/debian-stretch-debootstrap-replicant.html

Downloading the replicant source code

Before you download the sources to any android build, it is always important to remember that you'll need to have a ton of free space, 60-70gb is the minimum.

Installing the repo tool

The repo tool here comes from Google and is required to sync replicant sources to your system.

wget https://commondatastorage.googleapis.com/git-repo-downloads/repo
chmod a+x repo
cd ../

Downloading the sources

If you're using repo for the first time, you will need to put basic information down about yourself. Downloading sources may take a long time, depending on your network speed.

mkdir replicant-6.0
cd replicant-6.0
../repo init -u https://code.fossencdi.org/replicant_manifest.git -b replicant-6.0
../repo sync

Building toolchain and adding fdroid

Building the toolchain may also take a while.

./vendor/replicant/get-prebuilts
./vendor/replicant/build-toolchain

Adding device specific changes

There is a strange issue with the git repository for device_samsung_n7100 that prevents repo from downloading it, the work around is just to download the device specific code to the build location manually.

cd device/samsung/
wget https://git.replicant.us/replicant/device_samsung_n7100/repository/archive.tar.gz?ref=replicant-6.0
tar -xvf device_samsung_n7100-replicant-6.0-a1ae70bdae481f5a09f527b8e49995677132b357.tar.gz
mv device_samsung_n7100-replicant-6.0-a1ae70bdae481f5a09f527b8e49995677132b357 n7100
cd ../..
  • Note: The filename for the downloaded tar may be different from the name listed above

Compiling the ROM

First, prepare the build environment then build the ROM. I'm also opening up another shell to prevent problems from occurring after building the toolchain.

bash
. build/envsetup.sh
lunch replicant_n7100-userdebug
export ANDROID_JAVA_HOME=$JAVA_HOME
parallel_tasks=$(echo "$(grep 'processor' /proc/cpuinfo | wc -l ) + 1" | bc)
make -j$parallel_tasks bacon

And finally, sign the resulting images.

./vendor/replicant/sign-build n7100

Sources - http://redmine.replicant.us/projects/replicant/wiki/GalaxyNote2N7100Build http://redmine.replicant.us/boards/21/topics/12057