Installing bootloader on Hikey 960

I’m trying to follow these steps to build UEFI on the Hikey960 board.

I do not understand this step
Prepare AARCH64 toolchain from Linaro. – Does this mean I download the tar.xz file in the link.

Also

Build it as debug mode. Create script file for build.
BUILD_OPTION=DEBUG

export AARCH64_TOOLCHAIN=GCC5

export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools

export EDK2_DIR=${BUILD_PATH}/edk2

EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}

Building a script file, does it mean I create a new file lets say bootloader.sh and then use the sh bang as the first line and copy these lines given by changing the BUILD_PATH with the path I have.?

#!/bin/bash
BUILD_OPTION=DEBUG
export AARCH64_TOOLCHAIN=GCC5
export UEFI_TOOLS_DIR=${/home/susmitha/bootloader}/uefi-tools
export EDK2_DIR=${/home/susmitha/bootloader}/edk2
EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}

Something like this ?

I’m new to the board an also linux, could someone please explain these steps clearly .

First of all, note that uefi bootloader/firmware is available as binary, so I assume you want to build it yourself for any reason.

Yes you need to download and decompress the toolchain, then add it to your PATH environment variable.
(e.g. export PATH=~/Workspace/Toolchains/gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu/bin:$PATH)

Kind of, but keep the script as is an only set the BUILD_PATH variable. (e.g. export BUILD_PATH=/home/myhome/builatf), Below is the script I used last time:

#!/bin/bash

export CFLAGS=-fno-stack-protector 

export BUILD_PATH=`pwd`
export BUILD_OPTION=DEBUG

cd ${BUILD_PATH}/edk2

ln -sf ../OpenPlatformPkg

export AARCH64_TOOLCHAIN=GCC5

export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools

export EDK2_DIR=${BUILD_PATH}/edk2

EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}

cd ${EDK2_DIR}

# Build UEFI & ARM Trust Firmware

${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware hikey960

# Generate l-loader
cd ${BUILD_PATH}/l-loader

ln -sf ${EDK2_OUTPUT_DIR}/FV/bl1.bin

ln -sf ${EDK2_OUTPUT_DIR}/FV/fip.bin

ln -sf ${EDK2_OUTPUT_DIR}/FV/BL33_AP_UEFI.fd

make hikey960

I’m trying to follow these steps to build UEFI on the Hikey960 board.

https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md

I do not understand this step
Prepare AARCH64 toolchain from Linaro. – Does this mean I download the tar.xz file in the link.

Yes.

This one I would have thought:
http://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/aarch64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz

Also

Build it as debug mode. Create script file for build.
BUILD_OPTION=DEBUG

export AARCH64_TOOLCHAIN=GCC5

export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools

export EDK2_DIR=${BUILD_PATH}/edk2

EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}

Building a script file, does it mean I create a new file lets say bootloader.sh and then use the sh bang as the first line and copy these lines given by changing the BUILD_PATH with the path I have.?

#!/bin/bash
BUILD_OPTION=DEBUG
export AARCH64_TOOLCHAIN=GCC5
export UEFI_TOOLS_DIR=${/home/susmitha/bootloader}/uefi-tools
export EDK2_DIR=${/home/susmitha/bootloader}/edk2
EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}

Something like this ?

Almost…

There’s no need for the #!/bin/bash . The #! line tells the kernel how
to run the script… and you don’t want to run this script, you want to
source it.

The difference comes from how GNU/Linux handles environment variables, a
new bash is created when you run a script… and when the script ends
the changes to the environment go away with it. By sourcing
bootloader.sh the changes to the environment will be applied to the
shell you actually type commands into.

I prefer to start scripts like this with #!/do/not/execute/directly
(as a reminder) and they can be sourced by the current shell by issuing
source bootloader.sh.

So does this mean I just have to create a file lets say build.sh and copy this code ini that file?

yes, that’s correct.