Advertisement
Guest User

Untitled

a guest
Feb 13th, 2012
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.51 KB | None | 0 0
  1. Fri Oct 22 07:51:28 EDT 2010
  2.  
  3. In this file I will try to clean up all of my garbled note files into one
  4. coherent one. I'm sure I will miss something here but this list will be
  5. fairly comprehensive of what must be done in order to run EMC2 on
  6. a bare Debian system. I used about 5 GB (4.5 actually) on my root
  7. partition to get EMC2 installed. That is for my total system.
  8.  
  9. Install minimal Debian.
  10.  
  11. #aptitude update && aptitude safe-upgrade
  12.  
  13. Might need this later:
  14. #hwinfo > MySystem.txt ; less MySystem.txt
  15.  
  16. Strip it down even more.
  17.  
  18. #update-rc.d -f cups remove
  19.  
  20. #update-rc.d -f gdm remove
  21.  
  22. $echo "exec fluxbox" > ~/.xinitrc
  23.  
  24. At a console prompt use the command startx to get into X Window.
  25.  
  26. #apt-get remove network-manager
  27.  
  28. #update-rc.d -f avahi-daemon remove
  29.  
  30. #/etc/init.d/networking restart
  31.  
  32. Configure system so it will boot a different kernel:
  33.  
  34. #e2label /dev/hda1 h1p1
  35.  
  36. #e2label /dev/hda3 h1p3
  37.  
  38. #swapoff -a
  39.  
  40. #mkswap -L h1d2 /dev/hda2
  41.  
  42. #swapon
  43.  
  44. How cnc is partitioned:
  45. $df -h
  46.  
  47. Filesystem Size Used Avail Use% Mounted on
  48. /dev/hda1 14G 3.7G 9.5G 28% /
  49. tmpfs 253M 0 253M 0% /lib/init/rw
  50. udev 10M 620K 9.4M 7% /dev
  51. tmpfs 253M 0 253M 0% /dev/shm
  52. /dev/hda3 59G 213M 56G 1% /home
  53.  
  54. #gedit /etc/fstab
  55.  
  56. # <file system> <mount point> <type> <options> <dump> <pass>
  57. proc /proc proc defaults 0 0
  58. LABEL=h1p1 / ext2 errors=remount-ro 0 1
  59. LABEL=h1p3 /home ext2 defaults 0 2
  60. LABEL=h1p2 none swap sw 0 0
  61. /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
  62. /dev/hdd /media/cdrom1 udf,iso9660 user,noauto 0 0
  63. /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
  64.  
  65. ############################################
  66.  
  67. #gedit /boot/grub/menu.lst
  68.  
  69. and change the line:
  70.  
  71. # kopt=root=/dev/hda1 ro
  72.  
  73. to
  74.  
  75. # kopt=root=LABEL=h1d1 ro
  76.  
  77. #update-grub
  78.  
  79. #update-initramfs -u -k all
  80.  
  81. $sudo -i
  82.  
  83. #aptitude update && aptitude safe-upgrade
  84. #aptitude install \
  85. kernel-package \
  86. build-essential \
  87. dh-make \
  88. module-assistant \
  89. libncurses5-dev \
  90. zlib1g-dev \
  91. dh-kpatches \
  92. fakeroot \
  93. autoconf \
  94. dctrl-tools
  95.  
  96. #touch /etc/udev/rules.d/92-rtai.rules
  97.  
  98. /etc/udev/rules.d/92-rtai.rules
  99.  
  100. ACTION!="add|change", GOTO="rtai_end"
  101.  
  102. KERNEL=="rtf*", MODE="0666"
  103. KERNEL=="rtai*", MODE="0666"
  104.  
  105. LABEL="rtai_end"
  106.  
  107. #gedit /etc/security/limits.conf
  108.  
  109. * hard memlock 8192
  110.  
  111. #adduser paulcnc src
  112.  
  113. #exit
  114.  
  115. Get kernel source and install it:
  116.  
  117. $mkdir rtai
  118.  
  119. $cd rtai
  120.  
  121. $wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.5.tar.bz2
  122.  
  123. $tar xjf linux-2.6.30.5.tar.bz2 -C /usr/src
  124.  
  125. $cd /usr/src
  126.  
  127. $ln -s linux-2.6.30.5/ /usr/src/linux
  128.  
  129.  
  130. Getting the RTAI source
  131.  
  132. $wget http://linuxcnc.org/experimental/lenny/rtai_3.7.1.orig.tar.gz
  133.  
  134. $tar zxf rtai_3.7.1.orig.tar.gz
  135.  
  136. Getting the Debianization patch
  137.  
  138. $wget http://linuxcnc.org/experimental/lenny/rtai_3.7.1-2.diff.gz
  139.  
  140. $cd rtai-3.7.1/
  141.  
  142. $gunzip -c ../rtai_3.7.1-2.diff.gz | patch -p1 --dry-run
  143.  
  144. $gunzip -c ../rtai_3.7.1-2.diff.gz | patch -p1
  145.  
  146. $chmod u+x debian/rules
  147.  
  148. Building the packages.
  149.  
  150. $dpkg-buildpackage -rfakeroot -uc
  151.  
  152. Installing the RTAI packages.
  153.  
  154. $cd ..
  155.  
  156. #dpkg -i librtai1_3.7.1-2_i386.deb
  157.  
  158. #dpkg -i librtai-dev_3.7.1-2_i386.deb
  159.  
  160. #dpkg -i rtai-source_3.7.1-2_i386.deb
  161.  
  162. #exit
  163.  
  164. Building the kernel packages.
  165.  
  166. $cd /usr/src/linux
  167.  
  168. $make-kpkg clean
  169.  
  170. $time fakeroot make-kpkg --initrd --append-to-version -rtai --revision r1 --added-patches rtai --config menuconfig kernel-image kernel-headers kernel-source
  171.  
  172.  
  173. Here I screwed up royally but eventually managed to get a kernel that ran.
  174.  
  175. Probably not a very good idea:
  176. $make mrproper
  177.  
  178. Also not a very good idea:
  179. $make allnoconfig
  180.  
  181. I didn't try it but if it works it sounds good:
  182. $make localmodconfig
  183.  
  184. How to search for what you think you need in the kernel:
  185.  
  186. $grep -i ipipe .config
  187.  
  188. CONFIG_IPIPE=y
  189.  
  190. $find -type f -name Makefile | xargs grep CONFIG_IPIPE
  191.  
  192. ./arch/x86/kernel/Makefile:obj-$(CONFIG_IPIPE) += ipipe.o
  193.  
  194. then use / to search in the make menuconfig menu
  195.  
  196. Close to what I picked for my kernel configuration:
  197.  
  198. General setup --->
  199. [*] Prompt for development and/or incomplete code/drivers
  200. [*] Automatically append version information to the version strin
  201. Kernel compression mode (Bzip2) --->
  202. [*] Support for paging of anonymous memory (swap)
  203. [*] System V IPC
  204. [*] POSIX Message Queues
  205. [*] BSD Process Accounting
  206. [*] Initial RAM filesystem and RAM disk (initramfs/initrd) suppor
  207. [*] Strip assembler-generated symbols during link
  208.  
  209. [*] Enable loadable module support --->
  210. [*] Forced module loading
  211. [*] Module unloading
  212.  
  213. -*- Enable the block layer --->
  214. [*] Support for large block devices and files
  215. [*] Block layer SG support v4
  216. IO Schedulers --->
  217. <M> Anticipatory I/O scheduler
  218.  
  219. Processor type and features --->
  220. Processor family (Pentium-III/Celeron(Coppermine)/Pentium-III
  221. Preemption Model (Preemptible Kernel (Low-Latency Desktop))
  222. [*] Interrupt pipeline < Help > Symbol: IPIPE [=y]
  223. [*] Maintain code compatibility with older releases (NEW)
  224. [*] Local APIC support on uniprocessors
  225. High Memory Support (X) off
  226. [*] MTRR (Memory Type Range Register) support
  227. [*] x86 PAT support <-- disable if freeze up
  228. Timer frequency (300 HZ) --->
  229. [ ] Check for low memory corruption <-- (I can try this after things work)
  230. [*] Reserve low 64K of RAM on AMI/Phoenix BIOSen
  231.  
  232. Power management and ACPI options --->
  233. [*] Power Management support
  234. [*] Dock
  235.  
  236. Bus options (PCI etc.) --->
  237. [*] PCI support
  238. PCI access mode (Any) --->
  239. [*] Interrupts on hypertransport devices (NEW)
  240. [*] ISA support
  241.  
  242. Executable file formats / Emulations --->
  243. [*] Kernel support for ELF binaries
  244.  
  245. [*] Networking support --->
  246. Networking options --->
  247. <M> Unix domain sockets
  248. [*] TCP/IP networking
  249. <*> IP: IPsec transport mode (NEW)
  250. <*> IP: IPsec tunnel mode (NEW)
  251. <*> IP: IPsec BEET mode (NEW)
  252. [*] Large Receive Offload (ipv4/tcp) (NEW)
  253. <*> INET: socket monitoring interface (NEW)
  254. <M> The IPv6 protocol (NEW) --->
  255.  
  256.  
  257. Device Drivers --->
  258. Generic Driver Options --->
  259. [*] Select only drivers that don't need compile-time external fir
  260. -*- Userspace firmware loading support
  261.  
  262. -*- Plug and Play support --->
  263.  
  264.  
  265. <M> Parallel port support --->
  266. <M> PC-style hardware
  267. [*] IEEE 1284 transfer modes
  268.  
  269.  
  270. [*] Block devices --->
  271. <M> Normal floppy disk support
  272. <M> Loopback device support
  273. <M> Network block device support
  274.  
  275. {change this!}
  276. <M> ATA/ATAPI/MFM/RLL support --->
  277. <M> generic ATA/ATAPI disk support (NEW)
  278. [*] ATA disk support (NEW)
  279. <M> Include IDE/ATAPI CDROM support
  280. [*] IDE ACPI support
  281. <M> generic/default IDE chipset support
  282. <M> Generic PCI IDE Chipset Support
  283. <M> Intel PIIX/ICH chipsets support
  284. {go with this:}
  285. { [*] Serial ATA (prod) and Parallel ATA (experimental) drivers -- }
  286.  
  287.  
  288. SCSI device support --->
  289. <M> SCSI device support
  290. [*] legacy /proc/scsi/ support (NEW)
  291. <M> SCSI generic support
  292. [*] SCSI low-level drivers (NEW) --->
  293.  
  294. <M> I2O device support --->
  295.  
  296.  
  297. [*] Network device support --->
  298. <M> Dummy net driver support
  299. [*] Ethernet (10 or 100Mbit) --->
  300. [*] EISA, VLB, PCI and on board controllers
  301. <M> PCI NE2000 and clones support (see help) ne2k-pci
  302. say Y and read the Ethernet-HOWTO, available from
  303. <http://www.tldp.org/docs.html#howto>.
  304.  
  305. Input device support --->
  306. -*- Generic input layer (needed for keyboard, mouse, ...)
  307. [*] Provide legacy /dev/psaux device
  308. [*] Mice --->
  309. <M> PS/2 mouse
  310.  
  311.  
  312. [*] Miscellaneous devices --->
  313. <M> PC Speaker support
  314.  
  315.  
  316.  
  317. Character devices --->
  318. Serial drivers --->
  319. <M> 8250/16550 and compatible serial support
  320. -*- Unix98 PTY support
  321. <M> Parallel printer support
  322. <M> Support for user-space parallel port device drivers
  323. <M> Hardware Random Number Generator Core support
  324. <M> Intel HW Random Number Generator support
  325.  
  326.  
  327. <M> Hardware Random Number Generator Core support
  328. <M> Intel HW Random Number Generator support (NEW)
  329.  
  330. Graphics support --->
  331. <M> /dev/agpgart (AGP Support) --->
  332.  
  333. <M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI suppor
  334.  
  335. <M> Support for frame buffer devices --->
  336. <M> ATI Rage128 display support ( note this messes up EMC2 )
  337. [*] Support for backlight control
  338.  
  339. Console display driver support --->
  340. -*- VGA text console
  341.  
  342. [*] USB support --->
  343.  
  344.  
  345. <M> Real Time Clock --->
  346. <M> PC-style 'CMOS' (NEW)
  347.  
  348.  
  349. File systems --->
  350. <M> Second extended fs support
  351. [*] Inotify file change notification support
  352. [*] Inotify support for userspace (NEW)
  353.  
  354. CD-ROM/DVD Filesystems --->
  355. <M> ISO 9660 CDROM file system support
  356. [*] Microsoft Joliet CDROM extensions
  357.  
  358.  
  359. Pseudo filesystems --->
  360. -*- /proc file system support
  361. [*] /proc/kcore support
  362. [*] Virtual memory file system support (former shm fs)
  363.  
  364. Library routines --->
  365. {M} CRC32 functions
  366.  
  367.  
  368. I'm sure in all of the excitement I missed a few things but it is close.
  369.  
  370. reboot and cross your fingers!
  371.  
  372. #less MySystem.txt
  373.  
  374. might help
  375.  
  376. Along with
  377.  
  378. #dmesg
  379.  
  380. and
  381.  
  382. #less /var/log/messages
  383.  
  384. Anyhow once you have a kernel that runs and does what you want it to
  385. (took me about 6 tries) Then you can move on.
  386.  
  387. $cd /usr/src
  388.  
  389. $tar jxf rtai-source.tar.bz2
  390.  
  391. $cd /usr/src/linux
  392.  
  393. $fakeroot make-kpkg --append-to-version -rtai --added-modules rtai --config menuconfig modules_image
  394.  
  395. For EMC2 2.3 and newer, enable CONFIG_RTAI_MATH parameter.
  396. Base system ---> Other features ---> Mathfuns support in kernel ---> enabled
  397.  
  398. Default values are OK for other parameters. Save and exit.
  399.  
  400. $sudo -i
  401.  
  402. #cd /usr/src
  403.  
  404. #dpkg -i rtai-modules-2.6.30.5-rtai_3.7.1-2+r1_i386.deb
  405.  
  406. or
  407.  
  408. #dpkg -i rtai-modules-2.6.30.5-rtai-cnc_3.7.1-2+r6_i386.deb
  409.  
  410. #cd /usr/src/linux
  411.  
  412. #cp Module.symvers Module.symvers.old
  413.  
  414. #cat /usr/realtime/modules/Module.symvers >> Module.symvers
  415.  
  416. Adjust to your kernel name:
  417. #ln -s /usr/realtime/modules/ /lib/modules/2.6.30.5-rtai-cnc/rtai
  418.  
  419. #depmod -a
  420.  
  421. cnc:~# ls /dev/rtai
  422. ls: cannot access /dev/rtai: No such file or directory
  423.  
  424.  
  425. I found this script in the RTAI documentation and gave it a shot:
  426.  
  427. #touch restoreRT.sh
  428. #gedit restoreRT.sh
  429.  
  430. cnc:~# cat restoreRT.sh
  431. ------------ copy from here -------------------------
  432. #!/bin/sh
  433.  
  434. if test \! -c /dev/rtai_shm; then
  435. mknod -m 666 /dev/rtai_shm c 10 254
  436. fi
  437. for n in `seq 0 9`; do
  438. f=/dev/rtf$n
  439. if test \! -c $f; then
  440. mknod -m 666 $f c 150 $n
  441. fi
  442. done
  443.  
  444. -------------------- to here ----------------------------
  445.  
  446. #chmod +x restoreRT.sh
  447.  
  448. #./restoreRT.sh
  449.  
  450. Marvel at incomprehensible numbers for a while:
  451.  
  452. #cd /usr/realtime/testsuite/kern/latency/; time ./run
  453.  
  454. #cd /usr/realtime/testsuite/kern/preempt/; time ./run
  455.  
  456. #cd /usr/realtime/testsuite/kern/switches/; ./run
  457.  
  458. If the above really fascinates you go through
  459.  
  460. /usr/realtime/testsuite/user
  461.  
  462. as well to compare and contrast the differences. Or not.
  463.  
  464. OK back to installing EMC2
  465.  
  466. Get everything else you need to build EMC2:
  467.  
  468. aptitude install git-core \
  469. gitk \
  470. git-gui \
  471. autoconf \
  472. tk-dev \
  473. bwidget \
  474. build-essential \
  475. gettext \
  476. python-dev \
  477. libglu1-mesa-dev \
  478. libxmu-dev \
  479. libgtk2.0-dev \
  480. libgnomeprintui2.2-dev \
  481. libxaw7-dev \
  482. libncurses5-dev \
  483. libreadline5-dev \
  484. python-tk \
  485. python-imaging \
  486. python-imaging-tk \
  487. python-numarray \
  488. pciutils \
  489. libpci-dev \
  490. python-glade2 \
  491. python-xml \
  492. bc \
  493. libpth-dev \
  494. lyx \
  495. texlive-extra-utils \
  496. groff
  497.  
  498. Or:
  499. aptitude install git-core gitk git-gui autoconf tk-dev bwidget build-essential gettext python-dev libglu1-mesa-dev libxmu-dev libgtk2.0-dev libgnomeprintui2.2-dev libxaw7-dev libncurses5-dev libreadline5-dev python-tk python-imaging python-imaging-tk python-numarray pciutils libpci-dev python-glade2 python-xml bc
  500.  
  501. aptitude install libpth-dev lyx texlive-extra-utils groff
  502.  
  503.  
  504. Aptitude will install a bunch of other junk besides that list to satisfy
  505. dependencies.
  506.  
  507. $mkdir ~/EMC2
  508.  
  509. $cd ~/EMC2
  510.  
  511. $ wget http://downloads.sourceforge.net/project/emc/emc2/2.4.x/emc2_2.4.4/emc2_2.4.4.tar.gz
  512.  
  513. $ tar zxf emc2_2.4.4.tar.gz
  514.  
  515. $ cd emc2_2.4.4/src/hal/drivers
  516.  
  517. $ sed -i 's/pci_find_device/pci_get_device/g' *.c
  518.  
  519. $ cd ../..
  520.  
  521. $ ./autogen.sh
  522.  
  523. $ ./configure --enable-run-in-place
  524.  
  525. $ make clean
  526.  
  527. $ make
  528.  
  529. $ sudo make setuid
  530.  
  531. Go to the top directory of emc2-2.4.4
  532.  
  533. $ cd ..
  534.  
  535. If you're religious now might be a good time to pray.
  536.  
  537. $ . scripts/emc-environment ; scripts/emc
  538.  
  539. All of this junk took me about a week to figure out and the information was
  540. gathered from a variety of sources but mainly is from the Lenny pages
  541. at linuxcnc.org I just fleshed out some of the steps that got me stuck a bit
  542. more. With this file I could probably do it in a sitting or two.
  543.  
  544. I did all of this to avoid some of the overhead in Ubuntu on my antique
  545. machine I have dedicated to running EMC2. In the end I didn't actually
  546. gain anything in latency. Machines are what they are. But I might not hit
  547. those spikes as often. I don't know. I still like Debian more than Ubuntu.
  548.  
  549. Other stuff I did to this system to make it a bit more usable to me include:
  550.  
  551. #aptitude install mesa-utils xlibmesa-dri xlibmesa-gl xlibmesa-glu
  552. #aptitude install htop
  553. #aptitude install bootchart
  554. #usermod -a -G video paulcnc
  555. #gedit /etc/apt/sources.list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement