Raspberry Pi runs Linux in a small package.

Raspberry Pi — Hardware and Background

Raspberry Pi Background

The Raspberry Pi is a small single-board computer. It runs a variety of operating systems, most prominently several Linux distributions and Linux-derived systems including Android, Firefox OS and Google Chrome OS, as well as RISC OS, FreeBSD, NetBSD, Plan 9, Haiku and AROS. It costs just US$ 35 and is capable of a great deal for such a small package.

Raspberry Pi small Linux system.

It was developed by a charitable organization in the UK, supported by the University of Cambridge Computer Laboratory and Broadcom. The Raspberry Pi was initially intended for teaching basic computer science in schools. Eben Upton, a co-founder of the project, explained the need for the project in 2012:

"[T]he lack of programmable hardware for children — the sort of hardware we used to have in the 1980s — is undermining the supply of eighteen-year-olds who know how to program, so that's a problem for universities, and then it's undermining the supply of 21 year olds who know how to program, and that's causing problems for industry."

The Raspberry Pi is manufactured and sold online by Newark element14 in the US, RS Components in the UK, and Egoman in Taiwan. Egoman's version with a red circuit board without the FCC/CE marks is distributed solely in China and Taiwan.

The Raspberry Pi 1 has a single-core ARM1176JZF-S processor, the Raspberry Pi 2 has a 900 MHz quad-core ARM Cortex-A7.

Feature Model
A B B+ 2 B
CPU 700 MHz single-core 700 MHz single-core 700 MHz single-core 900 MHz quad-core
USB 2.0 ports 1 2 4 4
10/100 Mbps
Ethernet ports
0 1 1 1
RAM 256 MB 256 MB 512 MB 1024 MB
Storage SD/MMC/SDIO SD/MMC/SDIO MicroSD MicroSD
Power @5V DC 1.5 W
300 mA
3.5 W
700 mA
3.0 W
600 mA
4.0 W
800 mA

Hardware

A Model B is shown above. The available models and their differences are:

Board

The Raspberry Pi board measures 86 × 54 mm, just a little too large for an Altoids Tin, and it is powered by a smart phone charger supplying 5 V DC at up to 700 mA.

The system is based around the Broadcom BCM2835 system on a chip (or SoC), which was designed as a cost-optimized, full-HD, multimedia applications processor for mobile and embedded applications. This includes a low-power ARM1176JZ-F processor running at 700 MHz and a dual-core OpenGL-ES VideoCore IV GPU or multimedia co-processor.

Interfaces

The multimedia capability means that this small system supports 1080p30 full HD output over an HDMI connector. Other connectors provide:

  • USB 2.0 ports
  • Composite video (PAL and NTSC) output through an RCA connector
  • Audio output through a 3.5 mm jack
  • 10/100 Mbps Ethernet
  • A number of low-level peripherals are also available, including eight GPIO lines, a UART, an I2C bus, and SPI bus, and I2S audio.

CPU

The processor is an ARM RISC-based processor. It has a 700 MHz ARM1176JZF-S core. Confusingly, the ARM11 family is ARMv6, which is rather old. The current versions were ARMv7 and ARMv8 when the Raspberry Pi came out.

Let's ask the kernel to examine the CPU.

Raspberry Pi small Linux system.

IC2 is the SoC and RAM. It's the large module (12.5×12.5 mm) in the center of the board, behind the yellow RCA connector. The Samsung SDRAM is stacked on top of the Broadcom BCM2835 SoC.
IC3 is the combined USB and Ethernet controller. It's the chip between the blue audio connector, the USB connector and the Ethernet connector.

pi@raspberrypi ~ $ cat /proc/cpuinfo 
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 464.48
Features        : swp half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000e
Serial          : 000000002469bebb

pi@raspberrypi ~ $ lscpu
Architecture:          armv6l
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1

You can check the kernel and firmware versions with two commands, the second of which must be run as root:

root@raspberrypi: ~ $ uname -a
Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux
root@raspberrypi: ~ $ sudo /opt/vc/bin/vcgencmd version
Sep  1 2013 23:31:02 
Copyright (c) 2012 Broadcom
version 4f9d19896166f46a3255801bc1834561bf092732 (clean) (release)

