Raspberry Pi Projects For Dummies. Evans Jonathan

Читать онлайн.
Название Raspberry Pi Projects For Dummies
Автор произведения Evans Jonathan
Жанр Зарубежная образовательная литература
Серия
Издательство Зарубежная образовательная литература
Год выпуска 0
isbn 9781118766712



Скачать книгу

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.

      warning Be absolutely sure you’ve got the correct drive selected – the one that contains your SD card. Whatever drive you’ve chosen in the device menu will be completely erased!

      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.

      tip You need your system password to be able to flash the SD card. Just follow these steps:

      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.

      warning You can double-check to make sure you’ve selected the correct one by ensuring that the disk’s size (listed in the size column) corresponds to the size of your SD card. You don’t want to erase all the data on your main hard drive!

      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 continue installing the image, and press Return.

      The flash process can take a long time. You’ll see some dots on your screen as the process continues. Depending on your system, it can take 30 minutes or even up to an hour. You can use your computer for other things during this process, but if you lose power or restart, you’ll have to start all over again.

      tip If you’re presented with a message immediately after typing accept, there’s a problem. Even though the message may say Transfer Complete, the immediate response means that the transfer hasn’t been accomplished. This sometimes happens if the image file isn’t located where you indicated it was or if the distribution contains just an image file rather than an image file within a folder of the same name. If it happens, create a folder with the same name as the image file, drag the image file into it, and try again.

       Flashing an SD card in Linux

      If you’re using Linux, the process of flashing an SD card for your Raspberry Pi is pretty straightforward. We assume you’re using Ubuntu, one of the most popular Linux distributions. If you’re using another distribution, the following steps will be very similar.

      When you download the Raspbian Wheezy distribution, make sure you save it where you can find it, such as in the Documents directory. Then follow these steps to flash your SD card:

      1. Remove any external drives, USB keys, or other SD cards from your system and insert the SD card you would like to flash for your Raspberry Pi.

      2. Open a Terminal window.

      This is located in the Applications menu under Accessories.

      3. Type sudo fdisk –l (the last character of this command is the letter l, not the number 1).

      This starts the fixed disk program, a tool you can use to manage, erase, and separate disk drives into different logical partitions. It also shows you which drives are available on your system.

      4. Locate your SD card in the device list.

      The list gives details about each of the drives on your system, including the size of each device in bytes and other details such as the number of heads, sectors, cylinders, and so on. Find the device that most closely matches the size of your SD card in bytes. For example, an 8GB SD card will be listed as about 8,068MB. Take note of the name of that disk’s directory. For example, on our system, the SD card is located in the directory: /dev/sdg.

      5. Use the cd command (“change directory”) to navigate to the directory where you saved your Raspbian Wheezy distribution.

      For example, if it’s in the Documents directory, type cd Documents and press Enter.

      6. Display the name of your Raspbian Wheezy image file by typing ls *.img.

      7. To write the Raspbian Wheezy image to the SD card, use the dd command.

      Here’s