Problems in flashing Android Images to VIM3

Hi guys.

This is my first post in this community. So, please forgive me if my question looks duplciated. I searched, by myself, quite a time but can’t find exact same problem I have.

Let me ask my questions in two separate parts: easy/simple one and complicate one.

First, I’d like to know if I can use Khadas burning tool for Windows (VIM3 Burning Tools for Windows) for flashing Android 11 images to VIM3 Pro device instead of the instruction listed in [VIM3 Flashing Guideline](참조 보드 사용  |  Android 오픈소스 프로젝트  |  Android Open Source Project)?

Actually I had used the tool for burning Android 9 image which is a single image file (update.img) and each partition images are not seperated.

Second, I’d like to know what is the best practice to capture VIM3 USB device while running the Ubuntu as VirtualBox guest OS over the Windows host OS?

The reason I ask the 1st question is because it looks I have complicate problem to make my Ubuntu detect the VIM3 USB properly. Sometimes it detect it as Amlogic only which is working for u-boot image flashing but the other times it is detected as Google Nexus device which is working for adb only.

My environment:
Host OS: Windows 11
VirtualBox: 6.1.26 (with Extension Pack installed)
Guest OS: Ubuntu 18.04

What I found is to flash the u-boot image in the Ubuntu, I need to first make my VIM to enter upgrade mode by the key combination (Power + Reset) before starting the VB guest OS. Then, the linux detects the Amlogic vendor ID correctly as followings:

jhryu@LG-GRAM-LINUX:~/work/vim3/device/amlogic/yukawa/bootloader$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 1b8e:c003 Amlogic, Inc.
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

However, adb or fastboot command looks not working under this state. So, the flashing task fails at the 3rd step as the VIM3 USB is disconnected (there’s a disconnection sound from Windows):

./tools/update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000 (completed)
./tools/update run 0xfffa0000 (completed but USB disconnection sound heard)
./tools/update bl2_boot u-boot_kvim3_noab.bin (failed)

So, I re-started from the beginning with pyamlboot script pyamlboot script and it looks successful:

$ u-boot_kvim3_noab.bin
Firmware Version :
ROM: 3.2 Stage: 0.0
Need Password: 0 Password OK: 1
Writing u-boot_kvim3_noab.bin at 0xfffa0000…
Running at 0xfffa0000…
AMLC dataSize=16384, offset=65536, seq=0…
AMLC dataSize=49152, offset=393216, seq=1…
AMLC dataSize=16384, offset=229376, seq=2…
AMLC dataSize=49152, offset=245760, seq=3…
AMLC dataSize=49152, offset=294912, seq=4…
AMLC dataSize=16384, offset=65536, seq=5…
AMLC dataSize=1110384, offset=81920, seq=6…

However, the next command looks stuck and just waing the device:

$ fastboot oem format
< waiting for any device >

Remaing steps cannot be done.

Because I have all the Android 11 images already via successful compiling and Windows burning tool is detecting VIM3 board, I’d like to just use the tool if possible or I’d like to know how to configure the VirtualBox USB configuration to flash the images to my VIM3.

Any suggestion will be highly appreciated.

To the first question, the answer is currently no, some work still needs to be done for the AML image writer to be implemented. Also Android 11 for the vim3 is currently a preview and isn’t ready for daily use.

To the second question, if the device is already showing up in the VM, what you may be missing is the usb permissions needed for applications and tools to interact with the device. Instructions on how to set the permissions can be found in Baylibres instructions for the master branch(android 12 development) for all Yukawa devices

1 Like

@zonggestsu Thanks for your comment!

I have already applied udev rules as suggested in the link you provided. As I explained, if I enter the upgrade mode by pressing power + reset key before starting the VM, the linux guest OS detects the Amlogic USB VID and I could successfully flash the uboot via pyamlboot script. Doesn’t it means the VIM3 is communicating with the PC? But after this step, fastboot does not show any devices and stuck saying that <waiting for any device>. Is additional steps requried to make the device enter the fastboot mode or unlock the bootloader? I can’t find any other instruction eve in link

