Inhaltsverzeichnis
berries
So you also got yourself a berry (Raspberry Pi, raspberrypi). Here you can find some recipes.
Useful libraries
- wiringpi
General Knowledge
Getting started
The fastest way to get going with your raspberry pi is to simply flash a suitable prebuilt image to an SD card. (you need an SD card to boot though you could put everything aside the boot partition on a USB drive with additional effort)..
sudo dd if=<path_to_img>/2012-12-16-wheezy-raspbian.img of=/dev/<your_SD_card> bs=2M
(the sd card could be mmcblk0 or sdx - make sure not to overwrite your system harddrive)
After that you're good to boot up your raspberry pi for the first time. Make sure to expand your rootfs (so it fills your whole SD card). Adapt the other settings to suit your needs. Updating and ssh probably aren't the worst ideas.
After rebooting run a full upgrade (the initial user is pi, password raspberry)
sudo apt-get update && sudo apt-get dist-upgrade
This will leave you with a usable raspbian (kernel 3.2.27).
upgrade the firmware
You can either type some commands found here or download this litte script (which embeds those exact commands)
wget http://excogitation.de/projects/berry/update-my-raspberrypi-firmware.sh -O umr.sh
or even shorter (case sensitive)
wget bit.ly/UgXdPF -O umr.sh
execute with:
sudo sh umr.sh
→ this (at the time of writing) leaves you with kernel 3.6.11 + latest rpi firmware
Good to know
you can prevent your monitor from going blank
edit: /etc/lightdm/lightdm.conf e.g. sudo nano /etc/lightdm/lightdm.conf
find: [SeatDefault] #xserver-command=X
change to: (remove the # at the start of the line) xserver-command=X -s 0 dpms
Thin Client
VNC
This guide assumes there is no X already running.
Install xtightvncviewer (or use aptitude or whatever)
sudo apt-get install xtightvncviewer
you need to somehow start an X server
X &
or add it to /etc/rc.local then you're good to connect to your server
DISPLAY=:0 xtightvncviewer -fullscreen <yourserver>:port
The speed to run e.g. Windows 7 „on“ your raspberry pi is pretty impressive.
RDP
2come
USBIP
The possibility to do this is due to the awesome project over at soureforge. Unfortunately the driver is only in staging which means we have to build our own kernel. On the other hand we always wanted to do that and here's how you (cross)compile a kernel/modules.
For those of you who just want to start using some usb device over the network I have a precompiled kernel + matching usbip modules here (hey, I understand - it took me 2 days to get it running for the first time … compiling the modules from the 3.2.27/3.6.11 git branch which then wouldn't match the kernel - fuck me)
wget http://excogitation.de/projects/berry/usbip.tar.gz
or shorter
wget http://bit.ly/VUPf0k -O usbip.tar.gz
Take care though - this archive assumes you already have upgraded the firmware. It will overwrite your rc.conf, kernel, modules (assuming you're on 3.6.11 - which you should be - because you already ran the rpi-update).
No warranties and shit.
sudo tar -xzf usbip.tar.gz -C /
Reboot. Test.
sudo modprobe usbip-host
\^^ that should work - check with
lsmod | grep usbip
You can autoload the module by adding it (usbip-host) to /etc/modules
Install the usbip daemon
sudo apt-get install usbipd
It will initially share the upper usb port through usbip so if you have anything attached like a mouse or keyboard that device will no longer work.
adapt the /etc/rc.local to your needs
usbip bind -<your_usb_device_id> (find your usb_device_id with "usbip list -l")
find the device you want to share
usbip list -l
windows client
Unfortunately there is no matching client for windows on the sourceforge page since someone changed the defines only in the linux version You can find a working version here 1 or you can take another improved and adapted version from obcd who I met over at raspberry pi forums.
The rest will follow shortly - benchmark writing to a USB stick, … (I wrote it down in the virtual windows machine).
cross-compile the kernel
- get the toolchain
$ git clone https://github.com/raspberrypi/tools.git --depth 1
- install required packages e.g.
# apt-get install gcc-arm-linux-gnueabi make ncurses-dev
- clone raspberry pi kernel sources
git clone --depth 1 git://github.com/raspberrypi/linux.git
- generate .config file from bcmrpi-defconfig
make ARCH=arm CROSS_COMPILE=<path to toolchain>(/tools)/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi- bcmrpi_defconfig
- add USBIP to kernel config
echo -e "CONFIG_USBIP_CORE=m\nCONFIG_USBIP_VHCI_HCD=m\nCONFIG_USBIP_HOST=m\nCONFIG_USBIP_DEBUG=n" >> .config
- compiling the kernel
make ARCH=arm CROSS_COMPILE=<path to toolchain>(/tools)/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi- -j <# of cores to use>
- build the modules
ARCH=arm CROSS_COMPILE=<path to toolchain>(/tools)/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi- make modules_install INSTALL_MOD_PATH=../modules -j <# of cores to use>
- copy the stuff to the raspberry's SD card
- linux/arch/arm/boot/zImage → /mnt/partion #1/kernel.img
- modules → /mnt/partion #2/modules
- (modules/lib/modules/3.6.11+/kernel/drivers/staging/usbip is where your usbip modules magically appeared
)
Projects @shack
Lazor
At the moment we need a Windows OS to control our lasercutter because there's only control software available for Windows. Since dealing with that machine is a delicate matter - we haven't looked at/tried to reverse the control commands … yet.
It is possible to use a raspberry pie to control the laser by
- setting it up as a thin client connected to a virtual machine running some Windows os.
- forwarding the lasercutter (connected to the raspis USB port) to to that virtual machine using usb over ip
That way you also have a central place to manage a database with cutting settings and to update the laser software. Also the workflow should become easier and maybe also add usage statistics somewhen in the future.