From 453fbcec4ab1770daab88e0217b12dcfaa6a765b Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Mon, 25 Aug 2014 19:42:52 -0700 Subject: [PATCH] Add examples to go into /usr/share to make it easier to create pre-defined images. --- examples/README.txt | 27 +++++++++++++++ examples/auto-serial-console | 35 ++++++++++++++++++++ examples/beagleboneblack-customise.sh | 46 ++++++++++++++++++++++++++ examples/beagleboneblack.sh | 21 ++++++++++++ examples/cubietruck-customise.sh | 12 +++++++ examples/cubietruck.sh | 23 +++++++++++++ examples/lava.sh | 7 ++++ examples/vmdebootstrap.txt | 47 +++++++++++++++++++++++++++ 8 files changed, 218 insertions(+) create mode 100644 examples/README.txt create mode 100755 examples/auto-serial-console create mode 100755 examples/beagleboneblack-customise.sh create mode 100755 examples/beagleboneblack.sh create mode 100755 examples/cubietruck-customise.sh create mode 100755 examples/cubietruck.sh create mode 100644 examples/lava.sh create mode 100644 examples/vmdebootstrap.txt 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 <