How to build SP7021 Linux image for booting from SD card

The goal of the document is to illustrate how to create an SD card with SP7021 Linux kernel and root file-system. 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 GitHub - 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:

wells@wells-linux:~/q628/sdc$ ll total 52 drwxrwxr-x 12 wells wells 4096 Dec 5 00:42 ./ drwxrwxr-x 12 wells wells 4096 Oct 16 23:01 ../ drwxrwxr-x 8 wells wells 4096 Jun 7 19:59 boot/ drwxrwxr-x 4 wells wells 4096 Nov 20 23:10 build/ drwxrwxr-x 7 wells wells 4096 Jul 27 18:53 crossgcc/ drwxrwxr-x 6 wells wells 4096 Jun 7 19:59 eCos/ drwxrwxr-x 9 wells wells 4096 Jun 15 21:52 freertos/ drwxrwxr-x 8 wells wells 4096 Dec 4 23:02 ipack/ drwxrwxr-x 7 wells wells 4096 Jun 7 19:59 linux/ -r--r--r-- 1 wells wells 23 Jun 7 19:59 Makefile drwxrwxr-x 4 wells wells 4096 Jun 7 19:59 nonos/ drwxrwxr-x 7 wells wells 4096 Jun 7 19:59 .repo/ drwxrwxr-x 3 wells wells 4096 Jun 27 16:34 yocto/

2. Configure environment

Get latest source files of SP7021 from git server of SP7021 (2. HOW TO GET SOURCE FILE AND PACKAGE) and run make config command on top folder. After configuration menu pops up, first, choose board you want to build image for. For example, press 4 for SP7021 Demo Board (V3). Second, press 2 to choose to build image for SD card and then enter to start to configure building environment. Refer to screenshot below:

make config is starting to configure building environment. It takes 1~2 minutes to complete.

3. Build all images

Run make all command to start to create image for SD card. It might take several minutes to complete. After 'make all' completes, you will see screen like:

From information on screenshot, two partitions are created in the image of SD card. The first partition starts at sector 2,048 and ends at sector 264,191. Its size is 128 MiB and file-system is W95 FAT32. The second partition starts at sector 264,192 and ends at sector 297,647. Its size is 16.3 MiB and file-system is Linux (ext4).

4. Image files

The built image files are stored at out/boot2linux_SDcard/. Refer to screenshot of list of the folder:

ISPBOOOT.BIN is a binary file in which xboot is stored. xboot is a boot-loader which loads and runs u-boot during power-on booting processes. u-boot.img is u-boot image file. u-boot is the second stage boot-loader. It loads and runs Linux kernel image. uImage is an image file of compressed Linux kernel with u-boot header. uEnv.txt is an environment file of u-boot. u-boot imports environment variables in the file after it completes initializing. If uenvcmd command is defined in uEnv.txt, u-boot runs the uenvcmd command after it completes importing uEnv.txt. a926.img is an image file for processor A926. A926 processor is designed for taking care of real-time tasks. The default script of u-boot will load and run a926.img it if it exists in root of boot partition.

ISP_SD_BOOOT.img is an image for burning an SD card. It actually contains all files in both partitions.

5. Write image to an SD card

Use an application to write image file, ISP_SD_BOOOT.img, to an SD card. The capacity of SD card should be larger than size of image file, ISP_SD_BOOOT.img. For example, if you want to use “Win32 Disk Imager” to write image to an SD card. First, download the it from https://sourceforge.net/projects/win32diskimager/:

Then, install and run it. After application window pops, select “Image File” and “Device”. Finally, press “Write” button to start to write. Refer to screenshot when “Win32 Disk Imager” is writing image file, ISP_SD_BOOOT.img, to an SD card (G:\) below:

Another example is using “balenaEtcher”. Refer to screenshot when “balenaEtcher” is writing image file, ISP_SD_BOOOT.img, to an SD card below:

6. Boot from an SD card

Insert your SD card to SP7021 board and set its DIP-SW to “boot from SD card”. For example, if you are using SP7021 Demo Board (V1/V2/V3), you need to set DIP-SW to ON-ON for booting from SD card. Refer to picture below:

DIP-SW is set to ON-ON. Refer to Selection of boot devices of SP7021 for details of boot selection.

Turn on power of SP7021 board to start booting.

7. Extend size of root file-system

