#!/bin/sh function run { # st \ 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 ln -sf busybox $DIR/bin/mount # copy the things mkdir -p "$DIR/usr" find "$BIND" -maxdepth 1 -mindepth 1 \ ! -name "*initramfs*" \ ! -name "*kernel*" \ -exec cp -r {} "$DIR/usr" \; # 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