Subscribe to Grim's Projects        RSS Feed
-----

Sithberries anyone?

Icon 1 Comments
Did a quick search on the forum and much to my surprise there weren't any results for "raspberry pi." I just recently received mine (3 month wait) and figured I would document what I'd done to get it up and running. Less so to help others, moreso I might break the image and would like to easily recall the steps at a future date.

So... where to start?

Things that will be required:
  • Raspberry Pi Model B (makes it easier to get stuff from the interwebz)
  • 2 GB SD card
  • Power Supply Unit
  • Keyboard
  • Screen (HDMI or Composite input)
  • Interwebz

This is the bare minimum of stuffs required to get your Raspberry Pi up and running. The first should be obvious. The images from the Raspberry Pi site are structured for 2 GB SD cards. If you want to use a larger card you can, but you will need to modify the partitions manually (some of the distros do this automatically). Specifically, I will be dealing with the Arch image as that is my distro of choice. To set up the Arch image onto a flash card read here (raspberry pi wiki) or read here (Arch site, installation tab).

Once your image is set up you should have a functional base Arch Linux ARM system. Insert your newly imaged SD card to the SD port, plug in your keyboard via one of the two usb slots, choose one of the two video output ports (composite/HDMI) for your display and plug in said display, connect your ethernet port, plug in your power supply (make sure you have one that meets the specs), and finally turn on your surge protector. You should see your RasPi light up and start to display things on your monitor, these are all the standard linux kernel messages and some Arch specific ones. At the end of it all you should see a prompt asking you to login. Note that an additional message may appear and somewhat overwrite the login prompt (this message refers to your network connection being successfully established or not, don't be alarmed), just proceed to log in. The login changes from distro to distro so be sure to check the Downloads page where it says "Default login" for your particular image. In Arch (as of 25 Oct 2012) the default login username is "root" and the password is also "root" (no quotes).

Now I will document my particular changes to it. Commands that are entered into the terminal will be preceded by #$ and typed exactly as displayed.

The first step is to change your root user's password (security reasons as it were):
#$ passwd
You will see a prompt where you will type in your new password, and you will be asked to enter it once again. At this point I suggest you reboot because I had an issue the first time where upon doing this my password change malfunctioned and I could no longer log in as root, the solution was to rewrite the image to the SD card and try again (it worked the second time, and apparently this was an issue unique to me). You may choose to boldly proceed forward of course.

Second step is to update the system, this is critical in Arch as it's a distro that updates with a fair degree of frequency:
#$ pacman -Syyu
Once the update is done reboot:
#$ reboot
Why reboot? If there is a firmware or kernel upgrade a reboot is required, so rather than worry about which updates transpired it's just easier to reboot purposely. Now you have an updated Arch system, that always makes me feel better.

Now we're going to mess with various configuration files on the system, the first two files will tinker with your hostname, this is the "alarmpi" word you see on your shell
[root@alarmpi ~]$
. I don't like alarmpi, I want something else, and my hostname of choice is always theGrid (Tron fanboyism huzzah). We change this as follows:
#$ echo "theGrid" > /etc/hostname
We're not done yet though, we still need to edit a file:
#$ nano /etc/hosts
Using my hostname of theGrid as an example, two lines in this file should be changed to the following:
127.0.0.1	localhost.localdomain	localhost	theGrid
::1			localhost.localdomain	localhost	theGrid
To write the changes to this file press Ctrl + O, then press Ctrl + X to exit the nano text editor.

Moving along just fine we're now going to set our timezone. I realize the irony as the RasPi has no internal clock of its own, but hey, sometimes internet time is just as good.
#$ echo "America/New_York" > /etc/timezone
Why do I use the value American/New_York? Because America rules that's why. More specifically, that's my timezone, to determine your own please refer here and substitute accordingly. There is also another step we must perform which is to remove the Euro time that is the default on the system and update it with our new timezone as follows:
#$ rm /etc/localtime
#$ ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
Now your timezone is properly configured, as you can guess we tediously reboot, no I'm kidding, we can still modify some stuff and tediously reboot after that.

The other thing we need to modify is the locale information, i.e. what language you cretins speak. If you don't you'll get somewhat annoying messages on the shell about C not being able to determine the locale and blah blah blah. Therefore:
#$ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
#$ echo "en_US ISO-8859-1" >> /etc/locale.gen
Again, this is specific to myself, as I am an US English speaker. You may need to make use of another language you filthy foreigners. Should you do so, you will also need to modify the values in the /etc/locale.conf file, read here for said information, your mileage may vary. Finally, once all your locale changes have been made you need to let the system know you made them, we do this by executing the following command:
#$ locale-gen


Now you have a PROPER Arch system all set up and configured that is the envy of homebrew everywhere. At this point it makes sense to add a user that is not root. Why? Because you don't want to use root for everything, root can break things, root is the root of all evil. So we do the following for an interactive method to add a user:
#$ adduser
You will receive a series of prompts in which you will press Enter/Return for all questions asked except for the username, wherein you will type your username of choice (something OTHER than root), where you are asked for additional groups (groups OTHER than users) you will type the following:
audio,lp,optical,storage,video,wheel,games,scanner
Finally, when you are prompted for the user password you will enter whatever password you like.

At this point you have a streamlined and properly configured Arch command line system with a non-root user. However, why settle for just command line? The fact is the RasPi can make use of graphical applications. So let's do so, but first, a foreword. Regardless of whether or not you have a 256 MB or 512 MB version of the RasPi you only have so much RAM to work with, not to mention 700 MHz of processing speed. What does this mean for you? To work with graphical applications you must choose them... wisely (voice of Templar from Indiana Jones and the Last Crusade).

The optimal solution for displaying graphics may be DirectFB or Wayland. However, the setup for these is a bit more involved (as they tend to involve compiling from source and such) and thus far much of the reading I've done has proven beyond my grasp. Therefore, I am forced to settle for trusty old X to do the job. To get X running you'll need:
  • xorg-server: The X server (required)
  • xf86-video-fbdev: video driver for the framebuffer device, needed to have X display anything
  • xorg-server-utils: not required but it can be useful
  • xorg-xinit: used to launch X, but if you can hack some you don't need it
That's the graphical fundamentals, X is required and there's not much I know of to increase its performance. Furthermore, X won't do much on its own, except for show you a nice black screen with a cursor at the center.

This leads to a discussion on what does one need (at a bare minimum) on an X server to perform some sort of useful work? My answer to this question is twofold: a terminal emulator, and a window manager. Technically, you could do without a window manager and rely SOLELY on X and a terminal. At that point though, why bother with X? Might as well just work directly from the shell. A lack of window manager also means that operations like maximizing the window (to consume valuable screen real estate) would be impossible, as the X server only provides for focus on hover/click, thus relegating those duties to the application itself (which few applications tend to include). In conclusion, we NEED a window manager, particularly if we want to expand BEYOND one application and if we want to facilitate a bit of multi-tasking.

My chosen terminal is xterm. Why? I'm used to it. There are plenty of others but xterm does the job just fine and its lightweight (again memory and processing have to be taken into account). The only lighter one I know of is rxvt and again I haven't used it. Install whatever you prefer, this is simply my personal bias.

REVISION I was curious if there was anything similar, yet lighter than xterm. Sure enough I found something, st or simple terminal. Certainly, it's not the fanciest terminal out there. However, it provides similar low-level functionality and memory-wise (according to my own tests) it's about 4x less resource hungry. This means, on the RapPi, it's now my terminal of choice (and may soon be everywhere else).

The window manager of choice is SithWM. Why? Various reasons, all of which are equally important: no mouse is required (important when you only have two USB ports available), small file and memory footprint, can be compiled for ARM, provides all standard window operations, multiple desktops, and an easily configurable application menu. It takes a little getting used to but it's worth your time, if you are reluctant/hesitant refer to this chart to see that its performance is superior to most others.

So how do we go about doing all this? We use the Arch package manager pacman and do the following:
#$ pacman -S xorg-server xorg-server-utils xorg-xinit xf86-video-fbdev
It will proceed to download and install the particular binaries taking care of all related dependencies as well. A thing of beauty.

st and SithWM however, are a bit more involved because they have to be built from source. We do this by making use of the Arch User Repository, or AUR. Before we can proceed to install them, we have to set up a compilation environment. For which we will need two things:
#$ pacman -S base-devel sudo
It will ask you which portions of base-devel you wish to install, the default is ALL, which is what you want (you may be able to get away with fewer, but I leave that to the experts if they care to chime in). The sudo package will be of use later to alter the keyboard shortcuts of SithWM. It needs to be configured first though:
#$ EDITOR=nano visudo
This command will open a special configuration file. Within this file you're going to uncomment the following line:
#%wheel ALL=(ALL) ALL NOPASSWD:ALL
Remember Ctrl + O, then Ctrl + X to finalize your changes.

Once all of these packages have been loaded/installed issue a reboot:
#$ reboot
When prompted log in as your REGULAR user NOT as root. My regular user is tron, and so I would use that login and tron's password. Now you will be logged in as your user (whom I shall refer to as tron from this point forward). Your shell should display the following (using my shell for reference):
[tron@theGrid ~]$
So far so good I hope.

On another internet capable computer we want to go to the AUR and search for the package(s) st & SithWM. You want versions 0.2.1-0 maintained by the LemonMan and 1.2.3-3 maintained by dottorblaster, respectively. You will then be taken to a page that shows a hyperlink that reads Tarball, take note of the URLs, and returning to your RasPi's terminal issue the following commands:
#$ wget https://aur.archlinux.org/packages/st/st/st.tar.gz
#$ wget https://aur.archlinux.org/packages/si/sithwm/sithwm.tar.gz
Be sure that the URL is correct otherwise wget will report an error. This command will basically download a compressed archive to your home directory, which we will extract, modify, compile, and install.
#$ tar -xvzf st.tar.gz
#$ rm st.tar.gz
#$ cd st/
#$ nano PKGBUILD
At the end of this command sequence we should be in our familiar text editor with a file that looks like the following:
# Maintainer: Patrick Jackson <PatrickSJackson gmail com>
# based on st-hg PKGBUILD

pkgname=st
pkgver=0.2.1
pkgrel=0
pkgdesc='A simple virtual terminal emulator for X.'
arch=('i686' 'x86_64')
license=('MIT')
depends=('libx11')
makedepends=('ncurses')
url="http://st.suckless.org"
source=(http://hg.suckless.org/st/archive/$pkgver.tar.gz)
md5sums=('1e3249da1c4e52894cfa4b0f11e35599')

build() {
	cd $srcdir/$pkgname-$pkgver
	make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11 PREFIX=/usr DESTDIR="$pkgdir" TERMINFO="$pkgdir/usr/share/terminfo" install
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	install -Dm644 README "$pkgdir/usr/share/doc/$pkgname/README"
}
The particular line that matters to us is
arch=('i686' 'x86_64')
We want to change it to:
arch=('armv6h')
Again, Ctrl + O, then Ctrl + X. This change is important because we wish to compile st for an ARM architecture, not an x86 architecture, otherwise the compile will fail. To compile and install we do the following:
#$ makepkg -s
#$ sudo pacman -U st-0.2.1-0-armv6h.pkg.tar.xz
#$ cd ../
#$ rm -rf st/
This leaves us with st compiled and our system cleaned up.

Similarly, we will alter the PKGBUILD file for SithWM.
#$ tar -xvzf sithwm.tar.gz
#$ rm sithwm.tar.gz
#$ cd sithwm/
#$ nano PKGBUILD
At the end of this command sequence we should be in our familiar text editor with a file that looks like the following:
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
pkgname=sithwm  
pkgver=1.2.3
pkgrel=3
pkgdesc="a minimalist window manager"
url="http://sithwm.darkside.no/sithwm.html"
arch=('i686' 'x86_64')
depends=('libx11')
license=('GPL')
install=sithwm.install
source=("http://sithwm.darkside.no/sn/$pkgname-$pkgver.tgz")
md5sums=('15619f6977bb0cff32a1cdce49f6530d')
build() {
  cd $startdir/src/$pkgname-$pkgver
  make || return 1
  make DESTDIR=$startdir/pkg install
}
We will modify this entire file to resemble the following (the procedure is more involved because the PKGBUILD requires updating):
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
pkgname=sithwm  
pkgver=1.2.3
pkgrel=3
pkgdesc="a minimalist window manager"
url="http://sithwm.darkside.no/sithwm.html"
arch=('armv6h')
depends=('libx11')
license=('GPL')
source=("http://sithwm.darkside.no/sn/$pkgname-$pkgver.tgz")
md5sums=('15619f6977bb0cff32a1cdce49f6530d')
build() {
  cd $srcdir/$pkgname-$pkgver
  make CNF=STORMTROOPER XROOT=/usr 
}

package() {
  cd $srcdir/$pkgname-$pkgver
  make DESTDIR=$pkgdir install
    install -Dm644 README $pkgdir/usr/share/doc/$pkgname/README
}
Again, Ctrl + O, then Ctrl + X. To compile and install repeat as before:
#$ makepkg -s
#$ sudo pacman -U sithwm-1.2.3-3-armv6h.pkg.tar.xz
#$ cd ../
#$ rm -rf sithwm/
This leaves us with SithWM compiled and our system cleaned up. Finally, we want to copy the configuration file of SithWM to tron's home directory and create an .xinitrc file:
#$ cp /usr/share/sithwm/default.sithwmrc ~/.sithwmrc
#$ mv /usr/share/sithwm/default.sithwmrc /usr/share/sithwm/sithwmrc.default
#$ cp /etc/skel/.xinitrc ~/.xinitrc


The .xinitrc file which is now located in tron's home directory is a configuration file for the X server. Namely, it's only purpose in this setup is to execute SithWM. We will tinker with it as follows:
#$ echo "exec sithwm" >> ~/.xinitrc
Of course you can tweak it however you like, but there are plenty of examples, HowTos, and tutorials on the web for that very purpose.

Finally, we are going to irrevocably damage SithWM's configuration file which we copied earlier into our home directory. Therefore, open our familiar text editor:
#$ nano ~/.sithwmrc
You should see a bunch of somewhat cryptic text appear. Worry not, all you need to do is mosey down to the very end of the document, leave a blank line, and append the following:
cmd "Terminal" "st"
menu "System"
	cmd "Tasks" "st -e top -u $USER"
	cmd "SithWM" "st -e nano $HOME/.sithwmrc"
end
menu "Exit"
	cmd "Logout" "pkill sithwm"
	cmd "Reboot" "sudo reboot"
	cmd "Shutdown" "sudo poweroff"
end

key std		t		sh "st"
key std		Delete	sh "st -e top -u $USER"

nosoliddrag

fn "-*-liberation sans-medium-r-*-*-*-*-*-*-*-*-*-*"
Press Ctrl + O to write the changes to the file, and Ctrl + X to exit nano as usual. These changes will provide you with the following:
  • A populated system menu that is available when you press the key combination Windows + Enter
  • Two key bindings, Windows + T launches a terminal, and Windows + Delete shows you what tasks are running
There is one last step for getting SithWM ultimately configured, which is to install a font (as it will display nothing if it cannot find a suitable font). The font I've chosen is liberation which we install from the repositories as follows:
#$ sudo pacman -S ttf-liberation


AND WE ARE DONE! Or are we? Not quite.
#$ reboot
Login as your user, and then issue the following command
#$ xinit & exit
and you will be launched into your shiny new X Server with its amazing window manager complete with one yes ONE application. You may be alarmed by the fact that all you see is a black screen, worry not, just press Windows + Enter to open the application menu, and use the arrow keys to navigate it. From this point on you now have a general idea how to tweak SithWM and of course how to install whatever applications you choose (or can find) from the Arch repository. :: raises hand like the Templar in Indiana Jones as the blog crumbles around me ::

1 Comments On This Entry

Page 1 of 1

grimpirate Icon

29 October 2012 - 08:32 PM
0
Page 1 of 1