How to build and install SP7021 Linux image to run Raspbian on eMMC

The goal of the document is to illustrate how to build SP7021 image and install it with Raspbian rootfs on eMMC. Raspbian is a famous and popular Linux distribution. It is based Debian and for running on Raspberry Pi boards. Raspbian is released in form of SD card image. Raspbian image file of SD card can be downloaded from web of Raspbian foundation. Users can then write the image file into an SD card. The SD card image consists of two partitions. One is boot partition which is formatted to DOS/Windows FAT32 file-system and the other is rootfs partition which is formatted to Linux Ext4 file-system. boot partition contains files, including boot-loader, Linux kernel image, and etc, for booting from Raspberry Pi boards. rootfs partition contains files of whole root file-system of Linux. To run Raspbian on eMMC on SP7021 platforms, we need to replace all files of rootfs partition of eMMC with Raspbian’s.

This document provides to two methods to replace all files of rootfs partition of eMMC with Raspbian’s. One is to copy all files of rootfs partition of Raspbian to rootfs partition of eMMC directly. The other is to use rootfs partition of Raspbian as source of rootfs when building SP7021 Linux image for eMMC. Step 4 ~ 9 is for method one (A). Step 10 ~ 20 is for method two (B). Step 1 ~ 3 is for both. Please follow the following steps.

1. Download Raspbian image file

Download Raspbian image file, for example “2020-05-27-raspios-buster-full-armhf.zip“ from https://www.raspberrypi.org/downloads/raspbian/.

2 . Unzip image file

Raspbian image file from web is a zipped image file. We need to unzip it. For example, we can use 7-zip to unzip image file. First, download 7-zip from web: https://www.7-zip.org/download.html

Second, run '7-zip' to unzip image file.

3. Write (Burn) the unzip image file to an SD card

Use Win32DiskImager, BalenaEther or other SD card writers to write the unzip Raspbian image to an SD card. Note that size of SD card should be greater than 8 GB. Refer to step 4 of https://sunplus.atlassian.net/wiki/spaces/doc/pages/662569085 for how to write an image file to an SD card. BalenaEther can loaded zipped image file directly, no need to unzip image file before load it.

Method A

4. Get source files, build and install SP7021 Linux image to eMMC

Refer to https://sunplus.atlassian.net/wiki/spaces/doc/pages/701202573, get source files of SP7021, build images, and write SP7021 Linux image to eMMC of SP7021 platform. After finish writing SP7021 Linux image to eMMC, set DIP-SW to boot from eMMC and turn on power to boot from eMMC device. At first boot, Linux will extend root file-system to end of rootfs partition. Refer to log below:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [ 1.747769] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 [ 1.770798] EXT4-fs (mmcblk0p8): mounting ext3 file system using the ext4 subsystem [ 1.820259] random: fast init done [ 1.842710] mmc1: new high speed SDHC card at address aaaa [ 1.844094] mmcblk1: mmc1:aaaa SB16G 14.8 GiB [ 2.111919] EXT4-fs (mmcblk0p8): mounted filesystem with ordered data mode. Opts: (null) [ 2.112177] VFS: Mounted root (ext3 filesystem) on device 259:0. [ 2.114187] mmcblk1: p1 p2 [ 2.118216] devtmpfs: mounted [ 2.122654] Freeing unused kernel memory: 1024K [ 2.190434] Run /sbin/init as init process /etc/init.d/rcS starts... Mounting other filesystems ... rc.extra [bg] ******* resize2fs /dev/mmcblk0p8 **************** 0x00005B60 resize2fs 1.45.1 (12-May-2019) 0x00000006 Filesystem at /dev/mmcblk0p8 is mounted on /; on-line resizing required [ 2.467085] EXT4-fs (mmcblk0p8): resizing filesystem from 4110 to 1899447 blocks old_desc_blocks = 1, new_desc_blocks = 1 extra done [ 13.329636] EXT4-fs (mmcblk0p8): resized to 1212416 blocks [ 19.307623] EXT4-fs (mmcblk0p8): resized filesystem to 1899447 The filesystem on /dev/mmcblk0p8 is now 1899447 (4k) blocks long. End of /etc/init.d/rcS login[755]: root login on 'console' ~ #

From log, file system on rootfs partition (/dev/mmcblk0p8) was extended to 1,899,447 blocks (1,899,477 x 4KiB = 7,419 MiB). Note that this step is very important. Without this step, we cannot use all capacity of an eMMC device.

5. Build and install SP7021 Linux image to an SD card

Refer to https://sunplus.atlassian.net/wiki/spaces/doc/pages/662569085, build images again but this time is for booting from SD card. After finish writing SP7021 Linux image to an SD card, set DIP-SW to boot from SD card, plug in the SD card and turn on power to boot from the SD card. Wait for booting completes.

6. Mount rootfs partition of eMMC and remove all files.

After system boots completely, refer to log of commands below, first use mount command to mount rootfs partition of eMMC to folder /mnt. Second, use rm command to remove all files in root file-system of the eMMC device. Note that rootfs partition of eMMC is at /dev/mmcblk0p8.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ~ # cd / / # mount /dev/mmcblk0p8 /mnt [ 743.749393] EXT4-fs (mmcblk0p8): mounting ext3 file system using the ext4 subsystem [ 744.103125] EXT4-fs (mmcblk0p8): recovery complete [ 744.103620] EXT4-fs (mmcblk0p8): mounted filesystem with ordered data mode. Opts: (null) / # / # ls -al /mnt drwxr-xr-x 15 root root 4096 Jan 1 00:07 . drwxr-xr-x 15 root root 4096 Jan 1 00:15 .. drwxrwxr-x 2 1000 1000 4096 Jun 22 2020 bin drwxrwxr-x 2 1000 1000 4096 Jun 7 2020 dev drwxrwxr-x 4 1000 1000 4096 Jun 7 2020 etc lrwxrwxrwx 1 1000 1000 11 Jun 7 2020 init -> bin/busybox drwxrwxr-x 4 1000 1000 4096 Jun 22 2020 lib lrwxrwxrwx 1 1000 1000 11 Jun 22 2020 linuxrc -> bin/busybox drwx------ 2 root root 16384 Jun 22 2020 lost+found drwxrwxr-x 2 1000 1000 4096 Jun 22 2020 mnt drwxrwxr-x 2 1000 1000 4096 Jun 22 2020 proc drwxrwxr-x 3 1000 1000 4096 Jan 1 00:14 root drwxrwxr-x 2 1000 1000 4096 Jun 7 2020 sbin drwxrwxr-x 2 1000 1000 4096 Jun 22 2020 sys drwxrwxr-x 2 1000 1000 4096 Jun 22 2020 tmp drwxrwxr-x 6 1000 1000 4096 Jun 22 2020 usr drwxrwxr-x 3 1000 1000 4096 Jun 7 2020 var / # / # rm -rf /mnt/* / # ls -al /mnt drwxr-xr-x 2 root root 4096 Jan 1 00:28 . drwxr-xr-x 15 root root 4096 Jan 1 00:15 .. ~ #

All files in rootfs partition of eMMC were removed.

7. Plug USB SD card reader with Raspbian SD card.

Plug your Raspbian SD card (created at step 3) into an USB SD card reader and plug your USB SD card reader into USB socket of your SP7021 platform. Refer to log below when you plug in your USB SD card reader.

1 2 3 4 5 6 7 8 9 10 [ 697.489341] usb 2-1: new high-speed USB device number 2 using ehci1-sunplus [ 697.546404] usb-storage 2-1:1.0: USB Mass Storage device detected [ 697.559843] scsi host0: usb-storage 2-1:1.0 [ 698.611980] scsi 0:0:0:0: Direct-Access SanDisk SDDR-B531 2920 PQ: 0 ANSI: 6 [ 698.613471] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 698.829899] sd 0:0:0:0: [sda] 30244864 512-byte logical blocks: (15.5 GB/14.4 GiB) [ 698.831952] sd 0:0:0:0: [sda] Write Protect is off [ 698.833951] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ 698.920824] sda: sda1 sda2 [ 698.930181] sd 0:0:0:0: [sda] Attached SCSI removable disk

From log, two partitions, sda1 and sda2, are detected. sda1 is boot partition (FAT32) and sda2 is rootfs partition of the Raspbian SD card.

8. Mount rootfs partition to folder /rpi_rootfs

Refer to log below, use mount command to mount rootfs partition of Raspbian SD card to folder /rpi_rootfs.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 / # mkdir rpi_rootfs / # mount /dev/sda2 /rpi_rootfs/ [ 842.046192] EXT4-fs (sda2): recovery complete [ 842.050878] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null) / # ls -al /rpi_rootfs/ drwxr-xr-x 21 root root 4096 May 27 2020 . drwxr-xr-x 16 root root 4096 Jan 1 00:29 .. drwxr-xr-x 2 root root 4096 May 27 2020 bin drwxr-xr-x 2 root root 4096 May 27 2020 boot drwxr-xr-x 4 root root 4096 May 27 2020 dev drwxr-xr-x 116 root root 4096 May 27 2020 etc drwxr-xr-x 3 root root 4096 May 27 2020 home drwxr-xr-x 17 root root 4096 May 27 2020 lib drwx------ 2 root root 16384 May 27 2020 lost+found drwxr-xr-x 2 root root 4096 May 27 2020 media drwxr-xr-x 2 root root 4096 May 27 2020 mnt drwxr-xr-x 6 root root 4096 May 27 2020 opt drwxr-xr-x 2 root root 4096 May 10 2020 proc drwx------ 3 root root 4096 May 27 2020 root drwxr-xr-x 4 root root 4096 May 27 2020 run drwxr-xr-x 2 root root 4096 May 27 2020 sbin drwxr-xr-x 2 root root 4096 May 27 2020 srv drwxr-xr-x 2 root root 4096 May 10 2020 sys drwxrwxrwt 4 root root 4096 May 27 2020 tmp drwxr-xr-x 11 root root 4096 May 27 2020 usr drwxr-xr-x 11 root root 4096 May 27 2020 var / #

Use ls command to list contents of rootfs partition of the Raspbian SD card.

8. Copy all files of rootfs partition of the Raspbian SD card to rootfs partition of eMMC

Use cp command to copy all files of rootfs partition (mounted on rpi_rootfs) of the Raspbian SD card to rootfs partition (had mounted on /mnt) of eMMC. Note cp command should be issued with option -a to preserve everything of original files.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 / # cp -a /rpi_rootfs/. /mnt / # sync / # ls -al /mnt drwxr-xr-x 21 root root 4096 May 27 2020 . drwxr-xr-x 16 root root 4096 Jan 1 00:29 .. drwxr-xr-x 2 root root 4096 May 27 2020 bin drwxr-xr-x 2 root root 4096 May 27 2020 boot drwxr-xr-x 4 root root 4096 May 27 2020 dev drwxr-xr-x 116 root root 4096 May 27 2020 etc drwxr-xr-x 3 root root 4096 May 27 2020 home drwxr-xr-x 17 root root 4096 May 27 2020 lib drwx------ 2 root root 4096 May 27 2020 lost+found drwxr-xr-x 2 root root 4096 May 27 2020 media drwxr-xr-x 2 root root 4096 May 27 2020 mnt drwxr-xr-x 6 root root 4096 May 27 2020 opt drwxr-xr-x 2 root root 4096 May 10 2020 proc drwx------ 3 root root 4096 May 27 2020 root drwxr-xr-x 4 root root 4096 May 27 2020 run drwxr-xr-x 2 root root 4096 May 27 2020 sbin drwxr-xr-x 2 root root 4096 May 27 2020 srv drwxr-xr-x 2 root root 4096 May 10 2020 sys drwxrwxrwt 4 root root 4096 May 27 2020 tmp drwxr-xr-x 11 root root 4096 May 27 2020 usr drwxr-xr-x 11 root root 4096 May 27 2020 var / #

