Project

General

Profile

Building U-Boot and Pre-loader 2019

Building u-Boot and Preloader v2019.10

These instructions are valid for Quartus and SoC EDS 20.1 Standard. Instructions are given for Linux and were tested on Ubuntu 18.04.

Project Location

On the Support git Server: http://support.criticallink.com/gitweb/?p=mitysom-5cs/mitysom_5cse_dev_board.git;a=summary

Building the Preloader and U-Boot for the MitySOM-5CSx module

Because of the sensitivity of the Preloader to the HPS peripheral pin multiplexing and boot options, you need to follow the basic flow for generating the auto-generated files used by both the preloader and the u-Boot application prior to being able to build a working copy of either application. The auto-generated files are not included in the git repository, so you won't be able to build a preloader or a u-Boot image unless you follow the steps:

  1. Compile your FPGA project with the 20.1 Standard suite. This generates the necessary HPS software handoff files.
  2. Launch an altera embedded command shell
    {install_directory}/intelFPGA/20.1/embedded/embedded_command_shell.sh
    
  3. If you have not already done so, install the C compiler toolchain:
    wget https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz
    tar xf gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz
    rm gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz
    
  4. Setup environment variables for the toolchain
    export PATH=`pwd`/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf/bin:$PATH
    export CROSS_COMPILE=arm-none-linux-gnueabihf-
    
  5. Create a software/bootloader directory in your project directory and cd into it:
    mkdir -p software/bootloader
    cd software/bootloader
    
  6. Download a tarball of the U-Boot archive from our server and unpack it:
    git archive --format=tar.gz --prefix=u-boot-socfpga/ --remote=git://support.criticallink.com/home/git/u-boot-socfpga.git socfpga_v2019.10 > u-boot-socfpga.tar.gz
    tar xzf u-boot-socfpga.tar.gz
    
  7. Change your working directory to the project directory:
    cd ../..
    
  8. Convert the handoff data into source code. NOTE: You will need to replace dev_5cs_hps_0 with what is in your hps_isw_handoff directory.
    bsp-create-settings \
        --type spl \
        --bsp-dir software/bootloader \
        --preloader-settings-dir "hps_isw_handoff/dev_5cs_hps_0" \
        --settings software/bootloader/settings.bsp
    
  9. Change your working directory to the unpacked U-Boot source tree:
    cd software/bootloader/u-boot-socfpga
    
  10. Run the qts_filter to take the sources from the handoff folder and the ones generated by bsp-create-settings and format them appropriately and copy them to the U-Boot source code:
    ./arch/arm/mach-socfpga/qts-filter.sh cyclone5 ../../../ ../ ./board/cl/mitysom-5cs/qts/
    
  11. Set the device tree to build off of the SOM you are targeting. Options
    • socfpga_mitysom5csx-h6-42a_devkit
    • socfpga_mitysom5cse-h4-8ya_devkit
    • socfpga_mitysom5csx-h6-53b_devkit
    • socfpga_mitysom5cse-l2-3y8_devkit
    • socfpga_mitysom5csx-h6-4ya_devkit
    • socfpga_mitysom5csx-h5-4ya_devkit
    • socfpga_mitysom5cse-h4-3ya_devkit
      # Example of building for MitySOM-5CSX-H6-42A
      export DEVICE_TREE=socfpga_mitysom5csx-h6-42a_devkit
      
  12. Make the defconfig:
    make socfpga_mitysom5cs_defconfig
    
  13. If any additional customizations are required you can run menuconfig:
    make menuconfig
    
  1. Make the Preloader and U-Boot:
    make
    

Preloader binary location: {project_directory}/software/bootloader/u-boot-socfpga/spl/u-boot-splx4.sfp
U-Boot binary location: {project_directory}/software/bootloader/u-boot-socfpga/u-boot.img

Both the Preloader and U-Boot binaries have their device trees embedded, so there is no separate file (note this is separate from the Linux device tree, which is still a separate file as normal).

Creating the u-Boot environment for the MitySOM-5CSX Dev Kit

With U-Boot built, now the environment needs to be created. This environment will be stored on the SD card and it used to tell U-Boot where to load the kernel/FPGA image/device tree/root filesystem from. These instructions will show how to build this environment for our dev kit, which boots off of SD card.

NOTE: These steps assume that Building the Preloader and U-Boot for the MitySOM-5CSx module was already run

Steps:

  1. Change your working directory to the software/preloader folder in the root of your Quartus project:
    cd {project_directory}/software/preloader
    

    The uBootMMCEnv.txt is a human readable file that has all the U-Boot environment variables to boot linux from the SD card.
  2. Run the following:
    ../bootloader/u-boot-socfpga/tools/mkenvimage -s 65536 -o ubootenv.bin uBootMMCEnv.txt
    

    This step will convert uBootMMCEnv.txt to ubootenv.bin, which is a binary blob that U-Boot will read on startup to populate its environment variables.
  3. Now this ubootenv.bin will be used in Building SD Card Image to create the SD card image.

Updating the SD Card

See the ARM Software FAQs for details on updating the SD card with the new U-Boot and Preloader.

References

Go to top
Add picture from clipboard (Maximum size: 1 GB)