Started to build my Raspberry Pi PiDrive System (for RetroPie)

I’ve started to rework my Raspberry Pi ‘dial-up’ interface. Instead of just handling my external VPN and SSH connections I’ve extended it to also function as an intermediate file server and Git repository (both via NFS+SSH). I’ve also inserted the Raspberry Pi into a new case and added a 1 TB 2,5″ drive. I think it can handle additional load so I plan to extend its capabilities to also serve as a RetroPie console.

By the way: the case and the connector cable between the drive and the Pi are both from WD Labs. The hard drive is not a PiDrive but a refurbished USB 3.0 1 TB disk (it was a recertified My Passport Ultra) before I’ve dismantled it. For me it was cheaper that way. If you’re looking for a similar setup and need an additional power supply and SD card maybe you should think about buying a Nextcloud Box (free shipping; handled by WD). You might not need to use its ‘cloud’ functionality but still get all hardware I’ve previously mentioned which I think is a pretty good bargain.

Homemade minimal Raspberry Pi (Raspbian) image

I have to admit that I’m a big fan of single-board computers for specific tasks like home-automatation, backup systems, network gateways, or file-sharing. I also like the approach of the Raspberry Pi Foundation to provide an image file with Raspbian (an adapted Debian) for easy use. For most people out there it is the best way to fetch an SD-Card with a capacity of at least 4 GBytes, download and copy the Raspbian image onto the card. I have a few unused 1 and 2 GByte SD-Cards lying around which should be sufficient for my tasks but are too small for the ‘generic’ Raspbian image. So I had to create my own minimalistic Raspbian installation. Here is a step-by-step example of the creation process.

I started with the installation of a few later required packages. I’m pretty sure this list is incomplete as I’ve already had quite a lot dev-tool packages installed before…

sudo aptitude install qemu-user-static \
binfmt-support fakeroot debootstrap git

To get Qemu running to support armhf I had to add a parameter to itc configuration file:

echo "EXTRA_OPTS=\"-L/usr/lib/arm-linux-gnueabihf\"" > /etc/qemu-binfmt.conf

I used “/tmp/” as my working directory which might not be the best location (temporary, as the name says). Feel free to use another dir, but you might need to keep an eye on the (root) access permissions…

cd /tmp/
mkdir raspi raspi/bootfs
cd raspi

Next I downloaded a minimalistic list of Raspian packages that will later go onto the root partition. I’ve tried to avoid working with root permissions as far as possible (therefore ‘fakeroot’).

fakeroot debootstrap --foreign --no-check-gpg --include=ca-certificates --arch=armhf testing rootfs http://archive.raspbian.com/raspbian

No we need to (temporarily) add some arm binaries to the root directory.

cp $(which qemu-arm-static) rootfs/usr/bin

The following step will start the actual installation process of the Raspian packages. For some reason I was not able to continue at this point without root permissions. (Any tips to fix this are welcome.)

sudo chown root.root rootfs -R

sudo chroot rootfs/ \
/debootstrap/debootstrap --second-stage --verbose

You will need some of the Raspberry Pi firmware files. The following commands download and install them . The Git repository is huge (3.1 GB), so this might take some time…

git clone \
https://github.com/raspberrypi/firmware.git

