Return to Home Page
Copyright 2003 Jay Sissom |
Shortwave Radio Educational Kiosk - thinkNIC instructionsHere are the steps to make this software work in a thinkNIC system. I did all the development on a RedHat 7.1 system, then built a CDROM image for use in the thinknic. Hardware RequiredSoftware RequiredThere are many things that need to be done to build this software. Here are all the broad steps. All the details are included below:
Details for each of these steps are below. If you really don't want to go through all these steps, you can download a .iso image file and/or a .tar file from my web site. the .iso file is ready to burn on a CD and the .tar file has all of the files needed to build the .iso file. If you really want to build it yourself, here are the instructions. I'm assuming you aren't a linux novice here. I assume that you've compiled a kernel or other software and that you know your way around unix. If those aren't the case, you might want to get some help. These instructions are extremely long right now and would be 50 times longer if each step were explained in great detail. The detailed instructions are at the bottom of the file. Assembling The HardwareI wanted to make this system into a Kiosk. My friend at Wonderlab tells me that kids are very hard on the exhibits in a children's museum, so everything needs to be industrial strength. We couldn't put a computer, mouse and keyboard out there and expect it to last. My original plan was to use a touch screen. She said that these don't last in a children's museum either and they are very expensive to repair. I have a friend who has an arcade game in his house and I figured that if I could use the buttons in an arcade game, they should last a long time. I found a vendor that sells arcade buttons and another that sells keyboard emulators. The vendor I used for the buttons is Happ Controls. I purchased part number 58-9100-L through 58-9177-L (they have many different colors).The vendor I used for the keyboard encoder is Hagstrom Electronics. I purchased part number KE18. This board connects to the keyboard port of the PC and makes the PC think your pushbuttons are key presses. This allows you to use either 9 normally open pushbuttons or 81 normally open pushbuttons (depending on a jumper setting). I used the 9 button configuration because this software only requires 6 buttons:
The letters I used are in the list above. If you want to change these for some reason, you can change the shrek.h file and recompile the software. The thinkNIC system doesn't have a serial port, so I used a Keyspan USA-19 serial to USB adapter. This plugs into one of the USB connectors on the thinkNIC and connects to the serial connector on the RX-320 radio.
You don't need a mouse attached to the system. I didn't use the sound card on the computer. I connected the audio output of the radio directly to the speaker in the kiosk. Once all the connections are made and the CD is finished, you can put the CD into the system and turn everything on. Detailed Building InstructionsBuild the target KernelI used Linux 2.4.17 for the kernel. The thinkNIC computer has no serial port so I needed to use a USB to serial adapter. Since the 2.4 has good USB support, I used it instead of the 2.2.15 version used by the thinkNic people. Untar the kernel source on your computer place. From now on, ${KERNEL} will mean the root directory of the kernel source code. I made one change to the kernel for this application. By default, the kernel changes the keyboard repeat rate to 30 characters per second. At this rate, the RX-320 radio can't change frequencies fast enough to keep up with a button held down. I needed to slow the key repeat rate down. There is a utility that comes with some linux distributions that let you modify the repeat rate, but it didn't work for me. I changed the repeat rate in the BIOS to 6 characters per second to slow it down. Unfortunately, the keyboard rate is set in the kernel to automatically set it to the fastest possible. I had to comment out that section of code to make this work. I'm sure there is a much easier way to make this work, but this change worked for me. Modify the file ${KERNEL}/arch/i386/boot/setup.S Change the lines that say:
# Set the keyboard repeat rate to the max
movw $0x0305, %ax
xorw %bx, %bx
int $0x16
to # Set the keyboard repeat rate to the max # movw $0x0305, %ax # xorw %bx, %bx # int $0x16 There should be a file called kernel.config in the thinknic folder in this software distribution. Copy this file to the root directory of the 2.4.17 kernel source code and rename it to .config. You should then be able to type make bzImage to build a kernel image. This does not require any modules. This will build the file ${KERNEL}/arch/i386/boot/bzImage Build the Shrek softwareGrab the tar file from the web site and untar the software. If you have the GTK+ and tiff libraries installed properly, you should be able to type: make and the software will build the executable named shrek. If this doesn't build, make sure GTK+ and the tiff library is installed correctly. As far as I know the code is ANSI compliant and does nothing weird so it should compile just about anywhere. If this step doesn't work and you don't know why, it's time to ask someone for help! From now on, the directory that contains the Shrek software will be called ${SHREK}. Build the Boot ImageWhen you make a bootable CDROM, you need to provide a boot image. This image looks like a floppy to the system. In fact, it must be the exact size of a floppy or you won't be able to build the CD image. I used grub as the booting software because I was most familiar with it. Lilo and others would work also. This will show how to use grub. Untar and build the grub software. You do NOT need to run make install on this software. Doing so would install it on your development machine and could make your computer not boot correctly! We'll call the grub software directory ${GRUB} from now on. I used a blank floppy to build the image. I'm sure there is a way to do this without needing a floppy, but I'm just documenting what I did. You could build a file and use loopback devices for this, but I'm not going to document that. Put your floppy in your floppy drive of your development system, then format it: fdformat /dev/fd0H1440 (assuming it's a 1.44mb floppy) Build a e2fs file system on the floppy: mke2fs /dev/fd0 Mount the floppy: mount /dev/fd0 /mnt Make the directories and files needed on the floppy: mkdir -p /mnt/boot/grub Copy the grub software to the floppy: cp ${GRUB}/stage1/stage1 /mnt/boot/grub Make a text file named /mnt/boot/grub/menu.lst using your favorite text editor. The contents should have the following 5 lines: default 0 timeout 2 title boot root (fd0) kernel (fd0)/boot/bzImage root=/dev/hda These are command for grub to tell it how to boot linux. Copy your kernel to the floppy: cp ${KERNEL}/arch/i386/boot/bzImage /mnt/boot Unmount your floppy umount /dev/fd0 We now need to configure grub so it will boot when the floppy is used to boot the system. Run the grub program: ${GRUB}/grub/grub This should give you a grub prompt. Type these two commands at that prompt: install (fd0)/boot/grub/stage1 (fd0) (fd0)/boot/grub/stage2 At this point, the floppy disk is finished, now we need to put the floppy image into a file. Leave the floppy in your drive for now, we'll need to copy the image into our CD in the next step. Build the CD imageI used version 2.0 of the NIC OS software as a starting point for my software. Copy the contents of the CD to your hardrive. If you don't have this CD, you can download a CD image from http://www.thinknic.com/ The website for this program has a CD image and a tar file of this image that you can use if you don't want to modify everything yourself. I would highly recommend you get these images, but if you really want to do it yourself, you can. From this point on, the folder ${CD} is the root directory of the files for your target CD. There is lots of software on the NIC CD that is unneeded for the Shrek application. Here is a list of subdirectories you can remove:
${CD}/ifilm
${CD}/lib/modules
${CD}/usr/local/ICAClient
${CD}/usr/local/RealPlayer8
${CD}/usr/local/games
${CD}/usr/local/jre118
${CD}/usr/local/netscape
${CD}/usr/local/tik
${CD}/usr/local/zlite
${CD}/usr/lib/ICAClient
${CD}/usr/lib/RealPlayer7
I'm sure there are lots of others, but I didn't spend tons of time looking at each file. Copy your new kernel image from ${KERNEL}/arch/i386/boot/bzImage into ${CD}/boot. Copy your boot image using this command: cp /dev/fd0 ${CD}/boot/boot.img.hda This will create a file that is 1,474,560 bytes long (assuming you have a 1.44MB floppy). When the original NIC software boots, it uses a RAM disk for the /dev directory. I'm not doing that, so we need to create all the device files for the CD image. The easiest way to do this, is to copy them from your /dev directory on your development system. You'll need to be root to do this. Use this command: cp -a /dev/* ${CD}/dev Make sure that /dev/ttyUSB0 is there. If not, create it using this command: mknod ${CD}/dev/ttyUSB0 c 188 0 This device is used by the software to talk to the USB-to-serial adapter. The shrek software runs as user ID 100 on the thinkNIC. Make sure this user owns the above device file by running these commands: chown 100 ${CD}/dev/ttyUSB0 Modify the ${CD}/etc/inittab file. The line that says: 1:4:respawn:/usr/bin/boa -d -c /etc/boa > /dev/null 2>&1 should be commented out by placing a # at the beginning of the line. The ${CD}/etc/X11/xinit/xinitrc and ${CD}/etc/rc.d/rc.sysinit files need lots of changes. The thinknic directory in this software distribution has new versions of these two files. Copy the new versions over the existing ones. Now we can finally copy the shrek software into the CD image. Make a directory for the software: mkdir ${CD}/usr/local/shrek Copy the executable into this folder: cd ${SHREK}/shrek ${CD}/usr/local/shrek Copy the image that you will be using into this folder. Make sure the filename is the same as the one in the shrek.h file. I would also appreciate if you would copy the entire source code tar.gz file into this folder. If someone finds your CD in the future, they will have all the source code to the application. Build the ISO CD imageTo build the CD image, use the following command.
cd ${SHREK} (there is a period at the end of the command) The file boot/boot.cat does not exist. That's OK. This will create the file /tmp/cd.iso which is a CD image containing the software.Burn the CDI burn my CD's using Roxio's CD software for Windows because I have Windows on the machine that has the CD burner. I don't know the command to burn the CD on linux. If someone gives me the proper command, I can put it in these instructions. Somehow you need to burn the .ISO file to a CD. Remember, this is an ISO9660 image file. You don't just put this single file on the CD, you have to tell your software you have the entire CD image to burn. |