From 0e7eae03a4535592764be317efe69434a99d444a Mon Sep 17 00:00:00 2001 From: Jacob Pease Date: Wed, 23 Aug 2023 10:22:55 -0500 Subject: [PATCH 1/5] Updated README to explain usage of flash-sd.sh --- linux/README.MD | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/linux/README.MD b/linux/README.MD index 68de94f03..2b9ec3ab3 100644 --- a/linux/README.MD +++ b/linux/README.MD @@ -49,4 +49,13 @@ You'll find the resulting disassembled files in `/output/images/disas ## Creating a Bootable SD Card +To flash a bootable sd card for Wally's bootloader, use the `flash-sd.sh` script located in `/linux/sdcard`. The script allows you to specify which buildroot directory you would like to use and to specify the device tree. By default it is set up for the default location of buildroot in `/opt/riscv` and uses the vcu108 device tree. To use the script with your own buildroot directory and device tree, type: + + $ cd sdcard + $ ./flash-sd.sh -b -d + + for example + + $ ./flash-sd.sh -b ~/repos/buildroot -d wally-vcu118.dtb /dev/sdb + From 9928432b985aaaae58159834fa2f94bd437aee42 Mon Sep 17 00:00:00 2001 From: Jacob Pease Date: Wed, 23 Aug 2023 10:54:35 -0500 Subject: [PATCH 2/5] Minor formatting adjustments. --- linux/sdcard/flash-sd.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/linux/sdcard/flash-sd.sh b/linux/sdcard/flash-sd.sh index 8b1b6ebdc..7f58f6d45 100755 --- a/linux/sdcard/flash-sd.sh +++ b/linux/sdcard/flash-sd.sh @@ -22,6 +22,7 @@ BOLDYELLOW="\e[1;33m" NC="\e[0m" NAME="$BOLDGREEN"${0:2}:"$NC" ERRORTEXT="$BOLDRED"ERROR:"$NC" +WARNINGTEXT="$BOLDYELLOW"Warning:"$NC" # Default values for buildroot and device tree RISCV=/opt/riscv @@ -150,16 +151,16 @@ if [[ $REPLY =~ ^[Yy]$ ]] ; then sleep 3 - echo -e "$NAME: Copying binaries into their partitions." + echo -e "$NAME Copying binaries into their partitions." DD_FLAGS="bs=4k iflag=fullblock oflag=direct conv=fsync status=progress" - echo -e "$NAME: Copying device tree" + echo -e "$NAME Copying device tree" sudo dd if=$DEVICE_TREE of="$SDCARD"1 $DD_FLAGS - echo -e "$NAME: Copying OpenSBI" + echo -e "$NAME Copying OpenSBI" sudo dd if=$FW_JUMP of="$SDCARD"2 $DD_FLAGS - echo -e "$NAME: Copying Kernel" + echo -e "$NAME Copying Kernel" sudo dd if=$LINUX_KERNEL of="$SDCARD"3 $DD_FLAGS sudo mkfs.ext4 "$SDCARD"4 From 650199f7c321b83677b513580b903390f986a6f5 Mon Sep 17 00:00:00 2001 From: Jacob Pease Date: Wed, 23 Aug 2023 12:42:20 -0500 Subject: [PATCH 3/5] Minor color adjustment --- linux/sdcard/flash-sd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/sdcard/flash-sd.sh b/linux/sdcard/flash-sd.sh index 7f58f6d45..9e00e0600 100755 --- a/linux/sdcard/flash-sd.sh +++ b/linux/sdcard/flash-sd.sh @@ -111,7 +111,7 @@ echo -e "$NAME Device tree block size: $DST_SIZE" echo -e "$NAME OpenSBI FW_JUMP block size: $FW_JUMP_SIZE" echo -e "$NAME Kernel block size: $KERNEL_SIZE" -read -p "Warning: Doing this will replace all data on this card. Continue? y/n: " -n 1 -r +read -p $'\e[1;33mWarning:\e[0m Doing this will replace all data on this card. Continue? y/n: ' -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]] ; then DEVBASENAME=$(basename $SDCARD) From 5a832ed8287815611370c32865881bfe6c198403 Mon Sep 17 00:00:00 2001 From: Jacob Pease Date: Fri, 25 Aug 2023 17:44:06 -0500 Subject: [PATCH 4/5] Set default baud rate of serial output to 115200 for the VCU108. --- linux/devicetree/wally-vcu108.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/devicetree/wally-vcu108.dts b/linux/devicetree/wally-vcu108.dts index add2920bd..8c9182c6c 100644 --- a/linux/devicetree/wally-vcu108.dts +++ b/linux/devicetree/wally-vcu108.dts @@ -9,7 +9,7 @@ chosen { linux,initrd-end = <0x85c43a00>; linux,initrd-start = <0x84200000>; - bootargs = "root=/dev/vda ro"; + bootargs = "console=ttyS0,115200 root=/dev/vda ro"; stdout-path = "/soc/uart@10000000"; }; From 0e8012baee8115d8d8b7e62360e412c26769f27c Mon Sep 17 00:00:00 2001 From: Jacob Pease Date: Thu, 31 Aug 2023 23:58:10 -0500 Subject: [PATCH 5/5] Linux Makefile can now dynamically find binaries for object dumps. --- linux/Makefile | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/linux/Makefile b/linux/Makefile index abbf4a51a..95a849fcf 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -5,6 +5,7 @@ WALLY := $(shell dirname $(shell pwd)) WALLYLINUX := $(shell pwd) DIS := ${IMAGES}/disassembly BRPACKAGES := $(WALLYLINUX)/buildroot-packages +BR2023 := $(WALLYLINUX)/buildroot-config-src/buildroot-2023.05.1 # Buildroot Config Stuff WALLYBOARDSRC := $(WALLYLINUX)/buildroot-config-src/wally @@ -26,6 +27,14 @@ BINARIES := fw_jump.elf vmlinux busybox OBJDUMPS := $(foreach name, $(BINARIES), $(basename $(name) .elf)) OBJDUMPS := $(foreach name, $(OBJDUMPS), $(DIS)/$(name).objdump) +# LINUXDIR := $(shell ls $(BUILDROOT)/output/build | grep -e '^linux-[0-9]\+\.[0-9]\+\.[0-9]\+$$' ) +# LINUXDIR := $(BUILDROOT)/output/build/$(LINUXDIR) +# BUSYBOXDIR := $(shell ls $(BUILDROOT)/output/build | grep -e '^linux-[0-9]\+\.[0-9]\+\.[0-9]\+$$' ) +# BUSYBOXDIR := $(BUILDROOT)/output/build/$(BUSYBOXDIR) + +LINUXDIR := $(shell find $(BUILDROOT)/output/build -maxdepth 2 -type d -regex ".*/linux-[0-9]+\.[0-9]+\.[0-9]+$$") +BUSYBOXDIR := $(shell find $(BUILDROOT)/output/build -maxdepth 2 -type d -regex ".*/busybox-[0-9]+\.[0-9]+\.[0-9]+$$") + .PHONY: all generate disassemble install clean cleanDTB cleanDriver test # Generate all device trees ------------------------------------------- @@ -41,7 +50,8 @@ all: # Temp rule for debugging test: - @echo $(OBJDUMPS) + @echo $(LINUXDIR) + @echo $(BUSYBOXDIR) generate: $(DTB) $(IMAGES) @@ -68,10 +78,10 @@ $(DIS)/%.objdump: $(IMAGES)/%.elf $(DIS)/%.objdump: $(IMAGES)/% riscv64-unknown-elf-objdump -S $< >> $@ -$(IMAGES)/vmlinux: $(BUILDROOT)/output/build/linux-5.10.7/vmlinux +$(IMAGES)/vmlinux: $(LINUXDIR)/vmlinux cp $< $@ -$(IMAGES)/busybox: $(BUILDROOT)/output/build/busybox-1.33.0/busybox +$(IMAGES)/busybox: $(BUSYBOXDIR)/busybox cp $< $@ # Generating new Buildroot directories -------------------------------- @@ -87,10 +97,16 @@ install: $(BUILDROOT)/package/fpga-axi-sdc $(WALLYBOARD) $(DRIVER) # $(WALLYBOARD)/linux.config: $(BRPACKAGES)/linux.config $(WALLYBOARD) # cp $(BRPACKAGES)/linux.config $@ +# $(WALLYBOARD): $(BUILDROOT) +# cp -r $(WALLYBOARDSRC) $(BUILDROOT)/board +# cp $(BRPACKAGES)/wally.config $(WALLYBOARD)/main.config +# cp $(BRPACKAGES)/linux.config $(WALLYBOARD)/linux.config + +# CONFIG DEPENDENCIES 2023.05.1 --------------------------------------- $(WALLYBOARD): $(BUILDROOT) cp -r $(WALLYBOARDSRC) $(BUILDROOT)/board - cp $(BRPACKAGES)/wally.config $(WALLYBOARD)/main.config - cp $(BRPACKAGES)/linux.config $(WALLYBOARD)/linux.config + cp $(BR2023)/main.config $(WALLYBOARD)/main.config + cp $(BR2023)/linux.config $(WALLYBOARD)/linux.config # Buildroot Package --------------------------------------------------- $(BUILDROOT)/package/fpga-axi-sdc: $(BUILDROOT) $(PATCHFILE) $(BRPACKAGES)/fpga-axi-sdc @@ -103,14 +119,14 @@ $(PATCHFILE): $(BUILDROOT): git clone https://github.com/buildroot/buildroot.git $@ - # cd $@; git checkout 2023.05.x - cd $@; git checkout 2021.05 + cd $@; git checkout 2023.05.x + #cd $@; git checkout 2021.05 $(DRIVER): @ if [ -d "$(WALLY)/addins/vivado-risc-v" ] ; then git submodule update --init $(WALLY)/addins/vivado-risc-v; fi cp ../addins/vivado-risc-v/patches/fpga-axi-sdc.c $@ # For 2021.05 - sed -i "s|card_hw_reset|hw_reset|1" $@ + #sed -i "s|card_hw_reset|hw_reset|1" $@ # ---------------------------------------------------------------------