At the first time, Linux boots from a new SD card. The built-in script of Linux will run fdisk command to extend the size of rootfs partition to the end of SD card and then re-boot. Refer to log while Linux script is extending size of rootfs partition:

[ 1.808734] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null) [ 1.808981] VFS: Mounted root (ext4 filesystem) on device 179:26. [ 1.812659] devtmpfs: mounted [ 1.816636] Freeing unused kernel memory: 1024K [ 1.861603] Run /sbin/init as init process [ 1.867129] random: fast init done /etc/init.d/rcS starts... Mounting other filesystems ... rc.extra [bg] sdcard boot set... partition set 0x0000AA9F 0x00000007 totalsize=15836643328 extra done totalsize=30930936 startsector=264192 The number of cylinders for this disk is set to 483296. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): Disk /dev/mmcblk1: 15 GB, 15836643328 bytes, 30930944 sectors 483296 cylinders, 4 heads, 16 sectors/track Units: sectors of 1 * 512 = 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk1p1 0,32,33 16,113,33 2048 264191 262144 128M b Win95 FAT32 /dev/mmcblk1p2 16,113,34 18,134,36 264192 297647 33456 16.3M 83 Linux Command (m for help): Partition number (1-4): Command (m for help): Partition type p primary partition (1-4) e extended Partition number (1-4): First sector (16-30930943, default 16): Last sector or +size{,K,M,G,T} (264192-30930943, default 30930943): Command (m for help): Disk /dev/mmcblk1: 15 GB, 15836643328 bytes, 30930944 sectors 483296 cylinders, 4 heads, 16 sectors/track Units: sectors of 1 * 512 = 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk1p1 0,32,33 16,113,33 2048 264191 262144 128M b Win95 FAT32 /dev/mmcblk1p2 1023,3,16 1023,3,16 264192 30930936 30666745 14.6G 83 Linux Command (m for help): The partition table has been altered. Calling ioctl() to re-read partition table fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy End of /etc/init.d/rcS [ 3.971530] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null) The system is going down NOW! Sent SIGTERM to all processes Sent SIGKILL to all processes Requesting system reboot [ 6.672461] reboot: Restarting system sp_restart +++iBoot v1.02 Jan 10 2019 11:20:28

The latest command in the script is reboot command. You’ll see system re-boots after script completes extending size of rootfs partition.

After system re-boots successfully, built-in script of Linux will run resize2fs to resize the root file-system to make use of the whole partition (It was extended in previous step.). Refer to log (from u-boot to kernel):

