nasm will not convert to .bin file

when I execute the code
"Tools\NASM\nasm.exe -g -f -o Kernel.o Kernel.asm" like in the video 'Booting'
it'll give me the error
"system can't find the specified file" or something like it (translated raw from dutch :p)

can pls someone help me,



  • Hi Matthias,

    Just to make sure, you are trying to do this on Windows? If not, you will need to adjust the commands accordingly - there are tutorials online (e.g. on that will show you how to get started from Linux. You can still use the FlingOS Tutorial Code, it's just the commands and tools that will differ.

    If you are on Windows, then it looks like one of two things could be happening:

    1. The command line might not be finding the executable. Make sure your current directory is set to your project directory (where the .asm file is - use the "cd" command). Also make sure that "nasm.exe" is in the correct folder. Your project directory should contain a sub folder called "Tools" which should contain a folder called "NASM" which should contain "nasm.exe".

    2. NASM might not be able to find the assembly code file. Ensure that Kernel.asm is saved in the project folder (i.e. your current directory). The capitalization of the name of the file shouldn't matter but just in case, make sure that's the same as is in the command.

    If the error persists, please send a complete copy of the text from the command window (translated or untranslated - I'll figure it out as best I can).

  • so this is what I do:

    cd D:\OS\Syndrom\BOOT\TOOLS\NASM\nasm.exe -g -f -o Kernel.o Kernel.asm
    Nasm is installed in the folder
    cd D:\OS\Syndrom\BOOT\TOOLS\NASM\nasm
    the kernel is in
    cd D:\OS\Syndrom\BOOT\TOOLS\NASM
    it keeps giving the error "can't find file"
    a complete text isn't there cause of it even doesn't let me write the first line of code if I run nasm from the NASM\nasm\ directory
  • Aah I see, you're mixing up the "cd" (set Current Directory) command with the call to the NASM program. Also, your Kernel.asm is in the wrong folder.

    So, move "Kernel.asm" from "D:\OS\Syndrom\BOOT\TOOLS\NASM" to "D:\OS\Syndrom\BOOT".

    Then use the following commands (one at a time by writing or copy/paste then ENTER key to execute the command):

    cd "D:\OS\Syndrom\BOOT\"

    Tools\NASM\nasm.exe -g -f -o Kernel.o Kernel.asm

    Hopefully that will now work. You should end up with "Kernel.o" in "D:\OS\Syndrom\BOOT". In future, you will always need the Current Directory to be "D:\OS\Syndrom\BOOT" and all your OS files (not the Tools files) should be in that directory.

    Hope this helps,
  • Oh and looking in more detail, make sure "nasm.exe" is in "D:\OS\Syndrom\BOOT\TOOLS\NASM" not "D:\OS\Syndrom\BOOT\TOOLS\NASM\nasm".
  • getting this error now =>
    nasm : fatal: unrecognized output format '-o' - use -hf for a list
    type 'nasm -h' for help...

    isn't there any other source where you can convert your Kernel??
  • Hi, Sorry I thought something looked wrong with that command yesterday. It's missing the format specifier! As shown in the video, please use the following command:

    Tools\NASM\nasm.exe -g -f elf -o Kernel.o Kernel.asm

    Hopefully that will work now. It's important to be very precise when copying the commands from the video!

    Best of luck,
  • Oh and there are really only two alternatives:

    Use the GNU Assembler (called AS) but it uses a totally different assembly code syntax so you'd have to convert all the sample code.

    Or simply skip ahead in the videos to where it shows how to use the FlingOS compiler. That will handle assembly code compiling for you and allow you to use C# to program your OS. However, the tutorials start out with the basics like the above because it's important to understand what's going on in the compiler so that you fully understand the low level. Also, the boot sequence has to be written in assembly!
  • Lastly, if you look at the provided examples on GitHub you will see there is a Build.bat. This contains a script with all the necessary commands for compiling/building. You can run it from the command line by saving Build.bat to your project folder then running Build.bat on the command line just by typing its name and pressing enter.

    Please see Booting/Code/Build.bat

    Cheers, Ed
  • well, finally after digging around a bit in the code, rewriting it for more than 6 hours trying to figure out some passage... It finally worked, had some problems with the first code... so just rewrote it :p,
    worked perfectly :)

    thanks for the help
  • Glad you got it working! Hopefully the remaining tutorials will go more smoothly. If in doubt, just clone the repository of example code and it should work. You could then use a diff tool such as Beyond Compare to compare your own work with the examples to see the differences more easily. All the sample code was tested on multiple machines by at least 3 people so should work!

    Best of luck, and if you run into any more problems, please feel free to post on this forum.
  • Hya, i'm here (again...) it's most likely that the tutorial and so is fine, but I keep getting errors with the compiling proces

    with the newest version of Cygwin, it doesn't have a "ld.exe"
    anything else I can try, cause he keeps giving me errors for that
    (input (from BOOT)=> TOOLS\Cygwin\bin\ld.exe -T linker.ld -o Kernel.bin Kernel.o")
    error => unknown option "--T"
  • Hi, No problem! Always happy to help.

    So there's a few things to tackle here:

    1. Cygwin is a "Linux tools for Windows" wrapper. It usually distributes with a complete set of GCC tools. These _will_ contain Ld. So it _will_ have "Ld.exe" - it's simply not possible for it to not exist in Cygwin. Ld is the GCC linker - without it the whole thing compiler won't work.
    2. You aren't actually using Cygwin directly here. The provided package contains a copy of the Ld.exe program in "Tools\Cygwin" (which makes the full path: "Tools\Cygwin\ld.exe". Your path to Ld contains "\bin\" for some reason? I'm not sure why.
    3. Ld has clearly executed (somehow, despite the incorrect path?) because it's told you there's an unknown option. You've written "Unknown option --T" <- Two dashes? But the command should only contain one dash before the T e.g. "-T" However, that's what you have written in the copy of the command line so I'm not sure what's going on there. The -T option is definitely valid.
    4. Please make sure you're using the correct version of Ld (the one from the sample package). There are literally hundreds of different versions because GCC can be compiled as a cross-compiler for many different systems and target architectures. For a complete, correctly-built version of GCC, please see the list of pre-built packages at the bottom of this page:

    From what you've said, you probably want the "For Windows host" section and the "x86_64-elf 5.1.0 target" download (copy of the exact link:!bBxA3SKJ!TDL4i1NjaZKd4YMo9p2U7g)

    Please make sure the command you are using is exactly as shown in the video (/as in the Build.bat) and ensure you are in the correct current directory (your BOOT directory) before executing the command. The command for linking should be:

    Tools\Cygwin\ld.exe -T linker.ld -o Kernel.bin Kernel.o

    I don't understand why you've written:
    "input (from BOOT)=>"
    It seems as though (both here and previously) you are trying to chain together commands on the command line into one long thing, which is both wrong and not possible. Each command has two options, one for setting the input file and one for the output file. So the "output" from one command is saved to a file in "BOOT" and then you use that file's name as the next command's input argument, thus chaining the commands together.

    You need to execute each command separately (and repeat them all, in the proper order, each time you edit your ASM file). This process is significantly sped up and simplified by using the provided Build.bat. At which point you can just run the following two (separate) commands:

    cd "D:\OS\Syndrom\BOOT\"


    I think I'm right in assuming you aren't particularly familiar with working on a command line? If so, you might want to spend a bit of time learning how to use it quickly and easily and understanding generally how to run programs and pass options (a.k.a. arguments) to programs, because low-level dev (and a lot of web dev and other areas of programming too) use it a lot.

    For a complete working build script, with correct commands, do take a look at the Build.bat ( Booting/Code/Build.bat).

  • nono, i didn't write "--T", i wrote "-T", but the error gives me "try --T"
  • That's very odd given that Ld doesn't even have a --T option. See this page:

    But this may be because you chained commands together, in which case it won't have been Ld executing at all but whatever program was first in the command line. Without seeing a screenshot it's very hard to tell. You could upload an image to Snaggy: (very simple, print screen then paste into the web page) then post the link here and I can take a proper look.
Sign In or Register to comment.