Browse Source

Support sd autoboot

Signed-off-by: Jianlong Huang <jianlong.huang@starfivetech.com>
Jianlong Huang 1 year ago
parent
commit
3c2af1e0fe
2 changed files with 39 additions and 2 deletions
  1. 7 2
      Makefile
  2. 32 0
      conf/vf2_uEnv.txt

+ 7 - 2
Makefile

@@ -32,7 +32,11 @@ buildroot_rootfs_config := $(confdir)/buildroot_rootfs_config
 
 linux_srcdir := $(srcdir)/linux
 linux_wrkdir := $(wrkdir)/linux
-linux_defconfig := $(linux_srcdir)/arch/riscv/configs/starfive_jh7110_defconfig
+ifeq ($(HWBOARD), evb)
+	linux_defconfig := $(linux_srcdir)/arch/riscv/configs/starfive_jh7110_defconfig
+else
+	linux_defconfig := $(linux_srcdir)/arch/riscv/configs/starfive_visionfive2_defconfig
+endif
 
 vmlinux := $(linux_wrkdir)/vmlinux
 vmlinux_stripped := $(linux_wrkdir)/vmlinux-stripped
@@ -401,7 +405,7 @@ VFAT_END    = 614399
 VFAT_SIZE   = $(shell expr $(VFAT_END) - $(VFAT_START) + 1)
 ROOT_START  = 614400
 
-$(vfat_image): $(fit) $(confdir)/jh7110_uEnv.txt
+$(vfat_image): $(fit) $(confdir)/jh7110_uEnv.txt $(confdir)/vf2_uEnv.txt
 	@if [ `du --apparent-size --block-size=512 $(uboot) | cut -f 1` -ge $(UBOOT_SIZE) ]; then \
 		echo "Uboot is too large for partition!!\nReduce uboot or increase partition size"; \
 		 exit 1; fi
@@ -409,6 +413,7 @@ $(vfat_image): $(fit) $(confdir)/jh7110_uEnv.txt
 	/sbin/mkfs.vfat $(vfat_image)
 	PATH=$(RVPATH) MTOOLS_SKIP_CHECK=1 mcopy -i $(vfat_image) $(fit) ::starfiveu.fit
 	PATH=$(RVPATH) MTOOLS_SKIP_CHECK=1 mcopy -i $(vfat_image) $(confdir)/jh7110_uEnv.txt ::jh7110_uEnv.txt
+	PATH=$(RVPATH) MTOOLS_SKIP_CHECK=1 mcopy -i $(vfat_image) $(confdir)/vf2_uEnv.txt ::vf2_uEnv.txt
 
 .PHONY: format-boot-loader
 format-boot-loader: $(sbi_bin) $(uboot) $(fit) $(vfat_image) $(spl_bin_normal_out)

+ 32 - 0
conf/vf2_uEnv.txt

@@ -0,0 +1,32 @@
+# This is the sample jh7110_uEnv.txt file for starfive visionfive U-boot
+# The current convention (SUBJECT TO CHANGE) is that this file
+# will be loaded from the third partition on the
+# MMC card.
+devnum=1
+partnum=3
+
+# The FIT file to boot from
+fitfile=starfiveu.fit
+
+# for debugging boot
+bootargs=earlyprintk console=ttyS0,115200 debug rootwait earlycon=sbi root=/dev/mmcblk1p4
+
+# for addr info
+fileaddr=0xa0000000
+fdtaddr=0x46000000
+# boot Linux flat or compressed 'Image' stored at 'kernel_addr_r'
+kernel_addr_r=0x40200000
+irdaddr=0x46100000
+irdsize=0x5f00000
+
+# Use the FDT in the FIT image..
+setupfdt1=fdt addr ${fdtaddr}
+
+setupird=setexpr irdend ${irdaddr} + ${irdsize}; fdt set /chosen linux,initrd-start <0x0 0x${irdaddr}>; fdt set /chosen linux,initrd-end <0x0 0x${irdend}>
+
+setupfdt2=fdt print /chosen; fdt set /chosen bootargs "${bootargs}"; fdt print /chosen
+
+bootwait=setenv _delay ${bootdelay}; echo ${_delay}; while test ${_delay} > 0; do sleep 1; setexpr _delay ${_delay} - 1; echo ${_delay}; done
+
+boot2=mmc dev ${devnum}; mmc dev ${devnum}; fatload mmc ${devnum}:${partnum} ${fileaddr} ${fitfile}; bootm start ${fileaddr}; run setupfdt1;run setupird;run setupfdt2; bootm loados ${fileaddr}; echo "Booting kernel in"; booti ${kernel_addr_r} ${irdaddr}:${filesize} ${fdtaddr}
+