summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorNeil Williams <codehelp@debian.org>2014-08-25 19:42:52 -0700
committerNeil Williams <codehelp@debian.org>2014-08-25 19:42:52 -0700
commit453fbcec4ab1770daab88e0217b12dcfaa6a765b (patch)
tree27e1fc5a957cf9cc9e571ea7b3ad95d1efd944cb /examples
parent323303dc20128416dd7fe40defe2a081632d0518 (diff)
downloadvmdebootstrap-453fbcec4ab1770daab88e0217b12dcfaa6a765b.tar.gz
Add examples to go into /usr/share to make it easier to create pre-defined images.
Diffstat (limited to 'examples')
-rw-r--r--examples/README.txt27
-rwxr-xr-xexamples/auto-serial-console35
-rwxr-xr-xexamples/beagleboneblack-customise.sh46
-rwxr-xr-xexamples/beagleboneblack.sh21
-rwxr-xr-xexamples/cubietruck-customise.sh12
-rwxr-xr-xexamples/cubietruck.sh23
-rw-r--r--examples/lava.sh7
-rw-r--r--examples/vmdebootstrap.txt47
8 files changed, 218 insertions, 0 deletions
diff --git a/examples/README.txt b/examples/README.txt
new file mode 100644
index 0000000..a41d83d
--- /dev/null
+++ b/examples/README.txt
@@ -0,0 +1,27 @@
+Examples
+========
+
+The Freedombox project are using vmdebootstrap for ARM based images.
+
+http://anonscm.debian.org/cgit/freedombox/freedom-maker.git/
+
+Those scripts have been adapted to work directly within vmdebootstrap
+as customise scripts in this examples directory.
+
+There are also examples which fold all of the options into a single
+script which just needs to be called with a size and an image name.
+
+The only required argument for each example is the image name.
+
+Beaglebone-black
+----------------
+
+sudo ./beagleboneblack.sh --image bbb.img
+
+Arguments other than those already included in the shortcut can also
+be supplied, where required. e.g. --size, --variant, --package (can be
+specified multiple times), --hostname, --sudo, --root-password or
+--lock-root-password.
+
+CubieTruck
+----------
diff --git a/examples/auto-serial-console b/examples/auto-serial-console
new file mode 100755
index 0000000..9304e98
--- /dev/null
+++ b/examples/auto-serial-console
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+
+[ -f /etc/default/autogetty ] && . /etc/default/autogetty
+
+[ 1 -gt $ENABLED ] && exit
+
+for arg in $(cat /proc/cmdline)
+do
+ case $arg in
+ console=*)
+ tty=${arg#console=}
+ tty=${tty#/dev/}
+
+ case $tty in
+ tty[a-zA-Z]* )
+ PORT=${tty%%,*}
+
+ # check for service which do something on this port
+ if [ -f /etc/init/$PORT.conf ];then continue;fi
+
+ tmp=${tty##$PORT,}
+ SPEED=${tmp%%n*}
+ BITS=${tmp##${SPEED}n}
+
+ # 8bit serial is default
+ [ -z $BITS ] && BITS=8
+ [ 8 -eq $BITS ] && GETTY_ARGS="$GETTY_ARGS -8 "
+
+ [ -z $SPEED ] && SPEED='115200,57600,38400,19200,9600'
+
+ GETTY_ARGS="$AUTOGETTY_ARGS $GETTY_ARGS $SPEED $PORT"
+ exec /sbin/getty $GETTY_ARGS
+ esac
+ esac
+done
diff --git a/examples/beagleboneblack-customise.sh b/examples/beagleboneblack-customise.sh
new file mode 100755
index 0000000..2b69069
--- /dev/null
+++ b/examples/beagleboneblack-customise.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+rootdir=$1
+
+# copy u-boot to the boot partition
+cp $rootdir/usr/lib/u-boot/am335x_boneblack/MLO $rootdir/boot/MLO
+cp $rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img $rootdir/boot/u-boot.img
+
+# Setup uEnv.txt
+kernelVersion=$(basename `dirname $rootdir/usr/lib/*/am335x-boneblack.dtb`)
+version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
+initRd=initrd.img-$version
+vmlinuz=vmlinuz-$version
+
+# uEnv.txt for Beaglebone
+# based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
+cat >> $rootdir/boot/uEnv.txt <<EOF
+mmcroot=/dev/mmcblk0p2 ro
+mmcrootfstype=ext4 rootwait fixrtc
+
+console=ttyO0,115200n8
+
+kernel_file=$vmlinuz
+initrd_file=$initRd
+
+loadaddr=0x80200000
+initrd_addr=0x81000000
+fdtaddr=0x80F80000
+
+initrd_high=0xffffffff
+fdt_high=0xffffffff
+
+loadkernel=load mmc \${mmcdev}:\${mmcpart} \${loadaddr} \${kernel_file}
+loadinitrd=load mmc \${mmcdev}:\${mmcpart} \${initrd_addr} \${initrd_file}; setenv initrd_size \${filesize}
+loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
+
+loadfiles=run loadkernel; run loadinitrd; run loadfdt
+mmcargs=setenv bootargs console=tty0 console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype}
+
+uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
+EOF
+
+mkdir -p $rootdir/boot/dtbs
+cp $rootdir/usr/lib/linux-image-*-armmp/* $rootdir/boot/dtbs
diff --git a/examples/beagleboneblack.sh b/examples/beagleboneblack.sh
new file mode 100755
index 0000000..3923949
--- /dev/null
+++ b/examples/beagleboneblack.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+sudo vmdebootstrap \
+ --owner $(whoami) --verbose \
+ --mirror http://http.debian.net/debian \
+ --log beaglebone-black.log --log-level debug \
+ --arch armhf \
+ --foreign /usr/bin/qemu-arm-static \
+ --enable-dhcp \
+ --configure-apt \
+ --no-extlinux \
+ --no-kernel \
+ --package u-boot \
+ --package linux-image-armmp \
+ --distribution sid \
+ --serial-console-command "'/sbin/getty -L ttyO0 115200 vt100'" \
+ --customize "beagleboneblack-customise.sh" \
+ --bootsize 50m --boottype vfat \
+ "$@"
diff --git a/examples/cubietruck-customise.sh b/examples/cubietruck-customise.sh
new file mode 100755
index 0000000..74a0d5b
--- /dev/null
+++ b/examples/cubietruck-customise.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+rootdir=$1
+
+# u-boot needs to be dd'd to the partition
+#cp /usr/lib/u-boot/Cubietruck/uboot.elf /boot/
+#cp /usr/lib/u-boot/Cubietruck/u-boot-sunxi-with-spl.bin /boot/
+
+mkdir -p $rootdir/boot/dtbs
+cp $rootdir/usr/lib/linux-image-*-armmp/* $rootdir/boot/dtbs
diff --git a/examples/cubietruck.sh b/examples/cubietruck.sh
new file mode 100755
index 0000000..2da46af
--- /dev/null
+++ b/examples/cubietruck.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+sudo vmdebootstrap \
+ --owner $(whoami) --verbose \
+ --size 3G \
+ --mirror http://http.debian.net/debian \
+ --log cubietruck.log --log-level debug \
+ --arch armhf \
+ --foreign /usr/bin/qemu-arm-static \
+ --enable-dhcp \
+ --configure-apt \
+ --no-extlinux \
+ --no-kernel \
+ --package u-boot \
+ --package linux-image-armmp \
+ --distribution sid \
+ --serial-console-command "/sbin/getty -L ttyS0 115200 vt100" \
+ --customize "cubietruck-customise.sh" \
+ --serial-console-command \
+ --bootsize 50m --boottype vfat \
+ "$@"
diff --git a/examples/lava.sh b/examples/lava.sh
new file mode 100644
index 0000000..06da069
--- /dev/null
+++ b/examples/lava.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+rootdir=$1
+
+cp auto-serial-console $rootdir/bin/
diff --git a/examples/vmdebootstrap.txt b/examples/vmdebootstrap.txt
new file mode 100644
index 0000000..941edc1
--- /dev/null
+++ b/examples/vmdebootstrap.txt
@@ -0,0 +1,47 @@
+
+# Run vmdebootstrap script to create image
+sudo \
+ vmdebootstrap \
+ --log ../log \
+ --log-level debug \
+ --size 3G \
+ --image $IMAGE.img \
+ --verbose \
+ --mirror $MIRROR \
+ --customize "$basedir/bin/freedombox-customize" \
+ --arch $ARCHITECTURE \
+ --distribution $SUITE \
+ $extra_opts \
+ $pkgopts
+
+Needs u-boot:armhf & linux-image-armmp:armhf in the image.
+
+sudo ./vmdebootstrap --image ../images/test.img \
+ --size 1g --owner $(whoami) --verbose \
+ --mirror http://mirror.bytemark.co.uk/debian \
+ --log ../images/test.log --log-level debug \
+ --arch armhf \
+ --foreign /usr/bin/qemu-arm-static \
+ --no-extlinux \
+ --no-kernel \
+ --package u-boot \
+ --package linux-image-armmp \
+ --distribution sid \
+ --bootsize 20m --boottype vfat
+
+# copy u-boot specific files
+
+# copy auto-serial-console to /bin/
+
+sudo vmdebootstrap \
+ --enable-dhcp \
+ --serial-console --serial-console-command='/bin/auto-serial-console' \
+ --root-password='root' \
+ --verbose \
+ "$@"
+
+sudo vmdebootstrap \
+ --enable-dhcp --no-kernel --package=linux-image-generic \
+ --serial-console --serial-console-command='/bin/auto-serial-console' \
+ --root-password='root' --hostname='ubuntu' --user=user/pass --sudo \
+ --verbose \