30
STRATIX10 SOC UEFI BOOTLOADER USER GUIDE Revision: A Revision Date: 21th March 2017

S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

STRATIX10 SOC UEFI BOOTLOADER USER GUIDE

Revision: A

Revision Date: 21th March 2017

Page 2: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 2 of 30

1 TABLE OF CONTENTS 2 REVISIONS HISTORY ................................................................................................................ 3

3 OVERVIEW OF THE BOOT FLOW .......................................................................................... 4

4 SYSTEM REQUIREMENTS ........................................................................................................ 4

5 GETTING A WORKING ENVIRONMENT .............................................................................. 4

5.1 Download Software Components ............................................................................................................... 4

5.2 Building UEFI .............................................................................................................................................. 4

5.2.1 Pre-requisites in Window Environment ..................................................................................................... 5

5.2.2 Pre-requisites in Linux Environment .......................................................................................................... 5

5.2.3 Compiler ToolChain ................................................................................................................................... 5

5.2.4 Getting the UEFI Source Code.................................................................................................................... 5

5.2.5 Compile the UEFI ....................................................................................................................................... 6

6 RUNNING SOC VIRTUAL PLATFORM (SOCVP) ............................................................... 10

6.1 Installing SOCVP ....................................................................................................................................... 10

6.2 Running SOCVP with Prebuilt Linux Kernel ............................................................................................... 11

6.3 Running SOCVP with UEFI bootloader images .......................................................................................... 14

6.4 Ping and DHCP Test .................................................................................................................................. 16

6.4.1 Ping Test .................................................................................................................................................. 16

6.4.2 DHCP Test ................................................................................................................................................ 17

6.5 TFTP ......................................................................................................................................................... 18

6.5.1 Setup the TFTP server at the host machine Centos ................................................................................. 18

6.5.2 Run TFTP at client side ............................................................................................................................. 20

6.6 Boot linux ................................................................................................................................................. 21

6.6.1 From PitStop console ............................................................................................................................... 21

6.7 Boot vxWorks ........................................................................................................................................... 22

6.7.1 From DXE Console .................................................................................................................................... 22

7 PXE ............................................................................................................................................... 23

7.1 PXE Server - Ubuntu Machine .................................................................................................................. 23

7.1.1 Network Setup ......................................................................................................................................... 23

7.1.2 Prepare Bootimage .................................................................................................................................. 26

7.1.3 TFTP server in Ubuntu ............................................................................................................................. 26

7.1.4 Xinetd ....................................................................................................................................................... 26

7.1.5 Disable firewall ........................................................................................................................................ 27

7.1.6 DHCP server ............................................................................................................................................. 28

7.2 PXE client- UEFI ........................................................................................................................................ 29

7.2.1 SOCVP setting .......................................................................................................................................... 29

7.2.2 Boot UEFI ................................................................................................................................................. 29

Page 3: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 3 of 30

2 REVISIONS HISTORY

Date Revision Modifications

21th March 2017 A Initial version.

Page 4: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 4 of 30

3 OVERVIEW OF THE BOOT FLOW The boot flow by stages of UEFI:

In Stratix 10, the UEFI Bootloader is loaded directly by SDM onto the HPS on-chip RAM upon board power-on. The

binary image of the UEFI Bootloader is stored on QSPI flash device, NAND flash device or SD/MMC card.

The Bootloader’s main tasks is to bring up the DDR SDRAM memory and configure most of low level hardware such

as PLL, IOs, pin muxing and others. Bootloader will also support basic hardware diagnostic features under

engineering mode.

Besides that, bootloader tasks include fetching subsequent boot software such as operating system package or

secure kernel. For non secure boot, the operating system package might include a kernel image, device tree blob

and filesystem. For secure boot, it might be a secure kernel.

4 SYSTEM REQUIREMENTS The following items will be required to be able to complete the task in this user guide successfully:

Host Linux or Windows PC

o Serial terminal (for example minicom on Linux and Tera Term on Windows)

o Micro SD card slot or Micro SD card writer (or SD-capable writer + SD to micro SD converter)

Altera SoC EDS 17.0 and Quartus II version 17.0

Stratix 10 SOC Virtual Platform v1.3

5 GETTING A WORKING ENVIRONMENT

5.1 DOWNLOAD SOFTWARE COMPONENTS

To build UEFI, make sure you have the SoC Embedded Design Suite (SoCEDS) version 17.0 installed on your machine.

Download the SoCEDS: http://dl.altera.com/soceds/

5.2 BUILDING UEFI

Page 5: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 5 of 30

In this section, you will learn where to get the UEFI source code and how to compile the UEFI source with the

supported toolchain. You can choose to either compile the UEFI source code in a Windows or Linux environment

5.2.1 PRE-REQUISITES IN WINDOW ENVIRONMENT

If you are running on a Window environment, make sure you have the following components installed:

Install Git for Windows (https://www.git-scm.com/download/win)

Install SoC Embedded Design Suite (EDS) 17.0 for windows (http://dl.altera.com/soceds/). Python tool

will be available when SOCEDS is installed in your machine

5.2.2 PRE-REQUISITES IN LINUX ENVIRONMENT

First, you will need to install some packages. The command line to install them depends on your Linux distribution:

On Ubuntu:

$ sudo apt-get install uuid-dev build-essential

On Fedora:

$ sudo yum install uuid-devel libuuid-devel

5.2.2.1 PYTHON TOOL

For building UEFI, python tool is required.

1. If your machine doesn’t have python, you can grab it from SOCEDS installation path. Run the following

commands:

$ export PATH=$SOCEDS_DEST_ROOT/host_tools/python/bin/:$PATH

5.2.3 COMPILER TOOLCHAIN

Here is the supported toolchain can be used to build the UEFI:

1. Linaro Toolchain

aarch64-linux-gnu-gcc (crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04) 4.8.3

20140401 (prerelease)

You can download the toolchain from the link shown below

https://releases.linaro.org/archive/14.04/components/toolchain/binaries/

For Linux environment, download the “gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux.tar”

For Window environment, download the “gcc-linaro-aarch64-linux-gnu-4.8-2014.04_win32.zip”

5.2.4 GETTING THE UEFI SOURCE CODE The UEFI source code is located in https://github.com/altera-opensource/uefi-socfpga. To get the UEFI source code,

simply run the following steps:

1. Open a Terminal

2. Create a new directory to check out the UEFI source code from the github. For example, the UEFI directory here

is :/data/twooi/pggit_1028

Page 6: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 6 of 30

$ mkdir /data/twooi/pggit_1028

3. Change to this UEFI working directory and clone the UEFI source from the git trees

$ git clone https://github.com/altera-opensource/uefi-socfpga

4. When completed, change to the uefi-socfpga folder and perform a git check out

$ cd uefi-socfpga

$ git checkout -b socvp_socfpga_udk2015 – track origin/socvp_socfpga_udk2015

5.2.5 COMPILE THE UEFI In this section, you will learn how to compile the UEFI source code with the Linaro toolchain in both Windows and

Linux environments

To start compiling the UEFI source code with the Linaro toolchain, simply run the following steps:

5.2.5.1 IN WINDOWS ENVIRONMENT

1. Open the command prompt

2. Change your directory to your working directory and set the SOCEDS_DEST_ROOT to the location of your

SOCEDS

$ cd <your_working_directory>/uefi-socfpga

$ set SOCEDS_DEST_ROOT=<your_SOCEDS_location>

3. Set the GCC path to the location of the compiler toolchain

$ set PATH = <your_Linaro GCC Toolchain_location>;%PATH%

Page 7: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 7 of 30

If you encountered GCC error when compile the UEFI source code after setting the PATH. You can edit the setup.bat file manually to use the full compiler path required for step 4.

4. Run the setup command

$ setup.bat

5. Build the UEFI

$ make device=s10

Page 8: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 8 of 30

6. You will see the following messages once UEFI is successfully compiled

5.2.5.2 IN LINUX ENVIRONMENT

1. Open a Terminal window and enter the following command:

$ cd <your_uefi_directory>/uefi-socfpga

$ export PATH=<your gcc directory>/gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux/bin:$PATH

2. Clean the entire <your_uefi_directory>/uefi-socfpga/Build/ folder and also clean the BaseTools.

$ make clean

Page 9: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 9 of 30

3. Compile the UEFI Bootloader for Stratix 10 device using the following command

$ make DEVICE=s10

4. When the build is successfully, you will see the build done message once the compilation is completed

This will create the following four important files in the <your_uefi_directory>/uefi-

socfpga/Build/Stratix10SoCPkg/RELEASE_GCC48 folder:

File Description

~/uefi-socfpga/Build/ Stratix10SoCPkg/RELEASE_GCC48/ PEI.256 (256KB)

This is the main UEFI boot loader. It contains the device tree for the HPS and

the code does the initialization of the HPS. After initialization, it can boot

directly to baremetal application, RTOS or Linux. You can also extend the

UEFI boot phase to boot to the DXE.ROM to set UEFI network support and

UEFI Shell support.

.256 means the OCRAM size is 256KB.

Page 10: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 10 of 30

This file is generated from the mkpimage tool by adding a header to the

original file located at uefi-

socfpga/Build/Stratix10SoCPkg/RELEASE_GCC48/FV/ALTERA_HPS_OCRAM

_EFI_PART1.fd

PEI.ROM is actually PEI.256 file concatenated 4 times together. BootROM

support 4 fall back image. In the event of first image has a checksum error, it

will try the second image.

PEI.256 match the size of OCRAM with is also 256KB, so it can be loaded

directly onto the OCRAM using the DS-5, PEI.ROM cannot be use for this

purpose because it is 1MB (4 X 256KB).

~/uefi-socfpga/Build/ Stratix10SoCPkg/RELEASE_GCC48/PEI.ROM (1MB = 256KB X 4)

This file will be used to program into the Flash daughter card. The size of this file is four times bigger because the BootROM can support up to 4 backup images. For example, if the first image (256KB) is corrupted, the BootROM will load the second image and so on.

~/uefi-socfpga/Build/ Stratix10SoCPkg/RELEASE_GCC48/load_uefi_fw.ds

This is the DS-5 script template to be imported to DS-5 tool to load the UEFI firmware for debug and development purposes. This script will load the debug symbols for the user. Currently it only support for GCC compiler only. ARMCC is not supported.

~/uefi-socfpga/Build/ Stratix10SoCPkg/RELEASE_GCC48/DXE.ROM

This file load the optional 2nd phase of UEFI Bootloader when you want to boot to UEFI Shell and utilize the TFTP feature or run a UEFI application. The different between PEI.ROM and DXE.ROM is PEI.ROM load and run entirely in On-Chip RAM of the HPS while DXE.ROM required running on DDR SDRAM, also PEI.ROM does all the initialization for the HPS and DXE.ROM mainly initialize the Ethernet MAC and PHY with full network stack support.

6 RUNNING SOC VIRTUAL PLATFORM (SOCVP)

6.1 INSTALLING SOCVP

1. Download the Stratix 10 SoC Virtual Platform tar file (Stratix10_vp.tgz) from the link below. Note that you

must have an account to gain the access to Download Center

https://software.altera.com/accounts/login/?next=/s10socvp/

2. Uncompressed the file downloaded

$ tar zxvf Stratix10_vp.tgz

Page 11: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 11 of 30

3. Install the SOCVP

$ cd Stratix10_vp

$ ./install_s10socvp.exe -install <installation directory>

The installation directory should not exist before running the install command. Error might encounter if you specify a directory that is existed.

6.2 RUNNING SOCVP WITH PREBUILT LINUX KERNEL

Running SOCVP with prebuilt Linux Kernel can help to test up your SOCVP after installation

1. Go to the directory where the SOCVP is installed

$ cd <Path to SOCVP directory>

2. Download the prebuilt Linux kernel

Page 12: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 12 of 30

$ wget --no-cache http://rocketboards.org/foswiki/pub/Documentation/Stratix10SoCVPLinux/linux-

stratix10swvp-socfpga-4.5-angstrom-v2014.12-swvp-1.2.tgz --no-check-certificate

3. Uncompressed the file

$ tar xvzf linux-stratix10swvp-socfpga-4.5-angstrom-v2014.12-swvp-1.2.tgz

4. Run the SOCVP with prebuilt Linux kernel

$ ./run.exe

Page 13: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 13 of 30

5. Two console will be appeared when successfully boot into Linux

Page 14: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 14 of 30

6.3 RUNNING SOCVP WITH UEFI BOOTLOADER IMAGES

1. At SOCVP installation directory, edit parameters.txt to enable GDB session

# ----------------------------------

# Enable GDB session

# ----------------------------------

gdbstub_port=1234

2. Change to the directory where the SoCVP is installed and launch the run.exe

$ cd <your SoCVP directory>

$ ./run.exe

Page 15: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 15 of 30

3. Open a new terminal and launch debugger

$ cd <Path to linaro toolchain>/ gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux/bin

$ ./aarch64-linux-gnu-gdb

Page 16: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 16 of 30

4. At the GDB debugger, enter the following sequences:

$ target remote:1234

$ restore <Path to UEFI source code>/Build/Stratix10SoCPkg/RELEASE_GCC48/PEI.256 binary

0xffe00000

$ set var $pc=0xffe00000

5. Run the SOCVP

$ continue

6.4 PING AND DHCP TEST

6.4.1 PING TEST 1. Complete the steps in section 6.1 if you did not install the SoCVP

2. Complete the steps 1-3 in section 6.3 to start SOCVP and debugger

3. At the debugger, enter the following commands:

$ target remote:1234

$ restore <Path to UEFI source code>/Build/ Stratix10SoCPkg/RELEASE_GCC48/PEI.256 binary

0xffe00000

$ restore <Path to UEFI source code>/Build/ Stratix10SoCPkg/RELEASE_GCC48/DXE.ROM binary

0x02000000

$ set var $pc=0xffe00000

Page 17: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 17 of 30

4. Run the SoCVP

$ continue

5. At the DXE console, type the following commands:

$ ifconfig -s eth0 static 192.168.0.9 255.255.255.0 192.168.0.1

$ ifconfig -l eth0

$ ping -n 2 192.169.0.1

6.4.2 DHCP TEST 1. Complete the step 1-4 in section 6.4.1

Page 18: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 18 of 30

2. At the DXE console, type the following commands:

$ ifconfig -s eth0 dhcp

$ ifconfig -l eth0

3. You will see the following expected output:

A startup.nsh script has been compiled when you build the bootloader. This scripts will execute the commands automatically when DXE phase is loaded

6.5 TFTP

6.5.1 SETUP THE TFTP SERVER AT THE HOST MACHINE CENTOS

1. Install the necessary packages

$ sudo yum install httpd xinetd syslinux tftp-server

Page 19: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 19 of 30

2. Edit the file located in /etc/xinetd.d/tftp

$ vi /etc/xinetd.d/tftp

3. Enable the TFTP server by changing the “disable=yes” to “no”. You may change the server path to your

desired location

4. Edit the TFTP port from 69 to 70

$ sudo vi /etc/services

5. Start the TFTP server

$ sudo service xinetd stop

Page 20: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 20 of 30

$ sudo service xinetd start

6.5.2 RUN TFTP AT CLIENT SIDE 1. Completed the steps 1-4 in section 6.4.1 to boot into DXE phase

2. At the DXE console, execute the following command to use the static IPv4 address configuration for

Ethernet interface

$ ifconfig -s eth0 static 192.168.0.9 255.255.255.0 192.168.0.1

$ ifconfig -l eth0

3. Run the following command to perform TFTP test

$ fs 1:

$ tftp -r 70 192.168.0.1 <file located in the based directory of TFTP server>

4. Once tftp is completed, list the directory to confirm that the file is successfully transferred

$ ls

Page 21: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 21 of 30

6.6 BOOT LINUX

6.6.1 FROM PITSTOP CONSOLE

6.6.1.1 FROM RAM

1. Enable Pitstop utility before compile the UEFI source code

2. Completed all the steps in section 6.1 if you did not install the SOCVP

3. Completed all the steps in section 6.3 to start SOCVP and debugger

4. Press any key in Console 0 whenever UEFI bootloader is loaded to enter PitStop utility

5. Type command “bootr” to boot Linux from RAM

$ bootr

Page 22: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 22 of 30

6.7 BOOT VXWORKS

6.7.1 FROM DXE CONSOLE 1. Completed the steps 1-4 in section 6.4.1

2. At the DXE console, you would need to have vXworks image in your FAT partition. You can either transfer

the vXworks image using TFTP or include the vXworks image when creating a SD image. Here, the first

method is used. Completed the steps in section 6.5 to set up TFTP server and run the TFTP in client side to

transfer the file

3. After the file transferred is done, run the following command in DXE console to boot VxWorks

$ runaxf vxWorks

4. You will see the VxWorks is booted up in console 1

Page 23: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 23 of 30

7 PXE In this section, you will learn how to setup PXE boot for SOCVP in a dedicated Ubuntu machine.

7.1 PXE SERVER - UBUNTU MACHINE

7.1.1 NETWORK SETUP

7.1.1.1 DEPENDENCIES

1. You need to install the dependencies:

$ sudo aptitude install bridge-utils iproute2

2. Make sure that “tun” kernel module is in place

$ sudo modprobe tun

7.1.1.2 SETUP INTERNET VIA ETH0 AND BRIDGE VIA DHCP

Page 24: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 24 of 30

In this case, we have internet connection via WiFi (wlan0 interface), which is in external network (IP address obtained from external DHCP server). It shown on image below as separate subnetwork.

We also have local sub-network with local DHCP network. Local DHCP offers IP addresses to bridge interface "br0". PXE server (next-server) is bridge itself. UEFI talks to PXE server vi TAP interface "tap0". UEFI S10 obtains IP address for it's "eth0" interface (should've not be confused with laptop's "eth0" interface) from DHCP server on "br0" via "tap0".

All the stuff shown on the image above is on the same single laptop

7.1.1.3 CONFIGURATION

1. To configure the network, you can create a script with the following content. You need to make sure edit "user" variable appropriately:

user=your-user-name

tap=tap0

bridge=br0

nic=eth0

echo "---> Creating taps..."

ip tuntap add dev $tap mode tap user $user

ip link set dev $tap up

echo "---> Creating bridge..."

brctl addbr $bridge

brctl setfd $bridge 0

Page 25: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 25 of 30

brctl addif $bridge $nic

brctl addif $bridge $tap

echo "---> Bringing interfaces and bridge up..."

ifconfig $tap 192.168.0.4 promisc up

ifconfig $nic 192.168.0.9 promisc up

ifconfig $bridge 192.168.0.1 netmask 255.255.255.0 up

echo "---> Restart DHCP server"

service isc-dhcp-server restart

2. Run the next script (from root). Pay attention that we are using “192.168.0.1” as PXE Server IP address

If your "isc-dhcp-server" package wasn't installed correct (with error message "[FAIL] Starting ISC DHCP server: dhcpd[....] check syslog for diagnostics"), be sure to run next command after executing script above: $ sudo dpkg –configure isc-dhcp-server

7.1.1.4 REMOVING CONFIGURATION

1. You can create script with the following content to remove all the setup that was done in previous step

(this script requires some modifications though):

if ! brctl show | grep $bridge >/dev/null; then

echo -n "TAP Bridge $bridge does not exist "

echo "and no FMNetwork to stop."

exit 1

fi

# take down the bridge

ifdown $bridge

# remove the interfaces from the bridge

for tap in $taps; do

brctl delif $bridge $tap

ifconfig $tap down

# tapctrl -n $tap -a delete -t tap

Page 26: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 26 of 30

ip link set dev $tap down

ip tuntap del dev $tap mode tap

done

brctl delif $bridge $nic

# delete the bridge

ifconfig $bridge down

brctl delbr $bridge

# unset promiscuous mode

ifconfig $nic -promisc

ifup $nic

7.1.2 PREPARE BOOTIMAGE For PXE test, a standard EFI application is required for bootimage. In our test, HelloWorld.efi is used. It is located at

Build\Stratix10SoCPkg\RELEASE_GCC48\AARCH64\HelloWorld.efi

1. Copy HelloWorld.efi to the TFTP boot file path which is /var/lib/tftpboot

$ cp HelloWorld.efi /var/lib/tftpboot

7.1.3 TFTP SERVER IN UBUNTU

TFTP server provide files transfer over network

1. Install the TFTP server

$ sudo apt-get install tftpd-hpa tftp

2. Edit the file in /etc/default/tftpd-hpa as follows

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/var/lib/tftpboot"

TFTP_ADDRESS="0.0.0.0:70"

TFTP_OPTIONS="--secure"

7.1.4 XINETD There are 2 approaches on how to run tftpd daemon:

Page 27: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 27 of 30

1. Let tftpd to be always running (via specifying RUN_DAEMON="yes" in tftpd-hpa config file)

2. Let super-server handle tftpd starting

"xinetd" is super-server daemon. It listens for incoming requests over a network and launches the appropriate

service for that request. In our case, it will start tftpd service when it catches TFTP request over the network.

1. Install xinetd

$ sudo apt-get install xinetd

2. Create “/etc/xinetd.d/tftp” file with the following contents

service tftp

{

protocol = udp

port = 70

socket_type = dgram

wait = yes

user = root

server = /usr/sbin/in.tftpd

server_args = --secure /var/lib/tftpboot

disable = no

}

Argument Description

Disable=no Enable spawning TFTPD process

Server_args=/var/lib/tftpboot Path to the TFTP files

Server_args= --secure Use relative (rather than absolute) patches.

You may see the “man tftpd” for more details

3. Once the config is modified, restart the xinetd

$ sudo service xinetd restart

7.1.5 DISABLE FIREWALL

Page 28: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 28 of 30

1. Check that your firewall is not blocking DHCP/TFTP traffic (UDP) or alternatively, just turn off the firewall

together

$ iptables -F

$ iptables -X

$ iptables -P INPUT ACCEPT

$ iptables -P FORWARD ACCEPT

$ iptables -P OUTPUT ACCEPT

$ iptables -t mangle -F

$ iptables -t mangle -X

$ iptables -t nat -F

$ iptables -t nat -X

2. Check the iptables. If you turned it off, there should be no rules and the policy should be ACCEPT

$ iptables-save

7.1.6 DHCP SERVER DHCP server offers IP addresses to clients

1. Install the server

$ sudo apt-get install isc-dhcp-server

If installation wasn't completed due to error. This can be fixed later (after bringing network bridge up). DHCP server can be started after network bridge is up and we can finish "isc-dhcp-server" package installation using "sudo dpkg --configure" command.

2. Edit the “etc/default/isc-dhcp-server” file to contain the line below because DHCP server will be offering

addresses to the network i.e. UEFI S10 model

INTERFACES=”br0”

3. Added these lines to the “/etc/dhcp/dhcpd.conf” file

allow booting;

allow bootp;

subnet 192.168.0.0 netmask 255.255.255.0 {

Page 29: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 29 of 30

range 192.168.0.100 192.168.0.253;

}

next-server 192.168.01;

filename “HelloWorld.efi”;

Field Description

next-server IP address of PXE server (this PC)

filename Bootloader file to be offer via TFTP

7.2 PXE CLIENT- UEFI

7.2.1 SOCVP SETTING 1. Add the following setting into the parameter.txt for SOCVP

vlan:type = tap

#vlan:ifname = tap0 #This is default value

eth_mac = D0:67:E5:48:F4:49

multicast_passthrough = 1 #enable multicast messaging

eth_mac is the MAC address of bridge br0

7.2.2 BOOT UEFI 1. Once booted into the DXE phase, press any key to choose the boot selection

2. In the DXE console, type the following command to boot from PXE

a. Press “3” to choose the “Boot Manager”

b. Press “1” to choose the “Add Boot Device Entry”

c. Press “3” to choose the boot device which is “PXE on MAC Address: 02:11:22:33:44:55”

d. Press “y” when you are being asked where is it an EFI application

e. Enter “pxe” as the description for the new entry

f. Press “7” to return to the main menu

g. Now you will see PXE appear in the boot selection menu. Select the option “pxe” in order to boot

from PXE

3. You will see “Hello World” when the board is successfully booted up from PXE

Page 30: S 10 S C UEFI B U G - Intel...Stratix10 SoC UEFI Bootloader User Guide Rev A Page 8 of 30 6. You will see the following messages once UEFI is successfully compiled 5.2.5.2 IN LINUX

Stratix10 SoC UEFI Bootloader User Guide Rev A

Page 30 of 30