How to build SP7021 Linux image for booting from SPI-NOR flash

The goal of the document is to illustrate how to build SP7021 Linux image for booting from SPI-NOR flash on SP7021 boards. SP7021 build (make) system supports two types of root file-system for SPI-NOR flash. One is initramfs file-system and other is jffs2 file-system. If you choose initramfs file-system, build system merges root file-system into Linux kernel. The whole kernel (kernel + root file-system) is loaded into and operates in DRAM directly. The advantage of initramfs file-system is that accessing speed is very fast. But since it is stored in DRAM, all changes disappear when power off. If you choose jffs2 file-system, root file-system is compressed and is stored in rootfs partition of SPI-NOR flash. The drawback of jffs2 file-system is that accessing speed is slow. But all changes are kept in SPI-NOR flash when power off.

To build image of SPI-NOR flash, first, you need to get source files of SP7021 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 two binary files named spi_all.bin and ISPBOOOT.BIN. Third, you need to either use flash programmer to write the spi_all.bin to SPI-NOR flash or copy ISPBOOOT.BIN to an USB drive to in-system program SPI-NOR flash. Finally, set DIP-SW to “boot from SPI-NOR flash”. You are now ready to turn on SP7021 power to boot Linux from SPI-NOR flash. 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/nor$ ll total 52 drwxr-xr-x 12 wellslu sp 4096 Oct 15 12:01 ./ drwxr-xr-x 19 wellslu sp 4096 Oct 15 11:53 ../ drwxr-xr-x 8 wellslu sp 4096 Apr 27 18:51 boot/ drwxr-xr-x 4 wellslu sp 4096 Aug 25 12:05 build/ drwxr-xr-x 7 wellslu sp 4096 Jul 27 12:23 crossgcc/ drwxr-xr-x 6 wellslu sp 4096 Apr 27 18:51 eCos/ drwxr-xr-x 9 wellslu sp 4096 Jun 5 09:30 freertos/ drwxr-xr-x 8 wellslu sp 4096 Aug 11 16:40 ipack/ drwxr-xr-x 7 wellslu sp 4096 Apr 27 18:51 linux/ -r--r--r-- 1 wellslu sp 23 Apr 27 18:51 Makefile drwxr-xr-x 4 wellslu sp 4096 Apr 27 18:51 nonos/ drwxr-xr-x 7 wellslu sp 4096 Apr 27 18:51 .repo/ drwxr-xr-x 3 wellslu sp 4096 Jun 29 09:44 yocto/

2. Configure environment

Run make config command on top folder. After configuration menu pops up, first, choose a 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 (quad core CA7). Finally, press 3 (jffs2) or 4 (initramfs) to choose to boot from SPI-NOR flash 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. Modify device-tree source file

This step is for jffs2 (3) root file-system. Please skip this step if you are using initramfs (4) root file-system.

Modify device-tree node sp_spinor0 in device-tree source file linux/kernel/arch/arm/boot/dts/sp7021-ev.dts to setup operating frequency SPI-NOR flash and pins as shown below:

&sp_spinor0 { spi-max-frequency = <50000000>; spi-chip-selection = <0>; pinctrl-names = "default"; pinctrl-0 = <&spi_flash2_mux &spi_fla4b2_mux>; }

where operating frequency of SPI-NOR flash is 50 MHz and SPI-NOR flash is installed in pin-group: spi_flash2_mux and spi_fla4b2_mux. Set them base on your real hardware installation.

4. Remove SECT_4K flag of SPI-NOR flash

This step is for jffs2 (3) root file-system. Please skip this step if you are using initramfs (4) root file-system.

Some SPI-NOR flashes support 4 kB sector-erase, but mkfs.jffs2 -e option does not support 4 kB size of erase. Please remove SECT_4K flag in C file “driver/mtd/spi-nor/spi-nor.c” if your NOR flash support 4 KB sector-erase . Refer to screenshot of diff report, SECT_4K flag of Winbond w25q128 flashes are removed.

5. Build SPI-NOR image

Run make all command to start to create all images of SP7021. It may take several minutes to complete. At almost final stage of building processes, make will ask you to select the use of iBoot,

Please press x and enter to continue the processes. After make all completes, you will see screen like:

Two binary files spi_all.bin and ISPBOOOT.BIN are built and copied to folder out. You Refer to screenshot of output of ll out command:

Binary file spi_all.bin is a pure image of SPI-NOR flash. You can use a flash programmer to write the image into an SPI-NOR flash. Refer to step 6 for detail.

