diff options
author | kartofen <mladenovnasko0@gmail.com> | 2023-04-24 23:52:41 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2023-04-24 23:52:41 +0300 |
commit | 9bf5719d4c59993c07113c089ebd5a92d692f785 (patch) | |
tree | 7310918ccac5bb3cfffc18861c286a6872554c01 /vm.sh | |
parent | 2ca6677667af23ecb1e17479c5b5cc08efa53309 (diff) |
skeleton done
Diffstat (limited to 'vm.sh')
-rwxr-xr-x | vm.sh | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +#!/bin/sh + +function run +{ + qemu-system-x86_64 \ + -kernel "$BIND/$KERNEL_NAME" \ + -initrd "$BIND/$INITFS_NAME" \ + -append "console=ttyS0" -nographic +} + +function initramfs +{ + IMG="$(pwd)/$1" + DIR="${IMG%.*}" + mkdir -p $DIR + + # get busybox things + install -D $(which busybox) $DIR/bin/busybox + ln -sf busybox $DIR/bin/sh + ln -sf busybox $DIR/bin/dmesg + + # copy the compiled binaries + mkdir -p $DIR/usr/bin + cp $BIND/*.ko $DIR/usr/bin + + # copy the script and the bin + cp $2 $DIR/init + chmod +x $DIR/init + + # make image and delete folder + (cd $DIR; find . | cpio -H newc -o | gzip > $IMG) + + rm -rf $DIR +} + +function kernel +{ + sudo cp /boot/vmlinuz-linux-lts $1 +} + +$1 $2 $3 |