TinkerBoard2-Android / manifest

12 stars 9 forks source link

Build document for TinkerBoard2 #1

Closed 0fly0 closed 3 years ago

0fly0 commented 3 years ago

Hi, do TinkerBoard2 has build documents? build.sh has some compilation errors

asusiot commented 3 years ago

hello @0fly0

  1. Make sure Docker is ready for the build environment.
  2. Go to the directory where you have downloaded the code base and execute the script. This will take a while to install the necessary packages on the host and build the Docker image.

    $ ./docker_builder/docker-builder-run.sh

    Once the above is done, you are in the shell of the newly started Docker

  3. Build image

    $ source build/envsetup.sh

    $ lunch WW_Tinker_Board_2-userdebug

    $ ./build.sh -UKAu

    It will generate a file which named WW_Tinker_Board_2-raw.img and located at [source tree]/rockdev/Image-WW_Tinker_Board_2/WW_Tinker_Board_2-raw.img

mozcelikors commented 3 years ago

I have tidied this up a bit and tried to improve these instructions for those who want to get started. I did not use docker at all. I have verified that it works on Ubuntu 20.04 with gcc-9.

Downloading Source

repo init -u https://github.com/TinkerBoard2-Android/manifest.git -b android10-rk3399
repo sync

Building U-Boot

source build/envsetup.sh
lunch WW_Tinker_Board_2-userdebug
./build.sh -U

Building Kernel

source build/envsetup.sh
lunch WW_Tinker_Board_2-userdebug
./build.sh -K

Building Android

source build/envsetup.sh
lunch WW_Tinker_Board_2-userdebug
./build.sh -A -J <thread_count>

If you run into "Killed" or "out of memory" errors, reduce -J value. In initial build, there were a lot of memory required so I had to reduce to -J 3.

Building Complete Image

source build/envsetup.sh
lunch WW_Tinker_Board_2-userdebug
./build.sh -UKAu -J 6

It will generate a file which named WW_Tinker_Board_2-raw.img and located at [source tree]/rockdev/Image-WW_Tinker_Board_2/WW_Tinker_Board_2-raw.img If you run into "Killed" or "out of memory" errors, reduce -J value.

Write to SD Card

Write WW_Tinker_Board_2-raw.img to SD card using Balena Etcher and then connect 12V power and HDMI and boot the board. You should see it boot up. You can use a USB Type C cable to connect to ADB.

Clean Build

rm -rf out/
source build/envsetup.sh
lunch WW_Tinker_Board_2-userdebug
./build.sh -UKAu -J 6

Partial Build

If you want to compile single module, first prepare environment

source build/envsetup.sh
lunch WW_Tinker_Board_2-userdebug

then go to the directory which module you want to compile and execute following:

cd <module-path>
mma
0fly0 commented 3 years ago

thank you guys! @mozcelikors @asusiot