VEHPI-5: OS Setup

Issue Information

Issue Type: Task
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: VehManPi (VEHPI)
Resolution: Done (2013-12-28 05:39:59)
Target version: 1.0,

Created: 2013-12-10 00:12:22
Time Spent Working

Need to set the base OS up

Toggle State Changes


Getting the system up and running

apt-get install qemu-system
dd if=/dev/sdj of=disk.img

qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 512 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda disk.img

nano /etc/
Put a # in front of the first line so that it looks like this:

Press ctrl-x then y then enter to save and exit.
(Optional) Use steps 2 to 4 above to create a file /etc/udev/rules.d/90-qemu.rules with the following content:
KERNEL=="sda", SYMLINK+="mmcblk0"
KERNEL=="sda?", SYMLINK+="mmcblk0p%n",

The kernel sees the disk as /dev/sda, while a real pi sees /dev/mmcblk0. This will create symlinks to be more consistent with the real pi.

qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda disk.img

Completed the setup (including enabling SSH).

Manually edited NTP init script to run

ip a | grep inet | grep -v ""

and place a request (using wget) to

Should now be able to boot the pi from the image, but decided to dump the image to a USB stick

dd if="disk.img" of="/dev/sdg"

then mount partition 1 on the SD card and edited cmdline.txt to change root from /dev/mmcblk0p2 to /dev/sda2

Resized to fill the disk following the instructions here -
Setting up Wifi

Wifi dongle appears to be supported OOB as able to scan and find wifi networks

wpa_cli -p /var/run/wpa_supplicant -i wlan0 add_network
wpa_cli set_network 2 ssid '"guestwireless"'
wpa_cli set_network 2 scan_ssid 1
wpa_cli set_network 2 key_mgmt WPA-PSK
wpa_cli set_network 2 psk '"[REDACTED]"'
wpa_cli enable_network 2
wpa_cli save_config


auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Commit b4c368c adds a simple BASH script to check whether the Wifi interface is up, and tries to bring it up if it isn't
Example start script would be the XBMC script - /etc/init/xbmc.conf

\# XBMC Daemon

description "xbmc daemon"
author "None"

start on (started dbus and started mountall)
stop on (xbmc-do-stop or runlevel [!2345])


pre-start script
test -x /scripts/ && bash /scripts/
test -x /scripts/ || \{ stop; logger -t xbmc "cannot execute /scripts/, exiting" ; exit 1; \}
if [ -e $FBSET ]; then
FB_RESOLUTION=$(fbset | grep geometry | awk '\{print "-xres "$2" -yres "$3" -vxres "$4" -vyres "$5\}')
if [ ! -f /tmp/fb_resolution ]; then
echo $FB_RESOLUTION > /tmp/fb_resolution
end script

pre-stop script
test "x" = x`pidof xbmc.bin` || kill `pidof xbmc.bin`
if [ -e $FBSET ]; then
if [ -f /tmp/fb_resolution ]; then
fbset `cat /tmp/fb_resolution`
echo 1 > /sys/class/vtconsole/vtcon1/bind
DEPTH2=$(fbset | head -3 | tail -1 | cut -d " " -f 10)
if [ "$DEPTH2" = "8" ]; then
elif [ "$DEPTH2" = "16" ]; then
elif [ "$DEPTH2" = "32" ]; then
fbset -depth $DEPTH1 && fbset -depth $DEPTH2
start console-setup
echo -e "\033c" > /dev/tty1
end script

exec /scripts/

btasker changed status from 'Open' to 'In Progress'
btasker changed status from 'In Progress' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'