Skip to content

Commit

Permalink
Persistent shared dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmichalski-ant committed Feb 2, 2024
1 parent fb10cdc commit af920c3
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,26 @@ jobs:
git+https://github.com/antmicro/tuttest.git@c44309e0365c54759fb36864fb77bf8b347bd647
repos: https://github.com/antmicro/pyrav4l2.git pyrav4l2

riscv64-shared-dirs-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3

- name: test
uses: ./
with:
shared-dirs: tests
renode-run: |
echo "riscv64-shared-dirs-test"
- name: read
run: |
ls ./shared
cat shared/test.txt
ls ./rootfs/home
cat ./rootfs/home/test.txt
arm32-test:
runs-on: ubuntu-latest
needs: send-to-releases
Expand Down
5 changes: 4 additions & 1 deletion action/device/hifive_unleashed/init.resc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ machine LoadPlatformDescription @action/device/hifive_unleashed/platform.repl

# rootfs
machine LoadPlatformDescriptionFromString 'virtio: Storage.VirtIOBlockDevice @ sysbus 0x100d0000 { IRQ -> plic@50 }'
virtio LoadImage @images/rootfs.img
virtio LoadImage @images/rootfs.img true

machine LoadPlatformDescriptionFromString 'virtio2: Storage.VirtIOBlockDevice @ sysbus 0x100e0000 { IRQ -> plic@51 }'
virtio2 LoadImage @images/persistent.img true

showAnalyzer uart0
e51 LogFunctionNames true
Expand Down
6 changes: 5 additions & 1 deletion action/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ def burn_rootfs_image(
if not os.path.islink(fp):
size += os.path.getsize(fp)

image_size = f'{max(size * 2, 5 * 10**7)}'
image_size = f'{max(size * 2, 5 * 10**7)*2}'
try:

run(["truncate", "images/rootfs.img", "-s", image_size], check=True)
run(["mkfs.ext4", "-d", "images/rootfs", "images/rootfs.img"],
check=True,
stdout=DEVNULL)
run(["truncate", "images/persistent.img", "-s", "128MB"], check=True)
run(["mkfs.ext4", "images/persistent.img"],
check=True,
stdout=DEVNULL)
except CalledProcessError as e:
sys.exit(e.returncode)
6 changes: 6 additions & 0 deletions action/run-in-renode.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from dependencies import add_repos, add_packages
from images import prepare_shared_directories, prepare_kernel_and_initramfs, burn_rootfs_image
from dispatcher import CommandDispatcher
from subprocess import run

from datetime import datetime

Expand Down Expand Up @@ -146,3 +147,8 @@ def test_task(test_task_str: str):
dispatcher.add_task(test_task(args.get("renode-run", "")))

dispatcher.evaluate()

run(["mkdir", "shared"], check=True)
run(["sudo", "mount", "images/persistent.img", "shared"], check=True)
run(["mkdir", "rootfs"], check=True)
run(["sudo", "mount", "images/rootfs.img", "rootfs"], check=True)
1 change: 1 addition & 0 deletions action/tasks/chroot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ timeout: 5
fail-fast: true
commands:
- mount /dev/vda /mnt
# - echo "test" > /mnt/home/t.txt
- cd /mnt
- mount -t proc /proc proc/
- mount -t sysfs /sys sys/
Expand Down
18 changes: 18 additions & 0 deletions action/tasks/save_shared_dirs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: save_shared_dirs
shell: target
requires: [action_test]
echo: true
timeout: 5
fail-fast: false
check-exit-code: false
commands:
- echo "TEST"
- mkdir -p host_dir
- mount /dev/vdb host_dir
- ls host_dir
- echo "file from Renode" > host_dir/test.txt
- umount host_dir
- pwd
- echo "second file" > test.txt
- ls
# - umount /dev/vda
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/bo
index dddabfbbc7a9..15e528335102 100644
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
@@ -29,6 +29,12 @@ memory@80000000 {
@@ -29,6 +29,18 @@ memory@80000000 {
};

soc {
Expand All @@ -24,6 +24,12 @@ index dddabfbbc7a9..15e528335102 100644
+ reg = <0x00 0x100d0000 0x00 0x150>;
+ interrupt-parent = <&plic0>;
+ interrupts = <50>;
+ };
+ virtio@100e0000 {
+ compatible = "virtio,mmio";
+ reg = <0x00 0x100e0000 0x00 0x150>;
+ interrupt-parent = <&plic0>;
+ interrupts = <51>;
+ };
};

Expand Down

0 comments on commit af920c3

Please sign in to comment.