Copy processes may take tens minutes to complete. For example, size of rootfs partition of Raspbian is about 6.6 GiB, copy processes take about 50 minutes to complete.

9. Modify fstab

Original Raspbian image uses uuid to mount folders / and /boot in file /etc/fstab. Refer to content of /mnt/etc/fstab:

1 2 3 4 5 / # cat /mnt/etc/fstab proc /proc proc defaults 0 0 PARTUUID=6c620f41-01 /boot vfat defaults 0 2 PARTUUID=6c620f41-02 / ext4 defaults,noatime 0 1 / #

We don’t need to mount folders / and /boot manually. Please use vi or other text editor to mark out the two lines in /etc/fstab. Refer to new content of /mnt/etc/fstab:

1 2 3 4 5 6 / # cat rpi_rootfs/etc/fstab proc /proc proc defaults 0 0 #PARTUUID=6c620f41-01 /boot vfat defaults 0 2 #PARTUUID=6c620f41-02 / ext4 defaults,noatime 0 1 / # sync / #

9. Boot Raspbian from eMMC

Remove USB SD card reader, remove SD card, set DIP-SW to boot from eMMC, and then turn on power to boot Raspbian from eMMC device. After Raspbian starts up successfully, it will ask you to enter account name and password. The default user of Raspbian is pi, and the default password is raspberry.

Method B

10. Get source files and build SP7021 Linux image for booting from eMMC device

Refer to https://sunplus.atlassian.net/wiki/spaces/doc/pages/701202573, get source files of SP7021 and build SP7021 Linux image for booting from eMMC device. Refer to log of running make:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 wells@wells-linux:~/q628/emmc$ make make[1]: Entering directory '/home/wells/q628/emmc' make[2]: Entering directory '/home/wells/q628/emmc/boot/xboot' >>>>>>>>>>> Build draminit make -C ../draminit ARCH=arm CROSS=/home/wells/q628/emmc/crossgcc/armv5-eabi--glibc--stable/bin/armv5-glibc-linux- MKIMAGE= [KCFG] auto_config.h tools/auto_config/auto_config_h .config include/auto_config.h : : : make[3]: Leaving directory '/home/wells/q628/emmc/build/tools/isp' -e Copy xboot.img to out folder. -e Copy u-boot.img to out folder. -e Copy nonos img to out folder. 'linux/kernel/arch/arm/boot/uImage' -> 'out/uImage' 'linux/kernel/dtb' -> 'out/dtb' -e Copy dtb to out folder. -e Copy rootfs.img to out folder. 'linux/rootfs/rootfs.img' -> 'out/rootfs.img' Unit in sector (512 bytes): CONFIG_SRCADDR_DTB=0x2022 CONFIG_SRCADDR_KERNEL=0x2222 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv uboot2 0x68800/0x100000 (40.82%) used env 0x0/0x80000 (0.00%) used env_redund 0x0/0x80000 (0.00%) used nonos 0xc000/0x100000 (4.69%) used dtb 0x5000/0x40000 (7.81%) used kernel 0x410800/0x2000000 (12.70%) used rootfs 0x4ca000/0x1e0000000 (0.06%) used ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ make[2]: Leaving directory '/home/wells/q628/emmc' make[1]: Leaving directory '/home/wells/q628/emmc' wells@wells-linux:~/q628/emmc$

Use ll command to list contents of out folder:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 wells@wells-linux:~/q628/emmc$ ll out total 20336 drwxrwxr-x 2 wells wells 4096 Jul 2 18:20 ./ drwxrwxr-x 13 wells wells 4096 Jul 2 18:20 ../ -rw-rw-r-- 1 wells wells 49152 Jul 2 18:20 a926.img -rw-rw-r-- 1 wells wells 134144 Jul 2 18:17 down_32M.exe -rw-rw-r-- 1 wells wells 20480 Jul 2 18:20 dtb -rw-rw-r-- 1 wells wells 11317248 Jul 2 18:20 ISPBOOOT.BIN lrwxrwxrwx 1 wells wells 34 Jul 2 18:17 isp.sh -> /home/wells/q628/emmc/build/isp.sh* lrwxrwxrwx 1 wells wells 35 Jul 2 18:17 part.sh -> /home/wells/q628/emmc/build/part.sh* -rw-rw-r-- 1 wells wells 5021696 Jul 2 18:20 rootfs.img -rw-rw-r-- 1 wells wells 427708 Jul 2 18:20 u-boot.img -rw-rw-r-- 1 wells wells 4261664 Jul 2 18:20 uImage -rw-rw-r-- 1 wells wells 25320 Jul 2 18:20 xboot.img wells@wells-linux:~/q628/emmc$

