Booting a custon kernel on Lemaker Hikey


#1

Greetings,

I have compiled the Linux Kernel(v4.16), because i need Coresight support on the board, and the shipped kernel is too old(3.8). I’m trying to boot with it using an SDCARD.

I have downloaded the following https://releases.linaro.org/96boards/hikey/linaro/debian/latest/ and dd’d it to my SDCARD. I compiled a kernel using a default configuration aimed for arm64 boards, and then replaced my Image output file in the Image on the boot partition on SDCARD, and the dtb(hi6220-hikey.dtb) file as well. I left the initramfs as is. I also installed the drivers(modules_install) in the rootfs in the /lib/modules. This whole process worked perfectly on the Dragonboard 410c, but when i try to boot the Lemaker Hikey it is stuck and does nothing, and gets super warm.

Any ideas, hints? anything i’m doing wrong?

Thanks.


#2

I compiled the kernel here: https://github.com/suihkulokki/linux/tree/hikey-v4.15 and put the output artifacts in the boot partition of the SDCARD, it boots succesfully, but the dmesg is spammed with:

[ 243.379686] wlcore: ERROR Your WiFi FW version (8.9.0.0.39) is invalid.
[ 243.379686] Please use at least FW 8.9…58.
[ 243.379686] You can get the latest firmwares at:
[ 243.379686] git://git.ti.com/wilink8-wlan/wl18xx_fw.git
[ 243.400566] wlcore: ERROR error getting static data
[ 243.406494] wlcore: ERROR firmware boot failed despite 3 retries
[ 243.540838] dwmmc_k3 ff3ff000.dwmmc2: failed to set rate 2400000Hz
[ 243.547112] mmc_host mmc1: Bus speed (slot 0) = 25000000Hz (slot req 300000Hz, actual 297619HZ div = 42)
[ 243.575829] dwmmc_k3 ff3ff000.dwmmc2: failed to set rate 2400000Hz
[ 243.584294] dwmmc_k3 ff3ff000.dwmmc2: failed to set rate 2400000Hz
[ 243.605485] mmc_host mmc1: Bus speed (slot 0) = 25000000Hz (slot req 25000000Hz, actual 25000000HZ div = 0)

How do i fetch the correct firmware for this board?


#3

Hi @MikeCoresight,

You can flash the latest images available here: http://snapshots.linaro.org/96boards/hikey/linaro/debian/latest/

It is based on 4.15 kernel and the source can be found here: https://github.com/suihkulokki/linux/tree/hikey-v4.15

For building and flashing the kernel, follow the steps mentioned in documentation: https://github.com/96boards/documentation/blob/master/consumer/hikey/build/linux-kernel.md

Hope this helps!

Thanks,
Mani


#4

Greetings, @Mani

I tried the link you’ve provided and downloaded linaro-stretch-developer-hikey-20180212-17.sd.gz, ungzipped it, and dd’d it to my SDCARD. I can see the boot partition and the rootfs using fdisk -l:
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 133119 131072 64M c W95 FAT32 (LBA)
/dev/mmcblk0p2 133120 3686399 3553280 1.7G 83 Linux

But this kernel doesn’t boot. The Hikey board does nothing when i insert the SDCARD, 2 green LEDs are on: LED901, LED903.

Also the instrutions of compiling the kernel do not work. I created a debian package(on my Arch Linux host machine) and dpkg’d it on my board. It didn’t replace my kernel. I can see it extracted some artficats to the boot partition: vmlinux(ELF binary), initramfs and config. But i don’t see a device tree, and the vmlinux is in the wrong format, i need an Image file in PE format, just like the existing Image.


#5

Hi @MikeCoresight,

First of all, you need to flash new bootloader binaries onto Hikey before using those images. The new binaries can be obtained from the below link:

http://snapshots.linaro.org/96boards/hikey/linaro/uefi-openplatformpkg/latest/

Then you can try the SD card/Fastboot method to test the images. Regarding the custom kernel compilation, the instructions which I have pointed out should work with latest bootloader and debian image.

Thanks,
Mani


#6

