Documente Academic
Documente Profesional
Documente Cultură
In this chapter we will see how to build the different software components that have been programmed in previous chapter. It
is important to mention that all this chapter concerns is applicable only on Linux.
As the Alaric devkit is based on the Arria 10 SoC also used on the Altera Arria 10 SoC Board, we use Altera tools customized
for our own needs to build these elements. All the Altera documentation regarding their SoC boards (based on Cyclone V,
Arria V and Arria 10) can be found on the rocketboards website at the following address:
http://rocketboards.org/foswiki/view/Documentation/WebHome.
What we can point out here among other things about this build system is:
- It uses Quartus output files as input files: handoff folder, SOF file and sopcinfo file.
- It uses several tools provide by SoC EDS: the bootloader generator (named bsp-editor), the Linux device tree
generator, the Linux device tree compiler (dtc).
We use this mechanism that we have customized regarding the source of the U-Boot source code. Indeed, the U-Boot Makefile
generated by the Bootloader Generator uses as U-Boot source code the archive provided by the SoC EDS installation and
located in <SoC_EDS_Root_Path>/altera/15.0/embedded/host_tools/altera/bootloaders/u-boot/uboot-socfpga.tar.gz. The
makefile extract the archive then compile the source code. This cannot be used in our case because it prevent any modification
of the source code to handle our Alaric devkit hardware. Consequently we change the source of the U-Boot source code to use
a git repository provided by Altera as it is for the Linux Kernel source. This way we can modify U-Boot source code to match
our hardware and compile it using a custom Makefile.
The U-Boot build input is the handoff folder of the picture located on the USB key in <USB_Key>/HPS/U-
Boot/src/hps_isw_handoff. It contains the emif.xml file providing RAM timing to set in U-BOOT DDR configuration and
hps.xml that result of the HPS instanciation in QSYS. This later provides the I/O pin muxing and indicates especially which
I/O are shared between the FPGA and which I/O are dedicated to FPGA and HPS. There are 17 pins dedicated to HPS and
concerned only some specific devices. 48 pins are shared with FPGA and organized in 4 blocks of 12 pins. Each block can be
assigned to FPGA or HPS. The following figure describes this I/O configuration:
- arch/arm/cpu/armv7/socfpga_arria10/sdram.c: contains modification for malloc size and start address depending on
the RXC_CONFIG choosen in the configuration file socfpga_arria10.h. And modification to bypass code getting RBF
file from QSPI because we do not configure the FPGA from HPS boot and as shown in QSPI mapping, we do not
store RBF file in QSPI NOR flash.
- include/configs/socfpga_arria10.h : U-Boot configuration file for Alaric devkit. The main modifications are:
1.6.2.5. Bsp-editor
Bsp-editor is the name of the bootloader generator. From the handoff folder files it generates all files needed to build U-Boot
binary and its device tree: device tree source file, configuration file, Makefile and a useful initialization boot script for ARM
DS-5.
Now that we have introduced all the build components, here is the procedure to build our U-Boot image:
1) Download U-Boot source files from git repository executing the following commands in a terminal:
2) Open your profile file ~/.profile file and append the following variable definition:
export UBOOT_SRC_DIR="$HOME/uboot-src" where you need to replace $HOME/uboot-src by the real path of the
folder uboot-src.
4) Execute the command bsp-editor to launch the bootloader generator. In the tools windows, do the following actions:
Click on File | New HPS BSP . A new window named New BSP is displayed.
In New BSP window, in the hardware section, click on the button on the right to select the handoff folder.
Then in the software section, you can leave the Use default location checkbox checked to create a folder
called uboot at the handoff folder level in which files generated by bsp-editor will be stored. Or you can click
on the BSP target directory button to select your own folder to store these files. Do not modify the BSP
settings file name.
Then click on the OK button to validate your choice and again on the OK button asking for your
confirmation to overwrite BSP directory. Then this new window should be displayed:
In this window, click on the boot device list box and choose boot from QSPI
Now you should see in the BSP target directory 4 generated files:
uboot.ds: script for ARM DS-5 that allows to copy U-Boot directly on on-chip RAM through JTAG. Very
useful during U-Boot development.
As explained before, this Makefile need to be changed to compile the source code in the uboot-src folder.
5) Replace the BSP target directory Makefile by the Makefile of the USB located in <USB_Key>/HPS/U-Boot/src.
6) In the terminal, from the BSP target directory, execute the commande make to build U-Boot.
- It creates a symbolic link uboot-socfpga that points to the uboot-src folder then compile source code to create the
uboot_w_dtb-mkpimage.bin file.
Note:
- The toolchain used to cross-compile U-Boot is part of SoC EDS installation. It is set in the Makefile.
- To clean only the source code tree, execute the make clean-uboot command.
U-Boot binary should be loaded by BootROM in OCRAM. OCRAM size is only 256 KB. Here is the U-Boot mapping in
OCRAM with the configuration CONFIG_DESIGNWARE_ETH enabled:
0xFFE4 0000
PAGE TABLE 16 Ko
0xFFE3 C000
STACK 20 Ko
0xFFE3 7000
MALLOC 35 Ko
0xFFE2 E400
0xFFE2 E3B0
0xFFE2 E310
IRQ STACK 1 Ko
0xFFE2 DF10
FIQ STACK 1 Ko
0xFFE2 DB10
0xFFE0 0000
0xFFE4 0000
PAGE TABLE 16 Ko
0xFFE3 C000
STACK 20 Ko
0xFFE3 7000
MALLOC 16 Ko
0xFFE3 3000
0xFFE3 2FB0
0xFFE3 2F10
IRQ STACK 1 Ko
0xFFE3 DB10
FIQ STACK 1 Ko
0xFFE3 2710
0xFFE0 0000
As we can see the size for the U-Boot code is limited. The important consequence is that we can not have all device supported
in a same binary. More precisely, it is not possible to have support for Ethernet (CONFIG_ DESIGNWARE_ETH), SD/MMC
(CONFIG_MMC) and QSPI device (CONFIG_CADENCE_QSPI) in the same time without removing all U-Boot commands.
That is why by default we add Ethernet and QSPI support in U-Boot to be able to load Kernel stored in QSPI or over network
but not SD/MMC.
To build the zImage file, we will have to copy our own configuration file at the right path then launch the build command.
Here is the procedure:
1) To build the kernel on our PC for the Alaric devkit, we could use the SoC EDS toolchain like for U-Boot build, but
we can also use an external toolchain, what could be useful in any case to be Altera tool independant. A Linaro
toolchain can be a good choice, they can be download at the following address: https://launchpad.net/linaro-toolchain-
binaries/trunk/. To install for example the 2012.11 version in your home directory, execute the following commands
in a terminal:
cd ~
wget https://launchpad.net/linaro-toolchain-binaries/trunk/2012.11/+download/gcc-linaro-arm-linux-gnueabihf-4.7-
2012.11-20121123_linux.tar.bz2
tar xjf gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux.tar.bz2
To use it to compile Alaric devkit software, we need to export CROSS_COMPILE and ARCH variables in our profile
file to not have to set them as parameters for each make command. So open ~/.profile and append the following lines:
export CROSS_COMPILE="$HOME/gcc-linaro-arm-linux-gnueabihf-4.7-2012.11-20121123_linux/bin/arm-linux-
gnueabihf-"
export ARCH=arm
2) Download kernel source files from git repository executing the following commands :
3) Open again your profile file ~/.profile and append the following variable definition:
export UBOOT_SRC_DIR="$HOME/uboot-src" where you need to replace $HOME/uboot-src by the real path of the
folder uboot-src.
make socfpga_rxc_defconfig
make zImage
2) To generate first the device tree source AlaricLinuDT.dts, execute the following command:
A Linux build system can be used to create the root file system, this is the Altera approach for their reference kit using Yocto
(building also the kernel). Reflex CES approach is quite different. As for Alaric devkit all drivers are statically linked to the
kernel, there is no kernel modules to install in <rootfs>/lib/modules/, so the root file system is completely hardware
independent. Consequently, we decide to download an existing root file system containing a packet manager and to customize
it dynamically to fit our applicative needs.
The original root file system is a Linaro-nano 14.04 release found at the address https://releases.linaro.org/14.04/ubuntu/saucy-
images/nano/linaro-saucy-nano-20140410-652.tar.gz.
Here is the step to obtain quite the same root file system as the one delivered:
1) Extract the original root file system tar.gz file on your PC.
3) Create micro SD card following procedure described in paragraph about SD card creation, starting from point 3).
Fix the packet manager sources list (can be done offline with micro SD card mounted on the PC)
Edit /etc/network/interfaces for network configuration (can be done offline with mircro SD card mounted on
the PC)
Add our HPS script tests (can be done offline with mircro SD card mounted on the PC).
uboot_w_dtb-mkpimage.bin
zImage
AlaricLinuxDT.dtb
3) Open a terminal and in this folder, create a symbolic link called rootfs pointing to the micro SD card root file system
path