Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mkdir -p os/rootfs
- cd os/rootfs
- #create base file system
- mkdir dev proc sys tmp bin
- sudo mknod dev/console c 5 1
- #copy buysbox and link all applications
- cp /usr/bin/busybox bin
- ./bin/busybox busybox --install ./bin/
- #create init script
- echo '#!/bin/sh
- mount -t proc proc /proc
- mount -t sysfs sysfs /sys
- mount -t devtmpfs udev /dev
- /bin/sh
- poweroff -f' > init
- chmod +x init
- #create initrd
- find . | cpio -H newc -o | gzip > ../rootfs.cpio.gz
- cd ../
- #copy kernel from current system
- cp "$(ls /boot/vmlinuz-*|tail -n1)" linux
- #run virtual machine
- qemu-system-x86_64 -enable-kvm -kernel linux -initrd rootfs.cpio.gz
- #or run it without GUI in current shell
- qemu-system-x86_64 -enable-kvm -kernel linux -initrd rootfs.cpio.gz -nographic -append 'console=ttyS0'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement