【玄铁杯第三届RISC-V应用创新大赛】LicheePi 4A+TF卡启动文件系统
[复制链接]
官方文档没有说怎么烧写系统到TF卡以及从TF卡启动系统,所以只能从另一个方向去实现TF卡启动系统,来获取更大的存储空间了。
首先通过电脑端挂载rootfs-sing.ext4看了一下文件系统文件没有问题,可以直接挂载,然后就通过imagewrite将文件系统直接烧写到TF卡内。
接着修改uboot启动参数,默认的参数如下:
Light LPI4A# printenv
aon_ram_addr=0xffffef8000
arch=riscv
audio_ram_addr=0x32000000
baudrate=115200
board=light-c910
board_name=light-c910
boot_conf_addr_r=0xc0000000
boot_conf_file=/extlinux/extlinux.conf
bootcmd=run bootcmd_load; bootslave; sysboot mmc ${mmcdev}:${mmcbootpart} any $boot_conf_addr_r $boot_conf_file;
bootcmd_load=run findpart;run load_aon;run load_c906_audio; load mmc ${mmcdev}:${mmcbootpart} $opensbi_addr fw_dynamic.bin
bootdelay=2
cpu=c9xx
eth1addr=ee:aa:13:3c:43:46
ethaddr=ee:aa:13:3c:43:45
fdt_addr_r=0x02800000
fdt_high=0xffffffffffffffff
fdtcontroladdr=ffba81f0
fdtfile=thead/light-lpi4a.dtb
finduuid=part uuid mmc ${mmcdev}:${mmcpart} uuid
fwaddr=0x10000000
gpt_partition=gpt write mmc ${mmcdev} $partitions
kdump_buf=180M
kernel_addr_r=0x00200000
load_aon=load mmc ${mmcdev}:${mmcbootpart} $fwaddr light_aon_fpga.bin;cp.b $fwaddr $aon_ram_addr $filesize
load_c906_audio=load mmc ${mmcdev}:${mmcbootpart} $fwaddr light_c906_audio.bin;cp.b $fwaddr $audio_ram_addr $filesize
mmcbootpart=2
mmcdev=0
opensbi_addr=0x0
partitions=name=table,size=2031KB;name=boot,size=500MiB,type=boot;name=root,size=-,type=linux,uuid=${uuid_rootfsA}
pxefile_addr_r=0x00600000
ramdisk_addr_r=0x06000000
scriptaddr=0x00500000
splashimage=0x30000000
splashpos=m,m
uuid_rootfsA=80a5a8e9-c744-491a-93c1-4f4194fd690a
vendor=thead
Environment size: 1311/131068 bytes
查看mmc设备,有两个,如下
默认是mmc0,先看看mmc0的分区,其中分区2是启动分区:
分区3是文件系统分区:
切换到mmc1看看:
通过ext4ls查看TF卡的文件系统
所有检查都没有问题,接着修改启动参数,从mmc1启动:
通过分析bootcmd参数,可以得知,最后是通过sysboot来启动系统的,启动参数位于/extlinux/extlinux.conf
所以需要先创建一个/extlinux/extlinux_tf.conf,里面将启动分区指向TF卡就行,下面是两个文件的内容:
extlinux.conf:
## /boot/extlinux/extlinux.conf
##
## IMPORTANT WARNING
##
## The configuration of this file is generated automatically.
## Do not edit this file manually, use: u-boot-update
default l0
menu title U-Boot menu
prompt 2
timeout 50
label l0
menu label RevyOS GNU/Linux 5.10.113-lpi4a
linux /Image
fdtdir /dtbs/linux-image-5.10.113-lpi4a/
append root=/dev/mmcblk0p3 console=ttyS0,115200 rootwait rw earlycon clk_ignore_unused loglevel=7 eth= rootrwoptions=rw,noatime rootrwreset=yes
label l0r
menu label RevyOS GNU/Linux 5.10.113-lpi4a (rescue target)
linux /vmlinux-5.10.113-lpi4a
initrd /initrd.img-5.10.113-lpi4a
fdtdir /dtbs/linux-image-5.10.113-lpi4a/
append root=/dev/mmcblk0p3 console=ttyS0,115200 rootwait rw earlycon clk_ignore_unused loglevel=7 eth= rootrwoptions=rw,noatime rootrwreset=yes single
extlinux_tf.conf:
## /boot/extlinux/extlinux.conf
##
## IMPORTANT WARNING
##
## The configuration of this file is generated automatically.
## Do not edit this file manually, use: u-boot-update
default l0
menu title U-Boot menu
prompt 2
timeout 50
label l0
menu label RevyOS GNU/Linux 5.10.113-lpi4a
linux /Image
fdtdir /dtbs/linux-image-5.10.113-lpi4a/
append root=/dev/mmcblk1 console=ttyS0,115200 rootwait rw earlycon clk_ignore_unused loglevel=7 eth= rootrwoptions=rw,noatime rootrwreset=yes
label l0r
menu label RevyOS GNU/Linux 5.10.113-lpi4a (rescue target)
linux /vmlinux-5.10.113-lpi4a
initrd /initrd.img-5.10.113-lpi4a
fdtdir /dtbs/linux-image-5.10.113-lpi4a/
append root=/dev/mmcblk0p3 console=ttyS0,115200 rootwait rw earlycon clk_ignore_unused loglevel=7 eth= rootrwoptions=rw,noatime rootrwreset=yes single
启动参数修改如下,首先是增加环境变量:
setenv bootcheck 'if mmc dev 1; then setenv boot_conf_file /extlinux/extlinux_tf.conf; else setenv boot_conf_file /extlinux/extlinux.conf;fi'
然后是修改启动参数:
bootcmd 'run bootcmd_load; bootslave; run bootcheck; sysboot mmc ${mmcdev}:${mmcbootpart} any $boot_conf_addr_r $boot_conf_file;'
这样,当又TF插入时就会从TF卡启动了。
启动之后查看文件系统挂载情况如下:
这里可以看到空间很小,需要手动resize一下tf卡分区:
resize之后的空间已经是58GB了,可以正常用了。
|