Reader small image

You're reading from  Raspberry Pi for Secret Agents

Product typeBook
Published inApr 2013
PublisherPackt
ISBN-139781849695787
Edition1st Edition
Concepts
Right arrow
Author (1)
Stefan Sjogelid
Stefan Sjogelid
author image
Stefan Sjogelid

Stefan Sjogelid grew up in the 1980s in Sweden, getting hooked on 8-bit consoles, Amigas, and BBSes. With a background in system and network administration, he packed his bags for Southeast Asia and continued to work in IT for many years, before love and a magic 8 ball told him to seek new opportunities in the North American continent. The Raspberry Pi is the latest gadget to grab Stefan's attention, and after much tinkering and learning a great deal about the unique properties of the Pi, he launched the PiLFS website (http://www.intestinate.com/pilfs), which teaches readers how to build their own GNU/Linux distribution and applications that are particularly useful on Raspberry Pi.
Read more about Stefan Sjogelid

Right arrow

Writing Raspbian OS to the SD card


Computers can't do anything useful without an operating system, and the Pi is no exception. There is a growing collection of operating systems available for the Pi, but we'll stick with the "officially recommended" OS—the Raspbian GNU/Linux distribution.

Getting Raspbian

There are two main ways to obtain Raspbian. You can either buy it preinstalled on an SD card from your Raspberry Pi dealer, or download a Raspbian image yourself and write it to an empty SD card on a computer with an SD card slot.

Note

If you do have access to a computer but it lacks an SD card slot, it's a wise choice to invest in an external SD card reader/writer. They don't cost much and chances are you'll want to re-install or try a different operating system on your SD card sooner or later.

To download a Raspbian image, visit the site http://www.raspberrypi.org/downloads. Instead of version numbers, Raspbian uses code names (names of characters from the movie Toy Story) and the latest version at the time of writing is Wheezy. Just click on the link for the ZIP file and wait for your download to start or use the torrent link if you prefer, but we will not cover that in this book.

SD card image writing in Windows

Two things are needed to prepare your SD card—an uncompressed image and an image writer application. Perform the following steps to prepare your SD card:

  1. When your image has finished downloading, you'll need to unzip it, usually by right-clicking on the ZIP file and selecting Extract all or by using an application such as WinZip. Once extracted, you should end up with a disc image file named YYYY-MM-DD-wheezy-raspbian.img.

  2. It is highly recommended that you disconnect any attached USB storage devices for now to minimize the risk of writing the Raspbian image to the wrong place.

  3. Visit http://sourceforge.net/projects/win32diskimager/ and download the latest version of the Win32DiskImager application (win32diskimager-v0.7-binary.zip at the time of writing).

  4. Extract that ZIP file too and run the Win32DiskImager application. On Windows 7/8 you might need to run it as an administrator by right-clicking on the application and selecting Run as administrator.

  5. Select the IMG file you extracted earlier and choose the volume letter of your SD card slot from the Device drop-down menu. It is very important to verify that you have the correct volume of your SD card! Finally, click on Write and wait for the process to finish.

SD card image writing in Mac OS X or Linux

Two things are needed to prepare your SD card – an uncompressed image and an image writer script.

  1. When your image has finished downloading, you'll need to unzip it, usually by double-clicking on the ZIP file or by right-clicking and selecting Extract here. Once extracted, you should end up with a disk image file named YYYY-MM-DD-wheezy-raspbian.img.

  2. It is highly recommended that you disconnect any attached USB storage devices for now, to minimize the risk of writing the Raspbian image to the wrong place.

  3. To help us write the Raspbian image file to the SD card, we will be using a Python script written by Aaron Bockover. Visit http://www.intestinate.com/imagewriter.py to download the script and save it to your Desktop folder.

  4. Open up a Terminal (located in /Applications/Utilities on the Mac).

  5. Now we need to start the imagewriter.py script and tell it where to find the Raspbian IMG file. Adapt the following command to suite the paths of your files:

    sudo python ~/Desktop/imagewriter.py ~/Desktop/YYYY-MM-DD-wheezy-raspbian.img
    

    If you don't know the full path to your script or IMG file, you can just drag-and-drop the files on to the Terminal window and the full path will magically appear.

  6. You might be asked to input your user password so that sudo is allowed to run. The script will ask which device you'd like to write the image to. It will present a list of all the currently attached storage devices. Identify your SD card slot with the help of the device description, and the size that should match your card. Finally, type the number of your device and press the Enter key.

  7. If your SD card is currently mounted, the script will prompt you to unmount it first and you'll get a final warning before the operation starts. Answer y to both questions to continue. The progress meter will tell you when the image has been successfully written to your card. You might notice a new storage volume called Untitled. That's the boot partition of Raspbian. You should right-click on this volume and Eject it to safely remove your SD card.

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Previous PageNext Page
You have been reading a chapter from
Raspberry Pi for Secret Agents
Published in: Apr 2013Publisher: PacktISBN-13: 9781849695787
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Stefan Sjogelid

Stefan Sjogelid grew up in the 1980s in Sweden, getting hooked on 8-bit consoles, Amigas, and BBSes. With a background in system and network administration, he packed his bags for Southeast Asia and continued to work in IT for many years, before love and a magic 8 ball told him to seek new opportunities in the North American continent. The Raspberry Pi is the latest gadget to grab Stefan's attention, and after much tinkering and learning a great deal about the unique properties of the Pi, he launched the PiLFS website (http://www.intestinate.com/pilfs), which teaches readers how to build their own GNU/Linux distribution and applications that are particularly useful on Raspberry Pi.
Read more about Stefan Sjogelid