This repository has been archived on 2024-06-02. You can view files and clone it, but cannot push or open issues or pull requests.
upsilon-docker/Makefile

135 lines
4.5 KiB
Makefile
Raw Normal View History

2023-05-30 16:10:03 -04:00
.PHONY: images f4pga buildroot litex clone help attach hardware-image \
2023-06-05 16:47:26 -04:00
buildroot-image litex-f4pga-image \
upsilon-hardware.tar.gz upsilon-opensbi.tar.gz upsilon-buildroot.tar.gz
2023-05-26 15:00:46 -04:00
2023-05-30 16:10:03 -04:00
###### Images
2023-06-02 13:45:35 -04:00
images: hardware-image buildroot-image opensbi-image
2023-05-26 15:00:46 -04:00
hardware-image:
docker build -f scripts/Dockerfile.litex_f4pga -t "upsilon-litex-f4pga-env" .
2023-05-29 14:39:02 -04:00
buildroot-image: buildroot.tar.gz
docker build -f scripts/Dockerfile.buildroot -t "upsilon-buildroot-env" .
2023-05-29 14:39:02 -04:00
2023-06-02 13:45:35 -04:00
opensbi-image: opensbi.tar.gz
docker build -f scripts/Dockerfile.opensbi -t "upsilon-opensbi-env" .
2023-05-30 16:10:03 -04:00
###### Containers
2023-05-26 17:09:30 -04:00
2023-06-02 13:45:35 -04:00
### Hardware container
2023-05-30 16:10:03 -04:00
hardware-container:
2023-06-05 16:47:26 -04:00
docker run -d --name upsilon-hardware upsilon-litex-f4pga-env /bin/sh -c 'while true; do sleep 2; done'
hardware-copy: upsilon-hardware.tar.gz
2023-06-02 13:45:35 -04:00
# XXX: this always fails if there are very high UIDs, but the
# file is copied successfully.
2023-06-05 16:47:26 -04:00
-docker cp upsilon-hardware.tar.gz upsilon-hardware:/home/user/upsilon-hardware.tar.gz
hardware-execute:
docker exec -ti upsilon-hardware /bin/bash -lc ' \
tar -xvf upsilon-hardware.tar.gz && \
cd upsilon/firmware && \
source ~/conda/xc7/conda/etc/profile.d/conda.sh && \
conda activate xc7 && \
make clean && make'
hardware-shell:
docker exec -ti upsilon-hardware /bin/bash -l
hardware-get:
docker cp upsilon-hardware:/home/user/upsilon/firmware/build/digilent_arty/gateware/digilent_arty.bit upsilon/boot/
docker cp upsilon-hardware:/home/user/upsilon/firmware/arty.dtb upsilon/boot/
hardware-clean:
-docker container stop upsilon-hardware
-docker container rm upsilon-hardware
2023-05-26 17:09:30 -04:00
2023-06-02 13:45:35 -04:00
### OpenSBI Container
opensbi-container:
2023-06-05 16:47:26 -04:00
docker run -d --name upsilon-opensbi upsilon-opensbi-env /bin/sh -c 'while true; do sleep 2; done'
opensbi-copy: upsilon-opensbi.tar.gz
-docker cp upsilon-opensbi.tar.gz upsilon-opensbi:/home/user/upsilon-opensbi.tar.gz
opensbi-get:
docker cp upsilon-opensbi:/home/user/opensbi/build/platform/litex/vexriscv/firmware/fw_jump.bin upsilon/boot/
opensbi-shell:
docker exec -ti upsilon-opensbi /bin/bash -l
opensbi-execute:
docker exec -ti upsilon-opensbi /bin/bash -c ' \
2023-06-02 16:16:13 -04:00
tar -xvf upsilon-opensbi.tar.gz && \
cd opensbi && \
2023-06-05 16:47:26 -04:00
make clean && \
2023-06-02 16:16:13 -04:00
make CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=litex/vexriscv \
2023-06-02 16:02:45 -04:00
'
2023-06-05 16:47:26 -04:00
opensbi-clean:
-docker container stop upsilon-opensbi
-docker container rm upsilon-opensbi
2023-06-02 13:45:35 -04:00
2023-06-02 16:16:13 -04:00
### Buildroot Container
buildroot-container:
2023-06-05 16:47:26 -04:00
docker run -d --name upsilon-buildroot upsilon-buildroot-env /bin/sh -c 'while true; do sleep 2; done'
buildroot-copy: upsilon-buildroot.tar.gz
-docker cp upsilon-buildroot.tar.gz upsilon-buildroot:/home/user/upsilon-buildroot.tar.gz
buildroot-shell:
docker exec -ti upsilon-buildroot /bin/bash -l
buildroot-get:
docker cp upsilon-buildroot:/home/user/buildroot/output/images/Image upsilon/boot/
docker cp upsilon-buildroot:/home/user/buildroot/output/images/rootfs.cpio upsilon/boot/
buildroot-execute:
docker exec -ti upsilon-buildroot /bin/bash -c ' \
2023-06-02 16:16:13 -04:00
tar -xvf upsilon-buildroot.tar.gz && \
cd buildroot && \
make BR2_EXTERNAL=../upsilon/buildroot litex_vexriscv_defconfig && \
make '
2023-06-05 16:47:26 -04:00
buildroot-clean:
-docker container stop upsilon-buildroot
-docker container rm upsilon-buildroot
2023-06-02 16:16:13 -04:00
2023-06-07 12:47:20 -04:00
###### TFTP
tftp:
cd upsilon/boot && py3tftp --host 192.168.1.100 -p 6969 -v
2023-05-30 16:10:03 -04:00
###### External projects
2023-05-26 17:09:30 -04:00
2023-06-02 13:45:35 -04:00
clone: f4pga buildroot litex opensbi
2023-05-26 15:00:46 -04:00
f4pga:
if [ ! -d 'f4pga' ]; then \
git clone https://github.com/chipsalliance/f4pga; \
fi
cd f4pga && git checkout main && git pull && \
2023-05-30 16:10:03 -04:00
git checkout -B upsilon_stable 835a40534f9efd70770d74f56f25fef6cfc6ebc6 \
tar -czvf f4pga.tar.gz f4pga
2023-05-26 15:00:46 -04:00
buildroot:
if [ ! -d 'buildroot' ]; then \
git clone https://git.buildroot.org/buildroot; \
fi
cd buildroot && git checkout master && git pull && \
git checkout -B upsilon_stable 2023.02.1
tar -czvf buildroot.tar.gz buildroot/
litex:
if [ ! -d 'litex' ]; then \
git clone https://github.com/enjoy-digital/litex; \
fi
cd litex && git checkout master && git pull && \
git checkout -B upsilon_stable c6ccb626e88168045edacced3743f6bd98746742
2023-05-30 16:10:03 -04:00
2023-06-02 13:45:35 -04:00
upsilon-hardware.tar.gz:
tar -czvf upsilon-hardware.tar.gz upsilon/firmware/
2023-06-02 16:16:13 -04:00
upsilon-buildroot.tar.gz:
tar -czvf upsilon-buildroot.tar.gz upsilon/buildroot/
2023-06-02 13:45:35 -04:00
# 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/