C3V TFTP boot with SD card

C3V TFTP boot with SD card

Ubuntu PC install TFTP server.

sudo apt install tftpd-hpa

 

Create a folder for TFTP service, example of folder is /home/adminuser/tftp.

mkdir -p /home/adminuser/scftp sudo chmod -R 777 /home/adminuser/scftp sudo chown nobody.nogroup -R /home/adminuser/scftp

You need to copy C3V’s kernel image file (uImage) and dtb file (dtb) to folder of TFTP server (/home/adminuser/scftp).

 

Edit tftpd-hpa configuration file, /etc/default/tftpd-hpa

sudo nano /etc/default/tftpd-hpa

File content:

# /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/home/adminuser/scftp" TFTP_ADDRESS="0.0.0.0:69" TFTP_OPTIONS="--secure --create"

 

Restart tftpd-hpa

sudo service tftpd-hpa restart

 

Modify uEnv.txt that is within FAT32(boot partition) of C3V boot SD card to create TFTP uboot command.

Command is with reference to TFTP boot command within /boot/uboot/include/configs/pentagram_common_sp7350.h.

"tftp_boot=setenv ethaddr ${macaddr} && printenv ethaddr; " \ "printenv serverip; " \ "setenv filesize 0; " \ "dhcp ${addr_dst_dtb} ${serverip}:dtb" __stringify(USER_NAME) " && " \ "dhcp ${addr_temp_kernel} ${serverip}:uImage" __stringify(USER_NAME) "; " \ "if test $? != 0; then " \ "echo Error occurred while getting images from tftp server!; " \ "exit; " \ "fi; " \ "verify ${addr_temp_kernel} ${do_secure}; "\ "setexpr addr_temp_kernel ${addr_temp_kernel} + 0x40; " \ "setexpr addr_dst_kernel ${addr_dst_kernel} + 0x40; " \ "echo unzip ${addr_temp_kernel} ${addr_dst_kernel}; " \ "unzip ${addr_temp_kernel} ${addr_dst_kernel}; " \ "echo booti ${addr_dst_kernel} - ${addr_dst_dtb}; " \ "booti ${addr_dst_kernel} - ${addr_dst_dtb}; " \ "\0" \ "update_tftp=setenv isp_ram_addr 0x1000000; " \ "setenv ethaddr ${macaddr} && printenv ethaddr; " \ "printenv serverip; " \ "dhcp $isp_ram_addr $serverip:TFTP0000.BIN; " \ "setenv isp_main_storage ${sp_main_storage} && printenv isp_main_storage; " \ "setexpr script_addr $isp_ram_addr + 0x00 && setenv script_addr 0x${script_addr} && source $script_addr; " \ "\0"

 

Original content of uEnv.txt:

# # uEnv.txt for SP7350 (arm64) # KERNEL_IMG=uImage sRpi_args=setenv filesize 0; fatsize $isp_if $isp_dev /cmdline.txt; if test $filesize != 0; then fatload $isp_if $isp_dev $addr_dst_dtb /cmdline.txt; raspb init $fileaddr $filesize; fi; # bootargs sbootargs=setenv bootargs console=ttyS0,115200 earlycon root=/dev/mmcblk1p2 rw rootwait $bootargs; # load kernel sload_kernel=echo "fatload $isp_if $isp_dev $addr_temp_kernel /$KERNEL_IMG"; fatload $isp_if $isp_dev $addr_temp_kernel /$KERNEL_IMG; # verify kernel sverify=echo "verify ${addr_temp_kernel} ${do_secure}"; verify ${addr_temp_kernel} ${do_secure}; # unzip kernel sunzip_kernel=setexpr addr_temp_kernel ${addr_temp_kernel} + 0x40; setexpr addr_dst_kernel ${addr_dst_kernel} + 0x40; echo "unzip ${addr_temp_kernel} ${addr_dst_kernel}"; unzip ${addr_temp_kernel} ${addr_dst_kernel}; # boot cmd sboot_kernel=echo "booti ${addr_dst_kernel} - ${fdtcontroladdr}"; booti ${addr_dst_kernel} - ${fdtcontroladdr}; # uenvcmd cmd uenvcmd=run sload_kernel; run sbootargs; run sverify; run sunzip_kernel; run sboot_kernel; # # END #

Modified content of uEnv.txt for TFTP boot.

serverip 192.168.0.114 is for example.

You need to set it to be IPV4-IP of Ubuntu PC that is running the TFTP server.

# # uEnv.txt for SP7350 (arm64) # KERNEL_IMG=uImage sRpi_args=setenv filesize 0; fatsize $isp_if $isp_dev /cmdline.txt; if test $filesize != 0; then fatload $isp_if $isp_dev $addr_dst_dtb /cmdline.txt; raspb init $fileaddr $filesize; fi; # bootargs sbootargs=setenv bootargs console=ttyS0,115200 earlycon root=/dev/mmcblk1p2 rw rootwait $bootargs; # load kernel sload_kernel=echo "fatload $isp_if $isp_dev $addr_temp_kernel /$KERNEL_IMG"; fatload $isp_if $isp_dev $addr_temp_kernel /$KERNEL_IMG; # verify kernel sverify=echo "verify ${addr_temp_kernel} ${do_secure}"; verify ${addr_temp_kernel} ${do_secure}; # unzip kernel sunzip_kernel=setexpr addr_temp_kernel ${addr_temp_kernel} + 0x40; setexpr addr_dst_kernel ${addr_dst_kernel} + 0x40; echo "unzip ${addr_temp_kernel} ${addr_dst_kernel}"; unzip ${addr_temp_kernel} ${addr_dst_kernel}; # boot cmd sboot_kernel=echo "booti ${addr_dst_kernel} - ${fdtcontroladdr}"; booti ${addr_dst_kernel} - ${fdtcontroladdr}; # uenvcmd cmd #uenvcmd=run sload_kernel; run sbootargs; run sverify; run sunzip_kernel; run sboot_kernel; set_server_ip=setenv serverip 192.168.0.114; echo "server ip = ${serverip} set_filesize=setenv filesize 0 get_ipaddr=setenv autoload no; dhcp kernel_image=uImage kernel_dtb=dtb tftp_load_dtb=dhcp ${addr_dst_dtb} ${serverip}:dtb; echo "load dtb adr=${addr_dst_dtb}" tftp_load_kernel=dhcp ${addr_temp_kernel} ${serverip}:uImage; echo "load kernel adr=${addr_temp_kernel}" tftp_bootargs=setenv bootargs console=ttyS0,115200 earlycon root=/dev/mmcblk1p2 rw user_debug=255 rootwait $bootargs; tftp_boot=echo "booti ${addr_dst_kernel} - ${addr_dst_dtb}"; booti ${addr_dst_kernel} - ${addr_dst_dtb} uenvcmd=run set_server_ip; run set_filesize; run tftp_load_kernel; run tftp_load_dtb; run tftp_bootargs; run sverify; run sunzip_kernel; run tftp_boot # # END #

 

Connect C3V Ethernet port and Ubuntu PC Ethernet port to an router. Then power on the C3V, C3V will boot kernel from TFTP server.

C3V TFTP boot log is below:

U-Boot 2024.07-gfb4da8e7 (Nov 04 2025 - 19:18:47 +0800)

CONFIG_SYS_CACHELINE_SIZE: 64
Model: Sunplus SP7350 EVK
DRAM: 3.8 GiB (effective 4 GiB)
PLLA : 147456000 Hz
PLLC : 1500000000 Hz
PLLL3 : 1200000000 Hz
PLLD : 800000000 Hz
PLLH : 2150000000 Hz
PLLN : 500000000 Hz
PLLS : 2000000000 Hz
reset: reset@f8800004
Core: 336 devices, 20 uclasses, devicetree: separate
SPI: Manufacturer id = 0x00, Device id = 0x0000
MMC: sd: 0
Loading Environment from nowhere... OK
Disp: probe ...
Disp: init 1920x1080 settings
Disp: init lt8912b bridge ic
Disp: probe done
In: usbkbd,serial
Out: vidconsole,serial
Err: vidconsole,serial
Net: eth0: stmmac@f8103000

starting USB...
Bus usb@f8102100: ehci_sunplus_probe.164, dev_name:usb@f8102100,port_num:0
after write usbruncmd,usbcmd:80b01,retry_times:0
USB EHCI 1.10
Bus usb@f8102080: ohci_sunplus_probe.51, dev_name:usb@f8102080,port_num:1
USB OHCI 1.0
Bus dwc3@f80a1000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@f8102100 for devices... 2 USB Device(s) found
scanning bus usb@f8102080 for devices... 1 USB Device(s) found
scanning bus dwc3@f80a1000 for devices... 4 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot: 0
[scr] bootcmd started
fa218008: 000000fe ....
[scr] Boot from SD Card
sd: 0
run sdcard_boot
1834 bytes read in 39 ms (45.9 KiB/s)
Loaded environment from uEnv.txt
Running uenvcmd ...
server ip = 192.168.0.114
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.0.174 (2 ms)
Using stmmac@f8103000 device
TFTP from server 192.168.0.114; our IP address is 192.168.0.174
Filename 'uImage'.
Load address: 0xfffffc0
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
########
10.5 MiB/s
done
Bytes transferred = 9656004 (9356c4 hex)
load kernel adr=0xFFFFFC0
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.0.174 (3 ms)
Using stmmac@f8103000 device
TFTP from server 192.168.0.114; our IP address is 192.168.0.174
Filename 'dtb'.
Load address: 0x1f7ffc0
Loading: #####
7.5 MiB/s
done
Bytes transferred = 63297 (f741 hex)
load dtb adr=0x1F7FFC0
verify 0xFFFFFC0 0
unzip 10000000 2000000
Uncompressed size: 23570440 = 0x167A808
booti 2000000 - 0x1F7FFC0

Flattened Device Tree blob at 01f7ffc0

Booting using the fdt blob at 0x1f7ffc0
Working FDT set to 1f7ffc0
Loading Device Tree to 00000000edecd000, end 00000000ededf740 ... OK
Working FDT set to edecd000