########################################################################## # Instructions for DSCUD 5.7 Installation on Prometheus ########################################################################## $Id: dscud_build.txt,v 1.6 2005/06/03 19:18:36 richard Exp $ STEPS 1-15 are done on your "host" machines hard drive. (The one you compile code on) STEPS 16-19 are done on the flash for a Prometheus (which is temporarily mounted to your host machine) I -- DOWNLOAD CODE ================== 1) Download LINUX-DSCUD57.tar.gz file from http://www.diamondsystems.com (or get it from http://infohost.nmt.edu/~rsonnenf/research/research.html) 2) Download a kernel source from http://www.kernel.org/pub/linux/kernel/v2.4/ that matches the current version on pebble. Currently 2.4.26 so you would get linux-2.4.26.tar.bz2 Note:Switch to root after step 2. II -- PREPARING THE KERNEL SOURCE: ================================== 3) Move the kernel to the /usr/src directory mv linux-2.4.26.tar.bz2 /usr/src 4) Untar the kernel in /usr/src on the host system. cd /usr/src tar -jxvf linux-2.4.26.tar.bz2 [-j option for .bz2] 5) Next we are going to start a kernel build, but not finish it so the driver install program can find what it needs. cd linux-2.4.26 make menuconfig When the screen comes up select Exit and then say Y to save. You have now created a .config file in the linux-2.4.26 directory. Actually -- you can't do this blindly. Need to look at options and select reasonable ones. Mostly, make sure architecture is 486. I also turned off lots of kernel features that Prometheus doesn't use (like USB, PCI) -- (Battles claims this isn't necessary -- Architecture doesn't matter for this step. Hunyady claims its wise.) make dep (Creates makefiles, and according to John -- Puts .h files where they need to be too.) 6) The script install.sh (used for DSCUD) expects the kernel source to be in /usr/src/linux. You can actually put the kernel source somewhere else, but then put a soft link. For example: ln -s /usr/src/linux-2.4.26 /usr/src/linux III - PREPARING THE DSCUD OBJECT LIBRARIES: ========================================== 7) cd /Unpackdir ("Unpackdir"=where you put the DSCUD file and want to unpack it.) tar -zxvf LINUX-DSCUD57.tar.gz [-z option for .gz] 8) cd dscud-5.7 (Full path is /Unpackdir/dscud-5.7) 9) cd gcc3 (Full path is /Unpackdir/dscud-5.7/gcc3) This is assuming you have gcc version 3.x.x on your system. All work for summer '04 was done with a gcc 3.x compiler. [If you use 2.x.x then do a cd gcc2 instead.] tar -zxvf dscud-5.7.tar.gz 10) cd dscud5 (Again Fullpath is /Unpackdir/dscud-5.7/gcc3/dscud5) 11) Create directory for libraries and .h files mkdir /usr/local/dscud5 cp libdscud5.a /usr/local/dscud5/libdscud5.a (static library for dscud -- precompiled by Diamond Systems) cp dscud.h /usr/local/dscud5/dscud.h (h.file) 12) Run ./install.sh (As root -- Compiles object file dsudkp.o) You should see something like: --> Compiling kernel module for your system <-- rm -f dscudkp.o gcc -c -o dscudkp.o dscudkp.c -O2 -D__KERNEL__ -DMODULE -I/usr/src/linux/ include -D__SMP__ -DSMP --> Installing module dscudkp.o in /lib/modules/misc <-- mkdir -p /lib/modules/misc cp dscudkp.o /lib/modules/misc/ IV - COMPILE BALLOON_TX ======================= 13) Now that the driver is built, and the .h and .a files are in /usr/local/dscud5, you should be able to compile balloon_tx. (The /usr/local/dscud5 is mentioned explicitly with the -I (include) option in Makefile and with the -L (library) option -- For balloon_tx). The include refers to the .h file. The Library refers to the .a file. (Library calls refer to .so files preferentially, but if only a .a file exists, they will point at those.) 14) The assumption is that you will do code development and compilation on a host system, rather than on Prometheus. Here is what it takes to make that cross development work. 15) In the Makefile for any programs using the dscud5 lib the order of the libs must be changed so that -lm is after the other libraries. Otherwise, you will see compile errors like the following: : undefined reference to `pow' collect2: ld returned 1 exit status The makefile in balloon_tx should look have a line that looks like this: LIBS = -L/usr/local/dscud5 -ldscud5 -lrt -lm The reason for this is that the new dscud5 library makes use of the pow() function defined in the math library and so must be linked before the math library. Here is a sample Makefile for balloon_tx: Note the -march=i486 flag. By explicitly specifying compilation for i486, your code will run on Prometheus even if it is being compiled on a gentoo machine that is optimized for 686. Code is downward compatible, so your 486 code should still be testable on your 686 development system. richard@feynman balloon_tx $ cat Makefile CFLAGS = -I/usr/local/dscud5 -D_THREAD_SAFE -pthread -ggdb -D_LINUX -march=i486 -static LIBS = -L/usr/local/dscud5 -ldscud5 -lrt -lm CFLAGS2 = -ggdb -D_LINUX LIBS2 = -lm -lrt -lncurses all: balloon_rx balloon_tx balloon_rx : balloon_rx.o nmea.o balloon.o gcc -o balloon_rx balloon_rx.o nmea.o balloon.o $(CFLAGS2) $(LIBS2) balloon_tx : balloon_tx.o nmea.o prometheus.o balloon.o gcc -o balloon_tx balloon_tx.o nmea.o prometheus.o balloon.o $(CFLAGS) $(LIBS) balloon_rx.o : balloon_rx.c gcc -c balloon_rx.c $(CFLAGS) balloon_tx.o : balloon_tx.c gcc -c balloon_tx.c $(CFLAGS) nmea.o: nmea.c nmea.h gcc -c nmea.c $(CFLAGS) prometheus.o: prometheus.c prometheus.h gcc -c prometheus.c $(CFLAGS) balloon.o: balloon.c balloon.h gcc -c balloon.c $(CFLAGS) clean : rm balloon_tx *.o V - INSTALL DSCUD TO FLASH ========================== 16) The dscudkp kernel module is now in /lib/modules/misc/dscudkp.o. Copy this file to the same location on your target system. 17) The load.sh script will load the kernel module so that it can be used by the driver. You must run this script each time the Linux system boots. See the README file for help with this. 18) Copy the files to the Prometheus target with: scp /lib/modules/misc/dscudkp.o root@10.0.100.xxx:/lib/modules/misc scp /usr/local/dscud5/load.sh root@10.0.100.xxx:/etc/init.d/load.sh 19) ssh to the e-sonde and run depmod -a depmod: *** Unresolved symbols in /lib/modules/misc/dscudkp.o (This is OK). ----------------------------- This finishes installing and building the new drivers on the Prometheus. ----------------------------- 20) Version of tools used during this instruction manual: Battles System ============== Development platform: Slackware 10.1 running Linux 2.6.10.6 gcc: gcc (GCC) 3.3.5 GNU ld version 2.15.92.0.2 20040927 glibc-2.3.4 GNU Make 3.80 binutils-2.15.92.0.2 In fact -- John did compile, but that doesn't mean that everything worked. Sonnenfeld System ================= Development platform: Debian vmlinuz-2.2.20-idepci (This was the running Kernel) Generic 2.4.26 kernel (What was pointed to by /usr/src/linux) gcc: gcc (GCC) 3.3.5 (gcc -v) GNU ld version 2.15 (ld --version) installed w/ binutils. glibc- Version unknown. GNU Make 3.80 Revision History: ======================================================================== Version 1.0 by J.Battles (created original document 4/23/2005) Version 1.1 by R.Sonnenfeld (Added version info and some explanatory comments 5/23/2005) Version 1.3 by R.Sonnenfeld (Tested procedure. It didn't work. We are blaming DSCUD58 because it crashes with a seg. fault even under Diamond's own demo programs. Version 1.4 by R.Sonnenfeld (Regressed to DSCUD7 and a Debian system. It worked!) ======================================================================== $Log: dscud_build.txt,v $ Revision 1.6 2005/06/03 19:18:36 richard Made RCS compliant. Removed manual version info. Revision 1.5 2005/06/03 19:17:20 richard Fixed section numbering Revision 1.4 2005/06/03 19:14:43 richard This is the tested and working version as of June 3. It needs to be sha out more thoroughly, but it was running on Esonde yesterday.