11. Copy image of rootfs partition of Raspbian

Plug your Raspbian SD card (created at step 3) into an USB SD card reader and plug your USB SD card reader into USB socket of your Linux (compiler) computer. Use dd command to copy image of rootfs partition of Raspbian.

1 2 3 4 5 6 wells@wells-linux:~/q628/emmc$ sudo dd if=/dev/sda2 of=rpi_rootfs_2020_0527.img [sudo] password for wells: 13852672+0 records in 13852672+0 records out 7092568064 bytes (7.1 GB, 6.6 GiB) copied, 76.3667 s, 92.9 MB/s wells@wells-linux:~/q628/emmc$

where rootfs partition of Raspbian is at /dev/sda2. 6.6 GiB of rootfs image was copied and stored at file rpi_rootfs_2020_0527. Refer to report of ll command:

1 2 3 wells@wells-linux:~/q628/emmc$ ll rpi_rootfs_2020_0527.img -rw-r--r-- 1 root root 7092568064 Jul 2 19:06 rpi_rootfs_2020_0527.img wells@wells-linux:~/q628/emmc$

12. Mount image of rootfs partition of Raspbian to a folder

Refer to log below, use mkdir -p command to create folder rpi_rootfs and use mount -o loop command to mount the Raspbian image file to it.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 wells@wells-linux:~/q628/emmc$ mkdir rpi_rootfs wells@wells-linux:~/q628/emmc$ sudo mount -o loop rpi_rootfs_2020_0527.img rpi_rootfs [sudo] password for wells: wells@wells-linux:~/q628/emmc$ ll rpi_rootfs total 96 drwxr-xr-x 21 root root 4096 May 27 15:09 ./ drwxrwxr-x 14 wells wells 4096 Jul 2 20:30 ../ drwxr-xr-x 2 root root 4096 May 27 15:14 bin/ drwxr-xr-x 2 root root 4096 May 27 15:44 boot/ drwxr-xr-x 4 root root 4096 May 27 15:05 dev/ drwxr-xr-x 116 root root 4096 Jun 23 21:04 etc/ drwxr-xr-x 3 root root 4096 May 27 15:10 home/ drwxr-xr-x 17 root root 4096 May 27 15:22 lib/ drwx------ 2 root root 16384 May 27 15:44 lost+found/ drwxr-xr-x 2 root root 4096 May 27 15:05 media/ drwxr-xr-x 2 root root 4096 May 27 15:05 mnt/ drwxr-xr-x 6 root root 4096 May 27 15:20 opt/ drwxr-xr-x 2 root root 4096 May 11 04:59 proc/ drwx------ 3 root root 4096 May 27 15:15 root/ drwxr-xr-x 4 root root 4096 May 27 15:05 run/ drwxr-xr-x 2 root root 4096 May 27 15:22 sbin/ drwxr-xr-x 2 root root 4096 May 27 15:05 srv/ drwxr-xr-x 2 root root 4096 May 11 04:59 sys/ drwxrwxrwt 4 root root 4096 May 27 15:46 tmp/ drwxr-xr-x 11 root root 4096 May 27 15:16 usr/ drwxr-xr-x 11 root root 4096 May 27 15:05 var/ wells@wells-linux:~/q628/emmc$

13. Modify fstab

Original Raspbian image uses uuid to mount folders / and /boot in file /etc/fstab. Refer to content of linux/rootfs/disk/etc/fstab:

1 2 3 4 5 wells@wells-linux:~/q628/emmc$ cat rpi_rootfs/etc/fstab proc /proc proc defaults 0 0 PARTUUID=6c620f41-01 /boot vfat defaults 0 2 PARTUUID=6c620f41-02 / ext4 defaults,noatime 0 1 wells@wells-linux:~/q628/emmc$

We don’t need to mount folders / and /boot manually. Please use vi or other text editor to mark out the two lines in etc/fstab. Refer to new content of etc/fstab:

1 2 3 4 5 wells@wells-linux:~/q628/emmc$ cat rpi_rootfs/etc/fstab proc /proc proc defaults 0 0 #PARTUUID=6c620f41-01 /boot vfat defaults 0 2 #PARTUUID=6c620f41-02 / ext4 defaults,noatime 0 1 wells@wells-linux:~/q628/emmc$

14. Copy Linux modules to rootfs partition of Raspbian

Copy the following files:

linux/rootfs/initramfs/disk/lib/modules/5.4.35-SUNPLUS-v7+/kernel/

linux/rootfs/initramfs/disk/lib/modules/5.4.35-SUNPLUS-v7+/modules.*

to folder:

rpi_rootfs/lib/modules/5.4.35-SUNPLUS-v7+/

where “5.4.35-SUNPLUS-v7+” is Linux kernel release of SP7021.

15. Un-mount the folder of rootfs partition of Raspbian

Refer to log below, use umount command to un-mount the folder of Raspbian image file.

1 2 3 4 5 6 wells@wells-linux:~/q628/emmc$ sudo umount rpi_rootfs wells@wells-linux:~/q628/emmc$ ll rpi_rootfs total 8 drwxrwxr-x 2 wells wells 4096 Jul 2 20:30 ./ drwxrwxr-x 14 wells wells 4096 Jul 2 20:30 ../ wells@wells-linux:~/q628/emmc$

Refer to log below, use rm command remove original out/rootfs.img and use ln command to link Raspbian image file to out/rootfs.img

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 wells@wells-linux:~/q628/emmc$ rm out/rootfs.img wells@wells-linux:~/q628/emmc$ sudo ln rpi_rootfs_2020_0527.img out/rootfs.img [sudo] password for wells: wells@wells-linux:~/q628/emmc$ ll out total 6942212 drwxrwxr-x 2 wells wells 4096 Jul 2 20:17 ./ drwxrwxr-x 13 wells wells 4096 Jul 2 20:35 ../ -rw-rw-r-- 1 wells wells 49152 Jul 2 20:20 a926.img -rw-rw-r-- 1 wells wells 134144 Jul 2 20:17 down_32M.exe -rw-rw-r-- 1 wells wells 20480 Jul 2 20:19 dtb -rw-rw-r-- 1 wells wells 11317248 Jul 2 20:20 ISPBOOOT.BIN lrwxrwxrwx 1 wells wells 34 Jul 2 20:17 isp.sh -> /home/wells/q628/emmc/build/isp.sh* lrwxrwxrwx 1 wells wells 35 Jul 2 20:17 part.sh -> /home/wells/q628/emmc/build/part.sh* -rw-r--r-- 2 root root 7092568064 Jul 2 20:33 rootfs.img -rw-rw-r-- 1 wells wells 427708 Jul 2 20:20 u-boot.img -rw-rw-r-- 1 wells wells 4261664 Jul 2 20:20 uImage -rw-rw-r-- 1 wells wells 25320 Jul 2 20:20 xboot.img wells@wells-linux:~/q628/emmc$

out/rootfs.img was linked to image file of rootfs of Raspbian.

17. Build ISP files

Go to out folder and run isp.sh script to build ISP files. Refer to log below:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 wells@wells-linux:~/q628/emmc$ cd out wells@wells-linux:~/q628/emmc/out$ ./isp.sh EMMC Unit in sector (512 bytes): CONFIG_SRCADDR_DTB=0x2022 CONFIG_SRCADDR_KERNEL=0x2222 2797568+0 records in 2797568+0 records out 2864709632 bytes (2.9 GB, 2.7 GiB) copied, 22.2388 s, 129 MB/s vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv uboot2 0x68800/0x100000 (40.82%) used env 0x0/0x80000 (0.00%) used env_redund 0x0/0x80000 (0.00%) used nonos 0xc000/0x100000 (4.69%) used dtb 0x5000/0x40000 (7.81%) used kernel 0x410800/0x2000000 (12.70%) used rootfs 0x1a6c00000/0x1e0000000 (88.07%) used ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ wells@wells-linux:~/q628/emmc/out$

Two binary files, ISPBOOOT.BIN and ISPBOOT1.BIN were created in out folder. Refer to report of ll out command:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 wells@wells-linux:~/q628/emmc/out$ ll total 13865204 drwxrwxr-x 2 wells wells 4096 Jul 2 20:42 ./ drwxrwxr-x 13 wells wells 4096 Jul 2 20:35 ../ -rw-rw-r-- 1 wells wells 49152 Jul 2 20:20 a926.img -rw-rw-r-- 1 wells wells 134144 Jul 2 20:17 down_32M.exe -rw-rw-r-- 1 wells wells 20480 Jul 2 20:19 dtb -rw-rw-r-- 1 wells wells 4235740160 Jul 2 20:42 ISPBOOOT.BIN -rw-rw-r-- 1 wells wells 2864709632 Jul 2 20:41 ISPBOOT1.BIN lrwxrwxrwx 1 wells wells 34 Jul 2 20:17 isp.sh -> /home/wells/q628/emmc/build/isp.sh* lrwxrwxrwx 1 wells wells 35 Jul 2 20:17 part.sh -> /home/wells/q628/emmc/build/part.sh* -rw-r--r-- 2 root root 7092568064 Jul 2 20:33 rootfs.img -rw-rw-r-- 1 wells wells 427708 Jul 2 20:20 u-boot.img -rw-rw-r-- 1 wells wells 4261664 Jul 2 20:20 uImage -rw-rw-r-- 1 wells wells 25320 Jul 2 20:20 xboot.img wells@wells-linux:~/q628/emmc/out$

18. Copy ISPBOOOT.BIN and ISPBOOTx.BIN to an USB flash drive

Copy the built binary files, ISPBOOOT.BIN, ISPBOOT1.BIN, ISPBOOT2.BIN, … 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.

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

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

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

20. Write all SP7021 images to eMMC device

Plug your USB flash drive which contains ISPBOOOT.BIN, ISPBOOT1.BIN, ISPBOOT2.BIN, … files into an USB socket of SP7021 board. Turn on power of SP7021 board. After power on, SP7021 starts to write the images to eMMC one by one. Wait for writing to complete. Finally, you will see screen like:

1 2 3 4 5 6 7 Environment size: 8897/524284 bytes Saving Environment to MMC... Writing to MMC(0)... OK Saving Environment to MMC... Writing to MMC(0)... OK ************************************************** ISP all: Done ************************************************** =>

ISP all: Done” means all images were written to eMMC and verified successfully.

Note that in-system-program (ISP) of SP7021 does not support USB hub. The USB flash drive for ISP should be plugged into USB socket of SP7021 board directly.

If you are using Banana Pi BPI-F2P boards, please plug you USB flash drive to the micro USB socket for ISP. It is the only USB socket that is connected to SP7021 directly.

21. Boot Linux from eMMC device

Set DIP-SW (boot select switch) to “boot from eMMC device”. For example, if you are using SP7021 Demo Board (V1/V2/V3), please set DIP-SW to OFF-OFF (1-1) for booting from eMMC device. Refer to picture below:

DIP-SW is set to OFF-OFF. Now, you are ready to boot SP7021 Linux from eMMC device.

Remove the USB drive, and then turn on power to boot Linux with Raspbian from eMMC device. After Raspbian starts up successfully, it will ask you to enter account name and password. The default user of Raspbian is pi, and the default password is raspberry.