How can I build "hikey_idt' binary for aarch64 machine?

success_story

#1

I do not have a x86 machine runing linux when I’m on a business trip,but I still want to try to install linux on my hikey960;

I carry some single-borad computer(aarch64) with me,those computer can not run hikey_idt so I can not install linux to hikey960,I can Install Android system to hikey960 using those computer.


#2

There is no source available for this tool so I’m afraid you cannot build it.

However, you might be able to run it using qemu user emulation. See https://wiki.debian.org/QemuUserEmulation for full details but the following should give you basic idea.

Be warned… I’ve checked this far enough to check that hikey-idt runs (i.e. I run it with arguments and I can see the program emit an appropriate error message), I have not checked that is actually works.

sudo apt install qemu binfmt-support qemu-user-static
sudo dpkg --add-architecture amd64
sudo apt-get update
sudo apt-get install libc6:amd64
wget http://http.us.debian.org/debian/pool/main/h/hello/hello_2.10-1%2bb1_amd64.deb
dpkg -x hello_2.10-1+b1_amd64.deb /tmp/hello_amd64
/tmp/hello_amd64/usr/bin/hello 
git clone https://github.com/96boards-hikey/tools-images-hikey960
cd tools-images-hikey960/
./hikey_idt

#3

I had to know if this trick really does work or not… and… success!

oak$ uname -a
Linux oak 4.14.0-rc5-arm64 #1 SMP Debian 4.14~rc5.linaro.239-1 (2017-10-20) aarch64 GNU/Linux
oak$ sudo ./hikey_idt -c config -p /dev/ttyUSB0
Config name: config
Port name: /dev/ttyUSB0
0: Image: ./sec_usb_xloader.img Downalod Address: 0x20000
1: Image: ./sec_uce_boot.img Downalod Address: 0x6a908000
2: Image: ./sec_fastboot.img Downalod Address: 0x1ac00000
Serial port open successfully!
Start downloading ./sec_usb_xloader.img@0x20000...
file total size 99584
downlaod address 0x20000
Finish downloading
Start downloading ./sec_uce_boot.img@0x6a908000...
file total size 23680
downlaod address 0x6a908000
Finish downloading
Start downloading ./sec_fastboot.img@0x1ac00000...
file total size 3430400
downlaod address 0x1ac00000
Finish downloading
oak$ sudo dmesg | tail
[54349.217307] usb 1-4: USB disconnect, device number 4
[54349.227583] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[54349.227636] option 1-4:1.0: device disconnected
[54350.307721] usb 1-4: new high-speed USB device number 5 using xhci_hcd
[54350.460060] usb 1-4: New USB device found, idVendor=18d1, idProduct=d00d
[54350.460068] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[54350.460073] usb 1-4: Product: HI3650
[54350.460077] usb 1-4: Manufacturer: Fastboot2.0
[54350.460082] usb 1-4: SerialNumber: 4878578870000000
[54399.048270] usb 1-4: USB disconnect, device number 5

#4

Thank you very much for your tutorial with concrete and coplete operation steps,I already successfully executed ‘hikey_idt’ program with qemu simulator and flahsed linux to hikey960;
HDMI,USB,network is all worked normally,the following is my host machine’s print message in terminal:

linaro@linaro-alip:~/qemu/tools-images-hikey960$ uname -a
Linux linaro-alip 3.10.52-linaro-bubblegum #22 SMP PREEMPT Fri Apr 15 11:21:43 CST 2016 aarch64 GNU/Linux
linaro@linaro-alip:~/qemu/tools-images-hikey960$
linaro@linaro-alip:~/qemu/tools-images-hikey960$ sudo ./hikey_idt -c config -p /dev/ttyUSB0
Config name: config
Port name: /dev/ttyUSB0
0: Image: ./sec_usb_xloader.img Downalod Address: 0x20000
1: Image: ./sec_uce_boot.img Downalod Address: 0x6a908000
2: Image: ./sec_fastboot.img Downalod Address: 0x1ac00000
Serial port open successfully!
Start downloading ./sec_usb_xloader.img@0x20000…
file total size 99584
downlaod address 0x20000
Finish downloading
Start downloading ./sec_uce_boot.img@0x6a908000…
file total size 23680
downlaod address 0x6a908000
Finish downloading
Start downloading ./sec_fastboot.img@0x1ac00000…
file total size 3430400
downlaod address 0x1ac00000
Finish downloading
linaro@linaro-alip:~/qemu/tools-images-hikey960$

After that,I following How can we deploy latest image with UEFI on hikey960? and ’tools-images-hikey960/install-prebuilt-uefi/hikey960-efi-prebuilt.sh‘ installed linux and it works normally. Via ssh connection,I can use my my hikey960:

login as: root
root@hikey960:~#
root@hikey960:~# ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:39:49:5F:F5
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth0 Link encap:Ethernet HWaddr 00:E0:4C:36:03:A8
inet addr:192.168.31.190 Bcast:192.168.31.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4cff:fe36:3a8%4817440/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:270 errors:0 dropped:0 overruns:0 frame:0
TX packets:170 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24142 (23.5 KiB) TX bytes:21203 (20.7 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1%4817440/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:672 (672.0 B) TX bytes:672 (672.0 B)
root@hikey960:~# lsusb
Bus 001 Device 005: ID 0bda:8152 Realtek Semiconductor Corp.
Bus 001 Device 003: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 002 Device 002: ID 0424:5734 Standard Microsystems Corp.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0424:2740 Standard Microsystems Corp.
Bus 001 Device 002: ID 0424:2734 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@hikey960:~# login as: root
Password:

With this success of qemu simulation,I can do more work wich need x86 machine before,the x86 computer used as server and production machine became optional and I can throw down it;