Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bootable-tree-to-xo.sh
blob: c105c4328b87b012bb4865ff832227638844927a (plain)
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
#!/bin/bash

set -x
set -e

PATH=/sbin:/usr/sbin:$PATH

cleanup() {
    [ -d "$TMP_MNT" ] && rm -rf $TMP_MNT
}

exitclean() {
    echo "Cleaning up to exit..."
    cleanup
    exit 1
}

trap exitclean SIGINT SIGTERM


echo "Build jffs2 image $IMG"

ROOT=$1
IMG=${2:-${ROOT}.img}

TMP_MNT=$(mktemp -d ./jffs2.XXXXXX)

chmod a+rx $TMP_MNT/.

cp -al $ROOT/* $TMP_MNT

echo "(removing livesys scripts from image because they'll really foul it up if they run)"
rm -f $TMP_MNT/etc/init.d/livesys*

mkfs.jffs2 -n -e128KiB -r $TMP_MNT -o $IMG.tmp
sumtool -n -p -e 128KiB -i $IMG.tmp -o $IMG
rm $IMG.tmp
crcimg $IMG

echo "Done building jffs2 image $IMG"
cleanup