Browse Source

Add different board support

Now usdk support fit image build for three board:
fpga, evb and visionfive.

You can choose your target board with assigning HWBOARD,
eg. "make HWBOARD=visionfive", or just default fpga.
You can also specify the target to build, e.g. "make visionfive"

Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Signed-off-by: Som Qin <som.qin@starfivetech.com>
Hal Feng 2 years ago
parent
commit
710649d623
4 changed files with 134 additions and 7 deletions
  1. 21 4
      Makefile
  2. 3 3
      conf/evb-fit-image.its
  3. 55 0
      conf/fpga-fit-image.its
  4. 55 0
      conf/visionfive-fit-image.its

+ 21 - 4
Makefile

@@ -4,6 +4,7 @@ ABI ?= lp64d
 #TARGET_BOARD is U74 ,JH7110 or NULL
 TARGET_BOARD := JH7110
 BOARD_FLAGS	:=
+HWBOARD ?= fpga
 
 srcdir := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
 srcdir := $(srcdir:/=)
@@ -38,7 +39,7 @@ vmlinux_bin := $(wrkdir)/vmlinux.bin
 
 ifeq ($(TARGET_BOARD),JH7110)
 	export TARGET_BOARD
-	its_file=$(confdir)/jh7110-fit-image.its
+	its_file=$(confdir)/$(HWBOARD)-fit-image.its
 else ifeq ($(TARGET_BOARD),U74)
 	export TARGET_BOARD
 	BOARD_FLAGS += -DTARGET_BOARD_U74
@@ -103,8 +104,8 @@ rootfs := $(wrkdir)/rootfs.bin
 
 target_gcc := $(CROSS_COMPILE)gcc
 
-.PHONY: all nvdla-demo
-nvdla-demo: $(fit) $(vfat_image)
+.PHONY: all nvdla-demo check_arg
+nvdla-demo: check_arg $(fit) $(vfat_image)
 	@echo "To completely erase, reformat, and program a disk sdX, run:"
 	@echo "  make DISK=/dev/sdX format-nvdla-disk"
 	@echo "  ... you will need gdisk and e2fsprogs installed"
@@ -112,7 +113,7 @@ nvdla-demo: $(fit) $(vfat_image)
 	@echo "  This can be done manually if needed"
 	@echo
 
-all: $(fit) $(flash_image)
+all: check_arg $(fit) $(flash_image)
 	@echo
 	@echo "This image has been generated for an ISA of $(ISA) and an ABI of $(ABI)"
 	@echo "Find the image in work/image.fit, which should be copied to an MSDOS boot partition 1"
@@ -124,6 +125,11 @@ all: $(fit) $(flash_image)
 	@echo "  This can be done manually if needed"
 	@echo
 
+check_arg:
+ifeq ( , $(filter $(HWBOARD), visionfive evb fpga))
+	$(error board $(HWBOARD) is not supported, BOARD=[visionfive | evb | fpga(deflault)])
+endif
+
 # TODO: depracated for now
 #ifneq ($(RISCV),$(buildroot_initramfs_wrkdir)/host)
 #$(target_gcc):
@@ -132,6 +138,17 @@ all: $(fit) $(flash_image)
 #$(target_gcc): $(buildroot_initramfs_tar)
 #endif
 
+.PHONY: visionfive evb fpga
+
+visionfive: HWBOARD := visionfive
+visionfive: nvdla-demo
+
+evb: HWBOARD := evb
+evb: nvdla-demo
+
+fpga: HWBOARD := fpga
+fpga: nvdla-demo
+
 $(buildroot_initramfs_wrkdir)/.config: $(buildroot_srcdir)
 	rm -rf $(dir $@)
 	mkdir -p $(dir $@)

+ 3 - 3
conf/jh7110-fit-image.its → conf/evb-fit-image.its

@@ -1,7 +1,7 @@
 /dts-v1/;
 
 / {
-        description = "U-boot FIT image for StarFive JH7110";
+        description = "U-boot FIT image for jh7110-evb";
         #address-cells = <2>;
 
         images {
@@ -30,7 +30,7 @@
                 };
 
                 fdt {
-                        data = /incbin/("../work/linux/arch/riscv/boot/dts/starfive/starfive_jh7110.dtb");
+                        data = /incbin/("../work/linux/arch/riscv/boot/dts/starfive/jh7110-evb.dtb");
                         type = "flat_dt";
                         arch = "riscv";
                         load = <0x0 0x46000000>;
@@ -45,7 +45,7 @@
                 default = "config-1";
 
                 config-1 {
-                        description = "StarFive JH7110 with opensbi";
+                        description = "jh7110-evb with opensbi";
 						kernel = "vmlinux";
                         fdt = "fdt";
                         loadables = "ramdisk";

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

@@ -0,0 +1,55 @@
+/dts-v1/;
+
+/ {
+        description = "U-boot FIT image for jh7110-fpga";
+        #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/linux/arch/riscv/boot/dts/starfive/jh7110-fpga.dtb");
+                        type = "flat_dt";
+                        arch = "riscv";
+                        load = <0x0 0x46000000>;
+                        compression = "none";
+                        hash-1 {
+                                algo = "sha256";
+                        };
+                };
+        };
+
+        configurations {
+                default = "config-1";
+
+                config-1 {
+                        description = "jh7110-fpga with opensbi";
+						kernel = "vmlinux";
+                        fdt = "fdt";
+                        loadables = "ramdisk";
+                };
+        };
+};
+

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

@@ -0,0 +1,55 @@
+/dts-v1/;
+
+/ {
+        description = "U-boot FIT image for visionfive";
+        #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/linux/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtb");
+                        type = "flat_dt";
+                        arch = "riscv";
+                        load = <0x0 0x46000000>;
+                        compression = "none";
+                        hash-1 {
+                                algo = "sha256";
+                        };
+                };
+        };
+
+        configurations {
+                default = "config-1";
+
+                config-1 {
+                        description = "visionfive with opensbi";
+						kernel = "vmlinux";
+                        fdt = "fdt";
+                        loadables = "ramdisk";
+                };
+        };
+};
+