I have already written a very basic test hal driver in c, it works with linuxcnc and the test LED is blinking when it should

In that case:
sudo comp --install path/to/my/filename.c
ought to compile and install the module with the required permissions.

Interesting tip about using comp, I did not know about that thanks andy, unfortunatly it does not help with the actual problem I have but is still very useful

I should also say that I tried it and it has same effect as I originally made by hand (I also tried changing permissions and adding sticky bit to rtlib/hal_rpi.so). I should possible double check this again as I think after I tried with 'sudo comp --install' the error message when running scripts/linuxcnc did change and there maybe a problem with group ID also??

What I am really enquiring about is if linuxcnc loads modules via some SUID system or is this cause I am running linuxcnc in simulator mode.

I know X runs as root with some wrapper so it can access low level video hardware, is this how linuxcnc loads drivers?

I think RTAI and xenomai merged and then split again at some point in the past and the two systems have slightly different goals, RTAI attempts to have the best latency, xenomai attempts to be extensible and have wide compatability. xenomai used to have a RTAI compatability skin but apparently this is buggy and deprecated speedwise RTAI is best followed by xenomai followed by RT_PREEMPT.

I have not been able to get xenomai to boot on my pi, but I think this maybe due to my own stupidity and problems with my cross compile environment.

I just the other day managed to get RT_PREEMPT with the newest kernel to compile and boot on my pi, so I hope to compile the RT_PREEMPT version of linuxcnc this weekend.

Please note I am very much a newbie with RT systems and know nothing about the lower level kernel stuff, I am just hacking things together and seeing what happens.

I am really just a skillless hack so am posting lots of comments to any relevant forums in the hope that people with more expertise than I have will get involved and do the hard work which I am not able to do.

I think if you check most of these interlinked threads almost everything I know is available in them, though I think some newer xenomai stuff may not be in them as I have been concentrating on RT_PREEMPT as it looks simpler from a linuxcnc point of view.

I will hopefully also have some time this weekend to tidy up the driver and configs I made for linuxcnc and post them somewhere for people to rip to shreds .

If anyone has any advice or expertise to offer please feel free to comment, and realise that everything that I post may not be 100% correct.

I only ever tried to compile as sim as I did not until now have a RT_PREEMPT kernel, the page mentions preempt_rt but now I try to follow the wiki instructions to compile I find that possibly the instructions are wrong and the wiki page is actually using RTLinux not linux with RT_PREEMPT patch??????