summaryrefslogtreecommitdiff
path: root/i
diff options
context:
space:
mode:
authordufourj2006-01-30 23:04:52 +0000
committerdufourj2006-01-30 23:04:52 +0000
commitdbffb2d3ecfa4483099e8e888f1541706d5bd54d (patch)
tree510cbf8d0f746891c8c2e2d0c4ece8900b72d5ce /i
parentbabbeb8dfe6083ae08e61d0624c9eb7b62b8eeb8 (diff)
PC104:
- passage en init plutôt que linuxrc - enfin un mécanisme qui marchotte pour chrooter sur le système réel et rebooter proprement.
Diffstat (limited to 'i')
-rw-r--r--i/pc104/initrd/conf/busybox/config10
-rw-r--r--i/pc104/initrd/conf/fstab2
-rw-r--r--i/pc104/initrd/conf/inittab90
-rwxr-xr-xi/pc104/initrd/conf/rcS (renamed from i/pc104/initrd/conf/linuxrc)12
-rwxr-xr-xi/pc104/initrd/conf/update_initrd.sh18
-rwxr-xr-xi/pc104/initrd/create.sh19
6 files changed, 122 insertions, 29 deletions
diff --git a/i/pc104/initrd/conf/busybox/config b/i/pc104/initrd/conf/busybox/config
index 8aeee0f..28d373d 100644
--- a/i/pc104/initrd/conf/busybox/config
+++ b/i/pc104/initrd/conf/busybox/config
@@ -252,8 +252,8 @@ CONFIG_TRUE=y
#
# Init Utilities
#
-# CONFIG_INIT is not set
-# CONFIG_FEATURE_USE_INITTAB is not set
+CONFIG_INIT=y
+CONFIG_FEATURE_USE_INITTAB=y
# CONFIG_FEATURE_INITRD is not set
# CONFIG_FEATURE_INIT_COREDUMPS is not set
# CONFIG_FEATURE_INIT_SCTTY is not set
@@ -447,12 +447,12 @@ CONFIG_UDHCPC=y
# CONFIG_PIDOF is not set
# CONFIG_FEATURE_PIDOF_SINGLE is not set
# CONFIG_FEATURE_PIDOF_OMIT is not set
-# CONFIG_PS is not set
+CONFIG_PS=y
# CONFIG_FEATURE_PS_WIDE is not set
# CONFIG_RENICE is not set
# CONFIG_BB_SYSCTL is not set
-CONFIG_TOP=y
-CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
+# CONFIG_TOP is not set
+# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set
# CONFIG_UPTIME is not set
#
diff --git a/i/pc104/initrd/conf/fstab b/i/pc104/initrd/conf/fstab
index 929b4c7..431cd74 100644
--- a/i/pc104/initrd/conf/fstab
+++ b/i/pc104/initrd/conf/fstab
@@ -2,4 +2,4 @@
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
-/dev/hda1 /mnt/localsys ext2 defaults,ro 0 0
+/dev/hda1 /mnt/localsys ext2 ro 0 0
diff --git a/i/pc104/initrd/conf/inittab b/i/pc104/initrd/conf/inittab
new file mode 100644
index 0000000..e45a89a
--- /dev/null
+++ b/i/pc104/initrd/conf/inittab
@@ -0,0 +1,90 @@
+# /etc/inittab init(8) configuration for BusyBox
+# {{{ Busybox documentation for inittab
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+#
+#
+# Note, BusyBox init doesn't support runlevels. The runlevels field is
+# completely ignored by BusyBox init. If you want runlevels, use sysvinit.
+#
+#
+# Format for each entry: <id>:<runlevels>:<action>:<process>
+#
+# <id>: WARNING: This field has a non-traditional meaning for BusyBox init!
+#
+# The id field is used by BusyBox init to specify the controlling tty for
+# the specified process to run on. The contents of this field are
+# appended to "/dev/" and used as-is. There is no need for this field to
+# be unique, although if it isn't you may have strange results. If this
+# field is left blank, it is completely ignored. Also note that if
+# BusyBox detects that a serial console is in use, then all entries
+# containing non-empty id fields will _not_ be run. BusyBox init does
+# nothing with utmp. We don't need no stinkin' utmp.
+#
+# <runlevels>: The runlevels field is completely ignored.
+#
+# <action>: Valid actions include: sysinit, respawn, askfirst, wait, once,
+# restart, ctrlaltdel, and shutdown.
+#
+# Note: askfirst acts just like respawn, but before running the specified
+# process it displays the line "Please press Enter to activate this
+# console." and then waits for the user to press enter before starting
+# the specified process.
+#
+# Note: unrecognised actions (like initdefault) will cause init to emit
+# an error message, and then go along with its business.
+#
+# <process>: Specifies the process to be executed and it's command line.
+#
+# Note: BusyBox init works just fine without an inittab. If no inittab is
+# found, it has the following default behavior:
+# ::sysinit:/etc/init.d/rcS
+# ::askfirst:/bin/sh
+# ::ctrlaltdel:/sbin/reboot
+# ::shutdown:/sbin/swapoff -a
+# ::shutdown:/bin/umount -a -r
+# ::restart:/sbin/init
+#
+# if it detects that /dev/console is _not_ a serial console, it will
+# also run:
+# tty2::askfirst:/bin/sh
+# tty3::askfirst:/bin/sh
+# tty4::askfirst:/bin/sh
+#
+# Boot-time system configuration/initialization script.
+# This is run first except when booting in single-user mode.
+# }}}
+::sysinit:/etc/init.d/rcS
+
+# /bin/sh invocations on selected ttys
+#
+# Note below that we prefix the shell commands with a "-" to indicate to the
+# shell that it is supposed to be a login shell. Normally this is handled by
+# login, but since we are bypassing login in this case, BusyBox lets you do
+# this yourself...
+#
+# Start an "askfirst" shell on the console (whatever that may be)
+::askfirst:-/bin/sh
+# Start an "askfirst" shell on /dev/tty2-4
+tty2::askfirst:-/bin/sh
+#tty3::askfirst:-/bin/sh
+#tty4::askfirst:-/bin/sh
+
+# /sbin/getty invocations for selected ttys
+#tty4::respawn:/sbin/getty 38400 tty5
+#tty5::respawn:/sbin/getty 38400 tty6
+
+# Example of how to put a getty on a serial line (for a terminal)
+#::respawn:/sbin/getty -L ttyS0 9600 vt100
+#::respawn:/sbin/getty -L ttyS1 9600 vt100
+#
+# Example how to put a getty on a modem line.
+#::respawn:/sbin/getty 57600 ttyS2
+
+# Stuff to do when restarting the init process
+::restart:/sbin/init
+
+# Stuff to do before rebooting
+::ctrlaltdel:/sbin/reboot
+::shutdown:/bin/umount -a -r
+#::shutdown:/sbin/swapoff -a
+
diff --git a/i/pc104/initrd/conf/linuxrc b/i/pc104/initrd/conf/rcS
index 6ddf919..2b1b486 100755
--- a/i/pc104/initrd/conf/linuxrc
+++ b/i/pc104/initrd/conf/rcS
@@ -1,7 +1,8 @@
#!/bin/sh
-# Executed in autonomous mode for the matchs
+# /etc/init.d/rcS
+# Executed in autonomous mode for the matchs.
-# Mount tmp fs
+# Mount proc fs
mount /proc
# Try to to tell people we have booted !
@@ -11,13 +12,8 @@ mount /proc
#done
# Launch update script in background
-./etc/update_initrd.sh &
+./etc/robot/update_initrd.sh &
# TODO Export variables (LD...)
# Launch the program
# . /robot/start.sh
-#
-#while true
-#do
-# /bin/sh
-#done
diff --git a/i/pc104/initrd/conf/update_initrd.sh b/i/pc104/initrd/conf/update_initrd.sh
index b06057c..4a76956 100755
--- a/i/pc104/initrd/conf/update_initrd.sh
+++ b/i/pc104/initrd/conf/update_initrd.sh
@@ -10,7 +10,8 @@ ifconfig eth0 up
# Get the configuration of the network via dhcp
udhcpc -i eth0 -s /etc/udhcpc.script
# Wait here for a connection. I do not know if it is a feature or a bug, but
-# when nc receive a connection, it is end here.
+# when nc receive a connection, it is end here. Maybe it is because of the
+# missing library (warmed by gcc at compiled time)
nc -l -p 1234
# Mount the real system
@@ -19,15 +20,18 @@ mount /mnt/localsys
# XXX It is a good idea to pivot_root ? Chroot is better ?
cd /mnt/localsys
pivot_root . old_root
-exec chroot . sh <dev/console >dev/console 2>&1
+# FIXME: I do not sure this is the good solution... Why make a exec and a
+# chroot ? I am not sure it is a good idea...
+exec chroot . sh -c '/etc/init.d/mountvirtfs; /etc/init.d/ssh start;' \
+<dev/console >dev/console 2>&1
# This part sux : what's about the old process ?
# Kill them ?
-umount /old_root
+#umount /old_root
# We should call all the script
# TODO : find a better way to call it.
-/etc/init.d/mountvirtfs start
-/etc/init.d/mountall.sh start
-/etc/init.d/networking start
-/etc/init.d/ssh start
+#/etc/init.d/mountvirtfs start
+##/etc/init.d/mountall.sh start
+#/etc/init.d/networking start
+#/etc/init.d/ssh start
# XXX And for the end ?
# The FS has enough errors so do it well ! Umount everything !
diff --git a/i/pc104/initrd/create.sh b/i/pc104/initrd/create.sh
index 9bca54b..e6cc64f 100755
--- a/i/pc104/initrd/create.sh
+++ b/i/pc104/initrd/create.sh
@@ -50,17 +50,19 @@ mount_initrd ()
create_empty_struct ()
{
# Create an empty root structure
- mkdir -p $INITRD_TEMPDIR/{bin,dev,etc,proc,sbin,usr/{sbin,bin},var/lock,robot,initrd,mnt/localsys}
+ mkdir -p $INITRD_TEMPDIR/{bin,dev,etc/{robot,init.d},proc,sbin,usr/{sbin,bin},var/lock,robot,initrd,mnt/localsys}
# Create all the devices files we need
create_dev
+ # Install the inittab
+ install -m 644 $INITRD_CONFIG_DIR/inittab $INITRD_TEMPDIR/etc/inittab
+ # Copy the rcS script
+ install -m 755 $INITRD_CONFIG_DIR/rcS $INITRD_TEMPDIR/etc/init.d/rcS
# Fstab
install -m 644 $INITRD_CONFIG_DIR/fstab $INITRD_TEMPDIR/etc/fstab
+ # Copy the update script for autonome mode
+ install -m 755 $INITRD_CONFIG_DIR/update_initrd.sh $INITRD_TEMPDIR/etc/robot/update_initrd.sh
# Udhcpc script
install -m 755 $INITRD_CONFIG_DIR/udhcpc.script $INITRD_TEMPDIR/etc/udhcpc.script
- # Copy the linuxrc script
- install -m 755 $INITRD_CONFIG_DIR/linuxrc $INITRD_TEMPDIR/linuxrc
- # Copy the update script for autonome mode
- install -m 755 $INITRD_CONFIG_DIR/update_initrd.sh $INITRD_TEMPDIR/etc/update_initrd.sh
}
create_dev ()
@@ -72,13 +74,14 @@ create_dev ()
cd $INITRD_TEMPDIR/dev
# Create device
$makedev -v std
- # Create the console for logging ? Useful ? XXX
- $makedev -v consoleonly
- #tty1 tty2 tty3 tty4 tty5
+ # Create the console for logging ?
+ $makedev -v consoleonly tty1 tty2 tty5 # tty5 -> log
# Serial
$makedev -v ttyS0 ttyS1 ttyS2
# Hard disk
$makedev -v hda
+ # For initrd
+ #mknod -m 600 initctl p
# XXX Complete...
# Back to the originated directory
cd $cur_dir