From: Andres Salomon Date: Sat, 30 May 2009 00:13:25 +0000 (-0400) Subject: mkext3/mkjffs2: rework fstab/olpc.fth file generation during image creation X-Git-Tag: v0.6~56 X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=327c21cdf7408afb43afb62b6cc7dda9806a540d;p=xodist mkext3/mkjffs2: rework fstab/olpc.fth file generation during image creation Rather than creating them from a script, copy them out of configs/*. This will also let us specify the partition layout in the fstab files. Signed-off-by: Andres Salomon --- diff --git a/configs/debian-lenny-i386/fstab-ext3 b/configs/debian-lenny-i386/fstab-ext3 new file mode 100644 index 0000000..b1fdd0f --- /dev/null +++ b/configs/debian-lenny-i386/fstab-ext3 @@ -0,0 +1,6 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +LABEL=Boot /boot ext3 defaults 0 2 # 50 +LABEL=Root / ext3 errors=remount-ro 0 1 # 400 diff --git a/configs/debxo-awesome/fstab-ext3 b/configs/debxo-awesome/fstab-ext3 new file mode 100644 index 0000000..0d7b766 --- /dev/null +++ b/configs/debxo-awesome/fstab-ext3 @@ -0,0 +1,7 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024 +none /ofw promfs defaults 0 0 +tmpfs /var/cache/apt/cache tmpfs defaults 0 0 diff --git a/configs/debxo-awesome/fstab-jffs2 b/configs/debxo-awesome/fstab-jffs2 new file mode 100644 index 0000000..8b43fa1 --- /dev/null +++ b/configs/debxo-awesome/fstab-jffs2 @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/debxo-awesome/olpc.fth-ext3 b/configs/debxo-awesome/olpc.fth-ext3 new file mode 100644 index 0000000..58a5fec --- /dev/null +++ b/configs/debxo-awesome/olpc.fth-ext3 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-awesome/olpc.fth-jffs2 b/configs/debxo-awesome/olpc.fth-jffs2 new file mode 100644 index 0000000..d338716 --- /dev/null +++ b/configs/debxo-awesome/olpc.fth-jffs2 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-gnome/fstab-ext3 b/configs/debxo-gnome/fstab-ext3 new file mode 100644 index 0000000..d4a99fe --- /dev/null +++ b/configs/debxo-gnome/fstab-ext3 @@ -0,0 +1,7 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/debxo-gnome/fstab-jffs2 b/configs/debxo-gnome/fstab-jffs2 new file mode 100644 index 0000000..8b43fa1 --- /dev/null +++ b/configs/debxo-gnome/fstab-jffs2 @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/debxo-gnome/olpc.fth-ext3 b/configs/debxo-gnome/olpc.fth-ext3 new file mode 100644 index 0000000..58a5fec --- /dev/null +++ b/configs/debxo-gnome/olpc.fth-ext3 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-gnome/olpc.fth-jffs2 b/configs/debxo-gnome/olpc.fth-jffs2 new file mode 100644 index 0000000..d338716 --- /dev/null +++ b/configs/debxo-gnome/olpc.fth-jffs2 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-kde/fstab-ext3 b/configs/debxo-kde/fstab-ext3 new file mode 100644 index 0000000..0d7b766 --- /dev/null +++ b/configs/debxo-kde/fstab-ext3 @@ -0,0 +1,7 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024 +none /ofw promfs defaults 0 0 +tmpfs /var/cache/apt/cache tmpfs defaults 0 0 diff --git a/configs/debxo-kde/fstab-jffs2 b/configs/debxo-kde/fstab-jffs2 new file mode 100644 index 0000000..8b43fa1 --- /dev/null +++ b/configs/debxo-kde/fstab-jffs2 @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/debxo-kde/olpc.fth-ext3 b/configs/debxo-kde/olpc.fth-ext3 new file mode 100644 index 0000000..58a5fec --- /dev/null +++ b/configs/debxo-kde/olpc.fth-ext3 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-kde/olpc.fth-jffs2 b/configs/debxo-kde/olpc.fth-jffs2 new file mode 100644 index 0000000..d338716 --- /dev/null +++ b/configs/debxo-kde/olpc.fth-jffs2 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-lxde/fstab-ext3 b/configs/debxo-lxde/fstab-ext3 new file mode 100644 index 0000000..0d7b766 --- /dev/null +++ b/configs/debxo-lxde/fstab-ext3 @@ -0,0 +1,7 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024 +none /ofw promfs defaults 0 0 +tmpfs /var/cache/apt/cache tmpfs defaults 0 0 diff --git a/configs/debxo-lxde/fstab-jffs2 b/configs/debxo-lxde/fstab-jffs2 new file mode 100644 index 0000000..8b43fa1 --- /dev/null +++ b/configs/debxo-lxde/fstab-jffs2 @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/debxo-lxde/olpc.fth-ext3 b/configs/debxo-lxde/olpc.fth-ext3 new file mode 100644 index 0000000..58a5fec --- /dev/null +++ b/configs/debxo-lxde/olpc.fth-ext3 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-lxde/olpc.fth-jffs2 b/configs/debxo-lxde/olpc.fth-jffs2 new file mode 100644 index 0000000..d338716 --- /dev/null +++ b/configs/debxo-lxde/olpc.fth-jffs2 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-sugar/fstab-ext3 b/configs/debxo-sugar/fstab-ext3 new file mode 100644 index 0000000..0d7b766 --- /dev/null +++ b/configs/debxo-sugar/fstab-ext3 @@ -0,0 +1,7 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024 +none /ofw promfs defaults 0 0 +tmpfs /var/cache/apt/cache tmpfs defaults 0 0 diff --git a/configs/debxo-sugar/fstab-jffs2 b/configs/debxo-sugar/fstab-jffs2 new file mode 100644 index 0000000..8b43fa1 --- /dev/null +++ b/configs/debxo-sugar/fstab-jffs2 @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/debxo-sugar/olpc.fth-ext3 b/configs/debxo-sugar/olpc.fth-ext3 new file mode 100644 index 0000000..58a5fec --- /dev/null +++ b/configs/debxo-sugar/olpc.fth-ext3 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-sugar/olpc.fth-jffs2 b/configs/debxo-sugar/olpc.fth-jffs2 new file mode 100644 index 0000000..d338716 --- /dev/null +++ b/configs/debxo-sugar/olpc.fth-jffs2 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-xfce/fstab-ext3 b/configs/debxo-xfce/fstab-ext3 new file mode 100644 index 0000000..0d7b766 --- /dev/null +++ b/configs/debxo-xfce/fstab-ext3 @@ -0,0 +1,7 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +LABEL=DebXO / ext3 errors=remount-ro 0 1 # 1024 +none /ofw promfs defaults 0 0 +tmpfs /var/cache/apt/cache tmpfs defaults 0 0 diff --git a/configs/debxo-xfce/fstab-jffs2 b/configs/debxo-xfce/fstab-jffs2 new file mode 100644 index 0000000..8b43fa1 --- /dev/null +++ b/configs/debxo-xfce/fstab-jffs2 @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/debxo-xfce/olpc.fth-ext3 b/configs/debxo-xfce/olpc.fth-ext3 new file mode 100644 index 0000000..58a5fec --- /dev/null +++ b/configs/debxo-xfce/olpc.fth-ext3 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/debxo-xfce/olpc.fth-jffs2 b/configs/debxo-xfce/olpc.fth-jffs2 new file mode 100644 index 0000000..d338716 --- /dev/null +++ b/configs/debxo-xfce/olpc.fth-jffs2 @@ -0,0 +1,25 @@ +\ 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 diff --git a/configs/generic/fstab-ext3 b/configs/generic/fstab-ext3 new file mode 100644 index 0000000..3da3ce5 --- /dev/null +++ b/configs/generic/fstab-ext3 @@ -0,0 +1,9 @@ +# Default fstab for ext3 images - copy & customize this for a new image build + +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +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 diff --git a/configs/generic/fstab-jffs2 b/configs/generic/fstab-jffs2 new file mode 100644 index 0000000..885da99 --- /dev/null +++ b/configs/generic/fstab-jffs2 @@ -0,0 +1,8 @@ +# Default fstab for jffs2 images - copy & customize this for a new image build + +# /etc/fstab: static file system information +# +# +proc /proc proc defaults 0 0 # +mtd:root / jffs2 defaults,noatime 0 0 # 50 +mtd:boot /boot jffs2 defaults,noatime 0 0 # diff --git a/functions.sh b/functions.sh index 82e0556..8e2b34c 100644 --- a/functions.sh +++ b/functions.sh @@ -28,75 +28,6 @@ check_for_cmds() 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<${mntpt}/boot/olpc.fth< +# Copyright © 2008-2009 Andres Salomon # # 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 @@ -23,6 +23,8 @@ ROOT_DIR="" . ./functions.sh +CONFIG_TYPE=generic + # @img - fs image to attach loop device to # @offset - if the image is partitioned, the offset to attach at # @@ -149,7 +151,6 @@ mk_ext3_fs() # 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" } @@ -162,6 +163,7 @@ usage() echo "Options:" 1>&2 echo " -l