Browse Source

support autoboot buildroot rootfs

Signed-off-by: jianlonghuang <jianlong.huang@starfivetech.com>
jianlonghuang 2 years ago
parent
commit
17a5d78b0a
2 changed files with 16 additions and 54 deletions
  1. 2 1
      Makefile
  2. 14 53
      conf/uEnv.txt

+ 2 - 1
Makefile

@@ -424,7 +424,7 @@ UBOOT_END=473087
 UBOOT_SIZE=2047
 UENV_START=473088
 UENV_END=475135
-$(vfat_image): $(fit) $(confdir)/u74_uEnv.txt
+$(vfat_image): $(fit) $(confdir)/u74_uEnv.txt $(confdir)/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"; \
 		rm $(flash_image); exit 1; fi
@@ -432,6 +432,7 @@ $(vfat_image): $(fit) $(confdir)/u74_uEnv.txt
 	$(MKFS_VFAT) $(vfat_image)
 	PATH=$(RVPATH) MTOOLS_SKIP_CHECK=1 mcopy -i $(vfat_image) $(fit) ::hifiveu.fit
 	PATH=$(RVPATH) MTOOLS_SKIP_CHECK=1 mcopy -i $(vfat_image) $(confdir)/u74_uEnv.txt ::u74_uEnv.txt
+	PATH=$(RVPATH) MTOOLS_SKIP_CHECK=1 mcopy -i $(vfat_image) $(confdir)/uEnv.txt ::uEnv.txt
 else
 
 VFAT_START=4096

+ 14 - 53
conf/uEnv.txt

@@ -1,58 +1,19 @@
-# This is the sample uEnv.txt file for HiFive Unleashed U-boot
-# The current convention (SUBJECT TO CHANGE) is that this file
-# will be loaded from the first MSDOS(fat) GPT partition on the
-# MMC card. 
+fdt_high=0xffffffffffffffff
+initrd_high=0xffffffffffffffff
 
-# for debugging boot
-bootargs=video=640x480 console=ttySI0 root=/dev/mmcblk0p2 rootwait
-# for normal boot
-#bootargs=video=640x480 root=/dev/mmcblk0p2 rootwait
+scriptaddr=0x88100000
+script_offset_f=0x1fff000
+script_size_f=0x1000
 
-# To boot from partition 2 of an NVME drive (with a PCI iofpga,
-# such as the MicroSemi expansion board, uncomment below:
+kernel_addr_r=0x84000000
+kernel_comp_addr_r=0x90000000
+kernel_comp_size=0x10000000
 
-#bootargs=debug console=tty0 console=ttySIF0 root=/dev/nvme0n1p2
+fdt_addr_r=0x88000000
+ramdisk_addr_r=0x88300000
 
-# to boot an initramfs (buildroot or debian/etc) use this
-#setupchosen=run setupvml; run setupird
+bootcmd=run mmcsetup; run fdtsetup; run fatenv; echo 'running boot2...'; run boot2
+bootcmd_mmc0=devnum=0; run mmc_boot
 
-# to boot with straight to the root= parition, uncomment below
-# so we do not set the ramdisk pointers
-#setupchosen=run setupvml
-setupchosen=run setupird
-
-# The FIT file to boot from
-fitfile=hifiveu.fit
-
-# The rest of this is mostly of interest to u-boot developers
-# below much match what's in FIT (ugha)
-bbladdr=80000000
-fdtaddr=81f00000
-vmladdr=80200000
-irdaddr=82000000
-# oh the hack.. use a large size.. ugh
-irdsize=01000000
-vmlsize=00800000
-newfdt=f0000000
-# Use the FDT in the FIT image..
-#setupfdt1=fdt addr ${fdtaddr}; fdt resize; fdt chosen; fdt move ${fdtaddr} ${newfdt}
-
-#use FDT that came with uboot
-#setupfdt1=fdt addr ${newfdt}; fdt resize; fdt chosen; fdt move ${fdtaddr} ${newfdt}
-
-#Use fit image, but don't call fdt move  (TODO: understand later)
-setupfdt1=fdt addr ${newfdt}; fdt resize; fdt chosen
-
-setupird=setexpr irdend ${irdaddr} + ${irdsize}; fdt set /chosen linux,initrd-start <0x0 0x${irdaddr}>; fdt set /chosen linux,initrd-end <0x0 0x${irdend}>
-setupvml=setexpr vmlend ${vmladdr} + ${vmlsize}; fdt set /chosen riscv,kernel-start <0x0 0x${vmladdr}>; fdt set /chosen riscv,kernel-end <0x0 0x${vmlend}>
-
-#setupfdt2=fdt set /chosen bootargs ${bootargs}; fdt print /chosen
-setupfdt2=fdt print /chosen; fdt set /chosen bootargs "${bootargs}"; fdt set /firmware uboot,ver ${ver}; fdt print /chosen
-
-bootwait=setenv _delay ${bootdelay}; echo ${_delay}; while test ${_delay} > 0; do sleep 1; setexpr _delay ${_delay} - 1; echo ${_delay}; done
-
-# this assumes ${fileaddr} is already set!!
-boot2=fatload mmc 0:1 ${fileaddr} ${fitfile}; bootm start ${fileaddr}; run setupfdt1; run setupchosen; run setupfdt2; bootm loados ${fileaddr}; echo "Booting kernel in"; run bootwait; go 80000000
-
-# if you want to network boot, for testing, uncomment the following:
-#boot2=dhcp; env import -t ${fileaddr} ${filesize}; run boot2
+ipaddr=192.168.120.200
+netmask=255.255.255.0