Answer the question
In order to leave comments, you need to log in
How to upload a bin file to the second sector of an img image?
I decided to write a simple OS with a terminal, etc. for the sake of interest. I wrote a loader that should transfer control to the code in the second sector, if it finds it. It would seem that it remains to upload the code there, but I do not know how. I would like to know, preferably by means of qemu-img. Here's my Makefile just in case:
.PHONY: all run
all: os.img
run: all
qemu-system-x86_64 -fda os.img -boot a
# os.img
os.img: boot.bin
qemu-img dd if=bin/boot.bin of=os.img
# boot.bin
boot.bin: src/boot.asm
./yasm -f bin -o bin/boot.bin src/boot.asm
# hello.bin
hello.bin: src/hello.asm
./yasm -f bin -o bin/hello.bin src/hello.asm
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question