[fpc-pascal] Re: Building kernel modules using fpc (for fun)

Lukasz Sokol el.es.cr at gmail.com
Sun Jan 16 13:53:47 CET 2011


Lukasz Sokol <el.es.cr at ...> writes:

I have posted
http://pastebin.com/rM5GKB1q

which is the new version of http://pastebin.com/9D9ye7Pt.

This contains all 4 files needed for compilation, also moved the {$LINK } to the
kernel_module.pas (and also the printk() declaration moved there; Added some of
my touch to the files but went extra mile to keep the original author
(hopefully) happy.

It builds and insmods/rrmmods, printing Hello World and Bye-bye into dmesg ;)

(this is trivial enough code that I don't think it should eat my computer, so I
didn't bother with UML ;) or just like living dangerously... )

Why I decided to take the printk() definition out of system.pas ?

Well it seems to me more like 'Pascal way' that way. I think my next move would
be to put all the available versions of printk() (and all you can think of that
should be associated with it, but not module specific) into linux/printk.pas or
whatever would be appropriate and find out if it can be just added into the
'uses' section of the main kernel module pascal code... (implementation/uses,
probably ?)

(That way it should also be easier to track the never-changing-story of kernel
internals ;)
But that's for another hour of fun next time round ;)

For now,
enjoy and you have some fun too ;)
Lukasz




More information about the fpc-pascal mailing list