I downloaded the AOSP and bootloader as suggested in this.

In addition, the VIM3 is connected with PC using single USB-C cable. Should I seperate the power and the data cable?

For flashing, only the single USB C is needed. If you are having issues with fastboot, try sudo (which fastboot) and see if that works, also make sure to grab the latest adb from Google

1 Like

@zonggestsu Thanks again!
Single USB-C should works makes me comfortable and I believe adb tool chains are latest.

To isolate the problem from VM stuff, I’d better investigate first in the host os (windows 11) side. I have tried following steps but it stucks at the Step4 if I initiate the fastboot command. Why the device does not respond? Where’s the boot process staying (after the Step4, Ctrl+C does not bring back the adb devices which means the adbd is not starting)?

PS C:\Users\aerop> adb version
Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
Installed as C:\Users\aerop\AppData\Local\Android\Sdk\platform-tools\adb.exe

PS C:\Users\aerop> adb devices

  • daemon not running; starting now at tcp:5037
  • daemon started successfully
    List of devices attached
    c8631470a68e device

PS C:\Users\aerop> adb shell reboot fastboot

PS C:\Users\aerop> fastboot flashing unlock
< waiting for any device >

when bl2_boot is performed, it justs boots the new 2nd bootloader so you may have to try update to write 1st bootloader and boot second bootloader again. also there is the update utility for windows that can be grabbed from here but needs the libusb0.dll in the same directory as update.exe from amlogic usb burning tool found in C:\Program Files(x86)\Amlogic\USB_Burning_Tool provided you have it installed. i havent tested it myself, but some others say that it works

1 Like

I grabbed the tool and copy libusb0. Can you elaborate the step to update the 1st and the 2nd bootloader? What I have from latest AOSP building is:


and a few .imgs that I guess not mandatory.

Thanks again!

1 Like

so for updating the first one, using the same uboot file, you do
update(.exe) write {uboot bootloader} 0xfffa0000 0x10000
update(.exe) run 0xfffa0000
update(.exe) bl2_boot {uboot bootloader}

at this point, the device will boot the 2nd bootloader from ram after which you will use fastboot to actually write the second bootloader to its proper partition
fastboot(.exe) oem format
fastboot(.exe) flash bootloader {uboot bootloader}
fastboot(.exe) erase bootenv
fastboot(.exe) reboot bootloader

from here you will need to power cycle the device, since it wont actually power on by itself. either press the reset key or unplug and replug the usb cable.

from here its just the normal flashing of the different partition files

1 Like

I tried as follwings but it returns error at the step 4. As I explained, as soon as I completed the Step 3, there’s a USB disconnection sound and it looks the device power cycle to normal boot. So, the Step4 fails as always. Why the device does not sustain the connection when the Step 3 is completed?

Step 1:
Makes the device enters the upgrade mode by pressing & holding the power key with short pressing the reset key

Step 2:
C:\Users\aerop\Linux\android11>update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000

Transfer Complete! total size is 65536 Bytes

Step 3:
C:\Users\aerop\Linux\android11>update run 0xfffa0000
[update]:Run at Addr fffa0000

<USB disconnection sound beeps here!>

Step 4:
C:\Users\aerop\Linux\android11>update bl2_boot u-boot_kvim3_noab.bin
[update]:No [WorldCup Device] device after scan
[update]ERR(L1094):can not find device

After the failure at the Step4, the device definately goes to normal mode, as adb is connected;
C:\Users\aerop\Linux\android11>adb devices

  • daemon not running; starting now at tcp:5037
  • daemon started successfully
    List of devices attached
    c8631470a68e device


it doesnt seem very likely to me, but i would try a different cable just in case the one you are using has issues. its either that or possibly an issue with how windows handles usb device hardware changes