U-Boot 2019.04-ge0b14b8 (Dec 07 2020 - 19:12:45 +0800) CONFIG_SYS_CACHELINE_SIZE: 64 Model: SP7021/CA7/Demo V3 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: emmc: 0, sd: 1 Loading Environment from MMC... *** Warning - !ISP mode, using default environment OK In: serial Out: serial Err: serial Reason(s) of reset: REG(116, 22): 0x0012 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: 00000007 .... [scr] ISP from SD Card emmc: 0 (eMMC) sd: 1 ISPBOOOT filesize = 10000 run sdcard_boot 1216 bytes read in 1 ms (1.2 MiB/s) Loaded environment from uEnv.txt Running uenvcmd ... 49152 bytes read in 5 ms (9.4 MiB/s) ## Booting A926 from image at 0x10000 Image Name: uboot Image Type: ARM Linux Sunplus Quick Boot Image (uncompressed) Data Size: 49088 Bytes = 47.9 KiB Load Address: 00010040 Entry Point: 00010040 Verifying Checksum ... OK [u-boot] nonos_B address 0x00010000 nonos_size= 49088 4262424 bytes read in 385 ms (10.6 MiB/s) ## Booting kernel from Legacy Image at 00307fc0 ... Image Name: Linux-5.4.35-SUNPLUS-v7+ Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 4262288 Bytes = 4.1 MiB Load Address: 00308000 Entry Point: 00308000 Verifying Checksum ... OK ******OTP Secure Boot is OFF, return success****** ## Flattened Device Tree blob at 1f901f18 Booting using the fdt blob at 0x1f901f18 XIP Kernel Image ... OK Loading Device Tree to 1f8f8000, end 1f8fff9f ... OK Starting kernel ... Uncompressing Linux... done, booting the kernel. [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 5.4.35-SUNPLUS-v7+ (wellslu@scdiu3) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)) #444 SMP PREEMPT Mon Dec 7 14:44:23 CST 2020 [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: SP7021/CA7/Demo V3 [ 0.000000] printk: bootconsole [earlycon0] enabled [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] sp_map_io [ 0.000000] P_REG: [9c000000-9dffffff] -> [f8000000-f9ffffff] [ 0.000000] C_REG: [9ec00000-9effffff] -> [fa000000-fa3fffff] [ 0.000000] percpu: Embedded 15 pages/cpu s30732 r8192 d22516 u61440 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129412 [ 0.000000] Kernel command line: console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw user_debug=255 rootwait [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear) [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 508480K/522240K available (4096K kernel code, 883K rwdata, 1756K rodata, 1024K init, 349K bss, 13760K reserved, 0K cma-reserved, 0K highmem) [ 0.000000] rcu: Preemptible hierarchical RCU implementation. [ 0.000000] Tasks RCU enabled. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies. [ 0.000000] NR_IRQS: 205 [ 0.000000] random: get_random_bytes called from start_kernel+0x1c7/0x368 with crng_init=0 [ 0.000000] @@@ Sunplus clock init [ 0.000000] plla 135475200 [ 0.000000] plle 50000000 [ 0.000000] plle_2p5 2500000 [ 0.000000] plle_25 25000000 [ 0.000000] plle_112p5 112500000 [ 0.000000] pllf 202500000 [ 0.000000] plltv 148500000 [ 0.000000] pllsys 202500000 [ 0.000000] arch_timer: cp15 timer(s) running at 27.00MHz (phys). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x63a1e71a3, max_idle_ns: 440795203123 ns [ 0.000009] sched_clock: 56 bits at 27MHz, resolution 37ns, wraps every 4398046511093ns [ 0.008125] Switching to timer-based delay loop, resolution 37ns [ 0.014970] Console: colour dummy device 80x30 [ 0.019509] Calibrating delay loop (skipped), value calculated using timer frequency.. 54.00 BogoMIPS (lpj=270000) [ 0.030029] pid_max: default: 32768 minimum: 301 [ 0.035075] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) [ 0.042517] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) [ 0.052066] CPU: Testing write buffer coherency: ok [ 0.057780] CPU0: update cpu_capacity 1024 [ 0.061930] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.127918] Setting up static identity map for 0x400000 - 0x400054 [ 0.134344] rcu: Hierarchical SRCU implementation. [ 0.163646] smp: Bringing up secondary CPUs ... [ 0.219812] CPU1: update cpu_capacity 1024 [ 0.219822] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 [ 0.299760] CPU2: update cpu_capacity 1024 [ 0.299768] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002 [ 0.379854] CPU3: update cpu_capacity 1024 [ 0.379861] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003 [ 0.379987] smp: Brought up 1 node, 4 CPUs [ 0.413799] SMP: Total of 4 processors activated (216.00 BogoMIPS). [ 0.420161] CPU: All CPU(s) started in SVC mode. [ 0.425750] devtmpfs: initialized [ 0.435826] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5 [ 0.444529] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.454550] futex hash table entries: 1024 (order: 4, 65536 bytes, linear) [ 0.462185] pinctrl core: initialized pinctrl subsystem [ 0.468378] NET: Registered protocol family 16 [ 0.473582] DMA: preallocated 256 KiB pool for atomic coherent allocations [ 0.480656] audit: initializing netlink subsys (disabled) [ 0.487225] sp_init [ 0.489353] av1_stc: 0x0005649f [ 0.493087] audit: type=2000 audit(0.440:1): state=initialized audit_enabled=0 res=1 [ 0.493545] P-chip: sys = 202MHz, cpio_ctrl = (16bit, DDR) [ 0.506534] C-chip: core = 931MHz, sys = 465MHz, pllio = 1998MHz, cpio_bus = 399MHz [ 0.514291] apply partial clken to save power [ 0.519121] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers. [ 0.527234] hw-breakpoint: maximum watchpoint size is 8 bytes. [ 0.533206] 1: ext0-mask=0xf [ 0.536128] 2: ext1-mask=0xe [ 0.550860] sppctl pctl: funcs: 156 unq_grps: 140 [ 0.555989] SP7021 PinCtl by Sunplus/Tibbo Tech.(C) 2020 [ 0.601621] SCSI subsystem initialized [ 0.611462] usbcore: registered new interface driver usbfs [ 0.617131] usbcore: registered new interface driver hub [ 0.622715] usbcore: registered new device driver usb [ 0.628100] videodev: Linux video capture interface: v2.00 [ 0.634654] sunplus,sp7021-ocotp 9c00af00.otp: by Sunplus (C) 2020 [ 0.642416] Bluetooth: Core ver 2.22 [ 0.646223] NET: Registered protocol family 31 [ 0.650726] Bluetooth: HCI device and connection manager initialized [ 0.657199] Bluetooth: HCI socket layer initialized [ 0.662152] Bluetooth: L2CAP socket layer initialized [ 0.667311] Bluetooth: SCO socket layer initialized [ 0.672669] clocksource: Switched to clocksource arch_sys_counter [ 0.693128] register sunplus_usb_phy0_driver [ 0.697866] uphy0_irq:36 [ 0.706882] register sunplus_usb_phy1_driver [ 0.711398] uphy1_irq:37 [ 0.720257] register sunplus_usb_otg0_driver [ 0.725425] register sunplus_usb_otg1_driver [ 0.730637] HDMITX installed [ 0.734868] NET: Registered protocol family 2 [ 0.740214] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear) [ 0.748801] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear) [ 0.756721] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear) [ 0.764023] TCP: Hash tables configured (established 4096 bind 4096) [ 0.770661] UDP hash table entries: 256 (order: 1, 8192 bytes, linear) [ 0.777371] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear) [ 0.784899] NET: Registered protocol family 1 [ 0.803074] RPC: Registered named UNIX socket transport module. [ 0.809076] RPC: Registered udp transport module. [ 0.813909] RPC: Registered tcp transport module. [ 0.818673] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.826437] hw perfevents: no interrupt-affinity property for /arm-pmu, guessing. [ 0.834505] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available [ 0.844923] Initialise system trusted keyrings [ 0.849755] workingset: timestamp_bits=14 max_order=17 bucket_order=3 [ 0.857340] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.863939] NFS: Registering the id_resolver key type [ 0.869100] Key type id_resolver registered [ 0.873416] Key type id_legacy registered [ 0.917907] Key type asymmetric registered [ 0.922067] Asymmetric key parser 'x509' registered [ 0.927137] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 0.934687] io scheduler mq-deadline registered [ 0.939278] io scheduler kyber registered [ 0.946136] K_TTYS: sp_uart0's Rx is in PIO mode. [ 0.950915] K_TTYS: sp_uart0's Tx is in PIO mode. [ 0.955751] 9c000900.serial: ttyS0 at MMIO 0x9c000900 (irq = 53, base_baud = 1687500) is a sp_uart0 [ 0.965000] printk: console [ttyS0] enabled [ 0.965000] printk: console [ttyS0] enabled [ 0.973421] printk: bootconsole [earlycon0] disabled [ 0.973421] printk: bootconsole [earlycon0] disabled [ 1.000450] loop: module loaded [ 1.003085] libphy: Fixed MDIO Bus: probed [ 1.003171] CAN device driver interface [ 1.003738] [L2SW] L2 switch mode = 1 [ 1.004181] [L2SW] HW Addr = fc:4b:bc:fb:d3:36 [ 1.009214] [L2SW] Registered net device "eth0" successfully. [ 1.014353] libphy: sunplus_mii_bus: probed [ 1.019808] net eth0: could not add device link to 9c108000.l2sw-mii:01 err -17 [ 1.026930] [L2SW] HW Addr = fc:4b:bc:fb:d3:37 [ 1.030681] [L2SW] Registered net device "eth1" successfully. [ 1.035959] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 1.042230] ehci-platform: EHCI generic platform driver [ 1.047730] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 1.053581] ohci-platform: OHCI generic platform driver [ 1.058916] register ehci0_hcd_sunplus_driver [ 1.063376] ehci0-sunplus 9c102100.usb: Generic Platform EHCI Controller [ 1.069775] ehci0-sunplus 9c102100.usb: new USB bus registered, assigned bus number 1 [ 1.077824] ehci0-sunplus 9c102100.usb: irq 14, io mem 0x9c102100 [ 1.112670] ehci0-sunplus 9c102100.usb: USB 2.0 started, EHCI 1.10 [ 1.114074] hub 1-0:1.0: USB hub found [ 1.114203] hub 1-0:1.0: 1 port detected [ 1.116076] register ehci1_hcd_sunplus_driver [ 1.119937] ehci1-sunplus 9c103100.usb: Generic Platform EHCI Controller [ 1.126372] ehci1-sunplus 9c103100.usb: new USB bus registered, assigned bus number 2 [ 1.134378] ehci1-sunplus 9c103100.usb: irq 17, io mem 0x9c103100 [ 1.162671] ehci1-sunplus 9c103100.usb: USB 2.0 started, EHCI 1.10 [ 1.163863] hub 2-0:1.0: USB hub found [ 1.163977] hub 2-0:1.0: 1 port detected [ 1.165981] register ohci0_hcd_sunplus_driver [ 1.169870] ohci_id:1,irq:15 [ 1.172526] ohci0-sunplus 9c102080.usb: Generic Platform OHCI Controller [ 1.179230] ohci0-sunplus 9c102080.usb: new USB bus registered, assigned bus number 3 [ 1.187203] ohci0-sunplus 9c102080.usb: irq 15, io mem 0x9c102080 [ 1.265622] hub 3-0:1.0: USB hub found [ 1.265745] hub 3-0:1.0: 1 port detected [ 1.266512] register ohci1_hcd_sunplus_driver [ 1.266843] ohci_id:2,irq:18 [ 1.269314] ohci1-sunplus 9c103080.usb: Generic Platform OHCI Controller [ 1.276220] ohci1-sunplus 9c103080.usb: new USB bus registered, assigned bus number 4 [ 1.284014] ohci1-sunplus 9c103080.usb: irq 18, io mem 0x9c103080 [ 1.355624] hub 4-0:1.0: USB hub found [ 1.355737] hub 4-0:1.0: 1 port detected [ 1.356655] usbcore: registered new interface driver usb-storage [ 1.358301] register sunplus_driver_udc [ 1.358301] [ 1.364572] >>> sp_udc_alloc_request... [ 1.364572] [ 1.368650] <<< sp_udc_alloc_request... [ 1.368650] [ 1.374259] zero gadget: Gadget Zero, version: Cinco de Mayo 2008 [ 1.380004] zero gadget: zero ready [ 1.384278] mousedev: PS/2 mouse device common for all mice [ 1.390318] sp7021-rtc 9c003a00.serial: registered as rtc0 [ 1.394505] [RTC] Info: sp7021-rtc loaded [ 1.398769] i2c /dev entries driver [ 1.403608] [DISP][_display_probe:2845] disp probe ... [ 1.407180] [DISP]irq num:4 [ 1.411095] [DISP][_display_probe:3014] disp probe done [ 1.415959] [MIPI] sp_mipi_probe: mipicsi_regs = 0x(ptrval), csiiw_regs = 0x(ptrval) [ 1.423076] [MIPI] cam_gpio0 is at G_MX[92]. [ 1.427176] [MIPI] cam_gpio1 is at G_MX[93]. [ 1.431413] [MIPI] Registered V4L2 device. [ 1.435803] [MIPI] Registered video device '/dev/video0'. [ 1.440845] [MIPI] Got i2c adapter #1. [ 1.446359] [ov5647] Initialized V4L2 I2C subdevice. [ 1.449597] [I2C] Error (292): I2C NACK : wtire !! [ 1.454395] [ov5647] ERR: Unexpected sensor (id = 0x0000, ret = -5)! [ 1.460713] ov5647: probe of 1-0036 failed with error -1 [ 1.467296] [MIPI] ERR: Failed to register V4L2 subdevice! [ 1.472123] usbcore: registered new interface driver uvcvideo [ 1.477183] USB Video Class driver (1.1.1) [ 1.481318] usbcore: registered new interface driver btusb [ 1.523716] spsdc 9c003e80.mmc: Got CD GPIO [ 1.563883] hidraw: raw HID events driver (C) Jiri Kosina [ 1.564301] usbcore: registered new interface driver usbhid [ 1.564394] usbhid: USB HID core driver [ 1.567472] exFAT: Version 1.3.0 [ 1.571427] NET: Registered protocol family 10 [ 1.577144] Segment Routing with IPv6 [ 1.578840] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 1.585877] NET: Registered protocol family 17 [ 1.589076] can: controller area network core (rev 20170425 abi 9) [ 1.595443] NET: Registered protocol family 29 [ 1.599713] can: raw protocol (rev 20170425) [ 1.603926] can: broadcast manager protocol (rev 20170425 t) [ 1.609556] can: netlink gateway (rev 20190810) max_hops=1 [ 1.615381] Bluetooth: RFCOMM TTY layer initialized [ 1.619832] Bluetooth: RFCOMM socket layer initialized [ 1.625049] Bluetooth: RFCOMM ver 1.11 [ 1.628691] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 1.633981] Bluetooth: BNEP filters: protocol multicast [ 1.639177] Bluetooth: BNEP socket layer initialized [ 1.644147] Bluetooth: HIDP (Human Interface Emulation) ver 1.2 [ 1.650531] Bluetooth: HIDP socket layer initialized [ 1.655604] NET: Registered protocol family 37 [ 1.659451] Key type dns_resolver registered [ 1.663651] Key type ceph registered [ 1.668030] libceph: loaded (mon/osd proto 15/24) [ 1.672762] Registering SWP/SWPB emulation handler [ 1.677153] registered taskstats version 1 [ 1.680713] Loading compiled-in X.509 certificates [ 1.686635] mmc0: new DDR MMC card at address 0001 [ 1.693969] mmc1: new high speed SDHC card at address 59b4 [ 1.696940] mmcblk1: mmc1:59b4 USDU1 14.7 GiB [ 1.704552] mmcblk0: mmc0:0001 8GTF4R 7.28 GiB [ 1.707267] mmcblk0boot0: mmc0:0001 8GTF4R partition 1 4.00 MiB [ 1.710522] sp7021-fb soc@B:fb_device: [_sp7021_fb_create_device:292] mem VA 0xe0882000(PA 0x1ee00000), Palette VA 0xdea7f800(PA 0x1ea7f800), UI Res 1280x720, size 1843200 + 1024 [ 1.710852] mmcblk0boot1: mmc0:0001 8GTF4R partition 2 4.00 MiB [ 1.732252] sp7021-rtc 9c003a00.serial: setting system clock to 1970-01-01T09:06:25 UTC (32785) [ 1.733529] mmcblk1: p1 p2 [ 1.753533] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 [ 1.782798] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null) [ 1.783048] VFS: Mounted root (ext4 filesystem) on device 179:2. [ 1.787220] devtmpfs: mounted [ 1.790625] Freeing unused kernel memory: 1024K [ 1.852817] Run /sbin/init as init process [ 1.858296] random: fast init done /etc/init.d/rcS starts... Mounting other filesystems ... rc.extra [bg] sdcard boot set... resize2fs partition 0x0000AD3D 0x00000007 extra done Filesystem at /dev/mmcblk1p2 is mounted on /; on-line resizing required [ 2.180760] EXT4-fs (mmcblk1p2): resizing filesystem from 4182 to 3833343 blocks old_desc_blocks = 1, new_desc_blocks = 2 [ 2.410110] EXT4-fs (mmcblk1p2): resized filesystem to 3833343 The filesystem on /dev/mmcblk1p2 is now 3833343 (4k) blocks long. Filesystem Size Used Available Use% Mounted on /dev/root 14.5G 9.9M 14.5G 0% / devtmpfs 248.3M 0 248.3M 0% /dev tmpfs 248.8M 0 248.8M 0% /dev/shm tmpfs 248.8M 0 248.8M 0% /tmp End of /etc/init.d/rcS login[745]: root login on 'console' ~ #

Resizing completes. Available size of root file-system is 14.5 GB. You are ready to use SP7021 Linux.

Appendix: How to extend size of rootfs partition to maximum manually?

1. Use fdisk to extend size of rootfs partition to end of the SD card.

Run fdisk as below:

fdisk /dev/mmcblk1

where SD card device is at /dev/mmcblk1.

a) Press p to list partitions of the SD card.

b) Press d and then 2 to delete the second (rootfs) partition.

c) Press p to list partitions of the SD card again.

d) Press n and, p, 2, 206848 and then 31116279 to add back the second (rootfs) partition. Note that 206848 is start-LBA while 31116279 is new end-LBA of the partition.

e) Press p to list partitions of the SD card again. Confirm modification of partitions.

f) Press w to write back partition to the SD card.

g) Run reboot command to re-boot system.

Refer to screenshot below:

2. Run resize2fs to extend size of file-system to make use the whole partition

Run resize2fs command as below:

resize2fs /dev/mmcblk1p2