Building the Bootloader (U-boot)¶
1. Prerequisites 2. Building the FPGA Image 3. Building the Bootloader 4. Building the Filesystem 5. Building the SD Card
- Table of contents
- Building the Bootloader (U-boot)
Introduction¶
The main boot loader for the MitySOM-A10S is Das U-Boot. This boot loader is used to configure the pin mux, DDR, program the FPGA, and launch the next stage application/OS. Critical Link started from Intel's port of Das U-Boot and made minor modifications such as reading the MAC address from the on board EEPROM the ethernet MAC.
U-Boot utilizes scripts/macros in order to tailor the boot sequence for the user's needs. The development kit's U-boot is set up to read the core FPGA image (named mitysom_a10s_devkit.rbf) from the FAT partition on the SD card into RAM then load this image into the FPGA. Next, it would load the kernel and device tree into RAM from the ext4 partition and then boot the kernel. These scripts are stored in the U-boot environment, which is created from ubootenv.txt that is located in the FPGA project.
These instructions have been tested with Quartus Pro 18.1
Repository¶
Description | Repository | Branch | U-Boot Version |
U-Boot Source | https://git.criticallink.com/git/u-boot-socfpga.git | mitysom_a10 | v2014.10 |
Development Kit Pre-built Outputs¶
Description | Link |
270 KLE U-boot & environment | https://support.criticallink.com/redmine/attachments/download/26781/a10s-p8-uboot-20200929.zip |
480 KLE U-boot & environment | https://support.criticallink.com/redmine/attachments/download/26784/a10s-p9-uboot-20200929.zip |
Quick steps to Building U-Boot¶
- Open a terminal
- Enter the following command that will allow you to use the quartus tools from the command line:
/opt/intelFPGA_pro/18.1/embedded/embedded_command_shell.sh
- Change into the directory where project was cloned into (Example: /home/user/mitysom-a10s)
cd /home/user/mitysom-a10s/mitysom-a10s-devkit-goldenref
- Run the following command that will do the following:
- Create the device tree u-boot will use (containing HPS pin muxing, clock setup)
- Pulls Critical Links U-boot repo
- Builds U-boot
- Creates bootloader and U-boot environment Binaries
make bootloader ubootenv
Outputs¶
Description | Location |
Bootloader Binary | <Quartus Project Folder>/software/bootloader/uboot_w_dtb-mkpimage.bin |
U-Boot Environment Binary | <Quartus Project Folder>/software/bootloader/ubootenv.bin |
Customizing U-Boot¶
Customization through updating the U-boot environment¶
Most U-Boot customization for a carrier board can be done by adjusting the scripts/macros in the U-boot environment. This includes changing the name of the core FPGA image (RBF), Kernel, or device tree block (DTB). The U-boot environment is stored in the SD Card, 512 Bytes from the beginning of the SD Card. It can also be updated inside of U-boot by using the editenv, setenv, and saveenv commands. Please see the U-Boot documentation in Further Reading for more usages.
The U-Boot environment binary is built through the FPGA project, it's source is the ubootenv.txt
Important U-Boot Environment Variables¶
The core RBF location is in rbfcoreimage:
rbfcoreimage=mitysom_a10s.core.rbf
The DTB location is in fdtimage:
fdtimage=/boot/mitysom_a10s_devkit.dtb
Customizing through Patching U-Boot Source¶
The Makefile for creating the Bootloader, which is created by running the Intel's bsp-editor, allows for applying patches to the U-Boot source during the build process. Using this feature is easy to customize U-Boot by creating a patch of the U-Boot source and putting it in <Quartus Project Folder>/software/bootloader.
Example of Adding Addition Command to U-Boot¶
This example will add the itest command to U-Boot.
Important files:Description | Location |
Header for MitySOM-A10S that sets peripheral settings and enabled commands | <U-Boot Source>/include/configs/mitysom_a10s_dsc.h |
Handles early init of U-Boot specific to the MitySOM-A10S | <U-Boot Source>/include//board/cl/common/common_init.c |
MitySOM-A10S defconfig | <U-Boot Source>/configs/mitysom_a10s_dsc_defconfig |
In order to add the itest command #undef CONFIG_CMD_ITEST would need to be removed to <U-Boot Source>/include/configs/mitysom_a10s_dsc.h. Once that line is removed a patch will need to be made. Do this by running the following command from the top level of the U-boot repository that was checked out:
git diff > enable-itest.patch
Now, copy enable-itest.patch into <Quartus Project Folder>/software/bootloader, and the next U-boot is built that patch will be applied.
Advanced: Manual steps for Building U-Boot¶
These are the steps to build U-Boot without using the Makefile that is in Critical Link's reference Quartus Project.
- Open a terminal
- Enter the following command that will allow you to use the quartus tools from the command line:
/opt/intelFPGA_pro/18.1/embedded/embedded_command_shell.sh
- Change into the directory where project was cloned into (Example: /home/user/mitysom-a10s)
cd /home/user/mitysom-a10s
- Run the bsp-editor to generate the Makefile and device tree for U-Boot
bsp-create-settings \ --type uboot \ --bsp-dir software/bootloader \ --preloader-settings-dir "hps_isw_handoff" \ --settings software/bootloader/settings.bsp \ --set uboot.boot_device SDMMC \ --set uboot.rbf_filename mitysom_a10s.periph.rbf \ --set uboot.core_rbf_filename "" \ --set uboot.peripheral_rbf_filename "" \ --set uboot.model "MitySOM-A10S"
- Download the U-Boot source from Critical Link
git archive --format=tar.gz --prefix=uboot-socfpga/ --remote=git://support.criticallink.com/home/git/u-boot-socfpga.git mitysom_a10 > software/bootloader/uboot-socfpga.tar.gz
- Build U-Boot
make -C software/bootloader TGZ=uboot-socfpga.tar.gz SOCFPGA_BOARD_CONFIG=mitysom_a10s_dsc_defconfig
- Build the u-boot environment
software/bootloader/uboot-socfpga/tools/mkenvimage -s 4096 -o software/bootloader/ubootenv.bin software/bootloader/ubootenv.txt
FAQ¶
When should I rebuild my bootloader?¶
Your bootloader should be rebuilt anytime the settings in the HPS block in Platform Designer is changed. This includes but not limited to: changing the HPS pin mux, changing any of the clocks generated by the HPS, enabling/changing and the FPGA bridges (Light Weight HPS-to-FPGA, HPS-to-FPGA, FPGA-to-HPS, FPGA-to-SDRAM). When in doubt rebuilt and reflash U-Boot.
Further Read¶
1. Prerequisites 2. Building the FPGA Image 3. Building the Bootloader 4. Building the Filesystem 5. Building the SD Card
Go to top