Configuring a Raspberry Pi

So I created a new image on the SD (my old one was messed up) and used the script, everything goes fine, I reboot (as instructed) and nothing. Only the OK led flickers 6 times every 5 seconds… great!

After googling I found out that start.elf could not be loaded. The entire process is as follows (combined from a couple of forum posts at Raspberry Pi forums):

  1. When the Pi is turned on the ARM core is off and the GPU core is on. The SDRAM is disabled
  2. The GPU loads the first boot loader which is stored in ROM on the SoC. The first boot loader reads the SD card and loads the second boot loader (bootcode.bin) into the L2 cahce and then runs it.
  3. bootcode.bin enables the SDRAM and then reads the third boot loader (loader.bin) from the SD card into the RAM and runs it.
  4. loader.bin reads the GPU firmware (this is start.elf).
  5. start.elf is loaded and read config.txt (the file used to overclock the RaspPi), cmdline.txt and kernel.img
  6. After kernel.img (a binary image of ARM memory starting at physical address 0 from the ARM’s perspective) and sends a reset on the ARM
  7. The kernel is loaded and the rest of the boot process is handled by init or systemd.

The script works perfectly but it also goes another mile by updating the firmware, using rpi-update. This program allows updating the rpi firmware easily using a simple command. Problem found, the rpi-update fails to write the start.elf file on the SD card (or writes it in a wrong way for some reason). I fixed the problem by just removing the rpi-update command, and everything works!

MOTD Eyecandy

I also changed the welcome message of the Raspberry Pi. SSH users now are greeted by a fancy logo and cool ANSI art eyecandy.

"MOTD"

“MOTD”

Just edit the following file:

[email protected]:/home/pi# nano /etc/motd.tail

And type the greeting text, when using nano it’s also possible to add color (like I did). First press ALT+V and then press ESC. This inserts and escaping character (it looks like ^[ but typing this yourself wont work). After that add the color code, example:

^[[0;32m This is green!

A full list of color codes is available here, and an ansii generator can also be used. Mine has the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Linux raspberrypi 3.1.9+ #168 PREEMPT Sat Jul 14 18:56:31 BST 2012 armv6l
^[[0;32m
                         .~~.   .~~.
                        '. \ ' ' / .'^[[0;31m
                         .~..~~~..~.
                        : .~.'~'.~. :
                       ~ (   ) (   ) ~
                      ( : '~'.~.'~' : )
                       ~ .~ (   ) ~. ~
                        (  : '~' :  )
                         '~ .~~~. ~'
                             '~'
^[[1;37m
 _____                 _                            _____ _
|  __ \               | |                          |  __ (_)
| |__) |__ _ ___ _ __ | |__   ___ _ __ _ __ _   _  | |__) |
|  _  // _` / __| '_ \| '_ \ / _ \ '__| '__| | | | |  ___/ |
| | \ \ (_| \__ \ |_) | |_) |  __/ |  | |  | |_| | | |   | |
|_|  \_\__,_|___/ .__/|_.__/ \___|_|  |_|   \__, | |_|   |_|
                | |                          __/ |
                |_|                         |___/
^[[0;37m
############################################################

Now I’m ready to install some services (HTTP, FTP, PHP, MYSQL,…) I’m still looking for a lightweight server. Maybe nginx, monkey or lighthttp, apache is a bit to heavy.