]> spindle.queued.net Git - xodist/blobdiff - mkbootable.sh
debxo-sugar: update packages for squeeze
[xodist] / mkbootable.sh
index e1b53bfb36d0f9956827c617b71d4d9ba7aac71e..03cff0df98abc57842fdcb6513674804a11ab8ce 100755 (executable)
@@ -1,11 +1,39 @@
-#!/bin/sh
+#!/bin/bash
+#
+# mkbootable.sh, make a bootable file set from a jffs2 image
+# Copyright © 2008  James Cameron <quozl@laptop.org>
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# Using an image produced by mkjffs2.sh,
+# produces a tree of files suitable for erasing and loading an XO,
+# typical usage is to mount USB storage and then populate the storage,
+# for example:
+#
+# mount /dev/sdz1 /mnt
+# ./mkbootable --output /mnt gnome
+# umount /mnt
+
 set -e
 
 IMAGE_DEFAULT=
 INTERACTIVE=yes
 OUTPUT=${IMAGE_DEFAULT}.bootable
 
-. functions.sh
+. ./functions.sh
 
 images()
 {
@@ -73,7 +101,7 @@ if ! test -d ${OUTPUT}; then
        mkdir ${OUTPUT}
 fi
 
-cp ${IMAGE}.{dat,crc,img} ${OUTPUT}
+cp ${IMAGE}.{dat,img} ${OUTPUT}
 
 mkdir -p ${OUTPUT}/boot
 
@@ -81,12 +109,14 @@ mkdir -p ${OUTPUT}/boot
 cat <<EOF >${OUTPUT}/boot/olpc.fth
 \ OLPC boot script
 
+visible
+clear-screen
 cr
-." This is a debxo bootable install script." cr
+." This is a xodist bootable install script for the OLPC XO-1." cr
 cr
-." `md5sum ${IMAGE}.img`" cr
-." `md5sum ${IMAGE}.dat`" cr
-." `md5sum ${IMAGE}.crc`" cr
+." Checksums:" cr
+."     `md5sum ${IMAGE}.img`" cr
+."     `md5sum ${IMAGE}.dat`" cr
 cr
 EOF
 
@@ -96,18 +126,20 @@ case $INTERACTIVE in
                cat <<EOF >>${OUTPUT}/boot/olpc.fth
 
 \ --no-interactive was used, so we do not prompt
-." Erasing everything here and installing debxo ${IMAGE}" cr
+." Erasing everything here and installing ${IMAGE}" cr
 EOF
                ;;
        yes|*)
                cat <<EOF >>${OUTPUT}/boot/olpc.fth
 
 \ --interactive was used, so we prompt before erasing
-." Power off to abort, or" cr
-." press Enter to erase everything here and install debxo ${IMAGE} ?"
-begin
-    key d =
-until
+." Type yes then enter to erase everything here and install ${IMAGE} ? "
+cursor-on
+key  lcc  dup emit  ascii y = not  [if] cr abort [then]
+key  lcc  dup emit  ascii e = not  [if] cr abort [then]
+key  lcc  dup emit  ascii s = not  [if] cr abort [then]
+key       dup emit  d       = not  [if] cr abort [then]
+
 EOF
                ;;
 esac
@@ -118,10 +150,13 @@ cr
 ." Starting"
 
 \ erase the NAND flash and fill it with the image
-update-nand u:\\${IMAGE}.img
-
 \ boot from the NAND flash
-boot n:\boot\olpc.fth
+: update-and-boot
+  " update-nand u:\\${IMAGE}.img" evaluate
+  " boot n:\boot\olpc.fth" evaluate
+;
+
+update-and-boot
 EOF
 
 # TODO: avoid reflashing if already flashed