How to build SP7021 Linux image for booting from an USB flash drive

The goal of the document is to illustrate how to build SP7021 Linux image for booting from an USB flash drive.

First, you need to get source files from git server of SP7021. Second, you need to run make to build all images of SP7021. After make processes complete successfully, it will create a binary file named ISPBOOOT.BIN. This binary file is packed with all necessary codes and images. Please copy the built ISPBOOOT.BIN file to root directory of an USB flash drive. Finally, plug the USB flash drive into an USB socket of SP7021 board, and set DIP-SW to “boot from USB”.

Now you are ready to turn on SP7021 power to boot Linux from the USB flash drive. For details, please follow the following steps.

1. Download source files

Source files of SP7021 can be downloaded from GitHub or Yocto server of SP7021. Refer to https://github.com/sunplus-plus1/SP7021 or 2. HOW TO GET SOURCE FILE AND PACKAGE. Refer to report of ll command for the contents of top folder of source of SP7021:

wellslu@scdiu3:~/q628/usb$ ll total 52 drwxr-xr-x 12 wellslu sp 4096 Oct 15 12:23 ./ drwxr-xr-x 19 wellslu sp 4096 Oct 15 12:03 ../ drwxr-xr-x 8 wellslu sp 4096 Jul 2 13:08 boot/ drwxr-xr-x 4 wellslu sp 4096 Sep 8 10:22 build/ drwxr-xr-x 7 wellslu sp 4096 Aug 19 10:48 crossgcc/ drwxr-xr-x 6 wellslu sp 4096 Jul 2 13:08 eCos/ drwxr-xr-x 9 wellslu sp 4096 Jul 2 13:08 freertos/ drwxr-xr-x 8 wellslu sp 4096 Aug 19 10:48 ipack/ drwxr-xr-x 7 wellslu sp 4096 Jul 2 13:08 linux/ -r--r--r-- 1 wellslu sp 23 Jul 2 13:08 Makefile drwxr-xr-x 4 wellslu sp 4096 Jul 2 13:08 nonos/ drwxr-xr-x 7 wellslu sp 4096 Jul 2 13:08 .repo/ drwxr-xr-x 3 wellslu sp 4096 Jul 2 13:08 yocto/

2. Configure environment

Run make config command on top folder. After configuration menu pops up, first, choose board you want to build image for. For example, press 1 to choose “SP7021 Ev Board”. Second, press 1 to choose to use C chip (CA7 x4). Finally, press 6 to choose to boot from an USB flash drive and then enter to start to configure building environment. Refer to screenshot below,

make config starts to build compiler environment. It may take a few minutes. Please wait for make config completing the processes.

3. Build USB boot image

Run make all command to start to create all images of SP7021. It may take several minutes to complete. After make all completes, you will see screen like:

From information on screen, 3 partitions are created (in the binary file ISPBOOOT.BIN). For example, size of nonos partition is 0xc000 (49,152 bytes). The maximum allowable size of nonos is 0x100000 (1,048,576 bytes). 4.69% of maximum size is used. Size of dtb partition is 0x5000 (20,480 bytes). 7.81% of maximum size is used. Size of kernel partition is 0x836800 (8,611,840 bytes). 60.84% of maximum size is used.

4. Binary file ISPBOOOT.BIN

All built image files are packed to file ISPBOOOT.BIN at folder out/boot2linux_usb. Refer to screenshot of output of ll out/boot2linux_usb command:

5. Copy ISPBOOOT.BIN to an USB flash drive

Copy the built ISPBOOOT.BIN file to root directory of an USB flash drive. Note that the USB flash drive should be formatted to DOS/Windows FAT32 file-system. SP7021 can only load files from an USB flash drive which is formatted to FAT32 file-system. Note that FAT32 file-system should be in the first or the sole partition of the USB flash drive.

6. Set DIP-SW to “boot from USB”

Set DIP-SW (boot-select switch) to “boot from USB”. For example, if you are using SP7021 Ev Board, please set DIP-SW to OFF-OFF-OFF-OFF-ON-OFF (1-1-1-1-0-1) for booting from USB flash drive. Refer to picture below, DIP-SW is set to OFF-OFF-OFF-OFF-ON-OFF.

Refer to https://sunplus.atlassian.net/wiki/spaces/doc/pages/460981046 for details of boot selection of SP7021.

7. Boot Linux from USB flash drive

Plug your USB flash drive which contains ISPBOOOT.BIN into either USB socket of SP7021 board. Install UART console and set terminal to 115,200 bps. Finally, turn on power of SP7021 board to start to boot Linux.

Note that internal ROM code of SP7021 does not support USB hub. The USB flash drive for booting should be plugged into USB socket of SP7021 board directly.

Appendix. Layout of partitions of ISPBOOOT.BIN

Refer to layout of partitions of binary file ISPBOOOT.BIN. ISPBOOOT.BIN contains xboot, uboot, header and 3 partitions. The figures in parenthesis of each partition is the size of the partition. Note that root file-system of Linux is built into kernel.