@Mani
Thanks for your answer.
I’m having some trouble in flashing a new bootloader. I’m trying to use fastboot to do it,
i connected hikey to my laptop using a usb cable and the kernel recognizes it:
[ 1827.963520] usb 1-1: new full-speed USB device number 13 using xhci_hcd
[ 1828.092545] usb 1-1: New USB device found, idVendor=12d1, idProduct=3609
[ 1828.092552] usb 1-1: New USB device strings: Mfr=1, Product=4, SerialNumber=0
[ 1828.092557] usb 1-1: Product: \xe3\x84\xb0\xe3\x8c\xb2\xe3\x94\xb4\xe3\x9c\xb6\xe3\xa4\xb8
[ 1828.092561] usb 1-1: Manufacturer: \xe4\x95\x87\xe4\x95\x8e\xe4\xa5\x8e
[ 1828.093599] option 1-1:1.0: GSM modem (1-port) converter detected
[ 1828.093803] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0

Then, i use this script to flash the loader that you gave me:
sudo python hist-idt.py --img1 ./binaries/l-loader.bin -d /dev/ttyUSB0

The loader is flashed succesfully, and i can see the LED turn on.
±---------------------+
(’ Serial: ‘, ‘/dev/ttyUSB0’)
(’ Image1: ‘, ‘./binaries/l-loader.bin’)
(’ Image2: ', ‘’)
±---------------------+

(‘Sending’, ‘./binaries/l-loader.bin’, ‘…’)
Done

But then nothing happens… i don’t see any fastboot device in the dmesg, and
"sudo fastboot devices -l" gives me nothing.

I have my udev rules updated:
SUBSYSTEM==“usb”, ATTR{idVendor}==“18d1”, ATTR{idProduct}==“d00d”, MODE=“0660”, GROUP="users"
SUBSYSTEM==“usb”, ATTR{idVendor}==“12d1”, ATTR{idProduct}==“1057”, MODE=“0660”, GROUP="users"
SUBSYSTEM==“usb”, ATTR{idVendor}==“12d1”, ATTR{idProduct}==“1050”, MODE=“0660”, GROUP=“users”

SUBSYSTEM==“usb”, ATTR{idVendor}==“12d1”, ATTR{idProduct}==“3609”, MODE=“0660”, GROUP=“users” RUN+=“chmod 777 /dev/ttyUSB0”

Nothing is connected to the board except the power cable and the USB cable. Just to be clear… this is the LeMaker HIkey 8GB version.


#7

Hi @MikeCoresight,

I think you are using wrong image for command ‘hisi-idt.py’, you should use below command:

sudo python hisi-idt.py -d /dev/ttyUSB1 --img1=recovery.bin
sudo fastboot flash  loader l-loader.bin

In case you are interesting, I paste my own shell script for downloading and flashing image as below:

#!/bin/bash

## declare an array for images
declare -a boot_imgs=("hisi-idt.py"
                      "l-loader.bin"
		      "fip.bin"
		      "ptable-linux-4g.img"
		      "ptable-linux-8g.img"
		      "nvme.img"
		      "recovery.bin")

declare -a debian_imgs=("rootfs-linaro-stretch-developer-hikey-*.img.gz"
                        "boot-linaro-stretch-developer-hikey-*.img.gz")

# At my side, the relay5 connects to jumper pin3-4 so when
# turn off relay5 the pins will be connected. So we need
# turn off relay5 for recovery mode.
# The relay1 is connected for power supply, so do power cycle
# to reset the board.
hikey_enter_recovery_mode() {
	echo "relay5 off" > /dev/ttyACM0
	echo "relay1 off" > /dev/ttyACM0; sleep 1; echo "relay1 on" > /dev/ttyACM0
}

hikey_enter_normal_mode() {
	echo "relay5 on" > /dev/ttyACM0
	echo "relay1 off" > /dev/ttyACM0; sleep 1; echo "relay1 on" > /dev/ttyACM0
}

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

hikey_flash_img() {
	sudo fastboot flash $1 $2
	if [ $? -ne 0 ]; then
		echo "failed to burn $2"
		exit 1
	fi
}

hikey_download_boot_imgs() {
	for i in "${boot_imgs[@]}"
	do
		rm "$i"
		echo Download "$i"...
		wget http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/latest/hikey/debug/"$i"
	done
}

hikey_download_debian_imgs() {
	for i in "${debian_imgs[@]}"
	do
		rm "$i"
		echo Download "$i"...
		wget http://snapshots.linaro.org/96boards/hikey/linaro/debian/latest/"$i"
		echo Uncompress "$i"...
		gunzip "$i"
	done
}

hikey_flash_debian_imgs() {
	hikey_flash_img 'boot' 'boot-linaro-stretch-developer-hikey-*.img'
	hikey_flash_img 'system' 'rootfs-linaro-stretch-developer-hikey-*.img'
}

# Download images
# hikey_download_boot_imgs
# hikey_download_debian_imgs

# Run into recovery mode
hikey_enter_recovery_mode
sleep 2
hikey_load_recovery_img recovery.bin

hikey_flash_img 'ptable' 'ptable-linux-8g.img'
sleep 2

# Run into recovery mode
hikey_enter_recovery_mode
sleep 2
hikey_load_recovery_img recovery.bin

hikey_flash_img 'loader' 'l-loader.bin'
hikey_flash_img 'fastboot' 'fip.bin'
hikey_flash_img 'nvme' 'nvme.img'
sleep 2

hikey_flash_debian_imgs
sleep 2

# Run into normal mode
hikey_enter_normal_mode

#8

@leo-yan Thank you for your answer!

Your script actually works and my Hikey is now booting the “4.15-hikey” kernel from the latest linaro build, after flashing everything. One problem remains though, my kernel logs(dmesg) are spammed with this(and it doesn’t stop…):

#wlcore: ERROR SW watchdog interrupt received! starting recovery.
#WARNING: CPU: 5 PID: 1850 at drivers/net/wireless/ti/wlcore/main.c:796 wl12xx_queue_recovery_work.part.25+0x58/0x60[wlcore]
#CPU: 5 PID: 1850 Comm: irq/53-wl18xx Tainted: G W 4.15-hikey #1
#Hardware name: Hikey Development Board(DT)
#pstate: 60000005 (nZCv daif -PAN -UAO)
#pc: wl12xx_queue_Recovery_work.part.25+0x58/0x60 [wlcore]
#lr: wlcore_irq+9x178/0x1b0 [wlcore]
#Call trace:
#wl12xx_queue_recovery_work.part.25+0x58/0x60 [wlcore]
#wlcore_irq+0x178/0x1b0 [wlcore]
#irq_thread_fn+0x28/0x68
#irq_thread + 0x128/0x1d0
#kthread + 0xf8/0x128
#ret_from_fork+0x10/0x18
#— [end trace efaa0cd467c1ca8c] —
#wlcore: Hardware recovery in progress. FW ver: Rev 8.9.0.0.70
#wlcore: pc: 0x118032, hint_sts: 0x00000000 count: 27
#wlcore: down
#wlcore: down
#ieee80211 phy0: Hardware restart was requested
#mmc_host mmc2: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
#mmc_host mmc2: Bus speed (slot 0) = 24800000Hz (slot req 25000000Hz, actual 24800000HZ div = 0)
#wlcore: PHY firmware version: Rev 8.9.0.0.70
#wlcore: firmware booted (Rev 8.9.0.0.70)
#wlcore: down

Any hints? This seems like a firmware issue in the linaro build… not sure though.


#9

Hi @MikeCoresight,

This is a known issue and I think we need to update the Wlcore firmware in our build.


#10

IIUC the WIFI firmware is not compatible with kernel WIFI core driver, then there might introduce kernel panic.

Except @Mani mentioned to upgrade WIFI firmware as one solution for totally fixing this issue, you could do some quick trying if you don’t want WIFI (at my side I often use USB to ethernet adapter so in this case): you can remove firmware module in rootfs if you rollback to use the released kernel image, so at the system booting time you can avoid to load WIFI modules?


#11

@Mani @leo-yan
Updating the wl18xx firmware seemed to solve the issue. I successfully got an IP in my LAN using WiFI.

Thank you both.


#12

@MikeCoresight @leo-yan FYI: We have updated the Wifi firmware on our Hikey debian builds today. Please do sudo apt update && sudo apt upgrade to get the latest firmware and the Wifi issue will be gone.

Thanks,
Mani