Bläddra i källkod

init config for JH7110

yanhong.wang 3 år sedan
förälder
incheckning
8e524b1ba6
3 ändrade filer med 142 tillägg och 5 borttagningar
  1. 43 5
      Makefile
  2. 55 0
      conf/jh7110-fit-image.its
  3. 44 0
      conf/jh7110_uEnv.txt

+ 43 - 5
Makefile

@@ -1,6 +1,8 @@
 ISA ?= rv64imafdc
 ABI ?= lp64d
-TARGET_BOARD := U74
+
+#TARGET_BOARD is U74 ,JH7110 or NULL
+TARGET_BOARD := JH7110
 BOARD_FLAGS	:=
 
 srcdir := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
@@ -34,8 +36,11 @@ vmlinux := $(linux_wrkdir)/vmlinux
 vmlinux_stripped := $(linux_wrkdir)/vmlinux-stripped
 vmlinux_bin := $(wrkdir)/vmlinux.bin
 
-ifeq ($(TARGET_BOARD),U74)
-export TARGET_BOARD
+ifeq ($(TARGET_BOARD),JH7110)
+	export TARGET_BOARD
+	its_file=$(confdir)/jh7110-fit-image.its
+else ifeq($(TARGET_BOARD),U74)
+	export TARGET_BOARD
 	BOARD_FLAGS += -DTARGET_BOARD_U74
 	bbl_link_addr :=0x80700000
 	its_file=$(confdir)/u74_nvdla-uboot-fit-image.its
@@ -52,7 +57,13 @@ initramfs := $(wrkdir)/initramfs.cpio.gz
 
 sbi_srcdir := $(srcdir)/opensbi
 sbi_wrkdir := $(wrkdir)/opensbi
+
+ifeq ($(TARGET_BOARD),JH7110)
+sbi_bin := $(wrkdir)/opensbi/platform/starfive/jh7110/firmware/fw_payload.bin
+else
 sbi_bin := $(wrkdir)/opensbi/platform/starfive/vic7100/firmware/fw_payload.bin
+endif
+
 fit := $(wrkdir)/image.fit
 
 fesvr_srcdir := $(srcdir)/riscv-fesvr
@@ -69,11 +80,19 @@ qemu := $(qemu_wrkdir)/prefix/bin/qemu-system-riscv64
 
 uboot_srcdir := $(srcdir)/HiFive_U-Boot
 uboot_wrkdir := $(wrkdir)/HiFive_U-Boot
+
+ifeq ($(TARGET_BOARD),JH7110)
+uboot_dtb_file := $(wrkdir)/HiFive_U-Boot/arch/riscv/dts/starfive_jh7110.dtb
+else
 uboot_dtb_file := $(wrkdir)/HiFive_U-Boot/arch/riscv/dts/starfive_vic7100_evb.dtb
+endif
+
 uboot := $(uboot_wrkdir)/u-boot.bin
 uboot_config := HiFive-U540_regression_defconfig
 
-ifeq ($(TARGET_BOARD),U74)
+ifeq ($(TARGET_BOARD),JH7110)
+	uboot_config := starfive_jh7110_smode_defconfig
+else ifeq ($(TARGET_BOARD),U74)
 	uboot_config := starfive_vic7100_evb_smode_defconfig
 else
 	uboot_config := HiFive-U540_nvdla_iofpga_defconfig
@@ -207,11 +226,19 @@ linux-menuconfig: $(linux_wrkdir)/.config
 	$(MAKE) -C $(linux_srcdir) O=$(dir $<) ARCH=riscv savedefconfig
 	cp $(dir $<)defconfig $(linux_defconfig)
 
+ifeq ($(TARGET_BOARD),JH7110)
+sbi: $(uboot) $(vmlinux)
+	rm -rf $(sbi_wrkdir)
+	mkdir -p $(sbi_wrkdir)
+	cd $(sbi_wrkdir) && O=$(sbi_wrkdir) CFLAGS="-mabi=$(ABI) -march=$(ISA)" ${MAKE} -C $(sbi_srcdir) CROSS_COMPILE=$(CROSS_COMPILE) \
+		PLATFORM=starfive/jh7110 FW_PAYLOAD_PATH=$(uboot) FW_PAYLOAD_FDT_PATH=$(uboot_dtb_file)
+else
 sbi: $(uboot) $(vmlinux)
 	rm -rf $(sbi_wrkdir)
 	mkdir -p $(sbi_wrkdir)
 	cd $(sbi_wrkdir) && O=$(sbi_wrkdir) CFLAGS="-mabi=$(ABI) -march=$(ISA)" ${MAKE} -C $(sbi_srcdir) CROSS_COMPILE=$(CROSS_COMPILE) \
 		PLATFORM=starfive/vic7100 FW_PAYLOAD_PATH=$(uboot) FW_PAYLOAD_FDT_PATH=$(uboot_dtb_file)
+endif
 
 
 $(fit): sbi $(vmlinux_bin) $(uboot) $(its_file) ${initramfs}
@@ -319,7 +346,18 @@ UBOOTFIT	= 04ffcafa-cd65-11e8-b974-70b3d592f0fa
 
 flash.gpt: $(flash_image)
 
-ifeq ($(TARGET_BOARD),U74)
+ifeq ($(TARGET_BOARD),JH7110)
+VFAT_SIZE=263454
+$(vfat_image): $(fit) $(confdir)/jh7110_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
+	dd if=/dev/zero of=$(vfat_image) bs=512 count=$(VFAT_SIZE)
+	/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
+
+else ifeq ($(TARGET_BOARD),U74)
 VFAT_START=4096
 VFAT_END=270335
 VFAT_SIZE=266239

+ 55 - 0
conf/jh7110-fit-image.its

@@ -0,0 +1,55 @@
+/dts-v1/;
+
+/ {
+        description = "U-boot FIT image for HiFive Nvdla";
+        #address-cells = <2>;
+
+        images {
+                vmlinux {
+                        description = "vmlinux";
+                        data = /incbin/("../work/linux/arch/riscv/boot/Image");
+                        type = "kernel";
+                        arch = "riscv";
+                        os = "linux";
+                        load = <0x0 0x40200000>;
+                        entry = <0x0 0x40200000>;
+                        compression = "none";
+                };
+
+                ramdisk {
+                        description = "buildroot initramfs";
+                        data = /incbin/("../work/initramfs.cpio.gz");
+                        type = "ramdisk";
+                        arch = "riscv";
+                        os = "linux";
+                        load = <0x0 0x46100000>;
+                        compression = "none";
+                        hash-1 {
+                                algo = "sha256";
+                        };
+                };
+
+                fdt {
+                        data = /incbin/("../work/HiFive_U-Boot/arch/riscv/dts/starfive_jh7110.dtb");
+                        type = "flat_dt";
+                        arch = "riscv";
+                        load = <0x0 0x46000000>;
+                        compression = "none";
+                        hash-1 {
+                                algo = "sha256";
+                        };
+                };
+        };
+
+        configurations {
+                default = "config-1";
+
+                config-1 {
+                        description = "StarFive JH7110 with opensbi";
+						kernel = "vmlinux";
+                        fdt = "fdt";
+                        loadables = "ramdisk";
+                };
+        };
+};
+

+ 44 - 0
conf/jh7110_uEnv.txt

@@ -0,0 +1,44 @@
+# 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. 
+
+# for debugging boot
+#bootargs=video=640x480 console=ttySI0 root=/dev/mmcblk0p2 rootwait
+bootargs=earlyprintk console=ttyS0,115200 debug rootwait stmmaceth=chain_mode:1 root=/dev/mmcblk0p3 
+
+
+# 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=80700000
+fdtaddr=86000000
+irdaddr=86100000
+irdsize=06400000
+
+# 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
+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 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
+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
+
+# 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
+boot2=fatload mmc 0:1 ${fileaddr} ${fitfile}; bootm start ${fileaddr}; run setupfdt1;run setupird;run setupfdt2; bootm loados ${fileaddr}; echo "Booting kernel in"; go ${bbladdr} ${fdtaddr}
+
+# if you want to network boot, for testing, uncomment the following:
+#boot2=dhcp; env import -t ${fileaddr} ${filesize}; run boot2