Binary file ISPBOOOT.BIN consists of boot-loader (x-boot), u-boot and image of SPI-NOR flash. You can copy it to an USB drive to in-system program SPI-NOR image to SPI-NOR flash on SP7021 boards. Refer to step 7 for detail.

6. Write your SPI-NOR flash using flash programmer

Put your SPI-NOR flash chip into socket of a flash programmer. Be careful about the pin 1 position of the chip. It should be at the same corner of pin 1 of socket. Refer to picture below, an SPI-NOR flash is placed at socket of a GZUT USB flash programmer.

Run flash programmer application, for example, run GZUT_OnePro in Windows. After application window pops up, then load binary file, spi_all.bin. Press “Auto” to start to write processes automatically (including erase, write and verify). Refer to screenshot below, a Winbond 128 Mibit (16 MiB) flash chip (W25Q128) has been programmed and verified successfully.

Remove the SPI-NOR flash chip from socket. Plug the written SPI-NOR flash into socket of SPI-NOR flash of SP7021 boards.

Note that the size of spi_all.bin is about 12 MiB. So, size of SPI-NOR flash chip should be 16 MiB (or 128 Mibit) or greater.

7. In-system program SPI-NOR flash

First, copy the file ISPBOOOT.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. Also note that FAT32 file-system should be in the first or the sole partition of the USB flash drive.

Second, 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.

Third, plug your USB flash drive which contains ISPBOOOT.BIN into either USB socket of SP7021 board.

Finally, turn on power of SP7021 board. After power on, SP7021 starts to ”boot from USB” drive. It first loads boot-loader (x-boot) from ISPBOOOT.BIN in USB flash drive. Boot-loader loads u-boot. u-boot then runs built-in scripts which writes image to SPI-NOR flash and verify it. The processes takes 1 ~ 2 minutes. Please wait for the processes completing. At the end of processes, you will see screen like:

“ISP all: Done” means in-system program processes are done 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.

8. Set DIP-SW to “boot from SPI-NOR flash”

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

Now, you are ready to boot SP7021 Linux from SPI-NOR flash. Turn on power of SP7021 board to boot system.

Appendix A. Layout of partitions of SPI-NOR flash

Refer to layout of partitions of a 16 MiB SPI-NOR flash. There are 6 partitions in SPI-NOR flash. The figures in parenthesis of each partition is the size of the partition. Note that root file-system of Linux is built into kernel.

Appendix B. Log of ISP-ing of SPI-NOR flash

