HiKey LeMaker Recovery Failed



I am trying enabling OPTEE on hikey LeMaker verison. After I refalshed fip.bin, the device got stuck at “BL3-1: Initializing BL3-2”. But when I trying to flash back with the recovery mode, it cannot got into the this mode. And I tried all combinations of jumpers, it cannot reflash this device any more. Accoding the source of arm-trust-firmware, fastboot protocol is implemented in bl1. How can we get into this mode when the fip in damged and failed to boot to bl33. I tried several devices and got the same issue. It seems that there is hardware bug for hikey LeMaker version.

Could you show me how to reflash the device if the fip.bin is damaged? Thanks!

HiKey Recovery fails (Fastboot issue)

Hi @XevenQC,

I shared my burning script for recovery mode on Hikey; you could note below things:

  • When use script hisi-idt.py, it needs to specify the downloading port; so usually this port is your USB OTG device port on your PC; you could check command “lsusb” to check if USB OTG device has been recognized or not and ensure which device node /dev/ttyUSBX is for USB OTG device.

  • When finish power cycle on the board, the recovery mode has timeout for 60 seconds, otherwise the OTG device will be disconnected by SoC ROM.


rm ptable-linux-8g.img
rm l-loader.bin
rm fip.bin
rm nvme.img

wget https://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/latest/hikey/debug/ptable-linux-8g.img
wget https://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/latest/hikey/debug/l-loader.bin
wget https://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/latest/hikey/debug/fip.bin
wget https://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/latest/hikey/debug/nvme.img

# Link Jumper pin 3-4 for recovery mode
echo "relay5 off" > /dev/ttyACM0
# Reset board by power cycle power supply DC-IN
echo "relay1 off" > /dev/ttyACM0; sleep 1; echo "relay1 on" > /dev/ttyACM0

# Wait 2 seconds for board booting up
sleep 2

sudo python hisi-idt.py -d /dev/ttyUSB1 --img1=l-loader.bin
if [ $? -ne 0 ]; then
        echo "failed to burn l-loader.bin"
        exit 1

sudo fastboot flash ptable ptable-linux-8g.img
if [ $? -ne 0 ]; then
        echo "failed to burn ptable.img"
        exit 1

sudo fastboot flash fastboot fip.bin
if [ $? -ne 0 ]; then
        echo "failed to burn fip.bin"
        exit 1

sudo fastboot flash nvme nvme.img
if [ $? -ne 0 ]; then
        echo "failed to burn nvme.bin"
        exit 1

# Unlink Jumper pin 3-4 for normal mode
echo "relay5 on" > /dev/ttyACM0
# Reset board by power cycle power supply DC-IN
echo "relay1 off" > /dev/ttyACM0; sleep 1; echo "relay1 on" > /dev/ttyACM0


Hi Leo, Thanks for your sharing.

I still got several failed(more than 60 seconds) when loading l-loader.bin, and then fastboot cannot find the device. I have removed modemmanager. As you mentioned, the recovery mode will timeout for 60s. So might the fastboot failure be caused by the timeout?

I notice that there are two tty devices in your script. Is /dev/ttyACM0 for USB OTG device and /dev/ttyUSB1 for UART? When I just connected USB OTG to Linux PC, lsusb cannot find it. Command lsusb just can find the UART one (Bus 001 Device 017: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)) Is there anything wrong with my device or Linux PC?


If reboot board with link Pin 3-4 in jumper, then the board will run into recovery mode and SoC bootROM starts to work. The bootROM has 60 seconds timeout, before 60s timeout bootROM downloads images from USB OTG (on my PC, it’s usually /dev/ttyUSB1); after 60s timeout the bootROM switches to use UART to download image (on my PC, it’s usually /dev/ttyUSB0).

No, /dev/ttyACM0 is the device node to control my relay controller, it’s no matter with board. /dev/ttyUSB1 is the device node for Hikey board USB OTG;

This is the issue should be checked firstly. Could you confirm you have link the jumper pins for recovery mode: https://www.96boards.org/documentation/ConsumerEdition/HiKey/Installation/LinuxFactoryImage.md.html, “Step 3: Boot HiKey into Recovery mode using J15 header”.


Hi leo, thanks for your quick reply.

Yes I haved linked both Pin 1-2 and 3-4 and lsusb still cannot find the deivce node for USB OTG device. That’s wired and I tried on two Hikery boards.

As you said that after 60s timeout, l-loader.bin can be downloaded by UART. So without USB OTG device, we should also get boot logs from console, right? But there is nothing in console and it seems that l-loader and bl1.bin do not got executed.

Meanwhile, I modified the source of bl1 and make it enter into fastboot mode no matter what boot mode is set.

void bl1_platform_setup(void)
struct random_serial_num random;


    INFO("Hisilicon HiKey platform is initialized\n");
    if (1 /*query_boot_mode()*/) {
            NOTICE("Enter fastboot mode...\n");



Actually it has boot log for bootROM, but the bootROM uses the UART0 port (J801 on my Lemaker board which are 4 pins under the jumper pins). But now we are very seldom to use UART0 and totally change to use UART3 on low speed extension port.

I am curious after 60s timeout and use UART port for downloading, can you recovery the system back? And after Android system booting up, have you checked USB OTG can work well?


Hi leo, That’s my problem. After I enabled optee OS, the device got hung in booting BL32 and cannot boot to Android OS. So I just want to use recovery mode to reflash my Hikey back. When I got this board, the USB OTG worked well. It can be recognized by adb and fastboot.

Yes, bootROM uses the UART0 as output logs. But entering BL1, UART3 is used to output logs, right? So for my case, after comand “python hisi-idt.py -d /dev/ttyUSB0 --img1=l-loader.bin” is finished, the device got hung in bootROM and does not run into stage 1 bootloader?

And for the USB OTG not found issue, itseems something wrong with my PC, the USB OTG can be recognized for a very short while, as the following dmesg log.

[ 2734.123494] usb 1-1: new full-speed USB device number 34 using xhci_hcd
[ 2734.141135] usb 1-1: New USB device found, idVendor=12d1, idProduct=3609
[ 2734.141147] usb 1-1: New USB device strings: Mfr=1, Product=4, SerialNumber=0
[ 2734.141154] usb 1-1: Product: \xffffffe3\xffffff84\xffffffb0㌲㔴㜶㤸
[ 2734.141158] usb 1-1: Manufacturer: 䕇䕎䥎
[ 2734.142091] option 1-1:1.0: GSM modem (1-port) converter detected
[ 2734.142797] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 2734.711244] usb 1-1: USB disconnect, device number 34
[ 2734.711413] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 2734.711431] option 1-1:1.0: device disconnected


Hi leo, I repeated plug/unplug the OTG cables for several times, the OTG finally works and can be recognized and keep connected. And atfer loading l-loader.bin, it can run into fastboot mode. Maybe there is something wrong with my PC. Greate thanks for your kindly help.