Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this article, we will guide you through the process of downloading and compiling the SP7350 code. The source code for SP7350 is automatically updated on both GitHub and Gitee every day, ensuring users have access to the latest developments.

...

Table of Contents
minLevel1
maxLevel6
include
outlinefalse
indent
exclude
typelist
class
printablefalse

Install Necessary Software Packages

Before downloading or compiling the SP7350 code, ensure the following software packages, libraries, and Python3 packages are installed:

Packages:

  • bison

  • flex

  • git

  • make

  • mtd-utils

  • mtools

  • openssl

  • pv

  • python3-pip

  • u-boot-tools

Libraries:

  • libncurses*

  • libgmp-dev

  • libmpc-dev

  • libssl-dev

Python3 Packages:

  • crypto

  • pycryptodomex

  • pyelftools

...

Code Block
sudo apt install bison flex git make mtd-utils mtools openssl pv python3-pip u-boot-tools
sudo apt install libncurses* libgmp-dev libmpc-dev libssl-dev
pip install crypto pycryptodomex pyelftools

Download Code from GitHub or Gitee.

Clone the repository from GitHub:

...

Code Block
# Navigate to the Q654 directory
cd Q654

# Update the codeInitialize and itsupdate submodules
git submodule update --init --recursive

# Ensure all submodules are on the master branch
git submodule foreach git checkout master

Update to the latest code after the initial download:

Code Block
# Navigate to the Q654 directory
cd Q654

# Pull the latest changes from the repository
git pull

# Pull updates for all submodules
git submodule foreach git pull

...

Code Block
wellslu@scdiu3:~/Q654$ ll
total 52
drwxr-xr-x 11 wellslu sp 4096 Dec 15 12:27 ./
drwxr-xr-x  7 wellslu sp 4096 Nov 15 18:33 ../
drwxr-xr-x  6 wellslu sp 4096 Nov 15 15:38 boot/
drwxr-xr-x  3 wellslu sp 4096 Dec 29 13:20 build/
drwxr-xr-x  9 wellslu sp 4096 Nov 15 16:19 crossgcc/
drwxr-xr-x  3 wellslu sp 4096 Nov 15 15:38 firmware/
drwxr-xr-x  9 wellslu sp 4096 Dec 29 13:20 .git/
-rw-r--r--  1 wellslu sp 1117 Nov 15 15:38 .gitmodules
drwxr-xr-x  7 wellslu sp 4096 Nov 15 15:40 ipack/
drwxr-xr-x  4 wellslu sp 4096 Nov 15 15:38 linux/
-rw-r--r--  1 wellslu sp   23 Nov 15 15:38 Makefile
drwxr-xr-x  5 wellslu sp 4096 Dec 29 13:20 optee/
-rw-r--r--  1 wellslu sp 1003 Nov 15 15:38 README.md 
wellslu@scdiu3:~/Q654$

...

--  1 wellslu sp 1003 Nov 15 15:38 README.md 
wellslu@scdiu3:~/Q654$

This structure confirms that you have successfully updated the Q654 codebase, and your development environment is now aligned with the latest changes.

While the master branch contains the latest development code, stable versions of the code are maintained in branches such as v1.0 and v1.1.

To switch to a stable branch, use the following commands:

Code Block
# Checkout the desired branch for all submodules
git submodule foreach git checkout v1.1

# Pull the latest updates for the specified branch
git submodule foreach git pull

By following these steps, your Q654 environment will be up to date with the latest stable code.

Configure Building Environment

Navigate to the top folder of your Q654 project. Run the following command to initiate the configuration menu.

...

In the configuration menu:

  1. Choose the board you want to build the image for. For instance, press 1 2 to select "SP7350 Ev IO Board."

  2. Choose the device from which the system will boot device. For example, press 5 2 to specify booting from the SD card.

  3. Choose root file-system of Linux. For example, press 3 7 to opt for “Ubuntu MATE 2024.04.04” 1” as root file-system.

  4. Choose image securityboot modes. Press 1 to select building “No secure” “Normal boot” images.

