Introduction.
Building a recent version of U-Boot (v2019.10 or later) generates an image file "u-boot-with-spl.sfp" that contains both the Preloader (U-Boot SPL) and U-Boot. This article shows how to write "u-boot-with-spl.sfp" to an SD card in a Windows PC environment.
Point: Starting from SoC FPGA Embedded Development Suite (SoC EDS) v20.1_Std, the tool to write Cyclone® V U-boot to SD Card is limited to Linux PC only.
Reference: Building Bootloader > Cyclone V SoC - Boot from SD Card > C. Prepare SD Card Image
Point: The method described here uses the tools included with SoC EDS v18.1. SoC EDS v18.1 must be installed separately even if SoC EDS v20.1 is used for development.
Note: The procedures described in this article are not guaranteed to work.
Tools to be used
-
SoC EDS v20.1_Std or later:
Used to generate U-boot. Please refer to the following contents for the generation method.
Reference: First Time with Intel® SoC FPGA Exercise Manual v20.1 (Atlas-SoC / DE10-Nano board version)
-
SoC EDS v18.1_Std:
Use SoC EDS Command Shell (Embedded Command Shell).
Please refer to the following for installation instructions
Reference: How to install SoC FPGA Embedded Development Suite (SoC EDS)
-
Binary Editor:
Used for editing U-boot binary data.
Note: In this case, we will use a tool called Stirling.
Point: When writing binaries using the method described in this page, the file size must be adjusted to be 512Byte times longer.
Steps
Step 1: Edit the U-boot binary file
Confirm that u-boot-with-spl.sfp has been generated in the Quartus® Project Directory > software > spl_bsp > uboot-socfpga hierarchy, as shown in Figure 1.
If not, please refer to the following contents to execute Build.
Reference: First Time with Intel® SoC FPGA Exercise Manual v20.1 (Atlas-SoC / DE10-Nano board version)
Figure 1. Location of u-boot-with-spl.sfp
Open u-boot-with-spl.sfp in a binary editor.
Add 0 to the last area of data, 0x000CE1F0, and save it as shown in Figure 2.
Figure 2. Edit u-boot-with-spl.sfp
Step 2: Write to the SD Card using the SoC EDS Command Shell of ver18.1_Std
Insert the SD Card into the PC.
After inserting the SD Card, figure out the drive name of the SD Card as shown in [Figure 3] and press Cancel if a pop-up appears.
Figure 3. Inserting SD Card
Launch the SoC EDS Command Shell for ver18.1_Std from the Windows Start menu.
Navigate to Quartus® Project Directory > software > spl_bsp > uboot-socfpga, where u-boot-with-spl.sfp edited in step 1 is located, as shown in Figure 4, by "cd".
Use "alt-boot-disk-util.exe" to write u-boot-with-spl.sfp to the SD Card.
NOTES: Drive names vary from PC to PC; be careful not to rewrite a drive other than the SD Card.
Example command:
$ alt-boot-disk-util.exe -B u-boot-with-spl.sfp -a write -d <drive name>
Figure 4. Writing u-boot-with-spl.sfp to SD Card
Point: Since Preloader (U-Boot SPL) and U-Boot are generated separately, they can be written to SD Card separately by using the following command (no binary editing is required in this case).
1. To rewrite only the Preloader (U-Boot SPL)
$ alt-boot-disk-util.exe -p spl/u-boot-splx4.sfp -a write -d <drive name>
2. To rewrite only U-Boot
$ alt-boot-disk-util.exe -b u-boot.img -a write -d <drive name>
3. To rewrite Preloader (U-Boot SPL) + U-Boot (if you have separate image files)
$ alt-boot-disk-util.exe -p spl/u-boot-splx4.sfp -b u-boot.img -a write -d <drive name>
Note: spl/u-boot-splx4.sfp may not be generated depending on the version. In that case, please consider writing using u-boot-with-spl.sfp.
Step 3: Insert the SD Card into the SoC Kit and confirm the startup of U-Boot with Tera Term, etc.
Insert the SD Card into the SoC Kit and turn on the power.
Connect the UART cable to the PC, and you can confirm the startup using Tera Term, etc. as shown in Figure 5.
Figure 5. Confirmation of U-boot startup
Conclusion
The method described in this article can be used to write the latest U-boot to SD Card even on Windows, and can be used to verify the U-boot after booting.