Download The Android Source Code

The Android Source Tree of our Khadas VIMs are hosted on Github. There are many different repositories.

Walk through the steps below to download the Source Code.

Steps

Firstly, install git-lfs tool for downloading Android 11.0 64bit SDK

1
$ sudo apt install git-lfs

Or source code installation

1
2
3
4
5
6
7
$ mkdir git_lfs
$ cd git_lfs
$ wget https://github.com/git-lfs/git-lfs/releases/download/v2.3.4/git-lfs-linux-amd64-2.3.4.tar.gz
$ tar xvzf git-lfs-linux-amd64-2.3.4.tar.gz
$ cd git-lfs-2.3.4
$ sudo ./install.sh
$ git lfs install
  1. Create an empty directory to hold your working files:
1
2
$ mkdir -p WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
  1. Run repo init to download the manifest repository first:
1
$ repo init -u https://github.com/khadas/android_manifest.git -b khadas-vim4-r-64bit
  1. Run repo sync to pull down the Android Source Tree:
1
$ repo sync -j4

The initial sync operation may take an hour or more to complete.

Tip

You might need to run above command repeatly if it fails halfway. Or you can try with this script instead:

1
2
3
4
5
6
#!/bin/bash
repo sync -j4
while [ $? = 1 ]; do
echo "Sync failed, repeat again:"
repo sync -j4
done

If needed, press Ctrl-\ to quit.

  1. Begin a new branch for development:
1
$ repo start <BRANCH_NAME> --all
  1. Based on different unbutu versions, the following operations may be required to pull large files(Otherwise, the corresponding file is small and incorrect).
    You need to go to the following three directories and use the ‘git lfs pull’ command to pull large files, otherwise an error will be reported during compilation:
    1
    2
    3
    vendor/amlogic/common
    device/khadas/kvim4-kernel
    device/khadas
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    xxx@server:/users/vim4$ cd vendor/amlogic/common
    xxx@server:/users/vim4/vendor/amlogic/common$ git lfs pull
    Git LFS: (6 of 6 files) 239.31 MB / 239.31 MB
    xxx@server:/users/vim4/vendor/amlogic/common$ cd -
    /users/vim4
    xxx@server:/users/vim4$ cd device/khadas/
    xxx@server:/users/vim4/device/khadas$
    xxx@server:/users/vim4/device/khadas$ git lfs pull
    Git LFS: (2 of 2 files) 231.89 MB / 231.89 MB
    xxx@server:/users/vim4/device/khadas$ cd kvim4-kernel/
    xxx@server:/users/vim4/device/khadas/kvim4-kernel$
    xxx@server:/users/vim4/device/khadas/kvim4-kernel$ git lfs pull
    Git LFS: (4 of 4 files) 451.79 MB / 451.79 MB
    xxx@server:/users/vim4/device/khadas/kvim4-kernel$

    Further Reading