]> spindle.queued.net Git - xodist/blobdiff - mkext3.sh
add xterm for erikg
[xodist] / mkext3.sh
index d08485eb9ac5d785e95e4fdb5c94b7f7ab21dce1..4a53ab9506022c9f7d4287c9deb8dae015337a53 100755 (executable)
--- a/mkext3.sh
+++ b/mkext3.sh
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-IMG_NAME="DebOLPC"
-ROOT_SIZE="512"
-IMG_LABEL="DebOLPC"
+ROOT_SIZE="2048"
+IMG_LABEL="DebXO"
+IMG_NAME=""
 ROOT_DIR=""
-CRCIMG="./crcimg.pl"
 
 . functions.sh
 
@@ -79,7 +78,7 @@ rm_mount()
 
 # @img - image name to create
 # @size - image size
-mk_bootable_img()
+create_bootable_img()
 {
        img="$1"
        size="$2"
@@ -113,7 +112,7 @@ color cyan/blue white/blue
 
 title          $IMG_LABEL
 root           (hd0,0)
-kernel         /bzImage root=LABEL=${IMG_LABEL} rootfstype=ext3 ro
+kernel         /vmlinuz root=LABEL=${IMG_LABEL} ro
 boot
 EOF
 
@@ -158,18 +157,15 @@ mk_ext3_fs()
 usage()
 {
        echo "" 1>&2
-       echo "Usage: $0 [<options>] <root directory>" 1>&2
+       echo "Usage: $0 [<options>] <root directory> <img>" 1>&2
        echo "" 1>&2
        echo "Options:" 1>&2
        echo "  -l <label>    Image label" 1>&2
-       echo "  -o <img>      Image (base) filename" 1>&2
        echo "  -s <size>     Root filesystem size (in MB)" 1>&2
        echo "" 1>&2
        exit 1
 }
 
-check_for_cmds losetup dd parted mke2fs tune2fs grub || exit 1
-
 while test $# != 0
 do
        case $1 in
@@ -177,46 +173,43 @@ do
                IMG_LABEL=$2
                shift
                ;;
-       -o)
-               IMG_NAME=$2
-               shift
-               ;;
        -s)
                ROOT_SIZE=$2
                shift
                ;;
        *)
-               if [ "$#" != "1" ]; then
-                       echo "Unknown option $1" 1>&2
-                       usage
-               else
-                       ROOT_DIR="$1"
+               ROOT_DIR="$1"
+               shift
+               if [ "$#" = "1" ]; then
+                       IMG_NAME="$1"
                fi
                ;;
        esac
        shift
 done
 
-if [ "$(id -u)" != "0" ]; then
-       echo "" 1>&2
-       echo "*** Error: must be run as root!" 1>&2
-       echo "" 1>&2
-       exit 2
-fi
-
 if [ "$ROOT_DIR" = "" ]; then
        echo "" 1>&2
        echo "*** No root directory specified!" 1>&2
        usage
 fi
+if [ "$IMG_NAME" = "" ]; then
+       echo "" 1>&2
+       echo "*** No image name specified!" 1>&2
+       usage
+fi
 if [ ! -d "$ROOT_DIR" ]; then
        echo "" 1>&2
        echo "*** Unable to find root directory!" 1>&2
        usage
 fi
 
-mk_bootable_img "${IMG_NAME}.ext3.img" "$ROOT_SIZE"
-mk_ext3_fs "${IMG_NAME}.ext3.img" "$IMG_LABEL" "$ROOT_DIR"
+check_for_cmds losetup parted mke2fs tune2fs grub || exit 1
+create_fstab ${ROOT_DIR} ext3
+create_ofwboot ${ROOT_DIR} ext3
+
+create_bootable_img ${IMG_NAME} ${ROOT_SIZE}
+mk_ext3_fs ${IMG_NAME} ${IMG_LABEL} ${ROOT_DIR}
 
 #mount ${IMG_NAME}.ext3 $MOUNT_POINT -o loop,offset=$OS_PART1_BEGIN -t ext3
 #cp -r "$ROOT_DIR"/* $MOUNT_POINT