sys-kernel/genkernel: add wrapper arround the creation of chroot dev entries onyl when required
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/genlink@2624 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
|
||||
Date: 2010-10-30
|
||||
Initial Package Version: 3.4.10.907
|
||||
Origin: gentoo busybox mdev-start.sh and me
|
||||
Upstream Status: unknown
|
||||
Description: add a new boot command 'nashack' that creates the missing dev entries
|
||||
|
||||
diff -Naur genkernel-3.4.10.907.orig/defaults/initrd.scripts genkernel-3.4.10.907/defaults/initrd.scripts
|
||||
--- genkernel-3.4.10.907.orig/defaults/initrd.scripts 2010-10-29 16:11:03.765695917 +0000
|
||||
+++ genkernel-3.4.10.907/defaults/initrd.scripts 2010-10-29 21:14:39.022515391 +0000
|
||||
@@ -284,9 +284,60 @@
|
||||
/bin/ash
|
||||
}
|
||||
|
||||
+seed_chroot_dev()
|
||||
+{
|
||||
+ # Seed /dev with some things that we know we need
|
||||
+
|
||||
+ # Create problematic directories
|
||||
+ mkdir -p ${CDROOT}/dev/pts ${CDROOT}/dev/shm
|
||||
+
|
||||
+ # creating /dev/console and /dev/tty1 to be able to write
|
||||
+ # to $CONSOLE with/without bootsplash before mdev creates it
|
||||
+ [ -c ${CDROOT}/dev/console ] || mknod ${CDROOT}/dev/console c 5 1
|
||||
+ [ -c ${CDROOT}/dev/tty1 ] || mknod ${CDROOT}/dev/tty1 c 4 1
|
||||
+
|
||||
+ # udevd will dup its stdin/stdout/stderr to /dev/null
|
||||
+ # and we do not want a file which gets buffered in ram
|
||||
+ [ -c ${CDROOT}/dev/null ] || mknod ${CDROOT}/dev/null c 1 3
|
||||
+
|
||||
+ # creating /dev/initctl to be able to switch init
|
||||
+ [ -c ${CDROOT}/dev/initctl ] || mknod ${CDROOT}/dev/initctl p
|
||||
+}
|
||||
+
|
||||
+seed_dev()
|
||||
+{
|
||||
+ # Seed /dev with some things that we know we need
|
||||
+
|
||||
+ # creating /dev/console and /dev/tty1 to be able to write
|
||||
+ # to $CONSOLE with/without bootsplash before mdev creates it
|
||||
+ [ -c /dev/console ] || mknod /dev/console c 5 1
|
||||
+ [ -c /dev/tty1 ] || mknod /dev/tty1 c 4 1
|
||||
+
|
||||
+ # udevd will dup its stdin/stdout/stderr to /dev/null
|
||||
+ # and we do not want a file which gets buffered in ram
|
||||
+ [ -c /dev/null ] || mknod /dev/null c 1 3
|
||||
+
|
||||
+ # copy over any persistant things
|
||||
+ if [ -d /lib/mdev/devices ] ; then
|
||||
+ cp -RPp /lib/mdev/devices/* /dev 2>/dev/null
|
||||
+ fi
|
||||
+
|
||||
+ # Not provided by sysfs but needed
|
||||
+ ln -snf /proc/self/fd /dev/fd
|
||||
+ ln -snf fd/0 /dev/stdin
|
||||
+ ln -snf fd/1 /dev/stdout
|
||||
+ ln -snf fd/2 /dev/stderr
|
||||
+ [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
|
||||
+
|
||||
+ # Create problematic directories
|
||||
+ mkdir -p /dev/pts /dev/shm
|
||||
+}
|
||||
+
|
||||
runmdev() {
|
||||
# busybox udev replacement
|
||||
mdev -s
|
||||
+ # add missing dev entrys for nas devices without console
|
||||
+ seed_dev
|
||||
}
|
||||
|
||||
test_success() {
|
||||
@@ -1093,3 +1144,5 @@
|
||||
USE_UNIONFS_NORMAL=0
|
||||
fi
|
||||
}
|
||||
+
|
||||
+
|
||||
diff -Naur genkernel-3.4.10.907.orig/defaults/linuxrc genkernel-3.4.10.907/defaults/linuxrc
|
||||
--- genkernel-3.4.10.907.orig/defaults/linuxrc 2010-10-29 16:11:03.762695924 +0000
|
||||
+++ genkernel-3.4.10.907/defaults/linuxrc 2010-10-30 07:31:00.700222780 +0000
|
||||
@@ -62,6 +62,10 @@
|
||||
init_opts\=*)
|
||||
INIT_OPTS=`parse_opt "${x}"`
|
||||
;;
|
||||
+ # remount chroot rw and create missing files
|
||||
+ nashack)
|
||||
+ NASHACK=1
|
||||
+ ;;
|
||||
# Livecd options
|
||||
cdroot)
|
||||
CDROOT=1
|
||||
@@ -731,6 +735,17 @@
|
||||
|
||||
verbose_kmsg
|
||||
|
||||
+# create the missing dev entrys for the nas boxes if the don't exist
|
||||
+if [ "${NASHACK}" = '1' ]
|
||||
+then
|
||||
+ if [ ! -e "${CHROOT}/dev/console" ] || [ ! -e "${CHROOT}/dev/null" ]
|
||||
+ then
|
||||
+ mount -o remount,rw ${CHROOT} >/dev/null 2>&1
|
||||
+ seed_chroot_dev
|
||||
+ mount -o remount,ro ${CHROOT} >/dev/null 2>&1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
|
||||
if [ ! -e "${CHROOT}/dev/console" ] || [ ! -e "${CHROOT}/dev/null" ]
|
||||
then
|
||||
Reference in New Issue
Block a user