aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/conf/mkimage.sh
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-09-11 21:50:55 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-09-14 21:21:27 +0300
commit025778e89e7d0fe3cd1ad53537c9cc6f3cd819cc (patch)
treea137a9f405578b41e092e13892516feccc4d71e6 /arch/riscv64/conf/mkimage.sh
parent9e2720ca086a74cfb6fa595da8c42e6cd24352ee (diff)
downloadkmi-025778e89e7d0fe3cd1ad53537c9cc6f3cd819cc.tar.gz
kmi-025778e89e7d0fe3cd1ad53537c9cc6f3cd819cc.zip
riscv32 boots and advances as far as riscv64
Diffstat (limited to 'arch/riscv64/conf/mkimage.sh')
-rwxr-xr-xarch/riscv64/conf/mkimage.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/riscv64/conf/mkimage.sh b/arch/riscv64/conf/mkimage.sh
index d791396..9f745a1 100755
--- a/arch/riscv64/conf/mkimage.sh
+++ b/arch/riscv64/conf/mkimage.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+XLEN=$(echo "$1" | cut -c '6-7')
+
if [ ! -e fs ]; then
mkdir fs
fi
@@ -8,7 +10,6 @@ if [ ! -e rootfs.img ]; then
virt-make-fs --partition=mbr --type=vfat --size=10M fs rootfs.img
fi
-
SSIZE=$(fdisk -l rootfs.img | awk '$1=="Units:" {print $8}')
OFFSET=$(fdisk -l rootfs.img | awk '$1=="rootfs.img1" {print $2}')
mount -o loop,offset=$((${SSIZE}*${OFFSET})) rootfs.img fs
@@ -16,15 +17,16 @@ mount -o loop,offset=$((${SSIZE}*${OFFSET})) rootfs.img fs
# not entirely pleased with this solution, although eventually I should probably
# move `run` out of the kernel repo and into some `aposos` repo with a runtime
# and proper initrd etc. so this is good enough for now
-../rv64/u-boot-apos/tools/mkimage -f arch/riscv64/conf/apos.its fs/apos.itb
-../rv64/u-boot-apos/tools/mkimage -A riscv -O apos -T script \
+../rv${XLEN}/u-boot-apos/tools/mkimage -f arch/riscv${XLEN}/conf/apos.its fs/apos.itb
+../rv${XLEN}/u-boot-apos/tools/mkimage -A riscv -O apos -T script \
-d arch/riscv64/conf/boot.cmd fs/boot.scr
umount -l fs
-qemu-system-riscv64 -machine virt \
- -kernel ../rv64/u-boot-apos/u-boot \
- -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \
+qemu-system-riscv${XLEN} \
+ -machine virt \
+ -kernel ../rv${XLEN}/u-boot-apos/u-boot \
+ -bios ../rv${XLEN}/opensbi/build/platform/generic/firmware/fw_jump.elf \
-device virtio-blk-device,drive=hd0 \
-drive file=rootfs.img,format=raw,id=hd0 \
-S -s -m 2G \