forked from petterreinholdtsen/meshfx-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-rpi-mesh-node
executable file
·66 lines (52 loc) · 1.64 KB
/
build-rpi-mesh-node
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
#
# Set up a Raspberry Pi using Debian Jessie as a batman-adv mesh node.
# Based on https://kmp.or.at/~klaus/raspberry/build_rpi_sd_card.sh
set -e
if [ $EUID -ne 0 ]; then
echo "this tool must be run as root"
exit 1
fi
basedir=$(dirname $0)
builddir=$basedir/build
if [[ ! -e $builddir ]]; then
mkdir $builddir
fi
apt-get install binfmt-support python-cliapp qemu-user-static qemu-utils debootstrap kpartx parted mbr
# Fetch vmdebootstrap version with foreign and separate /boot support
wget https://gitorious.org/vmdebootstrap/vmdebootstrap/raw/HEAD:vmdebootstrap \
-O $builddir/vmdebootstrap
chmod a+rx $builddir/vmdebootstrap
# Used by rpi-update
pkgs="git-core binutils ca-certificates wget kmod"
# Stuff needed for the machine to work well
pkgs="$pkgs udev"
# Stuff needed by debootstrap (need /etc/hosts)
pkgs="$pkgs netbase"
# Useful firmware packages to get free hardware working
pkgs="$pkgs firmware-linux-free"
# Other packages useful to get a debuggable environment
pkgs="$pkgs psmisc bootlogd tcpdump iputils-ping iftop vim-tiny"
for p in $pkgs ; do
options="$options --package $p"
done
$builddir/vmdebootstrap \
--log=$builddir/debug.log \
--log-level=debug \
--variant minbase \
--arch armel \
--distribution jessie \
--mirror http://http.debian.net/debian \
--image $builddir/test.img \
--size 600M \
--bootsize 64M \
--boottype vfat \
--log-level debug \
--verbose \
--no-kernel \
--no-extlinux \
--root-password raspberry \
--hostname raspberrypi \
--foreign /usr/bin/qemu-arm-static \
--customize $basedir/build-rpi-mesh-node-customize \
$options