[Home]Ubuntu10.04Notes

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

*** KERNEL *************************

Here are some rough notes of the steps I've taken to modify and build the Ubuntu kernel in the Ubuntu way.

First, make sure we have the packages we need...

 sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge
 sudo apt-get build-dep linux
 sudo apt-get install git-core libncurses5 libncurses5-dev binutils-dev libelf-dev asciidoc xmlto

Add the following line at the end of your .bashrc so you can just type 'fdr' instead of 'fakeroot debian/rules':

 alias fdr='fakeroot debian/rules'

To get the latest lucid source with git and put it into a local directory called 'ubuntu-lucid', run the following command:

 git clone git://kernel.ubuntu.com/ubuntu/ubuntu-lucid.git ubuntu-lucid
Change to the new directory...
 cd ubuntu-lucid

I create a new branch for my changes. To branch from a specific tag:

 git checkout <tagname> -b rtai
To branch from wherever you are in the tree:
 git branch rtai
Then checkout the new branch.
 git checkout rtai

Get things ready for a new release with RTAI modifications:

 fdr clean
Note: if the top of the file 'debian.master/changelog' contains the following lines:
  CHANGELOG: Do not edit directly. Autogenerated at release.
  CHANGELOG: Use the printchanges target to see the curent changes.
  CHANGELOG: Use the insertchanges target to create the final log.
Then first run:
 fdr insertchanges
Otherwise skip that and just run:
 fdr startnewrelease

Now copy the latest patch from the rtai/base/arch/x86/patches directory to your 'ubuntu-lucid' kernel directory.
Then run the following command from the 'ubuntu-lucid' directory to patch the kernel...

 patch -p1 < hal-linux-2.6.xx.x-x86-x.x-xx.patch
Now fix the problem in arch/x86/kernel/process_32.c - see the process_32.c.rej file in the same directory. An ubuntu change to the vanilla kernel causes this failure, but you can add the #define... and #endif lines shown in the .rej file and all should be well.

Now copy the files for the generic flavour to new ones to create a flavour called 'rtai'. This way we can create kernel packages that have 'rtai' in the name instead of 'generic', and can be installed alongside a generic kernel if needed.

 cp debian.master/config/i386/config.flavour.generic debian.master/config/i386/config.flavour.rtai
copy debian.master/abi/[last kernel ver]/i386/generic to debian.master/abi/[last kernel ver]/i386/rtai
copy debian.master/abi/[last kernel ver]/i386/generic.modules to debian.master/abi/[last kernel ver]/i386/rtai.modules

Now edit the following files to make the build system aware of our new flavour:
In file: debian.master/etc/getabis
Search for the line:

 getall i386 generic generic-pae 386
Change it to:
 getall i386 generic generic-pae 386 rtai

In file: debian.master/rules.d/i386.mk
Search for the line:

 flavours        = generic generic-pae 386
Change it to:
 flavours        = generic generic-pae 386 rtai

Make a vars.rtai file for our flavour:

 cp debian.master/control.d/vars.generic debian.master/control.d/vars.rtai

Now edit it as follows:

 arch="i386 amd64"
 supported="Generic - RTAI"
 target="Geared toward CNC control systems."
 desc="x86/x86_64"
 bootloader="grub | lilo (>= 19.1)"
 provides="kvm-api-4, redhat-cluster-modules, ivtv-modules, ndiswrapper-modules-1.9"

Now edit the configs... You must do an 'fdr clean' before editconfig or it won't work!

 fdr clean
 fdr editconfigs

Exit out of each flavor without changes until we get to the rtai flavor we created, then make at least the following changes. This should give a generic kernel that can run SMP or single-core.

         Enable loadable module support ---> enabled [*]
         Loadable module support ---> Module versioning support ---> disabled
         Processor type and features ---> Processor Family ---> Pentium Pro (M686=y) or Pentium Classic (M586TSC)
         Processor type and features ---> HPET Timer Support ---> disabled
         Processor type and features ---> Peemption Model ---> Preemtible Kernel (Low-Latency Desktop)  (PREEMPT=y)
         Processor type and features ---> Interrupt pipeline ---> enabled [*]
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> enabled [*]
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi files ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated power /proc/acpi directories ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Future power /sys interface ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi/event support ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> AC Adapter ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Battery ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Button ---> enabled[*]
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Video ---> module [M]
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Fan ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Dock ---> enabled [*]
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Processor ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Disable ACPI for systems before Jan 1st this year ---> 0
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Debug Statements ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> PCI slot detection driver ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Container and Module Devices ---> disabled
         Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Smart Battery System ---> disabled
         Power management and ACPI options ---> APM (Advanced Power Management) BIOS support ---> disabled
         Power management and ACPI options ---> CPU Frequency scaling ---> disabled

        If you are using an older RTAI patch you may get the following error:
        include/linux/ipipe.h:76:2: error: #error "CONFIG_NR_CPUS is too large, please lower it."
        To fix this disable sparse irq numbering (CONFIG_SPARSE_IRQ=n):
            Processor type and features ---> Support sparse irq numbering ---> disabled

        If you have a multi cores CPU or SMP system, don't choose a processor family which has no TSC (time stamp counter).
        This means that for example you can not choose 586/K5/5x86/6x86/6x86MX as Processor family if you have a dual cores CPU.
        In conclusion, choose the most suitable processor family for your machine.

        NOTE: No need to disable High Memory Support for RTAI 3.7.1 and newer

        NOTE: No need to disable Symmetric multi-processing support for the uniproccesor machine for RTAI 3.7.1 and newer.
              But if you don't have a multi cores CPU or SMP system, you can disable it to improve the performance

        NOTE: There was supposedly no need to disable Module Versioning Support for RTAI 3.7.1, but it seems to be needed for the latest RTAI (3.8.1 or magma).
              I don't know if this is an RTAI problem or emc2, since I could run the RTAI latency test but not the emc2 stuff.

        NOTE: No need to turn off debugging if building packages with the ubuntu debian/rules system.
              Otherwise remember to turn off debugging info to vastly reduce kernel size!

Now add our changes to git:

 git add . 
git commit -a -m"Applied rtai IPIPE patch and edited configs for realtime operation"
Now set up the changelog with a new entry with the commit message above:
 fdr insertchanges

At the top of debian.master/changelog add '.rtai' to the version string as below, and fix name and email if needed.
Warning, do NOT use a dash (i.e. -rtai) or the compile will fail with several of these errors: /ubuntu-lucid/drivers/usb/core/hcd.c:144: error: expected expression before '>>' token

        linux (2.6.xx-xx.xx.rtai) lucid-proposed; urgency=low

          [Your Name Here]
          * Applied rtai IPIPE patch for realtime operation

          -- Your Name <youremail@whatever.com>  Sat, 27 Feb 2010 22:00:46 -0600

'fdr clean' also copies the changelog from debian.master to debian so run it again here.

 fdr clean
If you compiled with debugging turned off, you need to run: skipabi=true skipmodule=true no_dumpfile=true fdr binary-rtai
Note the "no_dumpfile=true" - without this you will get an error at the end of the compile or when building the packages.
Otherwise, run these commands:
 skipabi=true skipmodule=true fdr binary-rtai
 skipabi=true skipmodule=true fdr binary-indep

The packages should be ready to install.

*** RTAI *************************


*** EMC2 *************************

Need to list all packages needed to get and build emc2 packages.

 git-core gitk git-gui

For building and installing emc2:

 build-essential devscripts debhelper libpth-dev tcl8.5-dev tk8.5-dev bwidget libxaw7-dev libreadline5-dev python-dev libglu1-mesa-dev libxinerama-dev autoconf python-tk libglib2.0-dev libxft-dev gettext libgtk2.0-dev python-imaging-tk

For building the documents - required if building packages. I use --no-install-recommends is so the download is less than 100MB instead 400MB with stuff you don't need.

 apt-get install --no-install-recommends lyx texlive-extra-utils texlive-fonts-recommended texlive-latex-base texlive-font-utils groff dvipng imagemagick ttf-lyx texlive-latex-extra texlive-latex-recommended 

*** LIVECD *************************

Run the following in lucid to put the window buttons back in their proper places:

 gconftool-2 --set /apps/metacity/general/button_layout --type string "menu:minimize,maximize,close,"

Removed: gnome-games*, openoffice*
Installed: abiword, gnumeric,


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited May 15, 2010 9:49 am by Mozmck (diff)
Search:
Published under a Creative Commons License