Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
Y
yukawa
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Requirements
    • Requirements
    • List
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
  • Analytics
    • Analytics
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Commits
Collapse sidebar
  • BayLibre
    • amlogic
    • Android TV
    • A
      aosp
    • D
      device
  • amlogic
  • yukawa
  • Wiki
  • Khadas_VIM3

Last edited by Mattijs Korpershoek Nov 26, 2020
Page history

Khadas_VIM3

Khadas VIM3

VIM3 is part of the Khadas platforms and is available from khadas.com .

Note: Wiki from Khadas give all documentation needed for VIM3.

Download Source

repo init -u https://android.googlesource.com/platform/manifest -b master
repo sync -j8

Android Build Env instructions :

. ./build/envsetup.sh
lunch yukawa-userdebug|yukawa32-userdebug
make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3=true -j24

By default, Android is built with the 4.19 kernel. To use kernel 5.4 prebuilts:

make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3=true TARGET_KERNEL_USE=5.4 -j24

List of build flags:

  • TARGET_KERNEL_USE=5.4 : Use kernel 5.4 prebuilt
  • TARGET_AVB_ENABLE=true : Enable AVB
  • TARGET_USE_AB_SLOT=true : Enable AB partitions
  • TARGET_BUILTIN_EDID=true : This option allows to preload 1920x1080 EDID structure
  • TARGET_USE_TABLET_LAUNCHER=true : Use tablet launcher instead of Android TV launcher

Flashing yukawa images

For best results, VIM3 should be directly connect to host PC. Please avoid using USB hubs as they usually do not provide enough power to the board.

First time flashing method:

Flashing is done using the prebuild tools/update tool.

Put VIM3 in USB MODE

  1. Power-on VIM3.
  2. Quickly press the F button 3 times in 2 seconds, then release the button.

You will see the Power-LED (Blue) blink for about 3 seconds. After the Power-LED (Blue) turns OFF, this indicates that the board is in Upgrade Mode .

Flash Android Bootloader

cd path/to/aosp/device/amlogic/yukawa/bootloader/
./tools/update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000
./tools/update run 0xfffa0000
./tools/update bl2_boot u-boot_kvim3_noab.bin

Notes:

  • If you encounter permission issues, refer to the udev rules section to add the appropriate USB rules.

  • If tools/update does not work, use the pyamlboot tool to flash the board instead

U-Boot should boot and run fastboot, then:

fastboot oem format
fastboot flash bootloader u-boot_kvim3_noab.bin
fastboot erase bootenv
fastboot reboot bootloader

Unplug and plug Power cable. After this, the board should boot into the just-flashed u-boot and enter fastboot mode.

Flash Android Images

  • go to out/target/product/[yukawa|yukawa32] and launch this commands:
fastboot flash boot boot.img
fastboot flash super super.img
fastboot flash cache cache.img
fastboot flash userdata userdata.img
fastboot flash recovery recovery.img
fastboot flash dtbo dtbo-unsigned.img
fastboot reboot

Build Kernel Source

  1. Set AOSP_TOPDIR

    export AOSP_TOPDIR=/path/to/your/aosp/source
  2. Download additional toolchains:

    cd ${AOSP_TOPDIR}
    git clone https://android.googlesource.com/platform/prebuilts/gas/linux-x86 prebuilts/gas/linux-x86
  3. Clone the kernel source:

    # for 4.19
    git clone https://android.googlesource.com/kernel/hikey-linaro -b android-amlogic-bmeson-4.19
    # for 5.4
    git clone https://android.googlesource.com/kernel/hikey-linaro -b android-amlogic-bmeson-5.4
  4. Export build variables:

    export PATH=${AOSP_TOPDIR}/prebuilts/clang/host/linux-x86/clang-r399163b/bin:$PATH
    export PATH=${AOSP_TOPDIR}/prebuilts/gas/linux-x86:$PATH
    export PATH=${AOSP_TOPDIR}/prebuilts/misc/linux-x86/lz4:$PATH
    export ARCH=arm64
    export CROSS_COMPILE=aarch64-linux-gnu-
    export LLVM=1
  5. Build the kernel:

    cd hikey-linaro
    make meson_defconfig
    make DTC_FLAGS="-@" -j24
  6. Compress the kernel and copy build_artifacts to ${AOSP_TOPDIR}/device/amlogic/yukawa-kernel:

    lz4c -f arch/arm64/boot/Image arch/arm64/boot/Image.lz4
    KERN_VER=4.19 # for 4.19 kernel
    KERN_VER=5.4  # for 5.4 kernel
    
    for f in arch/arm64/boot/dts/amlogic/*{g12b-a311d,sm1}-khadas-vim3*.dtb; do
        cp -v -p $f ${AOSP_TOPDIR}/device/amlogic/yukawa-kernel/$(basename $f)-${KERN_VER}
    done
    cp -v -p arch/arm64/boot/Image.lz4 ${AOSP_TOPDIR}/device/amlogic/yukawa-kernel/Image.lz4-${KERN_VER}
  7. rebuild and flash your board

Note: for an alternative kernel build using build.sh, see Building kernel using build.sh

More links:

  • GPIO pinout

Troubleshooting

Udev rules

Create the /etc/udev/rules.d/99.amlogic_khadas.rules file with the following content:

# khadas vim3 initial flashing
# idVendor=1b8e, idProduct=c003
SUBSYSTEM=="usb", ATTR{idVendor}=="1b8e", ATTR{idProduct}=="c003", MODE="0660", GROUP="plugdev"

# khadas vim3 fastboot (initial bootloader)
# idVendor=1b8e, idProduct=fada,
SUBSYSTEM=="usb", ATTR{idVendor}=="1b8e", ATTR{idProduct}=="fada", MODE="0660", GROUP="plugdev"

Then restart udev with:

sudo udevadm control --reload
sudo udevadm trigger

Pyamlboot

Install pyamlboot via pip:

pip3 install pyamlboot

For other methods: https://github.com/superna9999/pyamlboot#installation

cd path/to/aosp/device/amlogic/yukawa/bootloader/
boot-g12.py u-boot_kvim3_noab.bin

Building kernel using build.sh

export AOSP_TOPDIR=/path/to/your/aosp/source
mkdir repo-kernel
cd repo-kernel
# for building kernel 4.19
repo init -u https://gitlab.com/baylibre/amlogic/atv/aosp/kernel/manifest.git -b android-amlogic-bmeson-4.19
# for building kernel 5.4
repo init -u https://gitlab.com/baylibre/amlogic/atv/aosp/kernel/manifest.git -b android-amlogic-bmeson-5.4
repo sync -j8 -c
DIST_DIR=${AOSP_TOPDIR}/device/amlogic/yukawa-kernel/ BUILD_CONFIG=hikey-linaro/build.config.yukawa.aarch64 build/build.sh
Clone repository
  • Android for Yukawa
  • GKI kernel
  • Khadas_VIM3
  • Khadas_VIM3L
  • Release v20190506
  • Release v20190517 Internal
  • Release v20190523
  • Home