Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

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.

It's recommended to have the latest version of Ubuntu installed on your computer. This choice is optimal for compatibility and ensures a seamless compilation process. Additionally, to enhance performance and reduce compilation time, your PC should be equipped with a minimum of 4 GB DRAM.

Contents

Install necessary software packages

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

Packages:

  • git

  • make

  • u-boot-tools

  • openssl

  • bison

  • flex

  • mtd-utils

  • python3-pip

  • pv

Libraries:

  • libssl-dev

  • libmpc-dev

  • libgmp-dev

Python3 packages:

  • pycryptodomex

  • pyelftools

  • crypto

If not yet installed, use the following commands:

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

Download code from GitHub or Gitee.

Clone the repository from GitHub:

git clone https://github.com/sunplus-plus1/Q654.git

Or, clone it from Gitee:

git clone https://gitee.com/sunplus-plus1/q654.git

Update the code:

# Navigate to the Q654 directory
cd Q654

# Update the code and its submodules
git submodule update --init --recursive
git submodule foreach git checkout master

Update to the latest code after the initial download:

cd Q654
git pull
git submodule foreach git pull

These commands ensure you have the latest changes from the main repository and update all submodules within the SP7350 codebase. This guarantees that your development environment is always synced with the most recent version of the code.

After completing the update, your Q654 top folder structure should resemble the following:

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$

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

Configure building environment

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

make config

Upon executing this command, a configuration menu will appear, providing several options for customization:

image-20240305-040354.png

In the configuration menu:

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

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

  3. Choose root file-system of Linux. For example, press 1 to opt for “BusyBox 1.31.1” as root file-system.

  4. Choose image security. Press 1 to select building “No secure” 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 feature (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.

make xconfig

Upon executing this command, a configuration menu will appear.

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

Configure U-Boot feature (optional)

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

make uconfig

Upon executing this command, a configuration menu will be displayed.

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

Configure Linux kernel feature (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.

make kconfig

Upon executing this command, a configuration menu will appear.

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:

make

This will compile the code based on your chosen configurations. The duration of this process depends on your computer's performance, typically taking a few minutes. Kindly exercise patience and allow the system to complete the build.

After make command completes, it will display information similar to the following screenshot:

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:

wellslu@scdiu3:~/Q654$ ll out/boot2linux_SDcard/
total 823876
drwxr-xr-x 2 wellslu sp      4096 Jan  1 13:53 ./
drwxr-xr-x 3 wellslu sp      4096 Jan  1 13:53 ../
-rw-r--r-- 1 wellslu sp    408526 Jan  1 13:53 fip.img
-rw-r--r-- 1 wellslu sp    135516 Jan  1 13:53 ISPBOOOT.BIN
-rw-r--r-- 1 wellslu sp 833515520 Jan  1 13:53 ISP_SD_BOOOT.img
-rw-r--r-- 1 wellslu sp    764728 Jan  1 13:53 u-boot.img
-rw-r--r-- 1 wellslu sp      1101 Jan  1 13:53 uEnv.txt
-rw-r--r-- 1 wellslu sp   9846041 Jan  1 13:53 uImage
wellslu@scdiu3:~/Q654$
  • 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 ISP_SD_BOOOT.img to SD card directly using the dd command. For instance:

dd if=out/boot2linux_SDcard/ISP_SD_BOOOT.img of=/dev/sda bs=1M; sync

where the SD card is accessed via a USB SD card reader and mounted on /dev/sda

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

umount /dev/sda

Boot your SP7350 platform

After completing create you SD card, plug your SD card into SD card socket your SP7350 platform. Set boot-switch to “Boot from SD card”. Plug in cable of your UART console. Turn on power of your SP7350 platform. The SP7350 platform will start to boot from your SD card. Finally, you can input your command in console.

For boot-switch selection, please refer to:

https://sunplus.atlassian.net/wiki/spaces/C3/pages/1994621039/A+guide+to+in-system+programming+flash+devices+on+the+SP7350+platforms#Appendix

In-system programming a flash device and boot from it.

If you want to in-system program a flash devcie (for example, eMMC) on 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

  • No labels