From 941eaa594ac449bdd38f00cbcff1e5ac06617ce1 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Fri, 2 Jun 2023 13:45:35 -0400 Subject: [PATCH] opensbi commands --- Makefile | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 92be622..581d0e1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: images f4pga buildroot litex clone help attach hardware-image \ buildroot-image litex-f4pga-image hardware-container \ - upsilon.tar.gz + upsilon.tar.gz upsilon-opensbi.tar.gz help: @echo 'compile commands (run in order)' @@ -9,7 +9,7 @@ help: ###### Images -images: hardware-image buildroot-image +images: hardware-image buildroot-image opensbi-image hardware-image: docker build -f scripts/Dockerfile.litex_f4pga -t "upsilon-litex-f4pga-env" . @@ -17,22 +17,40 @@ hardware-image: buildroot-image: buildroot.tar.gz docker build -f scripts/Dockerfile.buildroot -t "upsilon-buildroot-env" . +opensbi-image: opensbi.tar.gz + docker build -f scripts/Dockerfile.opensbi -t "upsilon-opensbi-env" . + ###### Containers +### Hardware container + hardware-container: docker run -d --name upsilon-hardware-container upsilon-litex-f4pga-env /bin/sh -c 'while true; do sleep 2; done' -hardware-container-copy: upsilon.tar.gz - # XXX: this always fails if there are very high UIDs - -docker cp upsilon.tar.gz upsilon-hardware-container:/home/user/upsilon.tar.gz +hardware-container-copy: upsilon-hardware.tar.gz + # XXX: this always fails if there are very high UIDs, but the + # file is copied successfully. + -docker cp upsilon-hardware.tar.gz upsilon-hardware-container:/home/user/upsilon-hardware.tar.gz hardware-container-shell: docker exec -ti upsilon-hardware-container /bin/bash -l hardware-container-clean: -docker container stop upsilon-hardware-container -docker container rm upsilon-hardware-container +### OpenSBI Container + +opensbi-container: + docker run -d --name upsilon-opensbi-container upsilon-opensbi-env /bin/sh -c 'while true; do sleep 2; done' +opensbi-container-copy: upsilon-opensbi.tar.gz + -docker cp upsilon-opensbi.tar.gz upsilon-opensbi-container:/home/user/upsilon-opensbi.tgz +opensbi-container-shell: + docker exec -ti upsilon-opensbi-container /bin/bash -l +opensbi-container-clean: + -docker container stop upsilon-hardware-container + -docker container rm upsilon-hardware-container + ###### External projects -clone: f4pga buildroot litex +clone: f4pga buildroot litex opensbi f4pga: if [ ! -d 'f4pga' ]; then \ @@ -57,5 +75,19 @@ litex: cd litex && git checkout master && git pull && \ git checkout -B upsilon_stable c6ccb626e88168045edacced3743f6bd98746742 -upsilon.tar.gz: - tar -czvf upsilon.tar.gz upsilon/ +upsilon-hardware.tar.gz: + tar -czvf upsilon-hardware.tar.gz upsilon/firmware/ + +# This script only works for GNU tar. It renames the extraction directory. +upsilon-opensbi.tar.gz: + tar -czvf upsilon-opensbi.tar.gz upsilon/opensbi/ --transform 's|upsilon/opensbi|opensbi/platform|' + +opensbi: + if [ ! -d 'opensbi' ]; then \ + git clone https://github.com/riscv-software-src/opensbi; \ + fi + cd opensbi && git checkout master && git pull && \ + git checkout -B upsilon_stable v1.2 + +opensbi.tar.gz: + tar -czvf opensbi.tar.gz opensbi/