Raspberry.Pi.Hacking.pdf

(2045 KB) Pobierz
Raspberry Pi Hacking
Loving your pi and hacking it too
By: magikh0e
Http://magikh0e.ihtb.org
Last Update: September 2 2012
Hacking the Raspberry Pi and hacking things with the Raspberry Pi.
Best of both worlds…
1
1062629638.001.png
Disclaimer
Follow this guide at your own risk. I take/accept not responsibility for any outcome from anything you
attempt to do within this guide Everything is in a “works for me” state )
Contents
2
 
Raspberry Pi
What is a Raspberry Pi?
The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard It’s a capable
little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-
processing and games. It also plays high-definition video. We want to see it being used by kids all over
the world to learn programming.
What are the dimensions?
The Raspberry Pi measures 85.60mm x 53.98mm x 17mm, with a little overlap for the SD card and
connectors which project over the edges. It weighs 45g.
3
1062629638.002.png
Raspberry Pi Specs – Model B
Processor / Chipset: Broadcom 700 MHz
RAM: Installed Size 256 MB
Graphics Controller: VideoCore IV
Operating System / Software OS Provided: Debian Linux
Tweaking Raspberry Pi’s Performance
Initially I was not planning on covering much hacking the Pi it’s self but seems that over clocking the Pi
and some OS modifications can greatly enhance the performance of the Pi. All of the changes to the pi
here will be software based changes, but be forewarned that messing with CPU settings can result in the
death of a Pi if not done properly. Everything in this guide has been tested by me, and confirmed to be
working on my Pi.
Performing some of these tweaks or modifications can allow you to see a performance boost of up to
25%. Multiple tips have been cropping up online from cutting down on RAM usage, tuning the SD card
to hacking some bits in the CPU.
RAM Usage
By simply removing un-needed services and disabling daemons, you can greatly increase performance.
Modifying Startup Services
You will first need to install sysv-rcocnf onto your Pi before you begin. Do so by issuing the following
command: sudo apt-get install sysv-rc-conf
Once this has been installed, you can begin disabling un-needed services by issuing the following
command: sudo sysv-rc-conf
Ie: samba, nfs etc..
Most services are safe to disable for normal operation of the Pi. If you know you will not be accessing
any windows file shares, samba is safe to disable, same goes for NFS with Linux/Unix shares. If you do
not know what it is it’s best to leave it alone Once you are done you will be required to run the
following command to complete the configuration: dpkg-reconfigure innserv
4
Inittab Modifications
By default the Pi will spawn 6 terminals available for use once the Pi boots up. The average use does not
need more than one or two at most. We can save some resources by limiting the amount of terminals
spawned down from 6 to 2.
To do so, edit the /etc/inittab file by issuing the following command: vi /etc/inittab
Once the file has been opened, look for lines matching the following (line 51) :
BEFORE
AFTER
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
Once the above changes have been made, you can now save and exit the editor.
Disabling console access
Depending how you use your Pi, you can save more resources by disabling console access if you are sure
you will not need it. This is useful in cases where you are using your Pi as a Raspbmc media center or
something.
To disable the console, you will need to edit the file: /boot/cmdline.txt
Remove the following line and save the file:
console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
5
Zgłoś jeśli naruszono regulamin