sudo cp -r firmware/hardfp/opt/* rootfs/opt/

At this point you could create a custom kernel image based on the downloaded files. In my opinion the stock kernel is just fine so I just used it as is:

mkdir -p rootfs/lib/modules/

sudo cp -r firmware/modules/* rootfs/lib/modules/

Create the boot partition (i.e. copy the necessary files):

mkdir bootfs
cp -r firmware/boot/* bootfs/

Next we can make some adaptions to the future image files: set a new root password, hostname, adapt the sources list, etc…

sudo chroot rootfs/ /usr/bin/passwd

vim rootfs/etc/hostname

cat >> rootfs/etc/apt/sources.list deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi

It might also be a good idea to adapt the future system to your local settings, e.g. keyboard layout.

sudo chroot rootfs/ apt-get update

chroot rootfs/ apt-get install console-data \ 
console-common console-setup tzdata most locales keyboard-configuration

sudo chroot rootfs/ dpkg-reconfigure locales

sudo chroot rootfs/ dpkg-reconfigure \
keyboard-configuration

sudo chroot rootfs/ dpkg-reconfigure tzdata

Now we can do some clean-up:

sudo rm rootfs/usr/bin/qemu-arm-static

Next step is the creation of the actual boot and root partitions on a SD-Card. I’ve not documented these steps in detail as everyone has a different favourite partition manager. This step can be done with fdisk, (g)parted, or other tools.

You have to create two partitions on your SD-Card. For the boot partition 64 MB are sufficient, the remaining space is used for the root partition. The boot partition needs to be a FAT32 partition. The nice thing about the Raspberry Pi is, that boots of the first FAT32 partition without further installing a boot block or so.

Here an example how a 2 GB SD-Card could look like:

fdisk -l /dev/sdd
  /dev/sdd1 2048 133119 65536 b W95 FAT32
  /dev/sdd2 133120 3987455 1927168 83 Linux

Now we can copy the files from the two directories we previously created onto the two SD-Card partitions (you might need to mount them first) and test the card.

cp -R rootfs/* /media/USER/root/ && sync
cp -R bootfs/* /media/USER/boot/ && sync

I also have created an image file, mounted is (as a block device), partitioned it similar to the steps above. But I have not yet documented these steps. Might be added in a future update…

Raspberry Pi – Chopped SD-Card adapter for a smaller form factor

This is just a small hack inspired by a post I read the Raspberry Pi forum.

A few weeks ago I bought a combined Micro-SD Card and USB-Adapter on eBay (from China).

SD-Card Adapter

 

I opened it and cut off  the USB-Adapter part as I am only interested in the SD-Card part of the adapter.

SD-Card Adapter w/ USB part chopped off

The result may not be the visually most convincing hack but it works perfect and reduces the chance of accidently pulling out the SD-Card.

SD-Card Adapter Hack

Raspberry Pi Power Supply: Nokia AC-10 + AC-16 [Review]

The Raspberry Pi is shipped without a power supply — there is not even one specifically available for this board as far as I know. Any micro USB power supply with a least 700 mA should work. But I did not want to rely on no-name products since the board should run continuously and the web is full of reports of counterfeits. So I’m currently using a Nokia AC-16E power supply, bought directly from Amazon (not on the Marketplace). Additionally, I bought a Nokia AC-10E (more or less for free, as their combination allowed free shipping). Based on the way the two Nokia supplies were packed and labelled (including safety marks and QR-Codes) I believe they should be genuine.

From left to right: OTB TR-005, Nokia AC-10E, Nokia AC-16E.

I tested the Nokia supplies and another (cheap/crappy?) one from OTB I already had lying around. Update: As requested in a comment, I have also added measurements of the on-board voltage between TP1 and TP2 (more information about these pins can be found here).

Power Supply Price (ca.) Output Voltage On-board Voltage
(standalone)
On-board Voltage
(attached devices)
OTB TR-005 3.- € 5 V / 1,000 mA 4.90 V 4.78 V
Nokia AC-10E 7.- € 5 V / 1,200 mA 4.88 V 4.82 V
Nokia AC-16E 13.- € 5 V / 1,000 mA 4.75 V 4.66 V

All three of them were able to support the Raspberry Pi board with several connected USB devices (passive hub, keyboard, mouse, wireless adapter) and a connected monitor (HDMI). There wasn’t much difference between them, all three ‘consumed’ about 3.8 W (6.7 VA) on average (1 hour; varying workload) and I did not notice any glitches. Still, a power drop was noticable when comparing the on-board voltage with and without any attached devices (sd-card only).

With the Nokia AC-16E power supply, the voltage dropped below the recommended 4.75 V.

In conclusion: I think I will stick to the Nokia AC-16E, as I’m currently running my Raspberry Pi only with an attached wireless usb adapter. If I notice any glitches, I can still switch over to the Nokia AC-10E power supply. Something that looks beautiful is not necessarily always better… *sigh*

Update [2014-11]: I’ve in the mean time switched to the Nokia AC-10E supply which seems to be more stable. Also I am running a second Raspberry Pi B+ now with a 2 A power supply.

My new Raspberry Pi

I just received my Raspberry Pi board from Farnell (element14). It’s the new Model B, Revision 2.0. 🙂 I originally wanted to use the board as a cheap always-running gateway. But the more I’m playing around with it, the more I enjoy its multimedia capabilities.

By the way, I’ve attached the Raspberry Pi to a power meter. According to it, the board consumes 3.1 Watt when idling and 3.4 Watt when compiling code or installing new packages. The attached mouse, keyboard and the network cable connection (wireless connection is planned) also drain some power. When being shut down, it still consumes 1.0 Watt (which might be due to the cheap USB power supply).