Hi all,

Ok, I am stymied on this. Here are a couple more things I tried:

1> I noticed a slight difference in the file size between
initrd.img-2.6.24-16-rtai as built when installed from an install of xubunut
vs when built from my minimal system. I copied that file as generated from
xubuntu and copied it to /boot on the minimal system. Just for grins, I also
copied all of the rtai files in /boot from the xubuntu system to the minimal
system, even though the others were exactly the same size on both systems.
In both cases there was no difference.

2> There was also a slight difference in the /etc/apt/spources.list files,
so I copied that file from xubuntu to the minimal system before install
xorg, xfce, etc. then installed the remaining software. Again no difference.

3> While I do not see how this problem can be a function of the packages
installed, I tried taking an xubuntu install and start removing packages
until EMC would generate this error. I was never able to get EMC to stop
working, at least where it would generate a segfault.

Those were more random shots than really knowing what I was doing. I was
mostly using the "Bob Hoover" method (he was the backup pilot for Chuck
Yeager on the X1) who said if you get into a situation you don't know how to
get out of, change the situation to one you can. :) So far I have not been
able to change it. I guess it is going to take putting some debug
information into the rtai kernel, which for the moment is beyond my skill
set.

For anyone wanting to reproduce my steps, or to see what I might be doing
wrong, here my exact steps:

1> Install Ubuntu 8.04 from the alternate install CD
Select F4 - MODE
Select "Install a command line system"
Follow the prompts, I basically used all of the defaults

2> Optionally do
sudo aptitude update
sudo aptitude upgrade
It made no difference whether this step was run or not
Also check /etc/apt/sources.list, but by default all necessary repositories
are enabled.

3> Install xorg
sudo aptitiude install xorg
startx

4> Install xfce
sudo aptitude install xfce4
startxfce4

5> Install slim
sudo aptitude install slim
[reboot and log in]

6> Install EMC
>From a terminal session and the /home/<user name> folder:
wget http://linuxcnc.org/hardy/emc2-install.sh
sudo chmod 755 emc2-install.sh
./emc2-install.sh

7> Make sure the rtai kernel is the default kernel
sudo nano /boot/grub/menu.lst
[Delete the generic kernels, or move the rtai kernels ahead of the generic
kernels]

8> Reboot and run EMC
>From terminal session enter:
emc
[Under sim, select the tkemc configuration]
It should generate 4 segfault errors and clean up.

Regards,
Eric



I traced down the code generating the segfault when installing EMC to a
minimum install of linux (only xorg, xfce4 and slim added to a command line
install of 8.04). The segfault is generated from a call to rtai_malloc in
the file rtapi/rtai_ulapi.c. The function called has the prototype:

int rtapi_shmem_new(int key, int module_id, unsigned long int size);

The specific code generating the error is:

    /* now get shared memory block from OS and save its address */
    shmem_addr_array[shmem_id] = rtai_malloc(key, size);
    // the check for -1 here is because rtai_malloc (in at least
    // rtai 3.6.1, and probably others) has a bug where it
    // sometimes returns -1 on error
    if (shmem_addr_array[shmem_id] == NULL || shmem_addr_array[shmem_id] ==
(void*)-1) {
        rtapi_mutex_give(&(rtapi_data->mutex));
        rtapi_print_msg(RTAPI_MSG_ERR,
            "RTAPI: ERROR: could not create shmem %d\n", n);
        return RTAPI_NOMEM;
    }

The returned value from the call to rtai_malloc is consistently -1. I
checked the values of the parameters to rtapi_shmem_new on both a working
system and this system, and they are identical.

The online documentation I found for rtai_malloc
(https://www.rtai.org/documentation/magma/html/api/group__shm.html#ga68)
defines rtai_malloc as (typos included <g>):

<quote>
#define rtai_malloc (name, size)  _rt_shm_alloc(0, name, size, USE_VMALLOC,
0)

Allocate a chunk of memory to be shared inter-intra kernel modules and Linux
processes. 

rtai_malloc is used to allocate shared memory from user space.

Parameters:     name  is an unsigned long identifier;
            size  is the amount of required shared memory;

rtai_malloc is a legacy helper macro, the real job is carried out by a call
to rt_shm_alloc() with the same name, size and with vmalloc support. This
function should not be used in newly developed applications. See
rt_shm_alloc fro more details.

Returns:
a valid address on succes, 0 on failure.
</quote>

Among other things, this indicates to me a direct kernel call to a kernel
with the rtai extensions. Thus it seems unlikely to have anything to do with
the additional packages in a full ubuntu or xubuntu install.

I don't know exactly what is going on when the emc install script
(emc2-install.sh) is run. Is a rtai patched kernel just copied into /boot or
does something get patched or otherwise modified locally to create the rtai
kernel? Is it possible that something different happens at the install when
only a minimal system is installed? Where is the -1 coming from which is not
a defined result (comment refers to it as a bug)? Any ideas where to look
next?


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to