summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/kconfig/rootfs/rootfs-config.kconfig59
-rw-r--r--core/kconfig/rootfs/rootfs.kconfig1
-rw-r--r--packages/system/openrc/etc/inittab.logging5
-rw-r--r--packages/system/openrc/etc/inittab.reboot6
-rw-r--r--packages/system/openrc/etc/inittab.runlevel8
-rw-r--r--packages/system/openrc/etc/inittab.tty3
-rw-r--r--packages/system/openrc/openrc.mk15
-rw-r--r--src/rootfs_skel/etc/inittab29
8 files changed, 114 insertions, 12 deletions
diff --git a/core/kconfig/rootfs/rootfs-config.kconfig b/core/kconfig/rootfs/rootfs-config.kconfig
new file mode 100644
index 0000000..f3f975a
--- /dev/null
+++ b/core/kconfig/rootfs/rootfs-config.kconfig
@@ -0,0 +1,59 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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, either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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, see <http://www.gnu.org/licenses/>.
+#
+################################################################################
+#
+# \file rootfs-config.kconfig
+# \brief Various RootFS configuration parameters
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date April 2014
+################################################################################
+
+
+menu "Root filesystem configuration"
+
+comment "Console configuration"
+config EMBTK_ROOTFS_TTY
+ string "tty device for console"
+ default "ttyS0"
+
+choice
+ prompt "tty device baudrate"
+ config EMBTK_ROOTFS_TTY_BAUDRATE_KERNEL
+ bool "Baudrate set in kernel"
+ config EMBTK_ROOTFS_TTY_BAUDRATE_9600
+ bool "9600"
+ config EMBTK_ROOTFS_TTY_BAUDRATE_19200
+ bool "19200"
+ config EMBTK_ROOTFS_TTY_BAUDRATE_38400
+ bool "38400"
+ config EMBTK_ROOTFS_TTY_BAUDRATE_57600
+ bool "57600"
+ config EMBTK_ROOTFS_TTY_BAUDRATE_115200
+ bool "115200"
+endchoice
+config EMBTK_ROOTFS_TTY_BAUDRATE
+ string
+ default "0" if EMBTK_ROOTFS_TTY_BAUDRATE_KERNEL
+ default "9600" if EMBTK_ROOTFS_TTY_BAUDRATE_9600
+ default "19200" if EMBTK_ROOTFS_TTY_BAUDRATE_19200
+ default "38400" if EMBTK_ROOTFS_TTY_BAUDRATE_38400
+ default "57600" if EMBTK_ROOTFS_TTY_BAUDRATE_57600
+ default "115200" if EMBTK_ROOTFS_TTY_BAUDRATE_115200
+
+
+endmenu
diff --git a/core/kconfig/rootfs/rootfs.kconfig b/core/kconfig/rootfs/rootfs.kconfig
index 50bb718..c217bc4 100644
--- a/core/kconfig/rootfs/rootfs.kconfig
+++ b/core/kconfig/rootfs/rootfs.kconfig
@@ -23,6 +23,7 @@
# \date December 2013
################################################################################
+source "core/kconfig/rootfs/rootfs-config.kconfig"
source "core/kconfig/rootfs/fs.kconfig"
source "packages/htools/squashfs/squashfs.kconfig"
source "core/kconfig/packages.kconfig"
diff --git a/packages/system/openrc/etc/inittab.logging b/packages/system/openrc/etc/inittab.logging
new file mode 100644
index 0000000..f74eb07
--- /dev/null
+++ b/packages/system/openrc/etc/inittab.logging
@@ -0,0 +1,5 @@
+# Logging
+null::sysinit:/bin/touch /var/log/messages
+null::respawn:/sbin/syslogd -n -m 0
+null::respawn:/sbin/klogd -n
+
diff --git a/packages/system/openrc/etc/inittab.reboot b/packages/system/openrc/etc/inittab.reboot
new file mode 100644
index 0000000..a182944
--- /dev/null
+++ b/packages/system/openrc/etc/inittab.reboot
@@ -0,0 +1,6 @@
+# Reboot
+::ctrlaltdel:/sbin/reboot
+null::shutdown:/sbin/openrc shutdown
+null::shutdown:/bin/umount -a -r
+null::shutdown:/sbin/swapoff -a
+
diff --git a/packages/system/openrc/etc/inittab.runlevel b/packages/system/openrc/etc/inittab.runlevel
new file mode 100644
index 0000000..7c8887e
--- /dev/null
+++ b/packages/system/openrc/etc/inittab.runlevel
@@ -0,0 +1,8 @@
+# Initial system critical filesystems mounting (/proc, /dev, /sys, etc.)
+::sysinit:/sbin/openrc sysinit
+
+# Goto other runlevels now
+::wait:/sbin/openrc boot
+::wait:/sbin/openrc default
+::wait:/sbin/openrc
+
diff --git a/packages/system/openrc/etc/inittab.tty b/packages/system/openrc/etc/inittab.tty
new file mode 100644
index 0000000..b9b2072
--- /dev/null
+++ b/packages/system/openrc/etc/inittab.tty
@@ -0,0 +1,3 @@
+# Put a getty on the serial port
+{ROOTFS_TTY}::respawn:/sbin/getty -L {ROOTFS_TTY} {ROOTFS_TTY_BAUDRATE} vt100
+
diff --git a/packages/system/openrc/openrc.mk b/packages/system/openrc/openrc.mk
index b087cb9..64d9765 100644
--- a/packages/system/openrc/openrc.mk
+++ b/packages/system/openrc/openrc.mk
@@ -97,8 +97,23 @@ define __embtk_install_openrc_confd
> $(embtk_rootfs)/etc/hostname
endef
+__embtk_rootfs_tty := $(call embtk_uquote,$(CONFIG_EMBTK_ROOTFS_TTY))
+__embtk_rootfs_tty_baudrate := $(call embtk_uquote,$(CONFIG_EMBTK_ROOTFS_TTY_BAUDRATE))
+define __embtk_install_openrc_inittab
+ cat $(embtk_openrc_mk)/etc/inittab.runlevel \
+ > $(embtk_rootfs)/etc/inittab
+ cat $(embtk_openrc_mk)/etc/inittab.tty | \
+ sed -e 's;{ROOTFS_TTY};$(__embtk_rootfs_tty);g' \
+ -e 's;{ROOTFS_TTY_BAUDRATE};$(__embtk_rootfs_tty_baudrate);g' \
+ >> $(embtk_rootfs)/etc/inittab
+ cat $(embtk_openrc_mk)/etc/inittab.logging \
+ >> $(embtk_rootfs)/etc/inittab
+ cat $(embtk_openrc_mk)/etc/inittab.reboot \
+ >> $(embtk_rootfs)/etc/inittab
+endef
define embtk_postinstall_openrc
$(__embtk_install_openrc_confd)
+ $(__embtk_install_openrc_inittab)
rm -rf $(embtk_rootfs)/etc/init.d
install -d $(embtk_rootfs)/etc/init.d || exit $$?
install -m 0644 $(embtk_openrc_mk)/etc/defaultdomain \
diff --git a/src/rootfs_skel/etc/inittab b/src/rootfs_skel/etc/inittab
index 5a1f1e8..95d11b8 100644
--- a/src/rootfs_skel/etc/inittab
+++ b/src/rootfs_skel/etc/inittab
@@ -1,24 +1,29 @@
-# Initial system critical filesystems mounting (/proc, /dev, /sys, etc.)
-::sysinit:/sbin/openrc sysinit
+# Filesystem
+null::sysinit:/bin/mount -o remount,rw /
+null::sysinit:/bin/mount -t proc proc /proc
+null::sysinit:/bin/mount -a
-# Goto other runlevels now
-::wait:/sbin/openrc boot
-::wait:/sbin/openrc default
-::wait:/sbin/openrc
+# Networking
+null::sysinit:/bin/hostname -F /etc/hostname
+null::sysinit:/sbin/ifconfig lo 127.0.0.1 up
+null::sysinit:/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
+null::sysinit:/sbin/udhcpc
-# Put a getty on the serial port
+# Runlevel script
+::sysinit:/etc/init.d/rcS
+
+# Serial console
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
-# Logging junk
null::sysinit:/bin/touch /var/log/messages
null::respawn:/sbin/syslogd -n -m 0
null::respawn:/sbin/klogd -n
+#tty3::respawn:/usr/bin/tail -f /var/log/messages
-# What to do at the "Three Finger Salute"
::ctrlaltdel:/sbin/reboot
-# Stuff to do before rebooting
-null::shutdown:/sbin/openrc shutdown
+# Reboot
+null::shutdown:/usr/bin/killall klogd
+null::shutdown:/usr/bin/killall syslogd
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a
-