From f05aaa0561e071a54785ae7dfae3d8a34c9df06a Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 21 Aug 2021 23:23:30 +0300 Subject: Updated build system with run command --- arch/riscv/conf/mkimage.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 arch/riscv/conf/mkimage.sh (limited to 'arch/riscv/conf/mkimage.sh') diff --git a/arch/riscv/conf/mkimage.sh b/arch/riscv/conf/mkimage.sh new file mode 100755 index 0000000..31abb8e --- /dev/null +++ b/arch/riscv/conf/mkimage.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +if [ ! -e fs ]; then + mkdir fs +fi + +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 + +../u-boot-apos/tools/mkimage -f arch/riscv/conf/apos.its fs/apos.itb +../u-boot-apos/tools/mkimage -A riscv -O apos -T script \ + -d arch/riscv/conf/boot.cmd fs/boot.scr + +umount -l fs + +qemu-system-riscv64 -machine virt \ + -kernel ../u-boot-apos/u-boot \ + -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ + -device virtio-blk-device,drive=hd0 \ + -drive file=rootfs.img,format=raw,id=hd0 \ + -S -s -m 2G \ + -serial stdio -- cgit v1.3