[Home]CoolCnc.0.5

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org


#! /bin/sh
# HOWTO BUILD A COOLCNC DEVELOPMENT ENVIRONMENT FROM SOURCE 0.0.1
# ok, not all from source. but all that is added is added from source!
#
#
# coolcnc is a puppybased linuxdistribution that can reproduce itself,
# runs on most x86 hardware and has realtimecapabilities utilizing rtai.
# so what can you do with it ?
# you can run your own realtime tasks on it. or you you could use it to run
# emc2 the enhanced machine controller and its beatuiful gui axis.
#
# prerequisites: this howto assumes that you have a linuxsystem up and running.
# the tools required besides are: bzip2, wget and qemu (0.8.X). for better
# performance i recomend the usage of the qemu acceleration module.
# you may also think about using a squashfs & unionfs equipped kernel
# for reducing the compiletime. a minihowto on this issue is includet
# at the bottom of this document. with some minor changes it should
# be no problem to adopt this howto for native install (no chroot, no qemu).
# as a matter of fact all you need to do is skip some lines of this howto :)
# as for hardware requirements, a fast processor enough ram reduces the
# time needed for compiling. +2500MB of free harddiskspace is required.
#
# you also need to switch to the root user or else some steps will not work
# and you have to manually do them via sudo !!!
#
# why do it: with a system setup the way explained below you are able to easily
# create custom emc2 equipped puppy linux distributions. you also are able
# to create your own special and or general purpose puppys.
#
# WARNING !!! THE PROCEDURES BELOW SHOULD BE UNDERSTOOD
# BEFORE BEEING UTILIZED.
# THIS HOWTO IS _NOT CREATED TO BE COPY AND PASTE PROOF_.
# THERE IS NO ERROR CHECKING OR OTHER SECURITYFEATURE INCLUDET
# STOPING YOU FROM _WHIPING OUT YOUR HARDDISK_ OR WORSE !!!
# THE AUTHOR IS NOT IN ANY WAY RELIABLE FOR ANY DAMAGE DONE
# BY FOLLOWING OR NOT FOLLOWING THE RECOMENDATIONS THIS
# HOWTO OFFERS.

# Big Thanks go to Raeed: for getting me onto this.
# The EMC developers: this is some serious nice software you got :)
# The axis team: eyecandy that works :) im loving it(tm) :)
# The fabulous QEMU: for making it sooooo easy
# The people @ #emc: for support whenever needed and not kicking me
# out of the channel :)
# All those Linuxhackers for making the World a better place to live.
# Special thanks go to Alex Joni and The Cooltool for hosting
# and other favors.
# not to forget Big Mama Thornton, George Benson, Robertos Funkmix
# and all the other nice music that helped me to keep sane :)

# at first lets get the actual puppy livecd:
 wget -c http://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/puppy-1.0.7-mozilla.iso

# create a harddiskimage for storing the puppy hd install
 qemu-img create coolcnc.0.2.img 3000M

# kqemu speeds up qemu alot
 modprobe kqemu

# boot into puppy using qemu:
 qemu -hda coolcnc.0.2.img -cdrom puppy-1.0.7-mozilla.iso -boot d -m 128

# INSIDE QEMU
# you are asked some simple questions like keyboardlayout and mousetype.
# answer them correctly and choose xfvb as X server. choose a screensize
# to work with and configure the network.
#
# on the bootprompt choose "4" and press [enter]
# select your desired keyboardlayout <OK> [enter]
# choose "ps/2" as mousetype to make it work with qemu
# we go with Xvesa server (the xorg server doesnt seem to
# work well with qemu)
#
# select your desired videomode and press <OK>
# go to Start->Setup->Ethernet/network Wizard and configure your networkinterfacecard
#  with qemu thats eth0 and AUTO/DHCP
# setup puppy on your harddiskimage:
#  open a terminal and execute cfdisk
#  create a primary partition spanning the whole disk
#  set the bootable flag -> write -> exit
#
# go to Start->Setup->Install Puppy hard drive
# choose "2" [enter]
# a new install [enter]
# "/dev/hda1" [enter]
# yes you are shure "y" [enter]
# cdrom is inserted [enter]
#
# now you have to type anything but space :) type "n" [enter]
# another trap : press "y" [enter] or else grub would not be configured
# choose "simple" [OK] -> [OK] -> "/dev/hda1" is [OK]
# we want to install into the MBR [OK]
#
# THATS IT :) you may shutdown qemu now
#-------------------------------------------------------------------------#

# you can access the created filesystem from your Linuxsystem via loopbackmount:
 lomount -diskimage coolcnc.0.2.img -partition 1 /coolcncmount

# lets get the puppy developementtools/header filesystemimage
# NATIV: if you do a native install you have to get usr_devx.sfs and put it into /
 cd /coolcncmount
 wget --passive-ftp http://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/usr_devx.sfs
 mkdir /coolcncmount/.usr_devx


# if your kernel supports unionfs and squashfs you can easily build a chrooted environment.
 losetup /dev/loop3 /coolcncmount/usr_devx.sfs
 mount -r -t squashfs -o noatime /dev/loop3 /coolcncmount/.usr_devx
 mount -t unionfs -o dirs=/coolcncmount/usr=rw:/coolcncmount/.usr_devx=ro none /coolcncmount/usr
 mount -o bind /dev /coolcncmount/dev
 mount -o bind /proc /coolcncmount/proc
 cp /etc/resolv.conf /coolcncmount/etc/resolv.conf

 cd /coolcncmount
 chroot .
# you may have to repeat the "chroot ."
 chroot .

# you are ready to utlilze the full power of your hardware for compiling
# instead of the rather slow emulation. if you dont have a suitable kernel
# running right now, nevermind, we are going to build a kernel anyways
# you can customize it if desired and also install it on your HOSTSYSTEM.

# if you run a kernel that does not support squashfs/unionfs
# you have to use qemu. you should unmount /coolcncmount before booting
# or else filesystemcorruption may follow
 umount /coolcncmount
 qemu -hda coolcnc.0.2.img -cdrom puppy-1.0.7-mozilla.iso -boot c -m 128

# the following commands are to be executed from within the qemu COOLCNC-
# environment, a NATIV install or a proper setup chroot environment !!!

# first lets get to the homedirectory
 cd /root


# if you do a NATIV install and dont get your keyboard configured orrectly
# you should launch the dotpup package installer and install the updated xkb.


# get puppy unleashed core (for building puppy from scratch) you can skip these steps
# for now if you want to. they can be done later. its a rather heavy download of
# aproximatly 300MB. you dont need this if you just want to take a look at the rtai'd puppy.

 wget -c http://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/puppy-unleashed-core-1.0.7.tar.gz

 mkdir /root/puppy
 cd /root/puppy
 tar -xvzf /root/puppy-unleashed-core-1.0.7.tar.gz

 cd /root
 mkdir package_tarballs
 cd package_tarballs

# get puppy unleashed packages (without openoffice ! you have to remove the exclude to get it - doesnt work!)
 wget -R openoffice_CUTDOWN -c -m -nd -np http://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/pupget_packages-1/


# unpack the packages into the unleashed package directory
 cd /root/puppy/puppy-unleashed/packages
 for package in `find /root/package_tarballs`; do tar -xvzf $package; done

# congratulations you have now finished setting up a puppy breeding environment
# now lets build a rtai patched kernel, emc2 and a axis packages for it

# QEMU: please verify that /usr_devx.sfs gets recognized and mounted.
# lets see if puppy automagically detects the usr_devx.sfs and mounts it at reboot.
# you can check if everything is ok by issuing the following command. watch out for lines
# telling about /dev/loop3 ....... 100% /.usr_devx
 unionctl /usr --list

# should output something like:
# /usr (rw)
# /.usr_devx (r-)

# if you are working within a chroot the us_devx.sfs should be allready mountet.
# verify it the same way as described above (note: when run outside the chroot
# you get to see the full path /coolcncmount/usr (rw) , /coolcncmount/.usr_devx (r-)

# building a 2.4.31 kernel
# now lets get the kernelsource
 cd /usr/src
 wget  -c http://www.fht.lkams.kernel.org/pub/linux/kernel/v2.4/linux-2.4.31.tar.bz2

# get unionfs, squashfs, ntfs patches/tools and adeos
# wget --passive-ftp ftp://unionfs-mirror.linux-live.org/unionfs/unionfs-1.0.9.tar.gz
 wget --passive-ftp ftp://unionfs-mirror.linux-live.org/unionfs/unionfs-1.0.14.tar.gz
 wget http://ovh.dl.sourceforge.net/sourceforge/squashfs/squashfs2.2-r2.tar.gz
 wget http://www.goosee.com/puppy/development/linux-2.4.29-ntfs-2.1.6b.patch.gz
 wget -c http://download.gna.org/adeos/patches/attic/v2.4/i386/candidates/adeos-linux-2.4.31-i386-r18c1.patch

# unpack the kernelsource and the patches and apply them to the source
 rm linux
 rm -rf linux-2.4.31
# rm -rf unionfs-1.0.9
 rm -rf unionfs-1.0.14
 rm -rf squashfs2.2-r2
 tar -xvjf linux-2.4.31.tar.bz2
 ln -s linux-2.4.31 linux
# tar -xvzf unionfs-1.0.9.tar.gz
 tar -xvzf unionfs-1.0.14.tar.gz
 tar -xvzf squashfs2.2-r2.tar.gz
 gzip -d linux-2.4.29-ntfs-2.1.6b.patch.gz
 cd linux
 patch -p1 < /usr/src/squashfs2.2-r2/linux-2.4.31/squashfs2.2-patch
 patch -p1 < /usr/src/adeos-linux-2.4.31-i386-r18c1.patch
 patch -p1 < /usr/src/linux-2.4.29-ntfs-2.1.6b.patch


