# Tinyos Cygwin (Windows) Installation # # CVS TinyOS 1.1.x installation as user 'anonymous' # With tips for installing as a user from the EECS domain # Installs in: C:\tinyos # Assumes no previous cygwin installation # # Works with supplemental files in tinyos-1.x_extra_files.zip tinyos-1.x_extra_files.zip includes: ------------------------------------ .bashrc .inputrc env_tinyos-1.x.sh .Xdefaults cygwin-rxvt.bat tinyos_permission_change.sh copy_commapi.sh javacomm20-win32.zip cygwinp_union_init.diff dot_emacs emacs.lnk nesc.el matlab.el nc.vim classpath.txt windows_startup.m windows_defineTOSEnvironment.m --- INSTALLATION INSTRUCTIONS --- I. Get the tinyos-1.1.0 InstallShield Installation for Windows. This will install all the basic tools that work with tinyos. We can then install the CVS tree afterwards. - Download tinyos-1.1.0-1is.exe from www.tinyos.net - Run setup.exe and follow the instructions. * Setup Type: ~ Destination Folder: C:\tinyos\ (default) ~ Custom Installation * Select Features: ~ Uncheck tinyos and TinyOS Optional Packages (we will get them from the CVS tree later) - If you have Symantec Client Firewall: When it prompts you with security alerts below, select "always allow connections ..." This is NOT the default selection * uname.exe * rpmd.exe * bash.exe * hostname.exe * rpm.exe (there might be later complaints throughout the installation process as well, such as for emacs, cvs,... just allow all connections) - If you are using a domain NT account (as opposed to a local NT account), You may find that many of the install logs are dumped into your home directory on a remote drive. You might want to move them to a new directory, like /cygdrive/c/tinyos/install_logs . II. Setting Up your Cygwin Environment (and Matlab) - If you use emacs, follow "Emacs in Cygwin" below before proceeding (so you can edit files less painfully) - If you are a network user and not a local user to the machine (ex. you logged into the machine from domain EECS) perform the steps in "Adding EECS/phoebusc to Cygwin" below before proceeding - If you are not a network user you can use in Cygwin mkpasswd -l -u username >> /etc/passwd to create your login account, if it is not already automatically set up for you. - Install Matlab (see "Setting Up Matlab to operate with Cygwin" for more details... the environment variable edits may be done in env_tinyos-1.x.sh later) III. Get the CVS tree of tinyos (and set some configurations) - Start Up a new Cygwin Window cd / mkdir opt cd opt - Download the tree from CVS: cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/tinyos login * When prompted for a password, just press * Ignore the warning about failing to open .cvspass cvs -z3 -d:pserver:anonymous@cvs.sf.net:/cvsroot/tinyos co tinyos-1.x - setting up TINYOS environment variables Two options (assuming you use the BASH shell): 1) copy "env_tinyos-1.x.sh" to your home directory * edit the environment variable as appropriate for your java installation ~ particularly, MATLAB_HOME, TOS_HOME, JAVA_HOME, CYG_HOME * you may need to comment out export PROGRAMMER_EXTRA_FLAGS="-dlpt=3" if you are not on an IBM thinkpad. * add the line 'source env_tinyos-1.x.sh' to your .bashrc file 2) copy the tinyos-1.x/tools/scripts/tinyos.sh.in to /etc/profile.d/tinyos.sh, and edit it to contain the correct value for TOSROOT (this assumes your setup runs the scripts in /etc/profile.d, if not, place the contents of tinyos.sh in your shell startup scripts) * If you use tcsh or some other shell, you will have to edit the scripts to use the syntax of other shell scripts. - From here on, work in new shells to get your new environment. - See 'Getting java commapi' to see if the tools for java to communicate with ports on the computer have been installed by the InstallShield installation (should be yes). - If the tinyos-1.x tree has new tools, you can compile and install them by doing: cd $TOSROOT make make install # (as root on Linux) * If it fails, you may need to edit 'cygwinp.C' in /tinyos-1.x/tools/src/uisp/src/cygwinp.C to compile. (see 'cygwinp_union_init.diff') - Compile the java code: cd $TOSROOT/tinyos-1.x/tools/java make - The first time you run any sort of java communication application, it will likely complain and create a platforms.properties file. You may want to dump this in the directory of TOSROOT, as the script env_tinyos-1.x will set TOS_PLATFORMS to point to TOSROOT/platforms/properties. IV. Complete setup of any optional features... see 'SETUP/CONFIGURATION' for some ideas. - If you are setting up the computer for multiple users by following "Setting Up Group Access", make sure you perform this step last. It involves a script that changes the file permissions on files, and you would probably like it to apply to all files under cygwin. V. You're done! Look under tinyos-1.x/docs to get started. --- SETUP/CONFIGURATIONS --- Sample Environment Configurations ********************************* Try dumping the sample .bashrc and .inputrc in your home directory Getting java commapi ******************** JAVA_HOME is defined in env_tinyos-1.x.sh - check if commapi in java is missing Open up commapi.sh to see where comm.jar would be copied, and check to see if it is there - If commapi is missing 1) unzip javacomm20-win32.zip into JAVA_HOME/commapi 2) run copy_commapi.sh (depends on JAVA_HOME environment variable) EMACS in Cygwin *************** To enable emacs to exit properly in cygwin, edit the cygwin.bat file used to launch cygwin. Add: SET CYGWIN=tty #put this before bash --login -i Adding EECS/phoebusc to Cygwin (phoebusc is a sample user login name) ****************************** Start Cygwin and type: cp /etc/passwd /etc/passwd.bak mkpasswd -d -u phoebusc >> /etc/passwd - If you wish to have your login directory in the main cygwin directory, go edit /etc/passwd after the changes above so that your default directory is no longer on Coeus (a network server). * edit the line to look like phoebusc:unused_by_nt/2000/xp: .*stuff*. :/home/phoebusc:/bin/bash * see /etc/profile, the first script run by bash, for more details Setting Up Group Access *********************** The steps below will alow you to more easily create files that are group writeable, which is important if you plan to have multiple users. WARNING: if you choose to make files group writeable, make sure the users know to back up their files. Otherwise, if one user types 'rm -rf' in the root directory, everyone's work will be lost. - Decide on a group that all TinyOS developers will belong to (ex. 'NEST') * If this is a local group, create it through the "Control Panel" under "Administrative Tools -> Computer Management" under "Local Users and Groups". Then, add all users to this group. * If this is a domain group, this should be done by the network administrator already, so proceed. - Restart Cygwin (after 'Adding EECS/phoebusc to Cygwin') and type: cp /etc/passwd /etc/passwd.bak * If domain group mkgroup -d >> /etc/group * If local group mkgroup -l >> /etc/group * OPTIONAL: You are free to clean up the /etc/group file and remove all entries added by mkgroup that are irrelevant to you - Change your login group in /etc/passwd to the TinyOS group agreed upon Alter the number denoted by *CHANGE_THIS_NUMBER* below: phoebusc:unused_by_nt/2000/xp:13712:*CHANGE_THIS_NUMBER*:phoebusc,... look in /etc/group to see the corresponding number for a particular group (or alternatively, type 'id' at the command line to see the numbers for groups that you belong to). For example: mkgroup_1_d:*stuff*:GROUP_NUMBER: * It's not clear what type of NT access restriction consequences arise if you do not change your NT SID string to match that of your default group. I have not encountered any yet. The NT SID string is something of the form S-1-5-21-73586283-725345543-1801674531-36297 * For more information about /etc/passwd, look at: http://cygwin.com/cygwin-ug-net/ntsec.html#NTSEC-RELEASE1.1 if this page has been moved, look for the keywords: cygwin, ntsec, SID - You may wish to set your umask in your startup scripts like .bashrc later to make sure files created are group writeable. ex. umask u+rwx,g+rwx,o+rx - Now you must change the permissions on the directories so other users can execute commands * Open tinyos_permission_change.sh to make sure that TOSGROUP is set properly in the file (also TOSROOT, but that should be okay). * run tinyos_permission_change.sh (this takes a long time... maybe 50 minutes, and it doesn't give any feedback on its progress. Go have a coffee break.) Setting Up Matlab to operate with Cygwin **************************************** - Install Matlab - If Matlab is locally installed, this is simple: put the path to the matlab executable in your cygwin PATH variable - If Matlab requires a license server, then you must: 1) Mount the remote server as a network drive 2) add the path to the matlab executiable to your cygwin PATH variable - There are more steps to setup Matlab to operate with TinyOS (see below) Example assuming you are using the EECS license install of Matlab 6.5: 1) Go to "My Computer" and access the "Add or Remove Programs" option and select the Matlab6.5 install (this should be very quick, as very little software physically needs to be installed on your computer) 2) In the "My Computer" Window, select "Tools->Map Network Drive" from the Menu Bar. Select a drive, say Z:, and select the folder \\Winsww\sww\public (or you can browse for it under Microsoft Windows Network->Eecs->Winsww->sww->public). Click "Finish" to map the drive. 3) Check in cygwin that /cygdrive/z exists. Matlab should be located at 'matlab/matlab-6.5/bin/win32/matlab.exe' on the Z: drive. Add it to your PATH variable. ex. export MATLAB_HOME='/cygdrive/z/matlab/matlab-6.5' export PATH="$PATH:$MATLAB_HOME/bin/win32" (this is done in env_tinyos-1.x.sh) Setup Matlab and TinyOS interoperability **************************************** This setup assumes you ALWAYS start matlab from the ~/matlab directory at a cygwin prompt. Instructions for License Server version of MATLAB: - copy windows_startup.m to ~/matlab/startup.m - copy windows_defineTOSEnvironment.m to tinyos-1.x/tools/matlab/defineTOSEnvironment.m - edit startup.m and defineTOSEnvironment to point to your tinyos-1.x/tos directory. Change the line [flag, TOSDIR] = system('ncc -print-tosdir'); to the equivalent of flag = 0; TOSDIR = 'c:/tinyos/cygwin/opt/tinyos-1.x/tos/'; - comment out the line in startup.m calling ucbRobo_startup unless you plan to use the ucbRobo package. * NOTE: windows_startup.m has been modified to accomodate ucbRobo stuff. There are some additional changes to ucbRobo_startup.m if you wish to use the ucbRobo package... see the README.matlab file in tinyos-1.x/contrib/ucbRobo/tools/matlab for more details. - Compile the MATLAB java tools You use env_tinyos-1.x.sh, which sets up the environment correctly: cd tinyos-1.x/tools/java/net/tinyos/matlab make matlab You use tinyos.sh in /etc/profile.d cd tinyos-1.x/tools/java/net/tinyos/matlab make # to see instructions for what to change Instructions for Local copy of MATLAB (untested): - Add tinyos-1.x/tools/matlab/startup.m to your MATLAB path - copy windows_startup.m to tinyos-1.x/tools/matlab/startup.m - copy windows_defineTOSEnvironment.m to tinyos-1.x/tools/matlab/defineTOSEnvironment.m - edit startup.m and defineTOSEnvironment to point to your tinyos-1.x/tos directory. Change the line [flag, TOSDIR] = system('ncc -print-tosdir'); to the equivalent of flag = 0; TOSDIR = 'c:/tinyos/cygwin/opt/tinyos-1.x/tos/'; - comment out the line in startup.m calling ucbRobo_startup unless you plan to use the ucbRobo package. * NOTE: windows_startup.m has been modified to accomodate ucbRobo stuff. There are some additional changes to ucbRobo_startup.m if you wish to use the ucbRobo package... see the README.matlab file in tinyos-1.x/contrib/ucbRobo/tools/matlab for more details. - Compile the MATLAB java tools You use env_tinyos-1.x.sh, which sets up the environment correctly: cd tinyos-1.x/tools/java/net/tinyos/matlab make matlab You use tinyos.sh in /etc/profile.d cd tinyos-1.x/tools/java/net/tinyos/matlab make # to see instructions for what to change Set up RXVT (terminal window) ***************************** Benefit: a terminal window that allows you to page up with 'Shift-PgUp'; Copying to other programs is simply higlighting and clicking with the middle mouse button (unfortunately, highlighting multiple screens requires you to use the 'Shift-PgUp'command in conjunction with holding the mouse button down) - Drop the sample .Xdefaults file in your home directory - Use the cygwin-rxvt.bat file to startup cygwin (instead of the usual cygwin.bat file). You can dump it in the same directory as cygwin.bat (ex. c:/tinyos/cygwin) Setting Up Emacs with NesC and Matlab font highlighting ******************************************************* - If you wish to use Emacs from Windows (separate from Cygwin), you will need to install it either from www.gnu.org, compiled for the Windows (see http://ftp.gnu.org/pub/gnu/windows/emacs) or get it from a software repository on your network, if available (ex. //winsww/sww/public). * benefit of starting emacs from within cygwin: recognizes environment variables and some other cygwin tools * benefit of starting emacs directly from windows: can have separate windows from terminal, can drag and drop files into an open emacs window - Dump the matlab.el and nesc.el files into the TOS_HOME/config directory - You will need to edit .emacs in cygwin, and _emacs if starting emacs from Windows (both are exactly the same... windows does not recognize files starting with . as the first character). We refer to dot_emacs below for both. - Edit your dot_emacs file to have font highlighting * copy the sample dot_emacs file (to .emacs or _emacs, accordingly) and change the path in the function (prepend-path ) to the path to TOS_HOME/config * see the sections 'loads font highlighting for nesc' and 'loads font highlighting for matlab' and 'adding user_config to file path' in the sample dot_emacs file for details. No modifications should be necessary. - Use emacs.lnk to start up emacs from Windows * Edit the link (right click, and select "Properties") so that it finds the emacs executable from the correct directory and loads _emacs from the correct directory - Dump the .emacs file into your home directory to affect the emacs that is started from Cygwin