Compiling the Nvidia kernel module

Get the kernel version for pr2b:

ssh pr2b
cat /proc/version

amaldo@pr2b:/usr/src/nvidia-304-304.116/patches$ cat /proc/version 
Linux version 3.4.28.rt40-1-pr2 (willow@ian) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #1 SMP PREEMPT Mon Feb 4 15:03:30 PST 2013

Compile the nvidia module for that kernel (but do it on pr2a):

ssh pr2a
sudo apt-get install nvidia-304   (we could also test with nvidia-331)
ls /usr/src/ |grep nvidia   (get the version number for dkms)
sudo dkms build nvidia-304/304.116 -k 3.4.28.rt40-1-pr2
sudo dkms install nvidia-304/304.116 -k 3.4.28.rt40-1-pr2
ssh pr2b
sudo modprobe nvidia

Make the loading of the module permanent:

ssh pr2a
cd /unionfs/overlay/etc
sudo cp /etc/modules .
sudo vim modules     <- Add nvidia at the bottom

Now you can make a phoney xorg.conf file to start X without a monitor attached, and use virtualGL to get rviz running on the robot

Setting up X

Get a Desktop Manager with minimal dependencies:

ssh pr2a
sudo apt-get install lightdm lightdm-gtk-greeter

Create a fake xorg.conf file with the following contents:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    Option         "ConnectedMonitor" "CRT-0"
    Option         "UseEDID" "FALSE"
EndSection


Section "DRI"
        Mode 0660
        Group "vglusers"
EndSection

Section "Monitor"
    Identifier     "Headless"
    HorizSync       80.0 - 80.0
    VertRefresh     75.0
    #
    #   Used command line:  gtf 1280 1024 75
    #   to come up with following Modeline:
    Modeline "1280x1024_75.00"  138.54  1280 1368 1504 1728  1024 1025
1028 1069  -HSync +Vsync
EndSection


Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Headless"
    DefaultDepth    24
    Option         "UsedEDID" "FALSE"
    SubSection     "Display"
        Depth       24
        Modes      "1280x1024"
    EndSubSection
EndSection