Would the Raspberry Pi be a good platform for tasks like password cracking, rainbow table construction, or Bitcoin mining?

No, not especially. It can do those things, but it can't do them fast enough for it to make much sense to use this platform for any of those tasks.

I have a simple program that starts with a 20-byte array filled with zeros. That is, a 160 bit array of zeros. That is used as the input to the SHA1() OpenSSL library call. The return value is then used as the input to the next call, repeating this cycle 100,000,000 times. The clock() function is then used to determine the CPU time used by the process, and that time plus the input and output of the last SHA-1 calculation are printed.

On my system with an AMD Phenom II X4 965 processor and a 3400.000 MHz clock system I see the following, where the process runs on just one of the four available cores yielding about 3.66 million hashes per second:

  Loop: 100000000 CPU time: 27.340s
      input = 0xeebc8597eba9eb078de1b13ff6171df8beb52d45
      hash  = 0x529f8309ff191b501fd086425cacb8866955ca9d

My Raspberry Pi can only calculate about 0.221 million hashes per second:

  Loop: 100000000 CPU time 452.160s
      input = 0xeebc8597eba9eb078de1b13ff6171df8beb52d45
      hash  = 0x529f8309ff191b501fd086425cacb8866955ca9d

That's a hash computation speed of just about 6% or 1/16.5 that of the single core of the desktop machine. An array of 17 Raspberry Pis could just barely exceed the speed of a single core on the desktop, but at a cost of:
17 × US$ 35 = US$ 595
The CPU can be overclocked to 1000 MHz, but the result is still much slower than a typical IA32/IA64 CPU. Dell is working on an ARM-based supercomputer, but not in the form of a Raspberry Pi array!

Also compare these hash rates to those of typical Bitcoin mining hardware.

The BogoMIPS estimate found in /proc/cpuinfo seems pretty useful. The desktop reports 6831.31 while the Raspberry Pi reports 464.48. That's a ratio of 1:14.7074 while the SHA-1 timing ratio is 1:16.5384.

Along these same lines, the BOINC client can be installed on the Raspberry Pi. However, it won't accomplish but a tiny fraction of one core on a typical desktop, and few of the BOINC projects have ARM packages to be run.

Raspberry Pi small Linux system, SoC or System on Chip.  Samsung 304 / K4P4G324EB-AGC1 / GKLQ856FU

IC2, the large module in the center of the board, is the SoC and RAM. The Samsung RAM is stacked on top of the Broadcom SoC.

But the Raspberry Pi is still very useful for security related tasks!

Password cracking is very CPU intensive, and rainbow table construction and Bitcoin mining even more so. I only measured its SHA-1 calculation speed because I had seen people asking these questions on line.

A Raspberry Pi does, however, make a very nice platform for tasks like hash harvesting and network intrusion detection! It can also be a nicely compact and portable OpenVAS scanner.

Are any more CPU details easily found?

Not a lot, but the kernel ring buffer can be displayed with the dmesg command:

pi@raspberrypi /proc $ dmesg
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.6.11+ (dc4@dc4-arm-01) \
		(gcc version 4.7.2 20120731 (prerelease) \
		(crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08) ) \
		#371 PREEMPT Thu Feb 7 16:31:35 GMT 2013
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine: BCM2708
  ....

Memory

There is 512 MB of RAM on board, shared with the GPU. You can configure how much is reserved for the GPU with the interactive raspi-config tool, the default is 64 MB. The rest is available for processes and the kernel itself, including its file system I/O buffering.

pi@raspberrypi /proc $ dmesg
     ....
[    0.000000] cma: CMA: reserved 16 MiB at 1b000000
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 114688
[    0.000000] free_area_init_node: node 0, pgdat c053b834, node_mem_map c05e5000
[    0.000000]   Normal zone: 896 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 113792 pages, LIFO batch:31
     ....
[    0.000000] Memory: 448MB = 448MB total
[    0.000000] Memory: 432264k/432264k available, 26488k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xdc800000 - 0xff000000   ( 552 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdc000000   ( 448 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc04e5470   (4982 kB)
[    0.000000]       .init : 0xc04e6000 - 0xc0506f24   ( 132 kB)
[    0.000000]       .data : 0xc0508000 - 0xc053c060   ( 209 kB)
[    0.000000]        .bss : 0xc053c084 - 0xc05e4738   ( 674 kB)
     ....
Top view of Raspberry Pi small Linux system with wired and wireless network connections.

Networking Hardware

We will examine the networking hardware here. See the networking page for the details of configuring the Raspberry Pi for both wired Ethernet and 802.11i, or 802.11 WLAN with WPA2 security.

IC3 is the LAN9512 USB/Ethernet controller on a Raspberry Pi small Linux system.

IC3, located just behind the USB connector, is the SMSC95xx / LAN9512 combined USB and Ethernet controller.

The on-board Ethernet is actually a built-in USB Ethernet interface combined with the USB controller. The Ethernet controller appears as device number 3 on USB. In the following output you will see that I have also plugged in an ASUSTek USB 802.11n interface.

Top view of Raspberry Pi small Linux system.
pi@raspberrypi /proc $ lsusb 
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 0b05:1786 ASUSTek Computer, Inc. USB-N10 802.11n Network

pi@raspberrypi /proc $ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/3p, 480M
        |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
        |__ Port 3: Dev 4, If 0, Class=vend., Driver=r8712u, 480M
pi@raspberrypi /proc $ dmesg
     ....
[    1.364017] usbcore: registered new interface driver smsc95xx
     ....
[    2.382258] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.391783] Indeed it is in host mode hprt0 = 00001101
[    2.602531] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[    2.611427] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.621454] hub 1-1:1.0: USB hub found
[    2.628838] hub 1-1:1.0: 3 ports detected
[    2.912583] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    3.022834] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    3.032317] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.050650] smsc95xx v1.0.4
[    3.127019] smsc95xx 1-1.1:1.0: eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:69:be:bb
[    3.222472] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[    3.355515] usb 1-1.3: New USB device found, idVendor=0b05, idProduct=1786
[    3.372276] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.381759] usb 1-1.3: Product: ASUS EZ N Network Adapter
[    3.406430] usb 1-1.3: Manufacturer: Manufacturer Realtek 
[    3.431282] usb 1-1.3: SerialNumber: 00e04c000001
     ....

The Asus USB-N10 wireless network device is recognized by the r8712u kernel module. If your installed distribution does not include the firmware-realtek package, install it:
# apt-get install firmware-realtek
Firmware is stored in the /lib/firmware directory.

pi@raspberrypi /proc $ dmesg
     ....
[    5.028951] r8712u: module is from the staging directory, the quality is unknown, you have been warned.
[    5.311932] r8712u: Staging version
[    5.572398] r8712u: register rtl8712_netdev_ops to netdev_ops
[    5.580397] r8712u: USB_SPEED_HIGH with 4 endpoints
[    5.892308] r8712u: Boot from EFUSE: Autoload OK
[    6.943016] r8712u: CustomerID = 0x0010
[    6.948984] r8712u: MAC Address from efuse = 08:60:6e:63:7b:80
[    6.956936] r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
[    6.970145] usbcore: registered new interface driver r8712u
     ....
Bottom view of Raspberry Pi small Linux system.

Power, Storage and Operating System

A micro USB cable connected to something like a smart phone charger provides power. You need 5 V DC at around 700 mA or more, get a charger module that can provide a solid 1 A or 1000 mA.

You need a quality SD memory card. Or, much more likely, Micro SD in an SD adapter. You will need a bare minimum of 2 GB of flash storage for the bootable OS, but you will probably want at least 8 GB.

Download the Raspbian OS image, unzip it, and write the resulting *.img file onto the flash card using the dd command on Linux or OS X.

Bottom view of Raspberry Pi small Linux system with wired and wireless network connections.
Raspberry Pi raspy-config screen shot.

At your first boot, df will show that your disk is just 2 GB in size because you're using the 2 GB image. If you are using the Raspian image, you can use the interactive raspi-config tool and select the expand_rootfs option to expand the file system to fill the available space on the device.

You can do this manually using an image without the raspi-config tool. For example, the Fedora-based Pidora.

Here is what we see with a 2 GB Pidora image installed with dd on an 8 GB MicroSD chip. The root file system is 100% full, but it is in a partition that can be expanded to fill the rest of the disk. Notice that it has 15,564,800 sectors but only the first 4,322,960 are in use.

# fdisk -l

Disk Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0009c1ec

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1 *         2048    104447   51200   c W95 FAT32 (LBA)
/dev/mmcblk0p2         104448   4233960 2064756+ 83 Linux
		

Let's manually expand it that second partition. Command input is in bold and a blue box indicates where you simply press <Enter> to accept the default.

[root@pidora boot]# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.24.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1,2, default 2):  

Partition 2 has been deleted.

Command (m for help): n

Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2):  
First sector (104448-15564799, default 104448):  
Last sector, +sectors or +size{K,M,G,T,P} (104448-15564799, default 15564799): 

Created a new partition 2 of type 'Linux' and of size 7.4 GiB.

Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0009c1ec

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1 *         2048    104447   51200   c W95 FAT32 (LBA)
/dev/mmcblk0p2         104448  15564799 7730176  83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used
at the next reboot or after you run partprobe(8) or kpartx(8)

# fdisk -l

Disk /dev/mmcblk0: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0009c1ec

Device         Boot     Start       End  Blocks  Id System
/dev/mmcblk0p1 *         2048    104447   51200   c W95 FAT32 (LBA)
/dev/mmcblk0p2         104448  15564799 7730176  83 Linux

Notice that the second partition has grown from 2,065,769 (plus a fraction) to 7,730,176 blocks, and the sectors in use extend to the end of the disk.

I tried using partprobe to force the kernel to detect the new partition table, but it wouldn't as it involved the partition holding the root file system. Reboot to continue.

Now you can grow the root file system to fill the larger partition.

# resize2fs /dev/mmcblk0p2
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/mmcblk0p2 to 7730176 (1k) blocks.
The filesystem on /dev/mmcblk0p2 is now 7730176 blocks long.

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.2G  1.9G  5.1G  27% /
devtmpfs        218M     0  218M   0% /dev
tmpfs           218M     0  218M   0% /dev/shm
tmpfs           218M  292K  218M   1% /run
tmpfs           218M     0  218M   0% /sys/fs/cgroup
tmpfs           218M  4.0K  218M   1% /tmp
/dev/mmcblk0p1   50M   23M   28M  45% /boot

Interfaces

HDMI and Power

The HDMI connector is at the center of one long edge of the card, the bottom if you use align the card so the Raspberry Pi logo is upright.

The Micro USB connector providing the power is then at the lower left. It is for power only, the +5 V and ground lines are connected but the data lines are not.

Raspberry Pi HDMI and Micro USB connectors.
Raspberry Pi Ethernet and USB connectors.

Ethernet and USB

This is a Model B, with one 10/100 Mbps Ethernet port and two USB ports.

If you need to use more than two low-power USB devices, or any device that needs more than about 100 mA of power, or if you need to support hot-plugging, use a small powered USB hub.

Analog and Video, and GPIO

Analog audio output is provided through a 3.5 mm jack, seen here with a light blue body.

Composite video (PAL and NTSC) output is provided through an RCA connector, seen here with a yellow body.

The GPIO and other I/O pins continue along the edge of the board from the analog video connector to the corner. This is a 2x13 pin 2.54 mm header expansion.

Raspberry Pi Ethernet, USB, audio and video connectors.
Status LEDs
D5 Green ACT SDCard Access
D6 Red PWR 3.3 V Power
D7 Green FDX LAN Full Duplex
D8 Green LNK LAN Link/Activity
D9 Yellow 100 LAN 10/100 Mbit

BIOS and PCI Bus

The platform has neither of these, so lspci fails as there is no /proc/bus/pci to read. Without a BIOS, dmidecode has nothing to do and isn't built for the ARM platform.


Select a Raspberry Pi topic: