3 # Copyright © 2008 Andres Salomon <dilinger@queued.net>
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 which $cmd >/dev/null || {
23 echo "Missing required command '$cmd'!" 1>&2
31 # @mntpt - path to mounted root directory
32 # @fstype - the root filesystem type (in a form that 'mount' understands)
38 if [ "${fstype}" = "jffs2" ]; then
41 r="LABEL=${IMG_LABEL}"
44 echo "${r} / ${fstype} defaults,noatime 1 1" >${mntpt}/etc/fstab
45 if [ "${fstype}" = "jffs2" ]; then
46 echo "mtd:boot /boot jffs2 defaults,noatime 1 1" >>${mntpt}/etc/fstab
49 cat >>${mntpt}/etc/fstab<<EOF
50 devpts /dev/pts devpts gid=5,mode=620 0 0
51 tmpfs /dev/shm tmpfs defaults,size=15% 0 0
52 proc /proc proc defaults 0 0
53 sysfs /sys sysfs defaults 0 0
54 none /ofw promfs defaults 0 0
55 tmpfs /var/cache/apt/cache tmpfs defaults 0 0
59 # @mntpt - path to mounted root directory
60 # @fstype - the root filesystem type (in a form that 'mount' understands)
66 if [ "${fstype}" = "jffs2" ]; then
68 rfs="rootfstype=jffs2"
70 r="LABEL=${IMG_LABEL}"
74 cat >${mntpt}/boot/olpc.fth<<EOF
77 \\ fetch the /chosen/bootpath property
78 " /chosen" find-package if ( phandle )
79 " bootpath" rot get-package-property 0= if ( propval\$ )
80 get-encoded-string ( bootpath\$ )
81 [char] \ left-parse-string 2nip ( dn\$ )
83 \ store the first part of bootpath (up to the '\\') in \$DN
88 " ro root=${r} ${rfs} video=lxfb fbcon=font:SUN12x22" to boot-file
89 game-key-mask h# 80 and if
90 \\ boot from backup kernel
91 " \${DN}\\vmlinuz.old" expand\$ to boot-device
92 " \${DN}\\initrd.img.old" expand\$ to ramdisk
94 \\ boot from regular kernel
95 " \${DN}\\vmlinuz" expand\$ to boot-device
96 " \${DN}\\initrd.img" expand\$ to ramdisk
102 chroot_internal_mounts()
105 mount -t proc proc ${root_dir}/proc
106 mount -t devpts devpts ${root_dir}/dev/pts
107 mount -t tmpfs tmpfs ${root_dir}/var/cache/apt/cache
110 chroot_internal_umounts()
113 umount ${root_dir}/proc
114 umount ${root_dir}/dev/pts
115 umount ${root_dir}/var/cache/apt/cache