Once you have completed the configuration selections in the menu, the system will start configuring the building environment. This process may take tens seconds or even a few minutes, depending on your computer's performance. Please wait patiently for the configuration process to conclude.

Please note that the system takes additional time to complete its initial run during the configuration process, as it requires the download of the toolchain.

Configure X-Boot Features (optional)

If you want to activate additional features or deactivate specific ones within the X-Boot, run the following command to initiate the configuration menu of X-Boot.

...

Once you have made the necessary adjustments in the menu, please ensure to save the changes before exiting the menu.

Configure U-Boot Features (optional)

To customize U-Boot settings, run the following command to initiate the configuration menu of U-Boot.

...

After making the necessary adjustments in the menu, please be sure to save the changes before exiting.

Configure Linux Kernel Features (optional)

For those who want to configure specific features in the Linux kernel, run the following command to initiate the configuration menu of Linux kernel.

...

After making the necessary adjustments in the menu, please ensure to save the changes before exiting.

Build Code

After completing all configurations, you are ready to initiate the code build. Execute the following command to commence the build process:

...

After make command completes, it will display information similar to the following screenshot:image-20240424-051233.pngImage Removed

...

The screenshot provides details about two partitions created in the SD card image. The first partition spans from sector 2,048 to sector 526,335, with a size of 256 MB and a W95 FAT file system. The second partition extends from sector 526,336 to sector 1,627,959, with a size of 537.9 MB and a Linux (ext4) file system.

Resulting Images for SD Card

Upon completion of the build process, the resulting image files are stored in the out/boot2linux_SDcard/ directory. Refer to the list below:

...

  • ISPBOOOT.BIN: Binary file storing X-Boot, the first-stage boot-loader responsible for DDR SDRAM initialization and training, loading images of TF-A, OP-TEE, U-Boot, and initiating the execution of TF-A.

  • fip.img: Image file comprising images of Trusted Firmware-A (TF-A) and Open Portable Trusted Execution Environment (OP-TEE).

  • u-boot.img: Image file of the U-Boot boot-loader, the second-stage boot-loader responsible for loading and running the Linux kernel image.

  • uEnv.txt: Environment file for U-Boot. U-Boot imports environment variables from this file after initialization. If the uenvcmd command is defined in uEnv.txt, U-Boot executes the specified command after importing uEnv.txt.

  • uImage: Image file of the compressed Linux kernel with the U-Boot header.

  • ISP_SD_BOOOT.img: Image file for burning an SD card, containing all files in both partitions.

Create SD Card

To create your SD card for booting SP7350 platforms, you can copy write the image file, ISP_SD_BOOOT.img, to an SD card directly using the dd command. For instance:

...

Depend on system you are using, you may need to unmount the SD card:

umount /dev/sda

Booting Your SP7350 Platform

  1. After creating your SD card, insert it into the SD card socket on your SP7350 platform.

  2. Set the boot-switch to "Boot from SD card".

  3. Connect the cable of your UART console.

  4. Power on your SP7350 platform.

  5. The platform will initiate booting from the SD card.

  6. Once booted, you can enter your commands in the console.

For boot-switch selection guidance, please consult:

https://sunplus.atlassian.net/wiki/spaces/C3/pages/1994621039/A+Guide+to+In-system+Programming+Flash+Devices+on+the+SP7350+Platforms#AppendixDevices#Appendix

For example, if you are using SP7350 Evaluation Board, please set boot-selection switch SW2 to all OFF (1111) and SW3 to OFF-OFF-ON-ON (1100) for booting from SD card.

...

In-system Programming a Flash Device and Booting from It.

If you intend to in-system program a flash device (e.g., eMMC) on the SP7350 platform and boot from it, please refer to:

A Guide to In-system Programming Flash Devices on the SP7350 Platforms

Log of Booting from SD Card

Refer to the log generated during the system booting from the SD card. After the boot process is complete, the 'df -hT' command is issued to display disk space usage on your SP7350 platform.

...