|
|
<center> <h1>Khadas VIM3L</h1> </center>
|
|
|
|
|
|
VIM3L is part of the Khadas platforms and is available from [khadas.com](https://www.khadas.com/vim3l) .
|
|
|
|
|
|
<p align="center">
|
|
|
<img src="./Images/VIM3L_Bareboard_Perspective.png" width="500" height="400"/>
|
|
|
</p>
|
|
|
|
|
|
Note: Wiki from [Khadas](https://docs.khadas.com/vim3) give all documentation needed for VIM3L.
|
|
|
|
|
|
|
|
|
## 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
|
|
|
make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3L=true -j24
|
|
|
```
|
|
|
|
|
|
By default, Android is built with the 5.10 kernel. To use kernel 5.4 prebuilts:
|
|
|
```
|
|
|
make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3L=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](https://source.android.com/security/verifiedboot/avb)
|
|
|
- TARGET_USE_AB_SLOT=true : Enable [AB partitions](https://source.android.com/devices/tech/ota/ab)
|
|
|
- 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, VIM3L 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 VIM3L in USB MODE
|
|
|
|
|
|
<p align="center">
|
|
|
<img src="./Images/VIM3L_Bareboard_Top.png" width="500" height="400"/>
|
|
|
</p>
|
|
|
|
|
|
1. Power-on VIM3L.
|
|
|
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_kvim3l_noab.bin 0xfffa0000 0x10000
|
|
|
./tools/update run 0xfffa0000
|
|
|
./tools/update bl2_boot u-boot_kvim3l_noab.bin
|
|
|
```
|
|
|
|
|
|
Notes:
|
|
|
- if you encounter permission issues, refer to the [udev rules section](https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3L#udev-rules) to add the appropriate USB rules.
|
|
|
|
|
|
- If `tools/update` does not work, use the [pyamlboot tool](https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3L#pyamlboot) to flash the board instead
|
|
|
|
|
|
|
|
|
U-Boot should boot and run fastboot, then:
|
|
|
```
|
|
|
fastboot oem format
|
|
|
fastboot flash bootloader u-boot_kvim3l_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 ${AOSP_TOPDIR}/https://android.googlesource.com/platform/prebuilts/gas/linux-x86 prebuilts/gas/linux-x86
|
|
|
```
|
|
|
|
|
|
2. 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
|
|
|
# for 5.10
|
|
|
git clone https://android.googlesource.com/kernel/hikey-linaro -b android-amlogic-bmeson-5.10
|
|
|
# for 5.15
|
|
|
git clone https://android.googlesource.com/kernel/hikey-linaro -b android-amlogic-bmeson-5.15
|
|
|
```
|
|
|
|
|
|
3. Export build variables:
|
|
|
|
|
|
```
|
|
|
export PATH=${AOSP_TOPDIR}/prebuilts/clang/host/linux-x86/clang-r445002/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
|
|
|
```
|
|
|
|
|
|
4. Generate the kernel configuration
|
|
|
|
|
|
```
|
|
|
cd hikey-linaro
|
|
|
make meson_defconfig
|
|
|
```
|
|
|
|
|
|
5. Build the kernel:
|
|
|
|
|
|
```
|
|
|
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
|
|
|
KERN_VER=5.10 # for 5.10 kernel
|
|
|
KERN_VER=5.15 # for 5.15 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/${KERN_VER}/$(basename $f);
|
|
|
done
|
|
|
cp -v -p arch/arm64/boot/Image.lz4 ${AOSP_TOPDIR}/device/amlogic/yukawa-kernel/${KERN_VER}/Image.lz4
|
|
|
```
|
|
|
|
|
|
7. [rebuild](https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3L#android-build-env-instructions-) and [flash your board](https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3L#flash-android-images)
|
|
|
|
|
|
Note: for an alternative kernel build using `build.sh`, see [Building kernel using `build.sh`](https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3L#building-kernel-using-buildsh)
|
|
|
|
|
|
## More links:
|
|
|
- [GPIO pinout](https://docs.khadas.com/vim3/GPIOPinout.html)
|
|
|
|
|
|
## 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", TAG+="uaccess"
|
|
|
|
|
|
# khadas vim3 fastboot (initial bootloader)
|
|
|
# idVendor=1b8e, idProduct=fada,
|
|
|
SUBSYSTEM=="usb", ATTR{idVendor}=="1b8e", ATTR{idProduct}=="fada", MODE="0660", TAG+="uaccess"
|
|
|
|
|
|
# khadas vim3 adb
|
|
|
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0660", TAG+="uaccess"
|
|
|
```
|
|
|
|
|
|
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_kvim3l_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.baylibre.com/baylibre/amlogic/atv/aosp/kernel/manifest.git -b android-amlogic-bmeson-4.19
|
|
|
# for building kernel 5.4
|
|
|
repo init -u https://gitlab.baylibre.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
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
VIM3L instructions are part of the [VIM3 page](./Khadas_VIM3.md). |