Difficulty building RTAI linuxcnc from source

More
3 years 3 months ago #276471 by southbayguy
Now I can build (thank you very much) but I'm not sure I know how to run. Trying to figure out the integer value board type the code finds for the Motenc-Lite board, I have tweaked a couple of lines in hal_motenc.c. I have commented out the original error message "unknown card detected" with double slashes. No way that error message gets printed. After make runs successfully, I do setuid and set the run in place environment, then type linuxcnc.

The error message "unknown card detected" appears! Somehow my change to the code is having no effect.

Make ran successfully (didn't take long, it only built the one file), and I could see a new hal_motenc.ko file had been created. I decided maybe make didn't know to link the new file, so I did make clean and then make again. (plus set uid and rip environment). Typed linuxcnc and again got "unknown card detected."

So my current theory is that the machine is not running my new version of linuxcnc, it must be running the compiled ready-to-ruin version I downloaded from linuxcnc.org a week and a half ago.

How do I make sure my homemade version of linuxcnc is the one that runs?

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #276473 by PCW
If you have a Run In Place Linuxcnc version you wish to run you (in a terminal)

. ~/linuxcnc-dev/scripts/rip-environment
linuxcnc

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #276475 by southbayguy
Thank you for your response. It didn't change the result.

I have made a change to linuxcnc-dev/src/hal/drivers/hal_motenc.c.
When I do make, the changes are compiled into a kernel module, hal_motenc.ko.
How do I tell make to link in the new hal_motenc.ko file, so it is used when I run linuxcnc?

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #276490 by southbayguy
I'm concentrating on error output from hal_motenc.c. After linuxcnc fails, I run dmesg, and it shows me:

13224.908831] USERMODE CHECK: OK.
[13224.908832] USERMODE CHECK PROVIDED (ns): KernelLatency 581, UserLatency 694.
[13224.908833] FINAL CALIBRATION SUMMARY (ns): KernelLatency 581, UserLatency 694.
[13224.916982] RTAI[math]: loaded, using musl libm.
[13224.956497] MOTENC: ERROR, unknown card detected
[13227.661406] RTAI[math]: unloaded.
[13227.700054] SCHED releases registered named ALIEN PEDV$D
[13227.702510] RTAI[malloc]: unloaded.

Note the "unknown card detected" right there in the middle of the Snip.

Then I edit hal_motenc.c so it is:

rtapi_print_msg(RTAPI_MSG_INFO, "MOTENC: Card is %s, ID: %d\n", pDevice->pTypeName, pDevice->boardID);
if ( pDevice->boardType == 0 ) {
rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR, unknown card detected 0728\n");

... everything the same except I've appended the data ("0728") to the error message.

Then I do make, setuid and the environment thing, and I don't get the error message with the date! I get the old error message. My new code is either not getting linked or not getting run.

I'm missing something. Please give me a clue. Thanks.

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #276577 by southbayguy
Hi -
Thanks to the senior moderators for helping me on this topic.
In a terminal, changing directories so I was in linuxcnc-dev, if I typed

./scripts/rip-environment
linuxcnc

then I got the installed version of linuxcnc.
If I typed everything on one line, then I got the version of linuxcnc that I had just built in my linuxcnc-dev directory, including the error message I was using as a test. So this is what did it for me:

,/scripts/rip-environement linuxcnc

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #276589 by phillc54
You were missing ". " in front of the command.
Code:
. ./scripts/rip-environment
It is the equivalent of entering:
Code:
source ./scripts/rip-environment
From the linuxcnc-dev/src directory you could:
Code:
. ../scripts/rip-environment
linuxcnc.org/docs/devel/html/code/buildi...cnc.html#Quick-Start
 
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum