Search code examples
assemblymakefilegnu-makebootloaderosdev

convert .bin to .img using makefile


I was writing a simple bootloader, I am using this make file command to convert the main.bin to a main_floppy.img

cp -f build/main.bin build/main_floppy.img

but I keep getting this error

nasm src/main.asm -f bin -o build/main.bin cp -f build/main.bin
build/main_floppy.img process_begin: CreateProcess(NULL, cp -f
build/main.bin build/main_floppy.img, ...) failed. make (e=2): The
system cannot find the file specified. make: *** [Makefile:3: setup]
Error 2

Solution

  • Looks like you're running Windows. Try this instead:

    all:
       nasm src\main.asm -f bin -o build\main.bin 
       rename build\main.bin main_floppy.img
    

    If you're indeed running Linux (we don't know), try this:

    all:
       nasm src/main.asm -f bin -o build/main.bin
       mv build/main.bin build/main_floppy.img
    

    (I just splitted the two commands in two different lines)