summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2011-12-08 16:10:42 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2011-12-09 08:29:47 +0000
commita3524bb914629fe0266aa261db41893e7d5122a0 (patch)
treecc2b0dc406a688e5cffcd0952835cf707899b51e
parentfe9a6ed7c27131aca7080f5a6233e3862ab0971a (diff)
downloadfhs-dirs-a3524bb914629fe0266aa261db41893e7d5122a0.tar.gz
Add terminal login support
Add more nodes to /dev and passwd,group,inittab to /etc add rcS, which mounts the contents of fstab Make the contents of fstab mount on startup This manually creates some device nodes that are needed for serial and virtual terminals, as well as the user and group information so that it is possible to log in as root. It may be more appropriate to create a new morph, as this is not strictly the fhs-dirs hierarchy, but at this stage that would require a new repository and the alteration of foundation to require that morph.
-rwxr-xr-xcreate-dev-nodes37
-rw-r--r--fhs-dirs.morph8
-rw-r--r--group1
-rw-r--r--inittab9
-rw-r--r--passwd1
-rw-r--r--rcS2
6 files changed, 56 insertions, 2 deletions
diff --git a/create-dev-nodes b/create-dev-nodes
new file mode 100755
index 0000000..1bef1ab
--- /dev/null
+++ b/create-dev-nodes
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Create FHS directories below a target directory.
+#
+# Copyright (C) 2011 Codethink Limited
+#
+# This program 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; version 2 of the License.
+#
+# 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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+set -e
+
+if [ "$#" != 1 ]
+then
+ echo "Error: must give target root directory as argument." 1>&2
+ exit 1
+fi
+
+DESTDIR=$1
+mknod -m 600 "$DESTDIR/dev/tty0" c 4 0
+mknod -m 600 "$DESTDIR/dev/tty1" c 4 1
+mknod -m 600 "$DESTDIR/dev/tty2" c 4 2
+mknod -m 600 "$DESTDIR/dev/tty3" c 4 3
+mknod -m 600 "$DESTDIR/dev/tty4" c 4 4
+mknod -m 600 "$DESTDIR/dev/ttyS0" c 4 64
+mknod -m 600 "$DESTDIR/dev/ttyS1" c 4 65
+mknod -m 600 "$DESTDIR/dev/console" c 5 1
+mknod -m 666 "$DESTDIR/dev/null" c 1 3
diff --git a/fhs-dirs.morph b/fhs-dirs.morph
index 792da16..99a9b87 100644
--- a/fhs-dirs.morph
+++ b/fhs-dirs.morph
@@ -4,8 +4,12 @@
"decription": "create the FHS 2.3 directory hierarchy (bootstrap edition)",
"install-commands": [
"./create-fhs-dirs \"$DESTDIR\"",
- "mknod -m 600 \"$DESTDIR/dev/console\" c 5 1",
- "mknod -m 666 \"$DESTDIR/dev/null\" c 1 3",
+ "./create-dev-nodes \"$DESTDIR\"",
+ "install passwd \"$DESTDIR/etc/passwd\"",
+ "install inittab \"$DESTDIR/etc/inittab\"",
+ "install group \"$DESTDIR/etc/group\"",
+ "install -d \"$DESTDIR/etc/init.d\"",
+ "install -m 744 rcS \"$DESTDIR/etc/init.d/rcS\"",
"echo baserock > \"$DESTDIR\"/etc/hostname"
]
}
diff --git a/group b/group
new file mode 100644
index 0000000..1dbf901
--- /dev/null
+++ b/group
@@ -0,0 +1 @@
+root:x:0:
diff --git a/inittab b/inittab
new file mode 100644
index 0000000..e82529a
--- /dev/null
+++ b/inittab
@@ -0,0 +1,9 @@
+::sysinit:/etc/init.d/rcS
+
+::askfirst:/bin/sh
+::respawn:/sbin/getty -L ttyS0 9600 vt100
+
+::ctrlaltdel:/sbin/reboot
+::shutdown:/sbin/swapoff -a
+::shutdown:/bin/umount -a -r
+::restart:/sbin/init
diff --git a/passwd b/passwd
new file mode 100644
index 0000000..1027b96
--- /dev/null
+++ b/passwd
@@ -0,0 +1 @@
+root::0:0:Super user:/:/bin/sh
diff --git a/rcS b/rcS
new file mode 100644
index 0000000..7e06844
--- /dev/null
+++ b/rcS
@@ -0,0 +1,2 @@
+#!/bin/sh
+mount -a #mount everything in fstab