HiKey(LeMaker version):Quick Start

From BananaPro/Pi
Jump to: navigation, search

Other languages:
English • ‎中文(简体)‎

By following this short quick start guide, we will be able to use our HiKey in just a few minutes. There are three steps to start up our HiKey.

Get what we need

MicroSD Card(Optional)
We recommend a 4GB or greater class 10 MicroSD card.

HDMI(Type A) to HDMI/VGA cable
HDMI(Full sized–Type A) to HDMI cable (for connecting to HD TVs or monitors with HDMI input).
Type A HDMI is 13.9 mm wide (search Wikipedia or Google for more info or look at the photos).

Keyboard and mouse(Optional)
Any standard USB keyboard and mouse should work. However, keyboards or mice that take a lot of power from the USB ports may need a powered USB hub. This may include some wireless devices.

DC Power supply
A good quality, 5.5*2.1mm DC power supply that can provide at least 2A at 12V is essential.

Linux PC
We suggest installing VMware Workstation in the Windows PC, and install Ubuntu or Fedora in the VMware Workstation.

MicroUSB cable
Be used for flashing OS for HiKey.

Jumper cap
Be used for flashing OS for HiKey

The photos of accessories are showed as below:
HiKey accessories.png

Prepare for installing OS

In order to enjoy our HiKey, we will need to install an Operating System (OS) onto the Micro SD card or the EMMC NAND Flash, we can install an Debian OS into the Micro SD card or the EMMC NAND Flash, but we only can install an Android OS onto the EMMC NAND Flash now. The instructions below will teach us how to flash an OS image to the Micro SD card or EMMC NAND Flash with the help of the Linux PC.

Download the OS image file

We can download the OS image files from LeMaker Hikey Resourse and download the flashing environment tool and bootloader from https://builds.96boards.org/releases/hikey/linaro/binaries/latest/.

Before we flash OS image, we should get the files below:

File types Debian for EMMC Debian for SD card Android
flashing environment hisi-idt.py
l-loader.bin
hisi-idt.py
l-loader.bin
hisi-idt.py
l-loader.bin
bootloader fip.bin
ptable-linux-8g.img
nvme.img
fip.bin
ptable-linux-8g.img
nvme.img
fip.bin
ptable-aosp-8g.img
nvme.img
kernel boot-fat.uefi.img hikey-jessie_alip_2015MMDD-nnn.img boot_fat.uefi.img
file system hikey-jessie_alip_2015MMDD-nnn-8g.emmc.img cache.img
system.img
userdata-8g.img

Note: Debian SD card image only one file(hikey-jessie_alip_2015MMDD-nnn.img) that including the kernel and file system, because if SD card boot, Debian OS will run bootloader from EMMC, load kernel from the first partion of MicroSD card and mount root file system from the second partion of MicroSD card.

Prepare the hardware and software

Step 1: Install Ubuntu (e.g. Ubuntu 14.04 LTS)or Fedora in Desktop PC.

Step 2: Install fastboot in the Linux PC.
I.Type the command below to install fastboot tool.

sudo apt-get update
sudo apt-get install android-tools-fastboot      // On Debian/Ubuntu

or

sudo yum update
sudo yum install android-tools                   // On Fedora

Note:if install failed, please add following deb source into /etc/apt/sources.list:

deb http://archive.ubuntu.com/ubuntu trusty universe restricted main multiverse

II. Create the file: /etc/udev/rules.d/51-android.rules. We need the superuser privileges, so we will use the command below to open the file.

$ sudo vim /etc/udev/rules.d/51-android.rules 
#or you can execute the below command to instead the above.
$ sudo gedit /etc/udev/rules.d/51-android.rules

Then add the following content to the file.

# fastboot protocol on HiKey
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d00d", MODE="0660", GROUP="dialout"
# adb protocol on HiKey
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", ATTR{idProduct}=="1057", MODE="0660", GROUP="dialout"
# rndis for HiKey
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", ATTR{idProduct}=="1050", MODE="0660", GROUP="dialout"

Step 3: We will also need a standard micro USB cable to connect HiKey's micro USB connector to the Linux PC; close Jumper1 and Jumper2, power up the HiKey board to prepare for flashing.

You can refer to Setting_Jumper to known how there works.

1-4-1.png
Step 4: Check the flashing environment:
I. After downloading the OS image file and extracting it, we need to use the following files and copy them to Linux PC:

hisi-idt.py
l-loader.bin

II. Check that the HiKey board has been recognized by your Linux PC.

ls /dev/ttyUSB*
/dev/ttyUSB0

III. Run the command and the script to initially prepare fastboot:

sudo apt-get install python2.7 python2.7-dev
alias python=python2.7
sudo python hisi-idt.py -d /dev/ttyUSB0 --img1=l-loader.bin

It will display the fllowing subtitle on your Ubuntu,if you execute the above command successfully.

+----------------------+
 Serial:  /dev/ttyUSB0
 Image1:  l-loader.bin
 Image2:  
+----------------------+
Sending l-loader.bin ...
Done

Install Debian OS

HiKey boot sequence and condition on Debian:
EMMC boot: if we don’t insert an SD card which already had the Debian OS, HiKey will boot from EMMC.
SD boot: if we insert an SD card which already had Debian OS, HiKey will boot from SD card.

The differences between flashing EMMC and SD card on Debian:

Flashing EMMC sudo fastboot flash system hikey-jessie_alip_2015MMDD-nnn-8g.emmc.img
Flashing SD card sudo dd if=hikey-jessie_alip_2015MMDD-nnn.img of=/dev/sdb bs=4M oflag=sync status=noxfer

Flashing EMMC

Step 1: Flashing bootloader.(In general case, bootloader have been installed into HiKey board, so we do not need to install)
I. After downloading the OS image file and extracting it, we need to use the following files and copy them to Linux PC:

fip.bin
ptable-linux-8g.img
nvme.img

II. Power on the HiKey board and verify communications from the Linux PC, run the command “sudo fastboot devices”. if show “0123456789abcdef fastboot”, it will be OK.

sudo fastboot devices
0123456789abcdef fastboot

III. The following fastboot commands then load the partition table, the bootloaders and other necessary files into the HiKey EMMC Flash memory.

sudo fastboot flash ptable ptable-linux-8g.img
sudo fastboot flash fastboot fip.bin
sudo fastboot flash nvme nvme.img

It will displays the fllowing caption on your Ubuntu, if you execute the above command successfully.

sudo fastboot flash ptable ptable-linux-8g.img
target reported max download size of 268435456 bytes
sending 'ptable' (17 KB)...
OKAY [  0.008s]
writing 'ptable'...
OKAY [  0.006s]
finished. total time: 0.014s
sudo fastboot flash fastboot fip.bin
target reported max download size of 268435456 bytes
sending 'fastboot' (1389 KB)...
OKAY [  0.172s]
writing 'fastboot'...
OKAY [  0.066s]
finished. total time: 0.239s
sudo fastboot flash nvme nvme.img
target reported max download size of 268435456 bytes
sending 'nvme' (128 KB)...
OKAY [  0.015s]
writing 'nvme'...
OKAY [  0.009s]
finished. total time: 0.024s

Step 2: Flashing kernel image.
I. After we downloading the OS image file and extracting it, we need to use the following files and copy them to Linux PC.

boot-fat.uefi.img

II. Power on the HiKey board and verify communications from the Linux PC, run the command “sudo fastboot devices”. if show “0123456789abcdef fastboot”, it will be OK.

sudo fastboot devices
0123456789abcdef fastboot

III. The following commands will flash the kernel images.

sudo fastboot flash boot boot-fat.uefi.img

It will display the fllowing subtitle on your Ubuntu, if you execute the above command successfully.

sudo fastboot flash boot boot-fat.uefi.img
target reported max download size of 268435456 bytes
sending 'boot' (65536 KB)...
OKAY [  8.560s]
writing 'boot'...
OKAY [  3.007s]
finished. total time: 11.577s

Step 3: Flashing file system into the EMMC.
I. After downloading the OS image file and extracting it, we need to use the following files and copy them to Linux PC:

hikey-jessie_alip_2015MMDD-nnn-8g.emmc.img (for 8G board)

II. Power on the HiKey board and verify communications from the Linux PC, run the command “sudo fastboot devices”. if show “0123456789abcdef fastboot”, it will be OK.

sudo fastboot devices
0123456789abcdef fastboot

III. The following commands will burn the file system images.

sudo fastboot flash system hikey-jessie_alip_2015MMDD-nnn-8g.emmc.img

It will display the fllowing subtitle on your Ubuntu, if you execute the above command successfully.

sudo fastboot flash system hikey-jessie_alip_2015MMDD-nnn-8g.emmc.img
target reported max download size of 268435456 bytes
sending sparse 'system' (260454 KB)...
OKAY [ 38.809s]
writing 'system'...
OKAY [ 15.000s]
sending sparse 'system' (260459 KB)...
OKAY [ 44.258s]
writing 'system'...
OKAY [ 17.645s]
sending sparse 'system' (260424 KB)...
OKAY [ 35.242s]
writing 'system'...
OKAY [ 13.537s]
sending sparse 'system' (260492 KB)...
OKAY [ 53.653s]
writing 'system'...
OKAY [ 21.689s]
sending sparse 'system' (258533 KB)...
OKAY [ 75.170s]
writing 'system'...
OKAY [ 29.901s]
sending sparse 'system' (262083 KB)...
OKAY [ 66.641s]
writing 'system'...
OKAY [ 26.263s]
sending sparse 'system' (200149 KB)...
OKAY [ 88.677s]
writing 'system'...
OKAY [ 33.593s]
finished. total time: 560.080s

Until now, we have updated the OS into EMMC. Open the Jumper2,connect HiKey to the display device by HDMI cable,power on, then it will boot the Debian OS from EMMC.

Flashing SD Card

We have two methods to flash SD Card.

Flashing SD Card on Ubuntu

The step 1 for flashing SD card are the same as flashing EMMC. Because we must install the bootloader into the EMMC, we just need to flash the kernel and file system into the SD card.

Step 1: Flashing bootloader as same as the EMMC flashing process. (In general case, bootloader have been installed into HiKey board, so we do not need to install)

Step 2: Flashing the kernel and file system into the SD Card:
I. Format the SD Card.
II. After downloading the OS image file and extracting it,we need to use the following files and copy them to Linux PC

hikey-jessie_alip_2015MMDD-nnn.img

III. Insert SD Card into Linux PC, use the command “sudo fdisk -l” to get SD card device node.

sudo fdisk -l
 
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00023435
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    39845887    19921920   83  Linux
/dev/sda2        39847934    41940991     1046529    5  Extended
/dev/sda5        39847936    41940991     1046528   82  Linux swap / Solaris
 
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
 
 
Disk /dev/sdb: 7948 MB, 7948206080 bytes
255 heads, 63 sectors/track, 966 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1     7167999     3583999+  ee  GPT

IV. The following command will flash the kernel and file system image. We maybe need to change the SD device node according to the actual device node number in following command .

sudo dd if= hikey-jessie_alip_2015MMDD-nnn.img of=/dev/sdb bs=4M oflag=sync status=noxfer

It will display the fllowing subtitle on your Ubuntu,if you execute the above command successfully.

sudo dd if= hikey-jessie_alip_2015MMDD-nnn.img of=/dev/sdb bs=4M oflag=sync status=noxfer
512+0 records in
512-0 records out

Until now, we have updated the OS into SD Card. Then we can pull out the SD Card from Linux PC. Open the Jumper2, insert the SD Card into the HiKey board,connect the HDMI display device, power on, then it will boot the Debian OS from SD Card.

Flashing SD Card on Windows

The step 1 for flashing SD card are the same as flashing EMMC . Because we must install the bootloader into the EMMC, we just need to flash the kernel and file system into the SD card.

Step 1: Flashing bootloader as same as the EMMC flashing process.(In general case, bootloader have been installed into HiKey board, so we do not need to install)

Step 2: Flashing the kernel and file system into the SD Card.
I. Format the SD Card.
Download and install a MicroSD card format tool such as SDFormatter from http://mirror.lemaker.org/SDFormatter_v4.zip. Start the tool as Administrator, In the "Options" menu, set "FORMAT TYPE" option to QUICK, "FORMAT SIZE ADJUSTMENT" option to "ON". And then click “OK” to finish options setting and click “Format” to format the MicroSD card.
SDFormatter.png

Formatter Setting.png
II. After downloading the OS image file and extracting it, we need to use the following file.

hikey-jessie_alip_2015MMDD-nnn.img

III. Copy hikey-jessie_alip_2015MMDD-nnn.img file to the Windows PC.
IV. Write OS image into the MicroSD card.
Download and install Win32DiskImage that can wirte OS images into an MicroSD card. Start the tool as Administrator. Open the unzipped image file, and then click the “write” button to write the OS image into the MicroSD card. Wait patiently to successfully complete the writing.
HiKey win32 disk imager.png
Until now, we have updated the OS into SD Card. Then we can pull out the SD Card from Linux PC. Open the Jumper2, insert therSD Card into the HiKey board, connect the HDMI display device, power on, then it will boot the Debian OS from SD Card.

Install Android OS

