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


Description
Need to set the base OS up


Toggle State Changes

Activity


Getting the system up and running


apt-get install qemu-system
dd if=/dev/sdj of=disk.img
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu


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/ld.so.preload
Put a # in front of the first line so that it looks like this:
#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so

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.
halt


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 "127.0.0.1"

and place a request (using wget) to bentasker.co.uk.

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 - http://www.dingleberrypi.com/2013/05/install-and-run-raspbian-from-a-usb-flash-drive/
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



/etc/network/interfaces

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])

respawn

pre-start script
test -x /scripts/wol.sh && bash /scripts/wol.sh
test -x /scripts/xbmc-watchdog.sh
; 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
fi
fi
end script

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

exec /scripts/xbmc-watchdog.sh


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'