Raspberry Pi Projects For Dummies. Evans Jonathan
Чтение книги онлайн.
Читать онлайн книгу Raspberry Pi Projects For Dummies - Evans Jonathan страница 6
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 what we would type on our system:
sudo dd if=mydistribution.img of=/dev/sdc bs=2M
You need to substitute the name of your distribution file where it says mydistribution.img. Substitute the directory where your SD card is located where it says /dev/sdc.
8. Press Enter to start flashing the image file your SD card.
It should take about two or three minutes to do this operation. You won’t see a progress update, but you may see the light next to your SD card slot flickering. When it’s finished, you’ll be advised how much data was copied and how long the operation took to complete. Pat yourself on the back. You’re ready to fire up your Raspberry Pi!
Connecting Your Hardware
When you’ve got the essential accessories and the operating system, you can set up your hardware. This is simply a matter of connecting the right bits together. Figure 1-5 shows you how things are connected using a Raspberry Pi Model B.
Figure 1-5: Hooking up all the hardware.
Follow these steps to set up your hardware:
1. Locate the SD card slot on the bottom of your Raspberry Pi and insert the newly flashed SD card snugly, with the label facing down.
The card will stick out from the side of the circuit board a little bit.
2. Connect your computer monitor or TV to your Raspberry Pi.
If you’re using a monitor or TV with an HDMI connection, just connect the two with an HDMI cable. If your monitor has a DVI connection instead, insert the HDMI cable into an HDMI-to-DVI adapter and then plug it into your monitor. If you’re using a TV without an HDMI connection, connect a yellow RCA connector cable to the round RCA jack on the top of your Raspberry Pi and plug the other end into your TV’s composite video input.
3. Connect your USB hub into one of the two USB sockets on the right side of your Raspberry Pi.
If you’re using a Raspberry Pi Model A, there will be only one socket. Your hub should have a power adapter – plug it into an electrical socket.
4. Plug your keyboard and mouse into the USB hub.
If you’re using a keyboard or a mouse with an older PS/2-style connector, you’ll need a PS/2-to-USB adapter. You can also connect them directly to your Raspberry Pi’s remaining USB socket, but it’s a good idea to use the hub, which has more available power.
5. Connect your audio.
If you’re using an HDMI monitor with audio, the audio will go through your HDMI cable. If you’re using external speakers or a TV, your audio output is the black 3.5mm socket on the top-right edge of your Raspberry Pi. Connect your speaker cable there.
6. Connect to your network.
If you’re using a Model A, you can skip this step. There is no network connection available for it.
If you’re using a Model B, connect an Ethernet cable to your Ethernet socket on the right side of the board. When your operating systems starts up, it will automatically connect