Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Bran's Kernel development tutorial

    Hi Experts,

    I was reading Bran's Kernel development tool at following link: Bona Fide OS Development Bran's Kernel Development Tutorial

    I used link.ld start.asm main.c system.h scrn.c file from this link as it is.

    As per the tutorial, it says add the two function calls(init_video() and puts()) to main function in main.c

    After adding the above two function calls to the main function, I compiled the code with following commands

    nasm -f aout -o start.o start.asm
    gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
    gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o scrn.o scrn.c
    ld -T link.ld -o kernel.bin start.o scrn.o

    Compilation and linking went fine, and kernel.bin was generated

    I copied kernel.bin to /boot and edited menu.lst under grub to pick up this kernel as follows.
    title joachim
    root (hd0,6)
    kernel /kernel.bin

    Now, when I rebooted the system and tried to boot with kernel.bin, I got following error:
    Error 13: Invalid or Unsupported executable format

    When I removed the calls to init_video() and puts() from the main() function and used the newly generated kernel.bin, I did not get any error 13 as mentioned above.

    Request you to help in this regard.

    For all the files that are mentioned above are available at :
    Bona Fide OS Development Bran's Kernel Development Tutorial

    Because there is lot of code, I did not paste it here.

    Thanks and Regards,

  2. #2
    Using the ld script from here:;20setup.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts