From a3524bb914629fe0266aa261db41893e7d5122a0 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 8 Dec 2011 16:10:42 +0000 Subject: 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. --- create-dev-nodes | 37 +++++++++++++++++++++++++++++++++++++ fhs-dirs.morph | 8 ++++++-- group | 1 + inittab | 9 +++++++++ passwd | 1 + rcS | 2 ++ 6 files changed, 56 insertions(+), 2 deletions(-) create mode 100755 create-dev-nodes create mode 100644 group create mode 100644 inittab create mode 100644 passwd create mode 100644 rcS 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 -- cgit v1.2.1