I have tried with another USB 2 to 3 cable but the result was the same. In addition, USB Burning tool for Windows works Ok with the same cable, which means the cable is not a problem?

Let me be more specific.
As USB is always disconnected at the Step3, I suspect the ‘update run’ commmand do something wrong. It looks to me that the command is to run the bl2 bin code from the VIM3 RAM. So does it mean the Step3 entirely depend on the bootloader image transfered at the Step2? Is there possibility that ‘update run’ gommand fails due to some pre-configuration? Is Step2 parameters are all good?


That I’m not sure of, usually when I do flash the bootloader i do the whole process on Linux, bare metal, and haven’t run into this sort of issue. Maybe could say more as to what may be going on.
Can you advise me if ‘update run’ command makes my VIM3 exit from the upgrade mode so tha I’m unable to program bl2 bootloader? I tried with several versions of bootloader images built by myself, uploaded in khadas repository with which someone had successfully flashed his own device. But no work till now.


@aeropia you can try this USB dirver.
You can use Ubuntu flash ROM yet.
Thanks for the reply but I can’t download the USB driver but you mean this?

But trying to install this driver doesn’t seem to go any further. I tried to right click the INF file and select ‘install’ but I can’t see anything in progress. I’m not sure it is installed or not.

When I enter the upgrade mode, the device management screen looks like this;

Are you suggesting to update this driver?

Strange thing is after I execte the ‘update run’ command, the USB is connected as Adb devices like below.

This is my falsh bat,you can refer to it.

@update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000
@if NOT %errorlevel%==0 goto :error

@update run 0xfffa0000
@if NOT %errorlevel%==0 goto :error

@update bl2_boot u-boot_kvim3_noab.bin
@if NOT %errorlevel%==0 goto :error

@fastboot oem format
@if NOT %errorlevel%==0 goto :error

@fastboot flash bootloader u-boot_kvim3_noab.bin
@if NOT %errorlevel%==0 goto :error

@fastboot erase bootenv
@if NOT %errorlevel%==0 goto :error

@fastboot reboot bootloader
@echo !!!!!!!!Flash uboot successfully!!!!!!!!
@goto :exit

@echo errorlevel %errorlevel%
@echo !!!!!!!!Flash uboot failed!!!!!!!!



@fastboot flash boot boot.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash super super.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash cache cache.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash userdata userdata.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash recovery recovery.img
@if NOT %errorlevel%==0 goto :error

@fastboot flash dtbo dtbo-unsigned.img
@if NOT %errorlevel%==0 goto :error

@fastboot reboot
@echo !!!!!!!!Flash some img successfully!!!!!!!!
@goto :exit

@echo errorlevel %errorlevel%
@echo !!!!!!!!Flash some img failed!!!!!!!!


It can be seen from the log that it is the problem of USB driver

Thanks for the update. I’ll try with your .bat file when I come back to home.

As I explained, I found that the run command at the Step3 makes the VIM3 exit from the upgrade mode and it gets connected as adb device, so I think the USB driver issue at the Step4 is as expected. So, I guess the problem is at the Step3, not Step4. Why on earth VIM3 exit the upgrade mode by ‘update run’ command?

Is it normal that the VIM3 is seen either WorldCup device or adb device exclusively?

Thanks again!

The normal mode is

update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000     // **WorldCup Device**
update run 0xfffa0000      // **WorldCup Device**
update bl2_boot u-boot_kvim3_noab.bin    // **WorldCup Device**

After this command(update bl2_boot u-boot_kvim3_noab.bin) was executed.
The VIM3 will enter “Android ADB mode”.

So, in my case the first ‘update write’ works and I can see “transfer complete” message but the 2nd ‘update run’ command fails but no error message. Only I can recognize is the USB disconnection sound and short blink of red LED. Then the USB device is changed from WorldCup to ADB. I guess the device reset at ths point?

So, can you explain what happens if ‘update run’ command is sent to VIM3? Is there any possible scenario to make the connection drop?

Sorry for so many repeated questions.