# PSP Programming/CYGWIN
## The PlayStation Portable Library
#### CYGWIN

This wikibook assumes that you run a UNIX-like operating system. If your computer runs Windows, you will need to use Cygwin.
CygWin is essentially a UNIX Like Operating Environment. That is, CygWin is a Linux Emulator for windows boxes. CygWin loads a Linux environment into memory on your Windows PC. This allows you to run Native Linux Applications on a windows box. At first, this whole CygWin thing sounds very intimidating. However, setting up and using CygWin is a very simple process.
Here is what is necessary for installing CYGWIN on your windows box:
* Download the install file from the CygWin website.
** After CygWin has finished downloading, open up the executable by double clicking on it with your left mouse button.
** A splash screen greets you.
*** Click next.
** You are presented with a prompt which asks what you want to do.
*** Select the default option of Install from Internet
** Select the next button
*** You are prompted to specify where on your Hard Disk Drive you want to install the CygWin Operating System Environment.
*** If it is not specified as such, change the install directory to "C:\cygwin"
**** Here, C: is the letter that designates your Local Hard Disk Drive
**** Leave the other options set to their Default Values
** Select the next button
** Next, you are prompted to specify where to save the installation files
*** Specify a location on your Hard Disk Drive where you can find them in the future
*** You will probably want to delete them after the installation process is completed
*** Select the Next button
** The next screen will prompt you to specify your network settings
*** If you do not use a proxy, just click next on this screen
**** If you encounter problems at this point, try letting the installer use use Internet Explorer's settings
***** Provided that no problems are encountered, you will be presented with a list of servers from which to download the installation files for CygWin
**** Select a download site and then select the next button
**** The installer will download the package list necessary for setting up CygWin
**** Once the download is completed, select the view option at the top of the dialogue box to view the available packages that can be installed.
** You will need the following packages:
*** autoconf2.59 (or greater)
*** automake1.9
*** bash
*** bison
*** coreutils
*** diff
*** diffutils
*** flex
*** gcc
*** gcc-core
*** gcc-g++
*** grep
*** gzip
*** make
*** patch
*** patchutils
*** subversion
*** tar
*** wget
** Select the packages by clicking where it says skip
*** Skip should change to a version number for the latest package that is available.
**** Do not worry if other packages are selected
***** Packages that are required by CygWin and by the other packages that you have selected are automatically set to be install
*** When you are finished making the selections of packages, select the next button
** CygWin will now begin to download and install the selected packages
*** This download and install process will usually take a very long time to complete
** After the install has finished, you will have a UNIX Like Operating System ready to run on your windows box
This completes the procedure necessary for installing the CygWin Operating System Environment. Armed with a UNIX Like emulator on your windows box, you are ready to install the ToolChain. This process is discussed in the next sectionl.

### PSP ToolChain

In this section of Getting Started--The PlayStation Portable Laboratory, I will explain the procedure necessary for installing the PlayStation Portable ToolChain. First, though, let me tell you a little about the ToolChain. You see, Sony Developers use special libraries and header files for creating their PSP Programs, Applications, and Emulators. This collection of libraries and header files are called a ToolChain. The Sony ToolChain is an official product of Sony Corporation, and it is licensed only for use by those who can afford the massively expensive licensing fee. That means that most of us cannot afford to use the official product. Fortunately for us, though, many | HACKERS have done what they do best and created their own version of the PSP ToolChain. That is the one that I use, since it is GPL and Open Source compliant FREE Software.
So, how do we install the GPL Open Source compliant FREE PSP ToolChain that these HACKERS have created? The process is actually quite simple. To install the PSP ToolChain, you will want to use your CygWin System. What follows is a short explanation of how to set up the PSP ToolChain in your CygWin Operating System Environment.
First, it is necessary to start up the CYGWIN System. From the Windows START Menu, choose CygWin → CygWin Bash Shell. Otherwise, choose run → "C:/cygwin/cygwin.bat". A Command Line will be provided in a DOS Shell Window. This is the command line from which you will execute most of the commands and programs that you use in CygWin. On the command line, you should see something along the lines of 'yourusername@yourcomputername ~', which identifies the user account that is being used and the computer upon which the CygWin Operating System Environment is currently running.
OK, now that you have started your CygWin Operating System Environment and verified that it is working, it is time to shut it down. Either click the red [X] Box in the upper right hand corner of the DOS Shell Window, or type 'exit' and press the <enter> or <return> key on your computer's keyboard. It might seem somewhat foolish to start and then stop the CygWin Operating System Environment without actually doing anything with it, but it is a necessary step. It verifies that everything has been installed up to this point.
The second step in the PSP ToolChain installation process is to download the latest version of the ToolChain. Use | GOOGLE or | SourceForge or a similar search engine to locate the FREE OpenSource GPL version of the PSP ToolChain. Download it to your computer's HDD.
Once the PSP ToolChain has been downloaded to your machine, you will need to extract the compressed files. Use an extractor such as WinAce or Winrar to extract the file contents of the PSP ToolChain archive. Place the extracted file in the 'C:/cygwin/home/user' Directory. In this case, 'user' is your own username [the user account that you saw when you had the CygWin Operating System Environment open a few moments before. See? I told you that it was a necessary step to start and then stop the CygWin System before you get to this part. Doing so allows you to know where the files need to be put.
In many cases, it is necessary to customize the PSP ToolChain's configuration so that it can work with CygWin. Why? Most of the reverse engineering and ToolChain creation happened in Linux. Since CygWin is not a true Linux Operating System it has a few quirks that must be dealt with. For instance, rather than the gmake parser that was used by the majority of the OpenSource FREE GPL PSP ToolChain Development Croo, the CygWin Operating System Environment uses the 'make' parser when compiling a set of C or C++ programming scripts. To accommodate this, do the following: