Raspberry Pi Projects For Dummies. Evans Jonathan
Чтение книги онлайн.
Читать онлайн книгу Raspberry Pi Projects For Dummies - Evans Jonathan страница 5
Flashing Your SD Card
Your operating system is made up of a bunch of files that are run from the SD card itself. However, when you write the operating system’s files to the SD card, they’re written in a special format that Linux can read. You can’t just copy them over as you would with other kinds of files. The Linux distribution you downloaded is in a special format called a disk image. And you flash the disk image to the SD card using a special little program. The program you need depends on whether you’re using Windows, Mac, or Linux.
Flashing an SD card in Windows
To create the image file in Windows, you use a special program called Image Writer for Windows. It’s free and pretty easy to use. Just follow these steps:
1. Insert your SD card into your computer’s SD card slot or, if you don’t have one, into your SD card reader.
Take note of which drive letter is assigned to your SD card.
2. Download the files at www.sourceforge.net/projects/win32diskimager/files/latest/download.
3. Double-click the file to extract it, click Extract All Files to unzip the archive into a folder, and then open the folder.
Note: If the filename of the file you downloaded ends with .exe, when you double-click the file, an installation wizard may run.
You should see the list of extracted files. Make sure that you aren’t looking at the zipped files.
4. Click the file Win32DiskImager.exe to open it.
5. Click the folder icon to the right of the long white box and navigate to the Linux .img file you just unzipped; double-click to select it.
This will put the file path into the long white box for you.
6. From the Device menu, select the drive letter that your SD card has been assigned.
7. After you’ve double-checked that you’ve selected the right drive, click the Write button to create the image file on your SD card.
Flashing an SD card on a Mac
On a Mac, you can use a simple script called RasPiWrite to do the work of flashing your image file to your SD card. First, you create a folder that RasPiWrite can use while it’s flashing your SD card. Then you use the script to create your image file. You do some of this by typing commands on the command line, using the Terminal program, which is found in your Applications/Utilities folder.
1. In your Documents folder, create a folder called SD Card Prep; in the SD Card Prep folder, create a folder called RasPiWrite.
2. Go to https://github.com/exaviorn/RasPiWrite to download the zip file of RasPiWrite.
3. Double-click the file you downloaded and open the resulting folder.
4. Drag the files in this folder to the RasPiWrite folder you created in Step 1.
5. Drag the zip file of your Linux distribution into your RasPiWrite folder.
6. Open the Terminal application, located in Applications/Utilities, and type cd and then a space.
7. Use the Finder to locate the SD Card Prep folder you created in Step 1; make sure you can see both the Finder window and the Terminal window, and then drag the RasPiWrite folder into the Terminal window.
This places that path name of that folder into the command line for you. (It’s easier than typing it all out.)
8. Press Return.
This switches you to the folder containing RasPiWrite.
9. Type ls and press Return.
The list command produces a list of files in the RasPiWrite folder. You use it later to tell RasPiWrite where to get the source files for your disk image.
1. Remove any external memory cards, USB sticks, or other pluggable storage device from your system so that you don’t accidentally erase them.
2. Type sudo python raspiwrite.py to run RasPiWrite.
3. Enter your system password.
You see a progress report as your script creates the disk image. If all goes well, you should see a raspberry made of text characters.
1. Insert your SD card into your Mac’s SD card slot or to an external SD card writer and press Return.
2. Follow the prompts to select the disk that corresponds to your SD card.
1. You’ll be asked if you want to download a distribution; because you already did that, type N.
The program asks you to locate the disk image file.
1. Scroll back up to where you used the ls command and copy the filename of the distribution; then scroll back down and paste this filename at the prompt and press Return.
The program extracts the image file and prepares it to upload onto your SD card. It then asks you to confirm that you’re about to erase your SD card. Be sure you’ve got the right SD card.
1. Type accept to