From 0d66c59676061c09450500fa8392bfd883823d2c Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Thu, 27 Feb 2025 02:03:07 +0100 Subject: [PATCH] busybox version --- .gitignore | 2 ++ create.sh | 15 +++++++++++++++ init | 2 ++ run.sh | 7 +++++++ 4 files changed, 26 insertions(+) create mode 100644 .gitignore create mode 100755 create.sh create mode 100755 init create mode 100755 run.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3b8d86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/initrd/ +/initrd.img diff --git a/create.sh b/create.sh new file mode 100755 index 0000000..8e656db --- /dev/null +++ b/create.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# LEdoian's absurdly simple initrd generator (benchmark arc) + +set -eu + +mkdir "initrd" +cp "./init" "initrd/" + +busybox="$(which busybox)" +cp "$busybox" "initrd/busybox" + +pushd "./initrd" +find . | cpio -o -H newc > ../initrd.img +popd diff --git a/init b/init new file mode 100755 index 0000000..56d8cc1 --- /dev/null +++ b/init @@ -0,0 +1,2 @@ +#!/busybox ash +/busybox poweroff -f diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..44a3630 --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -eu + +arch=x86_64 +kernel=/boot/vmlinuz-linux +time qemu-system-"$arch" -m 100M -net none -kernel "$kernel" -initrd "./initrd.img" -serial none -vga none -display none "$@"