From b5987117a40aad82d56e2b07b512fe92a11bbbd9 Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Fri, 22 Dec 2023 10:10:53 +0000 Subject: Update Qemu ARM64 notes --- md/writeup/qemu_arm64.md | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'md') diff --git a/md/writeup/qemu_arm64.md b/md/writeup/qemu_arm64.md index 244319c..79f8819 100644 --- a/md/writeup/qemu_arm64.md +++ b/md/writeup/qemu_arm64.md @@ -67,11 +67,44 @@ qemu-system-aarch64 -M virt -m 1024 -cpu cortex-a53 \ ## Run virt -Qemu contains configuration to run non existent machine called virt that suppose to be run with virtual machines. +Qemu contains configuration to run physicaly non existant ARM64 board called virt that suppose to be run with virtual machines and contains generic configuration. + +Basic examples how to boot into the busy box shell is. Build busy boxwith mount,ash,exec and echo. +Create init script that will set the pathes and create some dev,proc and sys mount points and switch +to busybox shell. + +```bash +#!/sh +/busybox echo "Boom" > /dev/kmsg +export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/ +/busybox mount -t proc none /proc +/busybox mount -t sysfs none /sys +/buysbox mount -t devtmpfs -o nosuid,mode=0755 udev /dev +/busybox mount /dev/pts +/busybox mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true +exec /busybox sh +``` + +Create initrd files with init file and busybox utilities + +```bash +find . | cpio -o -c -R root:root | gzip -9 > ../initrd-arm64.img +``` + +Boot into the just created initrd ```bash +qemu-system-aarch64 \ + -machine virt -m 1024M -cpu cortex-a53 \ + -kernel bootfs-arm64/Image.gz \ + -initrd initrd-out.gz \ + -append "root=/dev/ram0 console=ttyAMA0 debug " \ + -nographic ``` + + + ## Under ArchLinux Install all qemu packages with @@ -99,4 +132,5 @@ pacman -S qemu-full 12. [https://wiki.archlinux.org/title/mkinitcpio](https://wiki.archlinux.org/title/mkinitcpio) 13. https://www.ibm.com/docs/en/zos/2.4.0?topic=codes-exit-status-usrsbininit 14. https://access.redhat.com/solutions/24029 -15. [http://phwl.org/2022/qemu-aarch64-debian/](http://phwl.org/2022/qemu-aarch64-debian/) \ No newline at end of file +15. [http://phwl.org/2022/qemu-aarch64-debian/](http://phwl.org/2022/qemu-aarch64-debian/) +16. [http://git.main.lv/cgit.cgi/os201.git/tree/create_installroot](http://git.main.lv/cgit.cgi/os201.git/tree/create_installroot) \ No newline at end of file -- cgit v1.2.3