INTRODUCTION TO DESIGN AUTOMATION

Lecture 2. The Operating Systems (Cygwin, etc.)

Prof. Guoyong Shi [email protected] Dept of Micro/Nano-electronics Shanghai Jiao Tong University Spring 2014

* Lecture borrowed from my undergraduate course

2015-09-24 Slide 1 Outline

• CYGWIN - A Linux emulator on Windows • Cygwin installation, etc. • Linux virtual machine

* Linus Torvalds (born in Helsinki, Finland, in 1969) first released the Linux OS kernel on October 5, 1991.

2015-09-24 Lecture 2 slide 2 CYGWIN –

• GNU + Cygnus + Windows = CYGWIN

• What is Cygwin? . Cygwin is a Linus-like environment for Windows.

• Where to get Cygwin? . http://www.cygwin.com/

. Cygwin follows GNU General Public License (GPL), because Cygwin is free software.

2015-09-24 Lecture 2 slide 3 How to Install Cygwin

• Click “Install Cygwin now” icon on the Cygwin homepage. • Download Cygwin binaries to a Windows directory of your selection. • Follow the instructions for installation. • Choose to “install all” packages (by default).

• Install Cygwin at :\cygwin . Cygwin package is now very big ( > 2GB) • The latest release is Cygwin 1.7.7 (with qt4) or higher

2015-09-24 Lecture 2 slide 4 Use Cygwin

• Cygwin is a complete /Linux system . but runs on the Windows OS. • So, learning some Linux basics is equivalent to learning Cygwin . Command line commands . Environment setup . Shell scripts • Most important things: 1. Set up a basic OS environment (consult TA) 2. Install a text editor: vi (or gvim) 3. Cygwin includes “vi”.

2015-09-24 Lecture 2 slide 5 Use Cygwin

• After successful installation, you’ll see the Cygwin icon on you desktop. • Double click the icon, you see a black window pops up.

This window is more or less a Linux window. You may type in virtually all Linux commands.

You may also choose to install a Linux virtual machine.

2015-09-24 Lecture 2 slide 6 To access files

• Use the “mount” command to mount your Windows file system to Cygwin. • To mount your C: disk . mount c: /c/ • After that, you may assess a file at C:\mydir\myfile.txt by typing . cd /c/mydir/ . ls (listing all files there) . vi myfile.txt (use vi to edit the file)

2015-09-24 Lecture 2 slide 7 Edit a text file

• Cygwin has a home dir (depending on machine) . cd ( just type cd at any dir ) . pwd ( show the current path ) • You’ll see “/home/[computer_name]” • Type . ls –a ( -a means “to list all” ) • You should see a file named “.bashrc” among others. . If not, ask TA to create one. • “.bashrc” is a shell file where you can define some environment variables. Type . vi .bashrc ( to read this text file )

2015-09-24 Lecture 2 slide 8 Text Editor “vi” (or “gvim”)

• “vi” is a popular text editor developed for UNIX originally. • “vi” is an application program in Cygwin. • “gvim” is the Windows version of “vi” (free software).

2015-09-24 Lecture 2 slide 9 Modify .bashrc

• At the end of the file “.bashrc” • Add: . alias vi=‘/c/ “Program Files”//vim70/gvim’ . ( suppose you installed gvim there ) . export PATH=“.:$PATH” . ( then you can execute a program directly at a directory anywhere ) . export DISPLAY=“localhost:0” . ( needed for running GUI applications with X-windows ) • Save “.bashrc”. Then $ source .bashrc • Or restart a Cygwin window. • Learn more on online ...

2015-09-24 Lecture 2 slide 10 X-Server

• X-window server included with the Cygwin installation.

• Double click the icon to start the X- window server. . X-Server is needed for displaying popup windows in your program if you have GUI by Qt4 or GTK.

2015-09-24 Lecture 2 slide 11 Installations

• Download and install Cygwin and start playing around.

• Or, install a Linux virtual machine and familiarize yourself with the Linux OS.

• Install a text editor or an IDE tool for coding in the future.

2015-09-24 Lecture 2 slide 12