# copy  the original puppy config into place remove some lines and add adeos support
# and change the size of the inititalramdisk
 cat ../linux-2.4.29/config-2july05-2.4.29-pup1.0.4 |   grep -v CONFIG_MODVERSIONS | grep -v CONFIG_BLK_DEV_RAM_SIZE > .config
 echo "#changed for meeting the needs of rtai and to require no userinteraction
 CONFIG_FBCON_SPLASHSCREEN=y
 CONFIG_FBCON_CFB16=y
 CONFIG_SUPERMOUNT=m
 CONFIG_BLUEZ_HCIUART_H4=m
 CONFIG_SCSI_SATA_QSTOR=m
 CONFIG_MODVERSIONS=n
 CONFIG_ADEOS=m
 CONFIG_ADEOS_PROFILING=n
 CONFIG_ADEOS_CORE=y
 CONFIG_IPIPE=n
 CONFIG_IPIPE_STATS=n
 CONFIG_SQUASHFS_EMBEDDED=n
 CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_STACKOVERFLOW=n
 CONFIG_DEBUG_HIGHMEM=n
 CONFIG_DEBUG_SLAB=n
 CONFIG_DEBUG_IOVIRT=n
 CONFIG_DEBUG_SPINLOCK=n
 CONFIG_FRAME_POINTER=n
 CONFIG_BLK_DEV_RAM_SIZE=24576" >> .config

# if youd like to have any other things configured run make config or menuconfig now!
# also if you have too much ram and or cpu/s you could add
# MAKE = make -j2 to the Makefile

# ready to build a kernel ? lets go :)
 make oldconfig
 make dep
 make clean
 make bzImage
 make modules

# puppys xargs (which is just another part of busybox) lacks the -i option
# so we have to get GNU findutils first, compile it and copy xargs into
# our PATH in order to let make modules_install finish its job.
 cd /usr/src
 wget http://ftp.gnu.org/pub/gnu/findutils/findutils-4.2.27.tar.gz
 tar -xvzf findutils-4.2.27.tar.gz
 cd findutils-4.2.27
 ./configure
 make
 cp xargs/xargs /bin/xargs

# now the modules should install into /lib/modules/2.4.31
# the kernel and System.map gets copied to /boot
 cd /usr/src/linux
 make modules_install
 cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.31
 cp System.map /boot/System.map-2.4.31
 rm /lib/modules/2.4
 ln -s /lib/modules/2.4.31 /lib/modules/2.4

# now lets compile the unionfs module and copy it into place
# uname -r is removed because of some issues when compiling
# in a chrooted environment and the HOSTS kernel is not a
# 2.4.31 version kernel.
# cd /usr/src/unionfs-1.0.9
# echo "EXTRACFLAGS=-DNODEBUG
# LINUXSRC=/usr/src/linux-2.4.31" > fistdev.mk
# cat Makefile | sed 's/`uname\ \-r`/2.4.31-adeos/g' |  # sed 's/uname\ \-r/2.4.31/g' |   sed 's/^KERNELVERSION.*/KERNELVERSION=2.4/' > Makefile_

# here we got the same with unionfs-1.0.14, i prefer this because the
# removing of parts of branches works better
 cd /usr/src/unionfs-1.0.9
 echo "EXTRACFLAGS=-DNODEBUG
 LINUXSRC=/usr/src/linux-2.4.31" > fistdev.mk
 cat Makefile | sed 's/`uname\ \-r`/2.4.31-adeos/g' |   sed 's/uname\ \-r/2.4.31/g' |   sed 's/^KERNELVERSION.*/KERNELVERSION=2.4/' > Makefile_


 mv Makefile_ Makefile
 make
 make install

# we got all modules together, lets install the kernel for testing
# if you are doing a native install, you should change the root=/dev/hda1
# part to fit you partitionlayout!
 echo "title COOLCNC (on /dev/hda1)
 root (hd0,0)
 kernel /boot/vmlinuz-2.4.31 root=/dev/hda1 ro vga=normal" >> /boot/grub/menu.lst

#exit the chroot and umount proc and dev
exit

# i havent figured out yet how to remove the unions and mounts
# also seem to hang sometimes. dunno. right now i need to reboot
# in order to get rid of the mounts and unions


# boot qemu and choose COOLCNC when entering the grub bootmenu
# at the first boot with the new kernel the modules dependencyfile must be
# created by opening a terminal and entering depmond -a
# after the next reboot the usr_devx should be mounted correctly
# and we can continue to install rtai and emc. for this we need
# to run the rtaikernel we compiled earlier. you got two choices.
# use a qemu session (slow)
 qemu -hda coolcnc.0.2.img -cdrom puppy-1.0.7-mozilla.iso -boot c -m 256

# i recommend installing the kernel on the host too and use a chrooted environment.

# dont forget to do a depmod -a ! you will not be able to compile
# if usr_devx is not mounted and stacked over your /usr directory!

# next stop rtai, emc2, python, axis, mesa
 cd /usr/src
 wget http://download.gna.org/rtai/stable/v3/rtai-3.2.tar.bz2
 wget http://www.python.org/ftp/python/2.4.2/Python-2.4.2.tgz
 wget http://surfnet.dl.sourceforge.net/sourceforge/mesa3d/MesaLib-6.4.1.tar.bz2
 wget http://surfnet.dl.sourceforge.net/sourceforge/mesa3d/MesaGLUT-6.4.1.tar.bz2
 wget http://surfnet.dl.sourceforge.net/sourceforge/tcl/tcl8.4.12-src.tar.gz
 wget http://surfnet.dl.sourceforge.net/sourceforge/tcl/tk8.4.12-src.tar.gz
 wget http://unpy.net/cgi-bin/viewcvs.cgi/axis/axis.tar.gz?tarball=1
 mv axis.tar.gz\?tarball\=1 axis.tar.gz

# now some unionfstricks. its easy to create packages if you use unionfs to keep data separated.

 mkdir /.coolcnc
 dd if=/dev/zero of=/coolcnc.sfs bs=1M count=360
 mkfs.ext2 -F /coolcnc.sfs
 mount -o loop /coolcnc.sfs /.coolcnc

# lets direct all following writeoperations to /.coolcnc
 unionctl /usr --add --before /usr --mode rw /.coolcnc
 unionctl /usr --mode /usr ro

# unionctl /usr --list should now tell you something like this
#    /.coolcnc (rw)
#    /usr (r-)
#    /.usr_devx (r-)

# if youd like to you can put those lines into /etc/rc.d/rc.local
# they will be executed with every subsequent boot.
 echo "mount -o loop /coolcnc.sfs /.coolcnc
 unionctl /usr --add --before /usr --mode rw /.coolcnc
 unionctl /usr --mode /usr ro" >> /etc/rc.d/rc.local


# time to get rtai and emc on the road :)
# first lets compile rtai
cd /usr/src
echo "root ALL=(ALL) ALL" > /etc/sudoers
chmod 0440 /etc/sudoers
tar -xvjf rtai-3.2.tar.bz2
rm linux ; ln -s linux-2.4.31 linux
cd rtai-3.2
./configure
make install
# for cleanup
#cd /usr/src
#rm -rf rtai-3.2
# if you did that in a chroot you have to manually create the devicenodes
# for rtai (if you didnt mount -bind /dev to /chroot/dev you can igonre that).
# on the host say something like: umount /coolcnc/dev
# then in the chroot execute: mknod -m 666 /dev/rtai_shm c 10 254
# you can afterward savely do a mount -o bind /dev /coolcnc/dev

# emc2 depends on tcl/tk
cd /usr/src
tar -xvzf tcl8.4.12-src.tar.gz
tar -xvzf tk8.4.12-src.tar.gz

cd /usr/src/tcl8.4.12/unix
./configure
make
make install
cd /usr/src

cd /usr/src/tk8.4.12/unix
./configure
make
make install

# puppy uses a very outdated version of bwidget
# lets get the newest release

cd /usr/src
wget http://surfnet.dl.sourceforge.net/sourceforge/tcllib/BWidget-1.7.0.tar.gz
cd /usr/lib/ 
rm bwidget
tar -xvzf /usr/src/BWidget-1.7.0.tar.gz
ln -s BWidget-1.7.0 bwidget

# lets put it in a unleashed package rightaway
mkdir -p /root/puppy/puppy-unleashed/packages/bwidget-1.7.0-puppysit/usr/lib
cp -auv /usr/lib/BWidget-1.7.0 /root/puppy/puppy-unleashed/packages/bwidget-1.7.0-puppysit/usr/lib
cp -auv /usr/lib/bwidget /root/puppy/puppy-unleashed/packages/bwidget-1.7.0-puppysit/usr/lib



cd /usr/src

export LD_LIBRARY_PATH=/usr/local/lib
# lets add /usr/local/lib as librarypath to our .bashrc
echo "LD_LIBRARY_PATH=/usr/local/lib" >> /root/.bashrc

# now emc2 is ready to get leeched and compiled :)
# sourceforge cvs is sometimes under heavy load. at leat
# it looks like that because the checkout may take multiple
# runs before it works.

 touch /root/.cvspass
 cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/emc login
# you should not use this unless you know what you do!
# #leet# cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/emc co emc2
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/emc co -r TESTING -d emc2testing emc2
# cd emc2/src
 cd emc2-testing/src
 ./configure
 make

#cleanup
#rm -rf /usr/src/tk8.4.12
#rm -rf /usr/src/tcl8.4.12

# now lets see if emc2 works
 cd ..
 scripts/emc

# if youd like emc to talk to you in a language other then english
# you have to set your LANG environment variables correctly.
# german for example could be selected by executing:
 LANG=de


# lets get axis dependencies fullfilled
 cd /usr/src
 tar -xvzf Python-2.4.2.tgz
 cd Python-2.4.2
 ./configure
 make
 make install
# make some space or else we will run out during the next compiles
# rm -rf Python-2.4.2

# for the pretty 3d look axis depends on opengl
# lets use Mesa and Glut. if your graphiccard is
# supported by accelerated drivers you can use xorg
# to get better performance.
 cd /usr/src
 tar -xvjf MesaLib-6.4.1.tar.bz2
 cd Mesa-6.4.1
 make linux-x86
 cp -auv lib/* /usr/local/lib
 cd /usr/src

 tar -xvjf MesaGLUT-6.4.1.tar.bz2
 cd Mesa-6.4.1
 make linux-x86
 cp -auv lib/* /usr/local/lib
 cd /usr/src
# rm -rf /usr/src/Mesa-6.4.1

# now to axis
 tar -xvzf axis.tar.gz
 cd axis
 EMCROOT=/usr/src/emc2testing python setup.py install --force
# rm -rf /usr/src/Mesa-6.4.1

# now you could change the DISPLAY variable in the emc2 inifile
# you are using for your machine to DISPLAY = axis to give it
# a testrun.

cd /usr/src/emc2
scripts/emc

# you have finished installing rtai,emc2 and axis on
# your puppy. now lets get to the breeding part.

cd /usr/src

# first lets build a directorystructure for the adeos kernel
 rm -rf /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/
 mkdir -p /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/modules/0base_modules-2.4.31-adeos/lib/modules/

# now lets get the kernel and modules into place
 cp /usr/src/linux/.config /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/modules/0base_modules-2.4.31-adeos/lib/modules/config-2.4.31-adeos
 cp -auv /lib/modules/2.4.31-adeos /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/modules/0base_modules-2.4.31-adeos/lib/modules/
 cp /usr/src/linux/arch/i386/boot/bzImage /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/vmlinuz
 cd /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/ ; ln -s vmlinuz vmlinuz.fb
 cd /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/modules/0base_modules-2.4.31-adeos/lib/modules/
 ln -s 2.4.31-adeos 2.4

 rm /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/modules/0base_modules-2.4.31-adeos/lib/modules/2.4.31-adeos/build
# just a set of links, lets remove them
 rm -rf /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/modules/0base_modules-2.4.31-adeos/lib/modules/2.4.31-adeos/pcmcia


# lets gzip the modules
 for dir in `find /root/puppy/puppy-unleashed/kernels/2.4.31-adeos/modules/0base_modules-2.4.31-adeos/lib/modules/2.4.31-adeos -type d`
 do
 cd $dir
 ls *.o
 gzip -9 *.o
 ls *.gz
 done
# thats it, we now have our adeos patched kernel installed into the unleashed breeding environment

# because our kernel has more drivers within the initial ramdisk we have to change the size to 24576k
 cd /root/puppy/puppy-unleashed
 rm -rf packages/0rootfs_skeleton-1.0.7_puppysit
 cp -auv  packages/0rootfs_skeleton-1.0.7  packages/0rootfs_skeleton-1.0.7_puppysit
 echo 24576 > packages/0rootfs_skeleton-1.0.7_puppysit/etc/ramdiskfssize
# you have to remove the rootfs_skeleton-1.0.7 and add rootfs_skeleton-1.0.7_puppysit in the unleashed
# package selection gui if youd like to start with mastering right away ! all changes you want to make
# to the rootfs should be made in the rootfs_skeleton-1.0.7_puppysit directory.


# lets build unleashed packages for rtai,emc,python and axis
# maybe add -dev packages in the future

# rtai is really small not much work to do here
# besides some copying and a little striping
# the documentation is moved into a seperate package
# rtai-3.2-runtime_puppysit and rtai-3.2-doc_puppysit
ROOTFS_PATH=/root/puppy/puppy-unleashed/packages/0rootfs_skeleton-1.0.7_puppysit
DEVICE_PATH=$ROOTFS_PATH/dev
PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/rtai-3.2-runtime_puppysit

rm -rf $PACKAGE_ROOT

mkdir -p $ROOTFS_PATH/etc/init.d
rm $ROOTFS_PATH/etc/realtime

echo "#! /bin/bash
modprobe adeos
sleep 1" > $ROOTFS_PATH/etc/init.d/realtime

cat /etc/init.d/realtime | grep -v /bin/bash >> $ROOTFS_PATH/etc/init.d/realtime

mkdir -p $PACKAGE_ROOT/usr/realtime

for dirx in `echo "bin
calibration
include
lib
modules
testsuite"`
do
cp -auv /usr/realtime/$dirx $PACKAGE_ROOT/usr/realtime
done

sleep 5

for devx in `echo "rtai_shm
rtf0
rtf1
rtf2
rtf3
rtf4
rtf5
rtf6
rtf7
rtf8
rtf9"`
do
cp -auv /dev/$devx $DEVICE_PATH
done
sleep 5
strip --strip-unneeded $PACKAGE_ROOT/usr/realtime/bin/*
strip --strip-debug $PACKAGE_ROOT/usr/realtime/lib/*

PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/rtai-3.2-doc_puppysit
rm -rf $PACKAGE_ROOT

mkdir -p $PACKAGE_ROOT/usr/realtime
cp -auv /usr/realtime/share $PACKAGE_ROOT/usr/realtime/

# qemu - using the Xvesa server
# matrox milleniumII pci - using the Xorg server
# matrox g550 - using the Xorg server
# nvidia Geforce3 - works with the Xorg server
# if your computer hangs after entering graphical mode, you do have
# to configure the xserver correctly manualy!
#
#




# lets strip emc down to the bone :)
# we seperate docs and runtimeenvironment as with rtai
# into emc2-cvs_dateofcheckout and emc2-cvs_dateofcheckout-doc
ROOTFS_PATH=/root/puppy/puppy-unleashed/packages/0rootfs_skeleton-1.0.7_puppysit
cat $ROOTFS_PATH/etc/profile  | sed 's/LIBRARY_PATH="/LIBRARY_PATH="\/usr\/local\/lib:/g' > /tmp/profile
mv /tmp/profile $ROOTFS_PATH/etc/profile

PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/emc2-25.02.2006-puppysit
rm -rf $PACKAGE_ROOT

mkdir -p $PACKAGE_ROOT/usr/local/bin

for filex in `echo "classicladder
emc
emc_module_helper
emcsh
emcsvr
halcmd
halmeter
halscope
halvcp
idle
inivar
io
iosh
m5i20cfg
milltask
milltaskcanon
simio
usrmot"`
do
cp /usr/local/bin/$filex $PACKAGE_ROOT/usr/local/bin
done

mkdir $PACKAGE_ROOT/usr/local/etc
cp -auv /usr/local/etc/emc2 $PACKAGE_ROOT/usr/local/etc

mkdir -p $PACKAGE_ROOT/usr/local/share/emc
cp -auv /usr/local/share/emc/* $PACKAGE_ROOT/usr/local/share/emc/

strip --strip-unneeded $PACKAGE_ROOT/usr/local/bin/*


mkdir -p $PACKAGE_ROOT/usr/local/lib
for filex in `echo "libnml.so
libemc.a
librs274.so"`
do
cp /usr/local/lib/$filex $PACKAGE_ROOT/usr/local/lib
done
strip --strip-debug $PACKAGE_ROOT/usr/local/lib/*

# now python is huge, luckily axis developer jeff epler
# wrote a small pythonscript to make a directory containing
# only those things used by axis. it also strips and compresses.
# wget pack_python, i used the output of his tools for the following
# lines of bash.
#
# you can copy and paste the next ~222 lines ;)

ROOTFS_PATH=/root/puppy/puppy-unleashed/packages/0rootfs_skeleton-1.0.7_puppysit
echo "PYTHONHOME=/usr/local
PYTHONPATH=/usr/local/bin/python" >> $ROOTFS_PATH/etc/profile

# watch out this directory will be deleted!
PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/python2.4-subset-axis_puppysit
PYTHON_ROOT=$PACKAGE_ROOT/usr/local/lib/python2.4/
rm -rf $PACKAGE_ROOT
cd /root/puppy/puppy-unleashed/packages

mkdir -p $PACKAGE_ROOT/usr/local/lib/python2.4/lib-tk

cp /usr/local/lib/python2.4/lib-tk/Tkinter.pyo $PACKAGE_ROOT/usr/local/lib/python2.4/lib-tk

for filex in `echo "opcode.pyo
dis.pyo
inspect.pyo
ConfigParser.pyo
Dialog.pyo
FixTk.pyo
StringIO.pyo
Tkconstants.pyo
Tkinter.pyc
UserDict.pyo
__future__.pyo
atexit.pyo
codecs.pyo
copy.pyo
copy_reg.pyo
dummy_thread.pyo
__init__.pyo
cp875.pyo
iso8859_15.pyo
charmap.pyo
cp1257.pyo
cp1250.pyo
unicode_escape.pyo
latin_1.pyo
cp037.pyo
cp1252.pyo
base64_codec.pyo
koi8_u.pyo
string_escape.pyo
cp1256.pyo
uu_codec.pyo
utf_8.pyo
cp864.pyo
iso8859_10.pyo
raw_unicode_escape.pyo
mac_cyrillic.pyo
cp850.pyo
mac_latin2.pyo
iso8859_9.pyo
cp856.pyo
utf_7.pyo
cp1258.pyo
iso8859_7.pyo
hex_codec.pyo
cp862.pyo
cp1251.pyo
zlib_codec.pyo
iso8859_8.pyo
palmos.pyo
cp1026.pyo
cp866.pyo
iso8859_14.pyo
cp874.pyo
utf_16.pyo
cp437.pyo
iso8859_5.pyo
cp861.pyo
cp869.pyo
mac_iceland.pyo
iso8859_3.pyo
cp852.pyo
cp865.pyo
iso8859_4.pyo
iso8859_6.pyo
idna.pyo
mbcs.pyo
cp1140.pyo
cp857.pyo
cp775.pyo
rot_13.pyo
cp1255.pyo
unicode_internal.pyo
ascii.pyo
iso8859_2.pyo
cp500.pyo
cp1006.pyo
undefined.pyo
iso8859_1.pyo
utf_16_le.pyo
cp860.pyo
cp424.pyo
cp1253.pyo
punycode.pyo
cp737.pyo
mac_turkish.pyo
mac_greek.pyo
iso8859_13.pyo
mac_roman.pyo
cp855.pyo
quopri_codec.pyo
utf_16_be.pyo
cp1254.pyo
koi8_r.pyo
aliases.pyo
cp863.pyo
__init__.pyo
aliases.pyo
fnmatch.pyo
getopt.pyo
gettext.pyo
glob.pyo
hershey.pyc
linecache.pyo
locale.pyo
nf.pyc
os.pyo
popen2.pyo
posixpath.pyo
random.pyo
re.pyo
repr.pyo
__init__.pyc
interpret.pyc
glcanon.pyc
errorlist.pyc
OpenGLTk.pyc
options.pyc
__init__.pyc
OpenGLTk.pyc
errorlist.pyc
glcanon.pyc
interpret.pyc
options.pyc
shutil.pyo
site.pyo
socket.pyo
sre.pyo
sre_compile.pyo
sre_constants.pyo
sre_parse.pyo
stat.pyo
string.pyo
tempfile.pyo
token.pyo
tokenize.pyo
traceback.pyo
types.pyo
warnings.pyo
webbrowser.pyo"`
do
mkdir -p `find /usr/local/lib/python2.4  | grep /$filex  | grep -v __init__ |  sed "s/^/\/root\/puppy\/puppy-unleashed\/packages\/python2.4-subset-axis_puppysit/g" |  sed "s/\/$filex//g"`
cp `find /usr/local/lib/python2.4  | grep /$filex  | grep -v __init__`  `find /usr/local/lib/python2.4  | grep /$filex  | grep -v __init__ |  sed "s/^/\/root\/puppy\/puppy-unleashed\/packages\/python2.4-subset-axis_puppysit/g"`
done

for filex in `echo "
emc.so 
_random.so
fcntlmodule.so 
selectmodule.so 
timemodule.so 
pwdmodule.so 
minigl.so 
termios.so 
_ssl.so 
cStringIO.so 
zlibmodule.so 
gcode.so 
binascii.so 
arraymodule.so 
_togl.so 
_localemodule.so 
_socketmodule.so 
_tkinter.so 
structmodule.so 
mathmodule.so 
strop.so"`
do
mkdir -p `find /usr/local/lib/python2.4  | grep /$filex  | grep -v __init__ |  sed "s/^/\/root\/puppy\/puppy-unleashed\/packages\/python2.4-subset-axis_puppysit/g" |  sed "s/\/$filex//g"`


cp `find /usr/local/lib/python2.4  | grep /$filex  | grep -v __init__`  `find /usr/local/lib/python2.4  | grep /$filex  | grep -v __init__ |  sed "s/^/\/root\/puppy\/puppy-unleashed\/packages\/python2.4-subset-axis_puppysit/g"`

done
cp /usr/local/lib/python2.4/site-packages/emc.so $PYTHON_ROOT/site-packages/
mkdir -p $PYTHON_ROOT/lib-dynload/
cp /usr/local/lib/python2.4/lib-dynload/struct.so $PYTHON_ROOT/lib-dynload/
cp /usr/local/lib/python2.4/lib-dynload/array.so $PYTHON_ROOT/lib-dynload/
cp /usr/local/lib/python2.4/lib-dynload/time.so $PYTHON_ROOT/lib-dynload/
cp /usr/local/lib/python2.4/lib-dynload/math.so $PYTHON_ROOT/lib-dynload/

mkdir -p $PYTHON_ROOT/encodings $PYTHON_ROOT/rs274 
cp /usr/local/lib/python2.4/encodings/__init__.pyo $PYTHON_ROOT/encodings
cp  /usr/local/lib/python2.4/site-packages/rs274/__init__.pyc $PYTHON_ROOT/site-packages/rs274
mkdir -p $PACKAGE_ROOT/usr/local/bin
cp /usr/local/bin/python $PACKAGE_ROOT/usr/local/bin

# strip it
 strip --strip-unneeded $PACKAGE_ROOT/usr/local/bin/*
 strip --strip-debug $PYTHON_ROOT/encodings/*
 strip --strip-debug $PYTHON_ROOT/lib-tk/*
 strip --strip-debug $PYTHON_ROOT/site-packages/*
 strip --strip-debug $PYTHON_ROOT/site-packages/rs274/*
# compress the binary
 /root/puppy/puppy-unleashed/upx -9 $PACKAGE_ROOT/usr/local/bin/python

# some necessary fix
cd $PACKAGE_ROOT/usr/local/lib/python2.4
find . -name \*.pyo | while read i ; do mv $i ${i%.pyo}.pyc; done


# lets get on with axis
PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/axis-22.02.2006-puppysit
rm -rf $PACKAGE_ROOT

mkdir -p $PACKAGE_ROOT/usr/local/share/axis
cp -auv /usr/local/share/axis/* $PACKAGE_ROOT/usr/local/share/axis/

mkdir -p $PACKAGE_ROOT/usr/local/bin
cp /usr/src/emc2testing/bin/axis $PACKAGE_ROOT/usr/local/bin

mkdir -p $PACKAGE_ROOT/usr/local/share
cp -auv /usr/local/share/locale $PACKAGE_ROOT/usr/local/share

# now to tcl, tk, mesa and glut
PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/tcl8.4-puppysit
rm -rf $PACKAGE_ROOT

LIBDIR=$PACKAGE_ROOT/usr/local/lib/
mkdir -p $LIBDIR
cp -auv /usr/local/lib/tcl* $LIBDIR
cp -auv /usr/local/lib/libtcl* $LIBDIR
strip --strip-debug $LIBDIR/*

mkdir $PACKAGE_ROOT/usr/local/bin
cp -auv /usr/local/bin/tclsh8.4 $PACKAGE_ROOT/usr/local/bin
cp -auv /usr/local/bin/wish8.4 $PACKAGE_ROOT/usr/local/bin
strip --strip-unneeded $PACKAGE_ROOT/usr/local/bin/*

PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/tk8.4-puppysit
rm -rf $PACKAGE_ROOT

LIBDIR=$PACKAGE_ROOT/usr/local/lib/
mkdir -p $LIBDIR
cp -auv /usr/local/lib/tk* $LIBDIR
cp -auv /usr/local/lib/libtk* $LIBDIR
strip --strip-debug $LIBDIR/*

PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/mesa_glut-6.4.1-puppysit
rm -rf $PACKAGE_ROOT

LIBDIR=$PACKAGE_ROOT/usr/local/lib/
mkdir -p $LIBDIR
cp -auv /usr/local/lib/libGL* $LIBDIR
cp -auv /usr/local/lib/libglu* $LIBDIR
strip --strip-debug $LIBDIR/*

PACKAGE_ROOT=/root/puppy/puppy-unleashed/packages/mesa_lib-6.4.1-puppysit
rm -rf $PACKAGE_ROOT

LIBDIR=$PACKAGE_ROOT/usr/local/lib/
mkdir -p $LIBDIR
cp -auv /usr/local/lib/libOSMesa* $LIBDIR
strip --strip-debug $LIBDIR/*

# we finished creating the unleashed directorys
#
#/root/puppy/puppy-unleashed/packages/emc2-25.02.2006-puppysit:
#/root/puppy/puppy-unleashed/packages/libexpat-0.5.0_puppysit:
#/root/puppy/puppy-unleashed/packages/mesa_glut-6.4.1-puppysit:
#/root/puppy/puppy-unleashed/packages/mesa_lib-6.4.1-puppysit:
#/root/puppy/puppy-unleashed/packages/python2.4-subset-axis_puppysit:
#/root/puppy/puppy-unleashed/packages/rtai-3.2-doc_puppysit:
#/root/puppy/puppy-unleashed/packages/rtai-3.2-runtime_puppysit:
#/root/puppy/puppy-unleashed/packages/tcl8.4-puppysit:
#/root/puppy/puppy-unleashed/packages/tk8.4-puppysit:
#
#



# FINNISH !!! YOU DID IT !!!



# you are ready to build coolcnc now. enter the unleashed directory
# type ./createpuppy, just select or deselct the packages youd like
# with your iso and follow the instructions given by the script. 

# i put together some sample packages.txt in the future. i promise :)

# this version reflects the progress of this howto on March 2nd 2006


# KNOWN PROBLEMS AND WORKAROUNDS
#
# 
# if your computer hangs after entering graphical mode, you do have
# to configure the xserver correctly manualy!
# tested by now are:
# qemu - using the Xvesa server
# matrox milleniumII pci - using the Xorg server
# matrox g550 - using the Xorg server
# nvidia Geforce3 - works with the Xorg server


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited March 12, 2006 6:25 am by Cncuser (diff)
Search:
Published under a Creative Commons License