Cannot build Hikey Fw from source

Hi @vchong,

I have cloned the repos as follows:

  1. ARM Trusted Firmware:
    $ git clone https://github.com/ARM-software/arm-trusted-firmware.git
  2. edk2:
    $ git clone https://github.com/96boards-hikey/edk2.git
  3. OpenPlatformPkg?:
    $ git clone https://github.com/96boards-hikey/OpenPlatformPkg.git
  4. l-loader:
    $ git clone https://github.com/96boards-hikey/l-loader.git
  5. uefi-tools: (master branch)
    $ git clone uefi-tools.git - [no description]
  6. atf-fastboot: (only for HiKey)
    $ git clone https://github.com/96boards-hikey/atf-fastboot.git

Following instructions to compile and install the uefi bootloader from here:
https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md

Yea wrong branches.

  1. ARM Trusted Firmware:
    $ git clone https://github.com/ARM-software/arm-trusted-firmware.git
  2. edk2:
    $ git clone https://github.com/96boards-hikey/edk2.git -b testing/hikey960_v2.5
  3. OpenPlatformPkg?:
    $ git clone https://github.com/96boards-hikey/OpenPlatformPkg.git -b testing/hikey960_v1.3.4
  4. l-loader:
    $ git clone https://github.com/96boards-hikey/l-loader.git -b testing/hikey960_v1.2
  5. uefi-tools: (master branch)
    $ git clone uefi-tools.git - [no description]
  6. atf-fastboot: (only for HiKey)
    $ git clone https://github.com/96boards-hikey/atf-fastboot.git

Thanks @vchong, i was indeed on the wrong branches.
While trying to build, I faced another error, something like this:

{{{
//snip
plat/hisilicon/hikey960/platform.mk:13: warning: ignoring old recipe for target ‘check_SCP_BL2’
Building hikey960
CC tbbr_config.c
CC fiptool.c
CC bl1/tbbr/tbbr_img_desc.c
CC drivers/io/io_block.c
fiptool.c:21:25: fatal error: openssl/sha.h: No such file or directory
compilation terminated.
Makefile:50: recipe for target ‘fiptool.o’ failed
make[1]: *** [fiptool.o] Error 1
make[1]: *** Waiting for unfinished jobs…
CC drivers/io/io_storage.c
CC drivers/synopsys/ufs/dw_ufs.c
CC drivers/io/io_fip.c
Makefile:663: recipe for target ‘tools/fiptool/fiptool’ failed
make: *** [tools/fiptool/fiptool] Error 2
make: *** Waiting for unfinished jobs…

                                     Hikey960 DEBUG	fail

pass 0
fail 1
±----------------------------------------------------------+
Input Images:
bl1: bl1.bin
ns_bl1u: BL33_AP_UEFI.fd
Ouput Image: l-loader.bin
±----------------------------------------------------------+

Traceback (most recent call last):
File “gen_loader_hikey960.py”, line 129, in
main(sys.argv[1:])
File “gen_loader_hikey960.py”, line 124, in main
loader.create(img_bl1, img_ns_bl1u, output_img)
File “gen_loader_hikey960.py”, line 92, in create
self.add(0, img_bl1)
File “gen_loader_hikey960.py”, line 32, in add
fsize = os.path.getsize(fname)
File “/usr/lib/python2.7/genericpath.py”, line 57, in getsize
return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: ‘bl1.bin’
}}}

I was able to solve this by doing:

$ sudo apt-get install libssl-dev

Anyway,

I was ale to complete step 2 in https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md

But I am having trouble setting up telnet for console.

- Install ser2net. Use telnet as the console since UEFI will output window that fails to display in minicom.
$sudo apt-get install ser2net

- Configure ser2net.
$sudo vi /etc/ser2net.conf

Append one line for serial-over-USB in below.

#ser2net.conf

2004:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner

Open the console.
$telnet localhost 2004

rakshith@patkar007:~/Projects/UEFI-source/l-loader$ telnet localhost 2004
Trying 127.0.0.1…
telnet: Unable to connect to remote host: Connection refused

My question is: @vchong @ric96

To do telnet isn’t it necessary that ethernet is active?
And why are we using telnet?
Could you please explain step 4 in a little detail? Or point me to a source of such information?
Thanks in advance.

You’re telnet-ing to localhost, i.e. your own computer, so it’s not necessary to have an outside connection. In reality, it’s just telnet-ing to the port where the serial port/connection is so you can see the console output. Restart ser2net to ‘activate’ the new line and telnet should be ok.

$ sudo killall ser2net
$ sudo ser2net -u
$ telnet localhost 2004

@vchong, Thanks.

For doing step4, could you tell me the set up of dip switches and USB cable?

Refer to https://github.com/96boards-hikey/tools-images-hikey960/blob/master/README.md#step-1-materials-and-preperations.

To boot into recovery mode set switch 1 & 2 to ON state and switch 3 to OFF state
Connect USB type C cable from board to PC
Connect serial uart console cable/adapter from board to PC if available