2 Questions...

General discussion about Visopsys.
Post Reply
User avatar
osmiumusa
Posts: 36
Joined: Sat Jan 15, 2011 8:06 pm

2 Questions...

Post by osmiumusa »

Hi.

I have two questions.

Question one: As I don't exactly understand the way your makefiles are set up, how can I make the kernel only using make. This way every little time i make a change, it won't take 5 minutes.

Question two: How do you add functions to kernelAPI.c? I wrote a rounded rectangle function and I want it availible to user programs.

Thank you! :)

:mrgreen: ~osmiumusa
Lemons. :) Nobody doesn't like lemons!
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: 2 Questions...

Post by andymc »

osmiumusa wrote:Hi.

I have two questions.

Question one: As I don't exactly understand the way your makefiles are set up, how can I make the kernel only using make. This way every little time i make a change, it won't take 5 minutes.
If you just want to make the kernel, change into the kernel directory and type make. Note that if you change a .h file, or the Makefile itself, the whole kernel will be rebuilt. To shortcut this, you could just locate the compiler command output to the screen for the particular file you want to build, and cut-and-paste it.
osmiumusa wrote:Hi.
Question two: How do you add functions to kernelAPI.c? I wrote a rounded rectangle function and I want it availible to user programs.

Thank you! :)

:mrgreen: ~osmiumusa
There's a little bit of work to this, but it's late and I'm just going to give you a quick answer before I go to bed :animals-chicken:

You should add your function declaration and a new API call number to src/include/sys/api.h, and add an api skeleton symbol/function in src/lib/libc/_kernapi.c, then add parameter definitions in src/kernel/kernelApi.c.

Try picking a random API function (preferably one that isn't too common), and grepping the whole source for instances of its name without the 'kernel' prefix (like if the kernel function is called kernelFooBar(), do 'grep -iR foobar src/' and see the various places it appears, which should mainly be the files I mentioned, plus any userspace programs that call it)

Andy
User avatar
osmiumusa
Posts: 36
Joined: Sat Jan 15, 2011 8:06 pm

Re: 2 Questions...

Post by osmiumusa »

I see, so I can just put it in api.h in the order of the functions in the file?
Lemons. :) Nobody doesn't like lemons!
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: 2 Questions...

Post by andymc »

osmiumusa wrote:I see, so I can just put it in api.h in the order of the functions in the file?
Yes, each function has to have a unique call number also, as you can see in that same file.
Post Reply