+++iBoot v1.02 Jan 10 2019 11:20:28 -- B -- [d] iboot.c :96 [d] iboot.c :107 [d] iboot.c :877 hw_cfg=0x00017BFF bootmode=0x00000017 [d] iboot.c :813 [d] iboot.c :316 [[usb_isp]] usb0 [d] bootmain.c :116 dev=1 pin=0 find file [d] fat_boot.c :181 [d] fat_boot.c :189 [d] ehci_usb.c :229 [d] ehci_usb.c :239 Reset EHCI ......................... No usb device on port 0 [d] fat_boot.c :213 [d] iboot.c :285 not found usb1 [d] bootmain.c :116 dev=1 pin=0 find file [d] fat_boot.c :181 [d] fat_boot.c :189 [d] ehci_usb.c :229 [d] ehci_usb.c :239 Reset EHCI usb1 connected(0ms) enum u-disk get dev desc (64) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 64 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 vid=85 64 pid=10 00 rev=11 00 set addr [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 get dev desc (18) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 18 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 get conf desc (9) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 9 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 get conf desc (9) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 32 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 set config 1 [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 Test Unit Ready (0) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (1) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (2) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (3) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (4) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :218 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :230 part@0x00000800 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :259 [d] fat_boot.c :295 [d] fat_boot.c :314 [d] fat_boot.c :318 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :337 load file [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 mg=0x54554258 len=0x00006418 chk=0x0000B9B3 flg=0x00000001 [d] bootmain.c :338 OTP pub-key: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Verify signature...(AB) FAIL signature: B1 87 E3 11 8D E1 2D FD D8 E3 82 3B 92 90 4B E5 08 CF E1 80 EC 00 3F F3 86 25 75 ED 7A 73 7B 11 69 F8 E6 9F 1A CB 2A 6D E4 BE DD 9E C8 1D D4 8D 7F 17 3D EC 0F 99 97 E9 B9 74 AD D0 58 FA 59 06 tV=88 OTP Secure Boot is OFF boot! ..336610 +++xBoot Apr 20 2021 17:12:54 [d] xboot.c :162 -- B -- B: b_sysclk=202M abio_ctrl=(16bit,DDR) [d] xboot.c :228 [otp_rw.c]otp_rw in otp_rw.c]otp_rw out mode=0x00000017 [d] xboot.c :1659 [d] xboot.c :1015 {{usb_isp}} finding file [d] fat/fat_boot.c :284 [d] fat/fat_boot.c :294 [d] usb/ehci_usb.c :227 [d] usb/ehci_usb.c :237 Reset EHCI usb1 connected(2ms) enum u-disk get dev desc (64) vid=85 64 pid=10 00 rev=11 00 set addr get dev desc (18) get conf desc (18) get conf desc (32) set config 1 Test Unit Ready (0) Test Unit Ready (1) Test Unit Ready (2) Test Unit Ready (3) Test Unit Ready (4) [d] fat/fat_boot.c :343 [d] fat/fat_boot.c :355 part@0x00000800 [d] fat/fat_boot.c :397 FAT32 file system [d] fat/fat_boot.c :473 [d] fat/fat_boot.c :505 [d] fat/fat_boot.c :509 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 ++iBoot v1.02 Jan 10 2019 11:20:28 -- B -- [d] iboot.c :96 [d] iboot.c :107 [d] iboot.c :877 hw_cfg=0x00017BFF bootmode=0x00000017 [d] iboot.c :813 [d] iboot.c :316 [[usb_isp]] usb0 [d] bootmain.c :116 dev=1 pin=0 find file [d] fat_boot.c :181 [d] fat_boot.c :189 [d] ehci_usb.c :229 [d] ehci_usb.c :239 Reset EHCI ......................... No usb device on port 0 [d] fat_boot.c :213 [d] iboot.c :285 not found usb1 [d] bootmain.c :116 dev=1 pin=0 find file [d] fat_boot.c :181 [d] fat_boot.c :189 [d] ehci_usb.c :229 [d] ehci_usb.c :239 Reset EHCI usb1 connected(0ms) enum u-disk get dev desc (64) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 64 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 vid=85 64 pid=10 00 rev=11 00 set addr [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 get dev desc (18) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 18 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 get conf desc (9) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 9 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 get conf desc (9) [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 32 [d] ehci_usb.c :653 [d] ehci_usb.c :701 Out 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 set config 1 [d] ehci_usb.c :727 Setup 8 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 0 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :762 Test Unit Ready (0) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (1) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (2) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (3) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 Test Unit Ready (4) [d] ehci_usb.c :459 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :218 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :230 part@0x00000800 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :259 [d] fat_boot.c :295 [d] fat_boot.c :314 [d] fat_boot.c :318 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :321 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] fat_boot.c :337 load file [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 4096 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 [d] ehci_usb.c :534 [d] ehci_usb.c :775 Out 31 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 512 [d] ehci_usb.c :653 [d] ehci_usb.c :701 In 13 [d] ehci_usb.c :653 [d] ehci_usb.c :701 [d] ehci_usb.c :842 mg=0x54554258 len=0x00006418 chk=0x0000B9B3 flg=0x00000001 [d] bootmain.c :338 OTP pub-key: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Verify signature...(AB) FAIL signature: B1 87 E3 11 8D E1 2D FD D8 E3 82 3B 92 90 4B E5 08 CF E1 80 EC 00 3F F3 86 25 75 ED 7A 73 7B 11 69 F8 E6 9F 1A CB 2A 6D E4 BE DD 9E C8 1D D4 8D 7F 17 3D EC 0F 99 97 E9 B9 74 AD D0 58 FA 59 06 tV=88 OTP Secure Boot is OFF boot! ..336610 +++xBoot Apr 20 2021 17:12:54 [d] xboot.c :162 -- B -- B: b_sysclk=202M abio_ctrl=(16bit,DDR) [d] xboot.c :228 [otp_rw.c]otp_rw in otp_rw.c]otp_rw out mode=0x00000017 [d] xboot.c :1659 [d] xboot.c :1015 {{usb_isp}} finding file [d] fat/fat_boot.c :284 [d] fat/fat_boot.c :294 [d] usb/ehci_usb.c :227 [d] usb/ehci_usb.c :237 Reset EHCI usb1 connected(2ms) enum u-disk get dev desc (64) vid=85 64 pid=10 00 rev=11 00 set addr get dev desc (18) get conf desc (18) get conf desc (32) set config 1 Test Unit Ready (0) Test Unit Ready (1) Test Unit Ready (2) Test Unit Ready (3) Test Unit Ready (4) [d] fat/fat_boot.c :343 [d] fat/fat_boot.c :355 part@0x00000800 [d] fat/fat_boot.c :397 FAT32 file system [d] fat/fat_boot.c :473 [d] fat/fat_boot.c :505 [d] fat/fat_boot.c :509 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :512 [d] fat/fat_boot.c :528 Run draiminit@0x9E80601D Done draiminit dram test 0x00800000 - 0x00800400 fat load uboot load data size=427641 start verify in xboot! ******OTP Secure Boot is OFF, return success****** uboot_pentagram_board boot next @0x00200040 put bootinfo wake up A A_G0.11(pll): 0x00445149 A_G0.3(abio): 0x00020718 A_G0.18(ioctrl): 0x00F1E004 U-Boot 2019.04-g3c37ae1 (Apr 20 2021 - 17:13:02 +0800) CONFIG_SYS_CACHELINE_SIZE: 64 Model: SP7021/CA7/Ev DRAM: 512 MiB clk@osc0 : 27000000 Hz clk@0 : 13500000 Hz clk@A_pll0 : 2000000000 Hz plla : 135475200 Hz plle : 50000000 Hz plle_2p5 : 2500000 Hz plle_25 : 25000000 Hz plle_112p5 : 112500000 Hz pllf : 202500000 Hz plltv : 148500000 Hz plltv_a : 148500000 Hz pllsys : 202500000 Hz SPI: Manufacturer id = 0x00, Device id = 0x0000 MMC: sd: 0 In: serial Out: serial Err: serial Reason(s) of reset: REG(116, 22): 0x0002 After cleaning REG(116, 22): 0x0000 arch/arm/mach-pentagram/cpu.c, arch_misc_init: TBD. Net: Warning: l2sw@0x9c108000 using MAC address from ROM eth0: l2sw@0x9c108000 Hit any key to stop autoboot: 0 [scr] bootcmd started 9e809408: 00000017 .... [scr] ISP from USB storage starting USB... USB0: ehci_sunplus_probe.383, dev_name:usb@0x9C102100,port_num:0 after write usbruncmd,usbcmd:80b01,retry_times:0 USB EHCI 1.10 USB1: ehci_sunplus_probe.383, dev_name:usb@0x9C103100,port_num:1 after write usbruncmd,usbcmd:80b01,retry_times:1 USB EHCI 1.10 scanning bus 0 for devices... 1 USB Device(s) found scanning bus 1 for devices... 2 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found 2048 bytes read in 29 ms (68.4 KiB/s) isp_main_storage=nor ## Executing script at 01000020 ISP file from USB storage Interface: USB Device 0: Vendor: JetFlash Rev: 1100 Prod: Transcend 16GB Type: Removable Hard Disk Capacity: 15480.0 MB = 15.1 GB (31703040 x 512) Filesystem: FAT32 "NO NAME " 13100032 ISPBOOOT.BIN 1 file(s), 0 dir(s) Load NOR ISP script and run it... 5120 bytes read in 34 ms (146.5 KiB/s) ## Executing script at 01000000 Initialize NOR flash... SF: Detected W25Q128BV with page size 256 Bytes, erase size 64 KiB, total 16 MiB Erase whole chip (16 MiB)... SF: 1048576 bytes @ 0x0 Erased: OK SF: 1048576 bytes @ 0x100000 Erased: OK SF: 1048576 bytes @ 0x200000 Erased: OK SF: 1048576 bytes @ 0x300000 Erased: OK SF: 1048576 bytes @ 0x400000 Erased: OK SF: 1048576 bytes @ 0x500000 Erased: OK SF: 1048576 bytes @ 0x600000 Erased: OK SF: 1048576 bytes @ 0x700000 Erased: OK SF: 1048576 bytes @ 0x800000 Erased: OK SF: 1048576 bytes @ 0x900000 Erased: OK SF: 1048576 bytes @ 0xa00000 Erased: OK SF: 1048576 bytes @ 0xb00000 Erased: OK SF: 1048576 bytes @ 0xc00000 Erased: OK SF: 1048576 bytes @ 0xd00000 Erased: OK SF: 1048576 bytes @ 0xe00000 Erased: OK SF: 1048576 bytes @ 0xf00000 Erased: OK Program image to flash... 1048576 bytes read in 44 ms (22.7 MiB/s) device 0 offset 0x0, size 0x100000 SF: 1048576 bytes @ 0x0 Written: OK 1048576 bytes read in 50 ms (20 MiB/s) device 0 offset 0x100000, size 0x100000 SF: 1048576 bytes @ 0x100000 Written: OK 1048576 bytes read in 49 ms (20.4 MiB/s) device 0 offset 0x200000, size 0x100000 SF: 1048576 bytes @ 0x200000 Written: OK 1048576 bytes read in 50 ms (20 MiB/s) device 0 offset 0x300000, size 0x100000 SF: 1048576 bytes @ 0x300000 Written: OK 1048576 bytes read in 50 ms (20 MiB/s) device 0 offset 0x400000, size 0x100000 SF: 1048576 bytes @ 0x400000 Written: OK 1048576 bytes read in 49 ms (20.4 MiB/s) device 0 offset 0x500000, size 0x100000 SF: 1048576 bytes @ 0x500000 Written: OK 1048576 bytes read in 50 ms (20 MiB/s) device 0 offset 0x600000, size 0x100000 SF: 1048576 bytes @ 0x600000 Written: OK 1048576 bytes read in 44 ms (22.7 MiB/s) device 0 offset 0x700000, size 0x100000 SF: 1048576 bytes @ 0x700000 Written: OK 1048576 bytes read in 43 ms (23.3 MiB/s) device 0 offset 0x800000, size 0x100000 SF: 1048576 bytes @ 0x800000 Written: OK 1048576 bytes read in 43 ms (23.3 MiB/s) device 0 offset 0x900000, size 0x100000 SF: 1048576 bytes @ 0x900000 Written: OK 1048576 bytes read in 43 ms (23.3 MiB/s) device 0 offset 0xa00000, size 0x100000 SF: 1048576 bytes @ 0xa00000 Written: OK 495616 bytes read in 29 ms (16.3 MiB/s) device 0 offset 0xb00000, size 0x79000 SF: 495616 bytes @ 0xb00000 Written: OK Verifying... device 0 offset 0x0, size 0x100000 SF: 1048576 bytes @ 0x0 Read: OK md5 for 01000000 ... 010fffff ==> 283f2c43248f8cbeaf82638e9626e6ca md5sum: OK. device 0 offset 0x100000, size 0x100000 SF: 1048576 bytes @ 0x100000 Read: OK md5 for 01000000 ... 010fffff ==> 2f7bc78a98e4b9cf561ac1793b1f9f7a md5sum: OK. device 0 offset 0x200000, size 0x100000 SF: 1048576 bytes @ 0x200000 Read: OK md5 for 01000000 ... 010fffff ==> 2f9f5e9cddff6e574a6142221d6bd55b md5sum: OK. device 0 offset 0x300000, size 0x100000 SF: 1048576 bytes @ 0x300000 Read: OK md5 for 01000000 ... 010fffff ==> 6aeb06eb474613e0bcf1cf02e8f3c60b md5sum: OK. device 0 offset 0x400000, size 0x100000 SF: 1048576 bytes @ 0x400000 Read: OK md5 for 01000000 ... 010fffff ==> c9460c0e937c90586a67312a8a2884ff md5sum: OK. device 0 offset 0x500000, size 0x100000 SF: 1048576 bytes @ 0x500000 Read: OK md5 for 01000000 ... 010fffff ==> fe8f6257567d9ed5c4be2bafba70b6fc md5sum: OK. device 0 offset 0x600000, size 0x100000 SF: 1048576 bytes @ 0x600000 Read: OK md5 for 01000000 ... 010fffff ==> 936b674b1d7a378beb1460fa48ad53d6 md5sum: OK. device 0 offset 0x700000, size 0x100000 SF: 1048576 bytes @ 0x700000 Read: OK md5 for 01000000 ... 010fffff ==> 994f5a88be7e45cf5909b05a3a19e962 md5sum: OK. device 0 offset 0x800000, size 0x100000 SF: 1048576 bytes @ 0x800000 Read: OK md5 for 01000000 ... 010fffff ==> 5606b8aa0bb6e9233930bfab0b39fc5a md5sum: OK. device 0 offset 0x900000, size 0x100000 SF: 1048576 bytes @ 0x900000 Read: OK md5 for 01000000 ... 010fffff ==> 890b41c432543ce151ef13122fa0b11c md5sum: OK. device 0 offset 0xa00000, size 0x100000 SF: 1048576 bytes @ 0xa00000 Read: OK md5 for 01000000 ... 010fffff ==> d084a40d0ff729ef6e9d0fd16fe2670b md5sum: OK. device 0 offset 0xb00000, size 0x79000 SF: 495616 bytes @ 0xb00000 Read: OK md5 for 01000000 ... 01078fff ==> 7cc8e23ce2da1c926acdc902113509f3 md5sum: OK. ************************************************** ISP all: Done ************************************************** =>

Appendix C. Log of Booting from SPI-NOR (jffs2) flash

Refer to report of df command:

Type of file-system is jffs2. Total size is 10.2 MB. Used is 6.0 MB. Available is 4.1 MB.

Appendix D. Log of Booting from SPI-NOR (initramfs) flash

Refer to report of df command: