summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-03-07 16:43:24 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2014-03-07 16:43:24 +0100
commit9e914d4c02c1835a714f10ce1ebd99dbe73877f6 (patch)
treea8e3ad35c2b0c5941bc1190f2da378f2258afd21 /package
parent5101b72fac2c9a6971a0c7d2fe6bbd318e9678ab (diff)
use standard busybox init, remove previously used /init. some configs and ideas from buildroot project
Diffstat (limited to 'package')
-rw-r--r--package/base-files/Makefile8
-rw-r--r--package/base-files/src/etc/fstab9
-rw-r--r--package/base-files/src/etc/init.d/boot25
-rw-r--r--package/base-files/src/etc/init.d/mount10
-rwxr-xr-xpackage/base-files/src/etc/init.d/rcS7
-rwxr-xr-xpackage/base-files/src/etc/init.d/umount14
-rw-r--r--package/base-files/src/etc/inittab6
-rwxr-xr-xpackage/base-files/src/etc/network/if-post-down.d/03-wireless1
-rw-r--r--package/base-files/src/etc/profile1
-rwxr-xr-xpackage/base-files/src/init31
10 files changed, 52 insertions, 60 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 9323b25ad..a298d108b 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -6,7 +6,7 @@ include $(TOPDIR)/mk/rootfs.mk
PKG_NAME:= base-files
PKG_VERSION:= 1.0
-PKG_RELEASE:= 66
+PKG_RELEASE:= 67
PKG_SECTION:= base
PKG_DESCR:= basic files and scripts
PKG_BUILDDEP:= pkgconf-host file-host
@@ -33,13 +33,13 @@ endif
$(SED) 's,@HOST@,$(ADK_HOST),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@VENDOR@,$(ADK_VENDOR),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
echo /bin/sh >${IDIR_BASE_FILES}/etc/shells
+ echo /bin/mksh >>${IDIR_BASE_FILES}/etc/shells
+ifneq (${ADK_PACKAGE_ASH},)
echo /bin/ash >>${IDIR_BASE_FILES}/etc/shells
+endif
ifneq (${ADK_PACKAGE_BASH},)
echo /bin/bash >>${IDIR_BASE_FILES}/etc/shells
endif
-ifneq (${ADK_PACKAGE_MKSH},)
- echo /bin/mksh >>${IDIR_BASE_FILES}/etc/shells
-endif
ifneq (${ADK_PACKAGE_ZSH},)
echo /bin/zsh >>${IDIR_BASE_FILES}/etc/shells
endif
diff --git a/package/base-files/src/etc/fstab b/package/base-files/src/etc/fstab
new file mode 100644
index 000000000..fafa1d56e
--- /dev/null
+++ b/package/base-files/src/etc/fstab
@@ -0,0 +1,9 @@
+# /etc/fstab: static file system information.
+#
+# <file system> <mount pt> <type> <options> <dump> <pass>
+#/dev/root / ext2 rw,noauto 0 1
+proc /proc proc defaults 0 0
+devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
+tmpfs /dev/shm tmpfs mode=0777 0 0
+tmpfs /tmp tmpfs mode=1777 0 0
+sysfs /sys sysfs defaults 0 0
diff --git a/package/base-files/src/etc/init.d/boot b/package/base-files/src/etc/init.d/boot
index df2c493d7..b859d1d89 100644
--- a/package/base-files/src/etc/init.d/boot
+++ b/package/base-files/src/etc/init.d/boot
@@ -4,6 +4,29 @@
. /etc/functions.sh
+# disable kernel messages
+echo 0 > /proc/sys/kernel/printk
+
+# remount /dev with smaller size
+mount -o remount,nosuid,size=128k,mode=0755 -t tmpfs mdev /dev
+
+# remount /tmp with smaller size
+size=$(cat /etc/tmpfs 2>/dev/null)
+[ -z $size ] && size=2048
+mount -o remount,nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp
+
+# start mdev dynamic device node management
+echo >/dev/mdev.seq
+echo "/sbin/mdev" >/proc/sys/kernel/hotplug
+mdev -s
+
+# seed some random
+cat /etc/.rnd >/dev/urandom 2>&1
+
+# setup cfgfs
+[ -x /sbin/cfgfs ] && { cfgfs setup; mount -o remount,ro /;} || mount -o remount,rw /
+
+# create some useful directories in tmpfs
mkdir -p /var/log
mkdir -p /var/run
touch /var/log/lastlog
@@ -22,6 +45,4 @@ for f in /etc/modules.d/*; do
[[ -e $f ]] && load_modules /etc/modules.d/*
break
done
-# settle down, after module load
-sleep 2
exit 0
diff --git a/package/base-files/src/etc/init.d/mount b/package/base-files/src/etc/init.d/mount
deleted file mode 100644
index 6c59d7bab..000000000
--- a/package/base-files/src/etc/init.d/mount
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-#INIT 60
-[[ $1 = autostart ]] || exit 0
-
-# any lvm volumes to activate?
-[ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay;}
-# check and mount all filesystems not /
-[ -f /etc/fstab ] && { fsck -p >/dev/null; mount -a; swapon -a;}
-
-exit 0
diff --git a/package/base-files/src/etc/init.d/rcS b/package/base-files/src/etc/init.d/rcS
index 55c86729c..d34cce6e9 100755
--- a/package/base-files/src/etc/init.d/rcS
+++ b/package/base-files/src/etc/init.d/rcS
@@ -1,10 +1,11 @@
#!/bin/sh
+echo "System initialization ..."
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ln -s /proc/self/fd/2 /dev/stderr
{
grep '^#INIT ' /etc/init.d/* | \
sort -nk2 | \
while read line; do
- sh ${line%%:*} autostart 2>&1
+ sh ${line%%:*} autostart
done
- test -e /etc/init.d/boot.local && (/bin/sh /etc/init.d/boot.local) 2>&1
-} | logger -p 6 -t '' &
+} | tee /dev/stderr |logger -p 6 -t ''
diff --git a/package/base-files/src/etc/init.d/umount b/package/base-files/src/etc/init.d/umount
deleted file mode 100755
index 49bd5a020..000000000
--- a/package/base-files/src/etc/init.d/umount
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#INIT 55
-
-case $1 in
-autostop)
- cd /
- sync
- for i in $(grep -v ^# /etc/fstab 2>/dev/null|awk '{ print $2 }'|grep -v none);do
- umount $i 2>/dev/null
- done
- ;;
-esac
-exit 0
-
diff --git a/package/base-files/src/etc/inittab b/package/base-files/src/etc/inittab
index 79e69d931..eb00b00ef 100644
--- a/package/base-files/src/etc/inittab
+++ b/package/base-files/src/etc/inittab
@@ -1,2 +1,8 @@
+null::sysinit:/bin/mount -t proc proc /proc
+null::sysinit:/bin/mkdir -p /dev/pts
+null::sysinit:/bin/mkdir -p /dev/shm
+null::sysinit:/bin/mount -a
::sysinit:/etc/init.d/rcS
::shutdown:/etc/init.d/rcK
+null::shutdown:/bin/umount -a -r
+null::shutdown:/sbin/swapoff -a
diff --git a/package/base-files/src/etc/network/if-post-down.d/03-wireless b/package/base-files/src/etc/network/if-post-down.d/03-wireless
index 67c01714e..77bca475b 100755
--- a/package/base-files/src/etc/network/if-post-down.d/03-wireless
+++ b/package/base-files/src/etc/network/if-post-down.d/03-wireless
@@ -1,5 +1,4 @@
#!/bin/sh
-set -x
set -e
[ "${IFACE%%[0-9]*}" = "wlan" ] || exit 0
diff --git a/package/base-files/src/etc/profile b/package/base-files/src/etc/profile
index 96f03b980..ce425b54c 100644
--- a/package/base-files/src/etc/profile
+++ b/package/base-files/src/etc/profile
@@ -1,5 +1,4 @@
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export TERM=linux
export EDITOR=/bin/vi
if [[ $(id -u) = 0 ]]; then
export PS1='`whoami`@`hostname`:`pwd` # '
diff --git a/package/base-files/src/init b/package/base-files/src/init
index ad519e96d..a27548217 100755
--- a/package/base-files/src/init
+++ b/package/base-files/src/init
@@ -1,26 +1,7 @@
#!/bin/sh
-echo "System initialization ..."
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-mount -t devtmpfs devtmpfs /dev >/dev/null 2>&1
-mount -nt proc proc /proc
-echo 0 > /proc/sys/kernel/printk
-mount -o nosuid,nodev,noexec -t sysfs sysfs /sys
-[ ! -f /etc/notmpfs ] && {
- size=$(cat /etc/tmpfs 2>/dev/null)
- [ -z $size ] && size=2048
- mount -o nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp
-}
-mount -o remount,nosuid,size=128k,mode=0755 -t tmpfs mdev /dev
-[ -d /dev/pts ] || mkdir /dev/pts
-[ -d /dev/shm ] || mkdir /dev/shm
-mount -o nosuid,noexec -t tmpfs tmpfs /dev/shm
-mount -o nosuid,noexec -t devpts devpts /dev/pts
-echo >/dev/mdev.seq
-echo "/sbin/mdev" >/proc/sys/kernel/hotplug
-mdev -s
-cat /etc/.rnd >/dev/urandom 2>&1
-[ -x /installer ] && { /installer; }
-[ -x /kexecinit ] && { /kexecinit; }
-[ -x /cryptinit ] && { /cryptinit; exec switch_root /mnt "/init";}
-[ -x /sbin/cfgfs ] && { cfgfs setup; mount -o remount,ro /;} || mount -o remount,rw /
-exec /sbin/init
+# devtmpfs does not get automounted for initramfs
+/bin/mount -t devtmpfs devtmpfs /dev
+exec 0</dev/console
+exec 1>/dev/console
+exec 2>/dev/console
+exec /sbin/init $*