I
I
Insolent Muzzle2021-06-21 21:26:05
assembler
Insolent Muzzle, 2021-06-21 21:26:05

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

1 answer(s)
H
hint000, 2021-06-22
@pluffie

dd if=boot.bin of=os.img seek=1 conv=nocreat,notrunc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question