Unable to run qemu on Ubuntu, even for a simple guest

bootloader, loader, nasm, qemu, ubuntu

Solution

Looking at your assembler, you need to add a boot signature to the end of the boot sector - 0xaa55 - see http://www.nondot.org/sabre/os/files/Booting/nasmBoot.txt

I added the following two lines and your example then worked:

times 510-($-$$) db 0   ; Fill the file with 0's
dw 0AA55h               ; End the file with AA55

Problem

I have simple task - RUN THIS CODE "boothi.asm": ``` use16 org 0x7C00 xor ax, ax mov es, ax mov ds, ax mov ss, ax mov sp, 0x1000 mov ax, 3 int 10h mov si, mHello call print die: jmp short die mHello db 'Hello, world - i was booted!',10,13,0 print: cld pusha .PrintChar: lodsb test al, al jz short .Exit mov ah, 0eh mov bl, 7 int 10h jmp short .PrintChar .Exit: popa ret ``` I have compile it with: ``` nasm -f bin boothi.asm -o boothi.bin ``` But i don't understand - HOW can i run it on virtual machine to test. I try to crate floppy disk image and run it with qemu like this: ``` dd if=/dev/zero of=disk.img bs=1024 count=1440 dd if=boothi.bin of=disk.img conv=notrunc ``` But on the next step - ``` qemu -fda disk.img -boot a ``` I have strange trouble- ``` Could not access KVM kernel module: No such file or directory failed to initialize KVM: No such file or directory ``` I try to install qemu and kvm. But this error are in. But qemu try to run this code and check all devices - hard\cdrom\floppy - and write smth like "there is no sustem to load\boot". How can i test this asm code on Ubuntu? Output of commands on my PC: ``` root@alena-VirtualBox:~# ls -l /dev/kvm ls: cannot access /dev/kvm: No such file or directory root@alena-VirtualBox:~# lsmod|grep kvm kvm 359488 0 root@alena-VirtualBox:~# groups root root@alena-VirtualBox:~# qemu -version No command 'qemu' found, did you mean: Command 'qtemu' from package 'qtemu' (universe) Command 'aqemu' from package 'aqemu' (universe) qemu: command not found root@alena-VirtualBox:~# qemu-system-i386 -version QEMU emulator version 1.0 (qemu-kvm-1.0), Copyright (c) 2003-2008 Fabrice Bellard root@alena-VirtualBox:~# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz stepping : 7 microcode : 0x616 cpu MHz : 2469.580 cache size : 6144 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up pni monitor ssse3 lahf_lm bogomips : 4939.16 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: ```

Original source