Page 1 of 1

Compiling Sample Kernel

Posted: Fri Jun 23, 2006 7:26 am
by astrocrep
Hey all,

I feel like I am back from the dead. I haven't posted in forever. But now Im back into OSDev and am looking for a place to start.

I found this excellent (I think) tutorial kernel called: "Bran's Kernel Development Tutorial" http://osdever.net/bkerndev/index.php?the_id=90 - Full code at end of tutorial.

My native enviornment in Ubuntu 6.06 and I have installed ALL of the build tools.

I began porting the .bat file to a makefile however, my compilation fails when compiling irq.c

Code: Select all

void irq_handler(struct regs *r)
{
    /* This is a blank function pointer */
    void (*handler)(struct regs *r);

    /* Find out if we have a custom handler to run for this
    *  IRQ, and then finally, run it */
    handler = irq_routines[r->int_no - 32];
    if (handler)
    {
        handler(r);
    }

    /* If the IDT entry that was invoked was greater than 40
    *  (meaning IRQ8 - 15), then we need to send an EOI to
    *  the slave controller */
    if (r->int_no >= 40)
    {
        outportb(0xA0, 0x20);
    }

    /* In either case, we need to send an EOI to the master
    *  interrupt controller too */
    outportb(0x20, 0x20);
}

It fails on these lines:

handler = irq_routines[r->int_no - 32];
if (r->int_no >= 40)

Unfortuantly I don't have the error on my as I am at work right now, but it has to do with the type of the object.

Is this a good place to start messing around with a very light and thin kernel? Perhaps theres a better one.

I liked this one because it was just a very thin and solid foundation to start toying with.

Thanks,
-Rich

Re:Compiling Sample Kernel

Posted: Fri Jun 23, 2006 8:07 am
by Cjmovie
You should be able to fix it by first adding this to somewhere:

typedef (void*)(struct regs *r) t_func;

then casting handler to it:

handler = (t_func)irq_routines[r->int_no - 32];

Re:Compiling Sample Kernel

Posted: Fri Jun 23, 2006 2:22 pm
by astrocrep
I got everything compiling... but am having a linking problem...

See the other thread about Brans Tutorial.

Thanks,
Rich

Re:Compiling Sample Kernel

Posted: Sat Jun 24, 2006 12:00 pm
by Pype.Clicker
if you're moving from .bat to ubuntu, i guess your linking problem might be due to leading underscores that are prepended by default in MS environment and (virtually) nowhere else.