Raspberry PI notes

RPI horrible slow with apt-get/dpkg

This is especially true when using f2fs. This is caused by fsync/sync calls.
Solution: add force-unsafe-io to /etc/dpkg/dpkg.cfg.
If you also want to speed up all other software, use the "eatmydata"-package. E.g.:
eatmydata apt-get upgrade
Note that combining eatmydata with dpkg is still faster than force-unsafe-io alone!
Also warning: if your RPI crashes during eatmydata (or loses power or whatever), your data might be gone.

Migrating to f2fs

Please only try this if you're an advanced Linux user who knows how to figure things out by herself in case I made any mistakes in these steps.
Making a backup first is adviced (it is very easy to make fatal mistakes in these steps).
  • boot the rpi
  • run rpi-update 5e89b00f546ed1ca792e74b28d27bf5a4ce10296
  • edit /boot/cmdline.txt and replace 'ext4' by 'f2fs'
  • do the same for /etc/fstab
  • invoke cp /bin/true /sbin/fsck.f2fs
  • shutdown the rpi and insert the sdcard in a pc
  • copy the contents of the second partition on the sd-card to a temporary folder
  • install f2fs-tools on the pc and run mkfs.f2fs on the second partition on the sd-card (do not forget to unmount it first) - this will only work if your pc has at least kernel 3.8
  • re-mount the second partition and copy back its contents
  • unmount, insert back in rpi, power on rpi and notice that it now suddenly boots from f2fs!

Disabling wifi

In case you want to use the wifi dongle for eg monitor mode or so.
Remove the following lines:
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf


Compiling for RPI

One big warning: the default setting for 'char'-types on the rpi is UNSIGNED. Most other platforms use signed chars! This causes problems with certain programs like the squid proxy.
Suggested CFLAGS settings:
export CFLAGS="-fsigned-char -O3 -fomit-frame-pointer -march=armv6j -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"
export CXXFLAGS="-fsigned-char -O3 -fomit-frame-pointer -march=armv6j -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard"

Flashing LEDs

You can flash the "disk-activity" led by invoking:
echo 1 > /sys/bus/platform/devices/leds-gpio/leds/led0/brightness
It will automatically switch off.

Destroying the SD card

Always try the shutdown the device cleanly, e.g. with a "shutdown" command. If not, you can physically destroy the sd card.