Skip to content

Instantly share code, notes, and snippets.

@aagontuk
Last active November 12, 2024 13:42
Show Gist options
  • Select an option

  • Save aagontuk/f7a7986894e07c6eb9b08484b2f33981 to your computer and use it in GitHub Desktop.

Select an option

Save aagontuk/f7a7986894e07c6eb9b08484b2f33981 to your computer and use it in GitHub Desktop.

Revisions

  1. aagontuk revised this gist Jan 6, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -117,4 +117,4 @@ make install
    4. https://wiki.archlinux.org/index.php/QEMU
    5. https://wiki.gentoo.org/wiki/QEMU/Options
    6. https://www.tauceti.blog/posts/qemu-kvm-share-host-directory-with-vm-with-virtio/
    7. [Disk Images](https://qemu-project.gitlab.io/qemu/system/images.html)
    7. [QEMU Disk Images](https://qemu-project.gitlab.io/qemu/system/images.html)
  2. aagontuk revised this gist Jan 6, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -117,4 +117,4 @@ make install
    4. https://wiki.archlinux.org/index.php/QEMU
    5. https://wiki.gentoo.org/wiki/QEMU/Options
    6. https://www.tauceti.blog/posts/qemu-kvm-share-host-directory-with-vm-with-virtio/
    7. https://qemu-project.gitlab.io/qemu/system/images.html
    7. [Disk Images](https://qemu-project.gitlab.io/qemu/system/images.html)
  3. aagontuk revised this gist Jan 6, 2023. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -110,10 +110,11 @@ make install
    * [Automating the Creation of QEMU Archlinux Images from Scratch](https://blog.stefan-koch.name/2020/05/31/automation-archlinux-qemu-installation)
    * [Automating Debian install in QEMU](https://sigmaris.info/blog/2019/04/automating-debian-install-qemu/)
    ## References ##
    ## General References ##
    1. https://wiki.debian.org/KVM
    2. https://wiki.debian.org/QEMU
    3. https://wiki.archlinux.org/index.php/KVM
    4. https://wiki.archlinux.org/index.php/QEMU
    5. https://wiki.gentoo.org/wiki/QEMU/Options
    6. https://www.tauceti.blog/posts/qemu-kvm-share-host-directory-with-vm-with-virtio/
    6. https://www.tauceti.blog/posts/qemu-kvm-share-host-directory-with-vm-with-virtio/
    7. https://qemu-project.gitlab.io/qemu/system/images.html
  4. aagontuk revised this gist Jan 5, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -90,6 +90,7 @@ qemu-system-aarch64 -m 8G -cpu cortex-a57 -M virt,gic-version=max -smp 16 -nogra
    make olddefconfig
    make localmodconfig
    make -j$(nproc)
    make -j$(nproc) bzImage # If you want to create kernel bzImage
    make modules
    make modules_install
    make install
  5. aagontuk revised this gist Jan 5, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -97,6 +97,7 @@ make install
    ## Running the compiled kernel and Debugging ##
    * [Direct Linux Boot](https://qemu-project.gitlab.io/qemu/system/linuxboot.html)
    * [Prepare the environment for developing Linux kernel with qemu.](https://medium.com/@daeseok.youn/prepare-the-environment-for-developing-linux-kernel-with-qemu-c55e37ba8ade)
    * [Booting a Custom Linux Kernel in QEMU and Debugging It With GDB](http://nickdesaulniers.github.io/blog/2018/10/24/booting-a-custom-linux-kernel-in-qemu-and-debugging-it-with-gdb/)
  6. aagontuk revised this gist Jan 5, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -95,9 +95,10 @@ make modules_install
    make install
    ```
    ## Running the compiled kernel directly ##
    ## Running the compiled kernel and Debugging ##
    * [Prepare the environment for developing Linux kernel with qemu.](https://medium.com/@daeseok.youn/prepare-the-environment-for-developing-linux-kernel-with-qemu-c55e37ba8ade)
    * [Booting a Custom Linux Kernel in QEMU and Debugging It With GDB](http://nickdesaulniers.github.io/blog/2018/10/24/booting-a-custom-linux-kernel-in-qemu-and-debugging-it-with-gdb/)
    ## Automating QEMU ###
  7. aagontuk revised this gist Oct 10, 2022. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -95,6 +95,10 @@ make modules_install
    make install
    ```
    ## Running the compiled kernel directly ##
    * [Prepare the environment for developing Linux kernel with qemu.](https://medium.com/@daeseok.youn/prepare-the-environment-for-developing-linux-kernel-with-qemu-c55e37ba8ade)
    ## Automating QEMU ###
    * [qemu guest automation](https://stackoverflow.com/questions/3146013/qemu-guest-automation)
  8. aagontuk revised this gist Oct 10, 2022. No changes.
  9. aagontuk revised this gist Oct 9, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,9 @@ make install
    * [qemu guest automation](https://stackoverflow.com/questions/3146013/qemu-guest-automation)
    * [Is it possible to script qemu?](https://stackoverflow.com/questions/5271647/is-it-possible-to-script-qemu)
    * [How to Setup QEMU Output to Console and Automate Using Shell Script](https://fadeevab.com/how-to-setup-qemu-output-to-console-and-automate-using-shell-script/#binariesusedinexamples)
    * [Automating the Creation of QEMU Archlinux Images from Scratch](https://blog.stefan-koch.name/2020/05/31/automation-archlinux-qemu-installation)
    * [Automating Debian install in QEMU](https://sigmaris.info/blog/2019/04/automating-debian-install-qemu/)
    ## References ##
    1. https://wiki.debian.org/KVM
  10. aagontuk revised this gist Oct 9, 2022. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -95,6 +95,12 @@ make modules_install
    make install
    ```
    ## Automating QEMU ###
    * [qemu guest automation](https://stackoverflow.com/questions/3146013/qemu-guest-automation)
    * [Is it possible to script qemu?](https://stackoverflow.com/questions/5271647/is-it-possible-to-script-qemu)
    ## References ##
    1. https://wiki.debian.org/KVM
    2. https://wiki.debian.org/QEMU
  11. aagontuk revised this gist Aug 3, 2022. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -85,6 +85,16 @@ qemu-system-aarch64 -m 8G -cpu cortex-a57 -M virt,gic-version=max -smp 16 -nogra
    * https://tldp.org/HOWTO/pdf/Modules.pdf
    * [How to debug kernel using QEMU and aarch64 VM](https://futurewei-cloud.github.io/ARM-Datacenter/qemu/aarch64-debug-kernel/)
    **Quick Configure, build and install**
    ```
    make olddefconfig
    make localmodconfig
    make -j$(nproc)
    make modules
    make modules_install
    make install
    ```
    ## References ##
    1. https://wiki.debian.org/KVM
    2. https://wiki.debian.org/QEMU
  12. aagontuk revised this gist Jul 27, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -74,6 +74,7 @@ qemu-system-aarch64 -m 8G -cpu cortex-a57 -M virt,gic-version=max -smp 16 -nogra
    * Increase Resolution: `-vga virtio`
    * Better Graphics Support: https://www.linux-kvm.org/page/SPICE
    * [How to mount a qcow2 disk image](https://gist.github.com/shamil/62935d9b456a6f9877b5)
    * [Changing the password Qemu kvm qcow2 ](https://access.redhat.com/discussions/664843): Uses tool `guestfish` but simply mounting the image and editing /etc/shadow directly with a text editor will work too.
    ## Compiling the kernel ##
  13. aagontuk revised this gist Jul 27, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -73,6 +73,7 @@ qemu-system-aarch64 -m 8G -cpu cortex-a57 -M virt,gic-version=max -smp 16 -nogra
    * Audio: -soundhw ac97
    * Increase Resolution: `-vga virtio`
    * Better Graphics Support: https://www.linux-kvm.org/page/SPICE
    * [How to mount a qcow2 disk image](https://gist.github.com/shamil/62935d9b456a6f9877b5)
    ## Compiling the kernel ##
  14. aagontuk revised this gist Jul 12, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -51,15 +51,15 @@ Once the installation is done you can start the VM normally.
    * Create UEFI image for qemu:
    ```
    sudo apt-get install qemu-uefi
    sudo apt-get install qemu-efi
    cp /usr/share/qemu-efi-aarch64/QEMU_EFI.fd flash0.img
    truncate -s 64M flash0.img
    truncate -s 64M flash1.img
    ```
    * Run Ubuntu cloud image with QEMU:
    ```
    qemu-system-aarch64 -m 2048 -cpu cortex-a57 -M virt -smp 8 -nographic -drive if=pflash,format=raw,file=flash0.img,readonly -drive if=pflash,format=raw,file=flash1.img -drive if=none,file=focal-server-cloudimg-arm64.img,id=hd0 -device virtio-blk-device,drive=hd0
    qemu-system-aarch64 -m 8G -cpu cortex-a57 -M virt,gic-version=max -smp 16 -nographic -drive if=pflash,format=raw,file=flash0.img,readonly -drive if=pflash,format=raw,file=flash1.img -drive if=none,file=focal-server-cloudimg-arm64.img,id=hd0 -device virtio-blk-device,drive=hd0
    ```
    * [Installing Debian on QEMU’s 64-bit ARM “virt” board](https://web.archive.org/web/20220704230751/https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/)
  15. aagontuk revised this gist Jul 6, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -81,6 +81,7 @@ qemu-system-aarch64 -m 2048 -cpu cortex-a57 -M virt -smp 8 -nographic -drive if=
    * https://wiki.archlinux.org/title/Kernel/Traditional_compilation
    * https://unix.stackexchange.com/questions/253245/what-does-make-localmodconfig-do
    * https://tldp.org/HOWTO/pdf/Modules.pdf
    * [How to debug kernel using QEMU and aarch64 VM](https://futurewei-cloud.github.io/ARM-Datacenter/qemu/aarch64-debug-kernel/)
    ## References ##
    1. https://wiki.debian.org/KVM
  16. aagontuk revised this gist Jul 6, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -66,6 +66,7 @@ qemu-system-aarch64 -m 2048 -cpu cortex-a57 -M virt -smp 8 -nographic -drive if=
    * [Build an aarch64 UEFI image for QEMU](http://www.xryan.net/p/212)
    * [Ubuntu ARM on Qemu](https://wiki.ubuntu.com/ARM64/QEMU)
    * [How to install Ubuntu Server for Arm in a QEMU aarch64 virtual machine](https://lanyaplab.com/index.php/2020/06/08/how-to-install-ubuntu-server-for-arm-in-a-qemu-aarch64-virtual-machine/)
    * [QEMU ARM limit of 123 cores ](https://futurewei-cloud.github.io/ARM-Datacenter/qemu/qemu-arm-about-the-123-core-limit/): Use GIC to scale more than 8 processors
    ## Miscellaneous ##
  17. aagontuk revised this gist Jul 6, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ qemu-system-aarch64 -m 2048 -cpu cortex-a57 -M virt -smp 8 -nographic -drive if=
    * [Ubuntu ARM on Qemu](https://wiki.ubuntu.com/ARM64/QEMU)
    * [How to install Ubuntu Server for Arm in a QEMU aarch64 virtual machine](https://lanyaplab.com/index.php/2020/06/08/how-to-install-ubuntu-server-for-arm-in-a-qemu-aarch64-virtual-machine/)
    ## miscellaneous ##
    ## Miscellaneous ##
    * Audio: -soundhw ac97
    * Increase Resolution: `-vga virtio`
  18. aagontuk revised this gist Jul 6, 2022. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -45,6 +45,23 @@ Once the installation is done you can start the VM normally.
    ## ARM ##
    #### Running Ubuntu on Qemu ###
    * Download Ubuntu ARM cloud image: http://cloud-images.ubuntu.com/
    * Create UEFI image for qemu:
    ```
    sudo apt-get install qemu-uefi
    cp /usr/share/qemu-efi-aarch64/QEMU_EFI.fd flash0.img
    truncate -s 64M flash0.img
    truncate -s 64M flash1.img
    ```
    * Run Ubuntu cloud image with QEMU:
    ```
    qemu-system-aarch64 -m 2048 -cpu cortex-a57 -M virt -smp 8 -nographic -drive if=pflash,format=raw,file=flash0.img,readonly -drive if=pflash,format=raw,file=flash1.img -drive if=none,file=focal-server-cloudimg-arm64.img,id=hd0 -device virtio-blk-device,drive=hd0
    ```
    * [Installing Debian on QEMU’s 64-bit ARM “virt” board](https://web.archive.org/web/20220704230751/https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/)
    * [Build an aarch64 UEFI image for QEMU](http://www.xryan.net/p/212)
    * [Ubuntu ARM on Qemu](https://wiki.ubuntu.com/ARM64/QEMU)
  19. aagontuk revised this gist Jul 6, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -48,6 +48,7 @@ Once the installation is done you can start the VM normally.
    * [Installing Debian on QEMU’s 64-bit ARM “virt” board](https://web.archive.org/web/20220704230751/https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/)
    * [Build an aarch64 UEFI image for QEMU](http://www.xryan.net/p/212)
    * [Ubuntu ARM on Qemu](https://wiki.ubuntu.com/ARM64/QEMU)
    * [How to install Ubuntu Server for Arm in a QEMU aarch64 virtual machine](https://lanyaplab.com/index.php/2020/06/08/how-to-install-ubuntu-server-for-arm-in-a-qemu-aarch64-virtual-machine/)
    ## miscellaneous ##
  20. aagontuk revised this gist Jul 6, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -47,6 +47,7 @@ Once the installation is done you can start the VM normally.
    * [Installing Debian on QEMU’s 64-bit ARM “virt” board](https://web.archive.org/web/20220704230751/https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/)
    * [Build an aarch64 UEFI image for QEMU](http://www.xryan.net/p/212)
    * [Ubuntu ARM on Qemu](https://wiki.ubuntu.com/ARM64/QEMU)
    ## miscellaneous ##
  21. aagontuk revised this gist Jul 4, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,7 @@ Once the installation is done you can start the VM normally.
    ## ARM ##
    * [Installing Debian on QEMU’s 64-bit ARM “virt” board](https://web.archive.org/web/20220704230751/https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/)
    * [Build an aarch64 UEFI image for QEMU](http://www.xryan.net/p/212)
    ## miscellaneous ##
  22. aagontuk revised this gist Jul 4, 2022. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,10 @@ Debian netinst doesn't show any output if qemu is run with -nographic option whi
    Once the installation is done you can start the VM normally.
    ## ARM ##
    * [Installing Debian on QEMU’s 64-bit ARM “virt” board](https://web.archive.org/web/20220704230751/https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/)
    ## miscellaneous ##
    * Audio: -soundhw ac97
  23. aagontuk revised this gist Jun 22, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -52,6 +52,7 @@ Once the installation is done you can start the VM normally.
    ## Compiling the kernel ##
    * https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/README?id=refs/tags/v4.3.3
    * https://www.linux.com/topic/desktop/how-compile-linux-kernel-0/
    * https://wiki.archlinux.org/title/Kernel/Traditional_compilation
    * https://unix.stackexchange.com/questions/253245/what-does-make-localmodconfig-do
    * https://tldp.org/HOWTO/pdf/Modules.pdf
  24. aagontuk revised this gist Jun 22, 2022. 1 changed file with 13 additions and 6 deletions.
    19 changes: 13 additions & 6 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -32,12 +32,6 @@ sudo qemu-system-x86_64 -enable-kvm -m 2048 -cpu host -smp 2 -drive file=virtual
    * A better alternative for sharing file would be [virtiofs](https://virtio-fs.gitlab.io/index.html): Needs testing.
    ### miscellaneous ###
    * Audio: -soundhw ac97
    * Increase Resolution: `-vga virtio`
    * Better Graphics Support: https://www.linux-kvm.org/page/SPICE
    ## CLI installation (-nographic) ##
    Debian netinst doesn't show any output if qemu is run with -nographic option while installing from ISO. You have to use `-kernel /path/to/kernel` with `-append "console=ttyS0"`. Other Solutions:
    @@ -49,6 +43,19 @@ Debian netinst doesn't show any output if qemu is run with -nographic option whi
    Once the installation is done you can start the VM normally.
    ## miscellaneous ##
    * Audio: -soundhw ac97
    * Increase Resolution: `-vga virtio`
    * Better Graphics Support: https://www.linux-kvm.org/page/SPICE
    ## Compiling the kernel ##
    * https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/README?id=refs/tags/v4.3.3
    * https://wiki.archlinux.org/title/Kernel/Traditional_compilation
    * https://unix.stackexchange.com/questions/253245/what-does-make-localmodconfig-do
    * https://tldp.org/HOWTO/pdf/Modules.pdf
    ## References ##
    1. https://wiki.debian.org/KVM
    2. https://wiki.debian.org/QEMU
  25. aagontuk revised this gist Jun 21, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ sudo qemu-system-x86_64 -enable-kvm -m 2048 -cpu host -smp 2 -drive file=virtual
    ```
    2. In guest mount the host folder: `mount -t 9p -o trans=virtio,version=9p2000.L hostshare /path/to/mount/point`
    * A better alternative for sharing file would be [virtiofs](https://virtio-fs.gitlab.io/index.html): Need testing.
    * A better alternative for sharing file would be [virtiofs](https://virtio-fs.gitlab.io/index.html): Needs testing.
    ### miscellaneous ###
  26. aagontuk revised this gist Jun 21, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,8 @@ sudo qemu-system-x86_64 -enable-kvm -m 2048 -cpu host -smp 2 -drive file=virtual
    ```
    2. In guest mount the host folder: `mount -t 9p -o trans=virtio,version=9p2000.L hostshare /path/to/mount/point`
    * A better alternative for sharing file would be [virtiofs](https://virtio-fs.gitlab.io/index.html): Need testing.
    ### miscellaneous ###
    * Audio: -soundhw ac97
  27. aagontuk revised this gist Jun 21, 2022. 1 changed file with 3 additions and 9 deletions.
    12 changes: 3 additions & 9 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -12,27 +12,21 @@ distro.

    * Create a qcow2 image for the guest: `qemu-img create -f qcow2 virtualdebian.img 50G`

    * Preparing host for networking on guest.
    1. Install necessary packages: `sudo apt install bridge-utils iptables dnsmasq`
    2. Create `/etc/qemu-ifup` from here: https://gist.github.com/aagontuk/b6de2b428da4484c442b443ebad4974b
    3. Make it executable: `sudo chmod +x /etc/qemu-ifup
    4. Your getway will be 192.168.53.1 and IP range from 192.168.53.2 to 192.168.53.254.`

    * Boot ISO to install the guest OS: (You need to run this as root for networking to work)
    ```
    sudo qemu-system-x86_64 -enable-kvm -m RAM_IN_MB -smp NUM_CPU -drive file=virtualdebian.img -cdrom debian.iso -boot d -net tap -net nic
    sudo qemu-system-x86_64 -enable-kvm -m RAM_IN_MB -smp NUM_CPU -drive file=virtualdebian.img -cdrom debian.iso -boot d
    ```

    * Install guest OS.

    * Now run the guest OS with qemu whenever you want:
    ```
    sudo qemu-system-x86_64 -enable-kvm -m 2048 -smp 2 -drive file=virtualdebian.img -net tap -net nic
    sudo qemu-system-x86_64 -enable-kvm -m 2048 -cpu host -smp 2 -drive file=virtualdebian.img
    ```
    * If you want to share a folder from host to guest:
    1. Run the guest with this command:
    ```
    sudo qemu-system-x86_64 -enable-kvm -m 2048 -smp 2 -drive file=virtualdebian.img,if=virtio -fsdev local,security_model=passthrough,id=fsdev0,path=/path/to/host/folder -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare -net tap -net nic
    sudo qemu-system-x86_64 -enable-kvm -m 2048 -cpu host -smp 2 -drive file=virtualdebian.img,if=virtio -fsdev local,security_model=passthrough,id=fsdev0,path=/path/to/host/folder -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare
    ```
    2. In guest mount the host folder: `mount -t 9p -o trans=virtio,version=9p2000.L hostshare /path/to/mount/point`
  28. aagontuk revised this gist Jun 21, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -58,4 +58,5 @@ Once the installation is done you can start the VM normally.
    2. https://wiki.debian.org/QEMU
    3. https://wiki.archlinux.org/index.php/KVM
    4. https://wiki.archlinux.org/index.php/QEMU
    5. https://wiki.gentoo.org/wiki/QEMU/Options
    5. https://wiki.gentoo.org/wiki/QEMU/Options
    6. https://www.tauceti.blog/posts/qemu-kvm-share-host-directory-with-vm-with-virtio/
  29. aagontuk revised this gist Jun 21, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -44,13 +44,15 @@ sudo qemu-system-x86_64 -enable-kvm -m 2048 -smp 2 -drive file=virtualdebian.img
    ## CLI installation (-nographic) ##
    Debian netinst doesn't show any output if qemu is run with -nographic option. You have to use `-kernel /path/to/kernel` with `-append "console=ttyS0"`. Other Solutions:
    Debian netinst doesn't show any output if qemu is run with -nographic option while installing from ISO. You have to use `-kernel /path/to/kernel` with `-append "console=ttyS0"`. Other Solutions:
    * https://sites.google.com/a/palatin.fr/pierre/entries/debian-netinst-qemu
    * https://superuser.com/a/1311906/460620
    * https://levelup.gitconnected.com/probably-the-simplest-way-to-install-debian-ubuntu-in-qemu-2db6afde27ef
    * https://serverfault.com/questions/976140/how-do-i-boot-the-debian-10-image-with-qemu-kvm
    Once the installation is done you can start the VM normally.
    ## References ##
    1. https://wiki.debian.org/KVM
    2. https://wiki.debian.org/QEMU
  30. aagontuk revised this gist Jun 21, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions linux_kernel_on_kvm_guest.md
    Original file line number Diff line number Diff line change
    @@ -49,6 +49,7 @@ Debian netinst doesn't show any output if qemu is run with -nographic option. Yo
    * https://sites.google.com/a/palatin.fr/pierre/entries/debian-netinst-qemu
    * https://superuser.com/a/1311906/460620
    * https://levelup.gitconnected.com/probably-the-simplest-way-to-install-debian-ubuntu-in-qemu-2db6afde27ef
    * https://serverfault.com/questions/976140/how-do-i-boot-the-debian-10-image-with-qemu-kvm
    ## References ##
    1. https://wiki.debian.org/KVM