简体   繁体   中英

How to build and run an .img file in qemu emulator?

I am studying about the Operating System concepts. I created a simple boot loader and a second stage loader in assembly. I'm new to Linux, so I don't know how to emulate it. I went through a lot of sites, but couldn't find a perfect explanation.

So, How would I use dd tool and qemu to emulate boot.asm and load.asm files in emulator and how would I do the same into an USB and boot it in a real machine?

Please guide me so that I will catch it up..

OS : Ubuntu 16.04.1 Assembly : 8086 assembly

That '.img' file is container which contains required binnaries, eg '[bootloader][kernel][dtb]'. With 'dd' you can create such container. Another word, you can merge all this required files into one, eg 'boot.img' with offsets which you pointed out. Also all offsets need declare in header file for your bootloader. After 'boot.img' will be successfully created, you can pass it through option '-bios' (emulated rom) into qemu. Qemu will start execute this file from 0x0 offset - it is your bootloader. You bootloader will copy kernel into RAM and will pass execution to your kernel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM