--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=Boot /boot ext3 defaults 0 2 # 50
+LABEL=Root / ext3 errors=remount-ro 0 1 # 400
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+mtd:boot /boot jffs2 defaults,noatime 1 1 # 50
+mtd:root / jffs2 defaults,noatime 1 1
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=LABEL=DebXO video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=mtd:root rootfstype=jffs2 video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024
+none /ofw promfs defaults 0 0 #x
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+mtd:boot /boot jffs2 defaults,noatime 1 1 # 50
+mtd:root / jffs2 defaults,noatime 1 1
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=LABEL=DebXO video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=mtd:root rootfstype=jffs2 video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+mtd:boot /boot jffs2 defaults,noatime 1 1 # 50
+mtd:root / jffs2 defaults,noatime 1 1
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=LABEL=DebXO video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=mtd:root rootfstype=jffs2 video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+mtd:boot /boot jffs2 defaults,noatime 1 1 # 50
+mtd:root / jffs2 defaults,noatime 1 1
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=LABEL=DebXO video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=mtd:root rootfstype=jffs2 video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+mtd:boot /boot jffs2 defaults,noatime 1 1 # 50
+mtd:root / jffs2 defaults,noatime 1 1
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=LABEL=DebXO video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=mtd:root rootfstype=jffs2 video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+mtd:boot /boot jffs2 defaults,noatime 1 1 # 50
+mtd:root / jffs2 defaults,noatime 1 1
+none /ofw promfs defaults 0 0
+tmpfs /var/cache/apt/cache tmpfs defaults 0 0
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=LABEL=DebXO video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+\ OLPC boot script
+
+\ fetch the /chosen/bootpath property
+" /chosen" find-package if ( phandle )
+ " bootpath" rot get-package-property 0= if ( propval$ )
+ get-encoded-string ( bootpath$ )
+ [char] \ left-parse-string 2nip ( dn$ )
+
+ \ store the first part of bootpath (up to the '\') in $DN
+ dn-buf place ( )
+ then
+then
+
+" ro root=mtd:root rootfstype=jffs2 video=lxfb fbcon=font:SUN12x22" to boot-file
+game-key-mask h# 80 and if
+ \ boot from backup kernel
+ " ${DN}\vmlinuz.old" expand$ to boot-device
+ " ${DN}\initrd.img.old" expand$ to ramdisk
+else
+ \ boot from regular kernel
+ " ${DN}\vmlinuz" expand$ to boot-device
+ " ${DN}\initrd.img" expand$ to ramdisk
+then
+dcon-unfreeze
+boot
--- /dev/null
+# Default fstab for ext3 images - copy & customize this for a new image build
+
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+LABEL=Boot /boot ext3 defaults 0 2 # 50
+LABEL=Swap none swap sw 0 0 # 256
+LABEL=Root / ext3 errors=remount-ro 0 1 # 1024
--- /dev/null
+# Default fstab for jffs2 images - copy & customize this for a new image build
+
+# /etc/fstab: static file system information
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0 # <partition size in MB>
+mtd:root / jffs2 defaults,noatime 0 0 # 50
+mtd:boot /boot jffs2 defaults,noatime 0 0 #
return 0
}
-# @mntpt - path to mounted root directory
-# @fstype - the root filesystem type (in a form that 'mount' understands)
-create_fstab()
-{
- mntpt="$1"
- fstype="$2"
-
- if [ "${fstype}" = "jffs2" ]; then
- r=mtd:root
- else
- r="LABEL=${IMG_LABEL}"
- fi
-
- echo "${r} / ${fstype} defaults,noatime 1 1" >${mntpt}/etc/fstab
- if [ "${fstype}" = "jffs2" ]; then
- echo "mtd:boot /boot jffs2 defaults,noatime 1 1" >>${mntpt}/etc/fstab
- fi
-
- cat >>${mntpt}/etc/fstab<<EOF
-proc /proc proc defaults 0 0
-none /ofw promfs defaults 0 0
-tmpfs /var/cache/apt/cache tmpfs defaults 0 0
-EOF
-}
-
-# @mntpt - path to mounted root directory
-# @fstype - the root filesystem type (in a form that 'mount' understands)
-create_ofwboot()
-{
- mntpt="$1"
- fstype="$2"
-
- if [ "${fstype}" = "jffs2" ]; then
- r="mtd:root"
- rfs="rootfstype=jffs2"
- else
- r="LABEL=${IMG_LABEL}"
- rfs=""
- fi
-
- cat >${mntpt}/boot/olpc.fth<<EOF
-\\ OLPC boot script
-
-\\ fetch the /chosen/bootpath property
-" /chosen" find-package if ( phandle )
- " bootpath" rot get-package-property 0= if ( propval\$ )
- get-encoded-string ( bootpath\$ )
- [char] \ left-parse-string 2nip ( dn\$ )
-
- \ store the first part of bootpath (up to the '\\') in \$DN
- dn-buf place ( )
- then
-then
-
-" ro root=${r} ${rfs} video=lxfb fbcon=font:SUN12x22" to boot-file
-game-key-mask h# 80 and if
- \\ boot from backup kernel
- " \${DN}\\vmlinuz.old" expand\$ to boot-device
- " \${DN}\\initrd.img.old" expand\$ to ramdisk
-else
- \\ boot from regular kernel
- " \${DN}\\vmlinuz" expand\$ to boot-device
- " \${DN}\\initrd.img" expand\$ to ramdisk
-then
-dcon-unfreeze
-boot
-EOF
-}
-
start_logging()
{
logpipe="$1".pipe
#!/bin/bash -e
#
-# Copyright © 2008 Andres Salomon <dilinger@queued.net>
+# Copyright © 2008-2009 Andres Salomon <dilinger@collabora.co.uk>
#
# 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
. ./functions.sh
+CONFIG_TYPE=generic
+
# @img - fs image to attach loop device to
# @offset - if the image is partitioned, the offset to attach at
#
# populate the filesystem
mk_mount "$img" "ext3" "$partition_start"
cp -ra "$root_dir"/* "$MOUNT_POINT" || true
- create_fstab "$MOUNT_POINT" "ext3"
grub_install "$img" "$MOUNT_POINT"
rm_mount "$MOUNT_POINT"
}
echo "Options:" 1>&2
echo " -l <label> Image label" 1>&2
echo " -s <size> Root filesystem size (in MB)" 1>&2
+ echo " --config-type <config> directory name in configs/ to use" 1>&2
echo "" 1>&2
exit 1
}
while test $# != 0
do
case $1 in
+ --config-type)
+ CONFIG_TYPE=$2
+ [ -d ./configs/${CONFIG_TYPE} ] || {
+ echo "Error: can't find directory './configs/${CONFIG_TYPE}/'!" 1>&2
+ exit 2
+ }
+ shift
+ ;;
-l)
IMG_LABEL=$2
shift
fi
check_for_cmds losetup parted mke2fs tune2fs grub || exit 1
-create_fstab ${ROOT_DIR} ext3
-create_ofwboot ${ROOT_DIR} ext3
+
+# create image's /etc/fstab
+if [ ! -f ./configs/${CONFIG_TYPE}/fstab-ext3 ]; then
+ echo "*** Unable to find fstab-ext3!" 1>&2
+ exit 1
+fi
+sed 's/[[:space:]]#.*//' ./configs/${CONFIG_TYPE}/fstab-ext3 > ${ROOT_DIR}/etc/fstab
+
+# TODO: this needs to go into an OFW package; here it's a hack
+# create image's /boot/olpc.fth
+if [ -f ./configs/${CONFIG_TYPE}/olpc.fth-ext3 ]; then
+ cp ./configs/${CONFIG_TYPE}/olpc.fth-ext3 ${ROOT_DIR}/boot/olpc.fth
+fi
create_bootable_img ${IMG_NAME} ${ROOT_SIZE}
mk_ext3_fs ${IMG_NAME} ${IMG_LABEL} ${ROOT_DIR}
#!/bin/bash -e
#
-# Copyright © 2008 Andres Salomon <dilinger@queued.net>
+# Copyright © 2008-2009 Andres Salomon <dilinger@collabora.co.uk>
#
# 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
. ./functions.sh
+CONFIG_TYPE=generic
+
usage()
{
echo "" 1>&2
- echo "Usage: $0 <root directory> <img>" 1>&2
+ echo "Usage: $0 [<options>] <root directory> <img>" 1>&2
+ echo "" 1>&2
+ echo "Options:" 1>&2
+ echo " --config-type <config> directory name in configs/ to use" 1>&2
echo "" 1>&2
exit 1
}
-if [ "$#" != "2" ]; then
- usage
-fi
-
-ROOT_DIR=$1
-IMG_NAME=$2
+while test $# != 0
+do
+ case $1 in
+ --config-type)
+ CONFIG_TYPE=$2
+ [ -d ./configs/${CONFIG_TYPE} ] || {
+ echo "Error: can't find directory './configs/${CONFIG_TYPE}/'!" 1>&2
+ exit 2
+ }
+ shift
+ ;;
+ *)
+ if [ "$#" != "2" ]; then
+ echo "Unknown option $1" 1>&2
+ usage
+ else
+ ROOT_DIR=$1
+ IMG_NAME=$2
+ shift
+ fi
+ ;;
+ esac
+ shift
+done
if [ "${IMG_NAME}" == "${IMG_NAME/.img/.dat}" ]; then
DAT_NAME=${IMG_NAME}.dat
fi
check_for_cmds mkfs.jffs2 sumtool || exit 1
-create_fstab ${ROOT_DIR} jffs2
-create_ofwboot ${ROOT_DIR} jffs2
+
+# create image's /etc/fstab
+if [ ! -f ./configs/${CONFIG_TYPE}/fstab-jffs2 ]; then
+ echo "*** Unable to find fstab-jffs2!" 1>&2
+ exit 1
+fi
+sed 's/[[:space:]]#.*//' ./configs/${CONFIG_TYPE}/fstab-jffs2 > ${ROOT_DIR}/etc/fstab
+
+# TODO: this needs to go into an OFW package; here it's a hack
+# create image's /boot/olpc.fth
+if [ -f ./configs/${CONFIG_TYPE}/olpc.fth-jffs2 ]; then
+ cp ./configs/${CONFIG_TYPE}/olpc.fth-jffs2 ${ROOT_DIR}/boot/olpc.fth
+fi
create_jffs2()
{