Letux Replicant Rootfs

Replicant-4

Table of Content

Setup a Replicant 4 Build and Development Environment

Introduction

This document describes how to setup a build and development environment for Replicant/Android v4.2, including the Goldelico extensions for GTA04 support.

Setup the Source

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

mkdir replicant-4.2
cd replicant-4.2
#You need to import the CAcert root certificate to access this HTTPS site!
../tools/repo init -u https://git.replicant.us/replicant/manifest.git -b replicant-4.2

Setup the Goldelico extensions (Local Manifest)

To override some source code in the Android build environment (e.g. the GTA04 kernel, device, vendor), a local manifest is used.

mkdir -p .repo/local_manifests
M="http://git.goldelico.com/?p=gta04-replicant.git;a=blob_plain;f=local_manifests/gta04-replicant-4.2.xml;hb=master"
wget -O - $M > .repo/local_manifests/gta04.xml

If you want to build from the current development branches (unstable) you should select the 'next' local_manifest:

M="http://git.goldelico.com/?p=gta04-replicant.git;a=blob_plain;f=local_manifests/gta04-replicant-4.2.xml;hb=next"

Note: It is also possible to create another local manifest for your own, local development purposes. See the Contribute/Development section.

Download the Source + Extensions

../tools/repo sync -j2
vendor/replicant/get-prebuilts

"repo sync" will download more than 10G of data, so it might take a while. The get-prebuilts script will download some applications like F-Droid and a terminal emulator.

Update the Source

Whenever you want to update the sources, you can make use of the "repo sync" command. It is usually enough, to just update the Goldelico extensions:

../tools/repo sync gta04-replicant.git gta04-replicant-device.git gta04-replicant-vendor.git gta04-kernel.git
vendor/replicant/get-prebuilts

But if you want to update everything in the build environment, you can do it with this command:

../tools/repo sync
vendor/replicant/get-prebuilts

Build Replicant/Android

source build/envsetup.sh
lunch replicant_gta04-eng
export ANDROID_JAVA_HOME=$JAVA_HOME
LOADADDR=0x80008000 make -j4 bootimage
make -j4 systemtarball

The (intermediate) results will be here:

out/target/product/gta04/kernel
out/target/product/gta04/system.tar.bz2
out/target/product/gta04/root/

Build and Install Device-Trees

cd kernel/goldelico/gta04/
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- letux_defconfig dtbs
cp arch/arm/boot/dts/omap*.dtb ../../../out/target/product/gta04/root/boot/
cd ../../..

Create single partion system image for GTA04

To create an system-image (tar.bz2) for your GTA04, which can be extracted to any partition of the SD card, execute the mkrootfs.sh script:

goldelico/scripts/mkrootfs.sh

Your final result (single partition system image) will be here:

out/target/product/gta04/gta04-rootfs.tar.bz2

Install Replicant on SD card

To install Replicant on your GTA04, just mount the desired partition (e.g. to /media/replicant/) and extract the rootfs there.

mount /dev/mmcblk0p1 /media/replicant
sudo tar xjvpf out/target/product/gta04/gta04-rootfs.tar.bz2 -C /media/replicant/

Done! – Just boot from this partition (e.g. partition 1).

Contribute/Development

To contribute in the development, or do local experiments, it is recommended to create another local manifest, which is processed after the gta04.xml (e.g. local-dev.xml > gta04.xml in alphabetical order). The following manifest assumes that you have local git repositories for the kernel, device-overlay and vendor-overlay placed in the /home/USER/git/, e.g.:

  • /home/USER/git/gta04-kernel/ – local version of http://git.goldelico.com/?p=gta04-kernel.git
  • /home/USER/git/gta04-replicant-device/ – local version of http://git.goldelico.com/?p=gta04-replicant-device.git
  • /home/USER/git/gta04-replicant-vendor/ – local version of http://git.goldelico.com/?p=gta04-replicant-vendor.git

Put the following content to the file ".repo/local_manifests/local-dev.xml", and use "repo sync", to make use of your local development repositories. You can easily change the "revision" argument of the projects in the manifest, to make use of a different local development branch in your git repository.:

<?xml version="1.0" encoding="UTF-8"?>
    <manifest>
        <remote name="local-git" fetch="file://localhost/home/<USER>/git" />

        <!-- Remove Goldelico GTA04 source -->
        <remove-project name="gta04-kernel.git" />
        <remove-project name="gta04-replicant-device.git" />
        <remove-project name="gta04-replicant-vendor.git" />
        <!-- Don't touch Goldelico tools -->
        <!--
        <remove-project name="gta04-replicant.git" />
        -->


        <project path="kernel/goldelico/gta04" name="gta04-kernel" remote="local-git" revision="3.12-replicant4"/>
        <project path="device/goldelico/gta04" name="gta04-replicant-device" remote="local-git" revision="replicant-4.2"/>
        <project path="vendor/replicant" name="gta04-replicant-vendor" remote="local-git" revision="replicant-4.2"/>
        <!-- keep Goldelico tools untouched -->
        <!--
        <project path="goldelico" name="gta04-replicant" remote="local-git" revision="master">
            <copyfile src="local_manifests/gta04-replicant-4.2.xml" dest=".repo/local_manifests/gta04.xml" />
        </project>
        -->
    </manifest>

Connecting via ADB

Please make sure to use ADB >= v1.0.31, to connect to your Replicant 4.2 device. At the first time you connect your device to your host computer, a dialog will popup on the phone and you need to confirm the hosts fingerprint, to allow it to connect via ADB. If you don't do this, "adb devices" will always list your device as "offline".

Submitting Patches

Please use git format-patch and send patches by email to gta04-owner@goldelico.com (please subscribe through http://lists.goldelico.com/mailman/listinfo/gta04-owner).

Clean Image Rebuild

If you want to do a clean image+kernel rebuild, without any leftovers/impact from your previous builds, you should remove the "out/target/product/gta04" directory:

rm -rf out/target/product/gta04/

Important Kernel Config and Arguments

  • No Initramfs: CONFIG_INITRAMFS_SOURCE=""
  • No blinking VT cursor in GUI: vt.global_cursor_default=0
  • Don't override CMDLINE, to get mux= parameter from U-Boot

Troubleshooting

Problem with "repo sync", fetching data from http://git.goldelico.com, such as this:

$ repo sync gta04-kernel.git
Fetching project gta04-kernel.git
error: Unable to find 2f500a5268ad4d18399913029c6f8f61198d3a63 under
http://git.goldelico.com/gta04-kernel.git
Cannot obtain needed object 2f500a5268ad4d18399913029c6f8f61198d3a63
error: Fetch failed.
error: Unable to find 2f500a5268ad4d18399913029c6f8f61198d3a63 under
http://git.goldelico.com/gta04-kernel.git
Cannot obtain needed object 2f500a5268ad4d18399913029c6f8f61198d3a63
error: Fetch failed.
error: Cannot fetch gta04-kernel.git

Solution:

cd .repo/projects/kernel/goldelico/gta04.git
rm objects/pack/pack-*.idx objects/*/*.temp
git fetch goldelico

References