(We suggest to refer to https://source.android.com/source/devices.html to run Android on HiKey.)

Flashing EMMC

Step 1: Flashing bootloader.
I. After we downloading the OS image file and extracting it,we need to use the following files and copy them to Linux PC:

fip.bin
ptable-aosp-8g.img
nvme.img

II. Power on the HiKey board and verify communications from the Linux PC, run the command “sudo fastboot devices”. if show “0123456789abcdef fastboot”, it will be OK.

sudo fastboot devices
0123456789abcdef fastboot

III. The following fastboot commands then load the partition table, the bootloaders and other necessary files into the HiKey EMMC flash memory.

sudo fastboot flash ptable ptable-aosp-8g.img
sudo fastboot flash fastboot fip.bin
sudo fastboot flash nvme nvme.img

It will displays the fllowing caption on your Ubuntu,if you execute the above command successfully.

sudo fastboot flash ptable ptable-aosp-8g.img
target reported max download size of 268435456 bytes
sending 'ptable' (17 KB)...
OKAY [  0.009s]
writing 'ptable'...
OKAY [  0.007s]
finished. total time: 0.016s
sudo fastboot flash fastboot fip.bin
target reported max download size of 268435456 bytes
sending 'fastboot' (1389 KB)...
OKAY [  0.183s]
writing 'fastboot'...
OKAY [  0.065s]
finished. total time: 0.248s
sudo fastboot flash nvme nvme.img
target reported max download size of 268435456 bytes
sending 'nvme' (128 KB)...
OKAY [  0.023s]
writing 'nvme'...
OKAY [  0.010s]
finished. total time: 0.033s

Step 2: Flashing kernel image.
I. After we downloading the OS image file and extracting it,we need to use the following files and copy them to Linux PC:

boot-fat.uefi.img

II. Power on the HiKey board and verify communications from the Linux PC, run the command “sudo fastboot devices”. If show “0123456789abcdef fastboot”, it will be OK.

sudo fastboot devices
0123456789abcdef fastboot

III. The following commands will flash the kernel images.

sudo fastboot flash boot boot_fat.uefi.img 
target reported max download size of 268435456 bytes
sending 'boot' (49152 KB)...
OKAY [  6.308s]
writing 'boot'...
OKAY [  2.204s]
finished. total time: 8.512s

step 3: Flashing file system into the EMMC.
I. After we downloading the OS image file and extracting it,we need to use the following files and copy them to Linux PC:

cache.img
system.img
userdata-8g.img (for 8G board)

II. Power on the HiKey board and verify communications from the Linux PC, run the command “sudo fastboot devices”. If show “0123456789abcdef fastboot”, it will be OK.

sudo fastboot devices
0123456789abcdef fastboot

III. The following commands will burn the file system images.

sudo fastboot flash cache cache.img
target reported max download size of 268435456 bytes
sending 'cache' (6248 KB)...
OKAY [  0.795s]
writing 'cache'...
OKAY [  0.295s]
finished. total time: 1.090s
sudo fastboot flash system system.img
target reported max download size of 268435456 bytes
sending sparse 'system' (262132 KB)...
OKAY [ 36.623s]
writing 'system'...
OKAY [ 12.683s]
sending sparse 'system' (258624 KB)...
OKAY [ 34.501s]
writing 'system'...
OKAY [ 12.081s]
sending sparse 'system' (257367 KB)...
OKAY [ 34.143s]
writing 'system'...
OKAY [ 12.336s]
finished. total time: 142.366s
sudo fastboot flash userdata userdata-8g.img
target reported max download size of 268435456 bytes
sending 'userdata' (90185 KB)...
OKAY [ 11.334s]
writing 'userdata'...
OKAY [  4.100s]
finished. total time: 15.434s

Until now, we have updated the OS into EMMC. remove the jumper cap from Jumper2 and keep jumper cap on Jumper1, connect HiKey to display device by HDMI cable,power on, then it will boot the Android OS from EMMC.


Install Snappy Ubuntu Core

You can download the image files from http://www.lemaker.org/product-hikey-download-54.html

Flashing SD Card

Step 1: Flashing bootloader.(In general case, bootloader have been installed into HiKey board, so we do not need to install)
After downloading the OS image file and extracting it, we need to use the following files and copy them to Linux PC:

ptable-linux.img
fip.bin
nvme.img

And then use the following command to load the partition table, the bootloaders and other necessary files into the HiKey EMMC Flash memory.

sudo ./hisi-idt.py -d /dev/ttyUSB0 --img1=l-loader.bin
sudo fastboot flash ptable ptable-linux.img
sudo fastboot flash fastboot fip.bin
sudo fastboot flash nvme nvme.img

Step 2: Flashing writable.
Before we flash writabe, we should reset the HiKey.
And then execute the following command to flash writable.img.

sudo ./hisi-idt.py -d /dev/ttyUSB0 --img1=l-loader.bin
sudo fastboot flash writable writable.img

Step 3: Flash system image to SD card
Execute the following command to flash image to SD card:

sudo dd if=hikey-snappy.img of=/dev/sdc bs=32M
sync

At last, insert the Micro SD card into Micro SD card slot , and then start up HiKey.

Shut down HiKey

We can use the GUI to shut down the Hikey safely. Also we can run the command in the terminal to shut down the HIkey:

sudo halt

or execute the below command to instead the above command

sudo shutdown –h now.