Patchwork [1/2] busybox, mdev: Added option for disabling mdev -s in sysv-init

login
register
mail settings
Submitter Kim Bøndergaard
Date Dec. 14, 2012, 8:56 a.m.
Message ID <39a86e2323951ca6d7f269f8d1de2d65be3e7287.1355474720.git.kibo@prevas.dk>
Download mbox | patch
Permalink /patch/206371/
State Changes Requested
Headers show

Comments

Kim Bøndergaard - Dec. 14, 2012, 8:56 a.m.
---
 recipes/busybox/busybox-configure.inc |  2 ++
 recipes/busybox/busybox-install.inc   | 26 ++++++++++++++++++++++++++
 recipes/busybox/files/busybox-mdev    |  8 ++------
 3 files changed, 30 insertions(+), 6 deletions(-)
Esben Haabendal - Dec. 14, 2012, 6:59 p.m.
Kim Bøndergaard <kibo@prevas.dk> writes:

> ---
>  recipes/busybox/busybox-configure.inc |  2 ++
>  recipes/busybox/busybox-install.inc   | 26 ++++++++++++++++++++++++++
>  recipes/busybox/files/busybox-mdev    |  8 ++------
>  3 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/recipes/busybox/busybox-configure.inc b/recipes/busybox/busybox-configure.inc
> index 037cd97..7032257 100644
> --- a/recipes/busybox/busybox-configure.inc
> +++ b/recipes/busybox/busybox-configure.inc
> @@ -118,6 +118,8 @@ DEFAULT_USE_busybox_mdev_sysvinit_start = "10"
>  RECIPE_FLAGS += "busybox_mdev_splashutils_progress busybox_mdev_splashutils_msg"
>  SPLASHUTILS_INITSCRIPTS:>USE_busybox_mdev += " busybox_mdev"
>  DEFAULT_USE_busybox_mdev_splashutils_msg = "\"Starting Mdev\""
> +RECIPE_FLAGS += "busybox_mdev_dash_s"
> +DEFAULT_USE_busybox_mdev_dash_s = "1"
>  
>  RECIPE_FLAGS += "busybox_klogd \
>          busybox_klogd_sysvinit_start busybox_klogd_conlevel"
> diff --git a/recipes/busybox/busybox-install.inc b/recipes/busybox/busybox-install.inc
> index bfb0c11..b94e8c2 100644
> --- a/recipes/busybox/busybox-install.inc
> +++ b/recipes/busybox/busybox-install.inc
> @@ -135,3 +135,29 @@ do_install () {
>  		sysvinit_install_script ${SRCDIR}/busybox-httpd
>  	fi
>  }
> +
> +do_install[postfuncs] += "${BUSYBOX_INSTALL_POSTFUNCS}"
> +BUSYBOX_INSTALL_POSTFUNCS = ""
> +BUSYBOX_INSTALL_POSTFUNCS:>USE_busybox_mdev = " do_install_fix_mdev"
> +#do_install[postfuncs] += "do_install_fix_mdev"

Remove this commented out line.

> +
> +python do_install_fix_mdev () {
> +	import os, fileinput
> +	path = d.get("D")
> +	os.chdir(path)

Instead of the two lines above, you should instead use

do_install_fix_mdev[dirs] = "${D}"

> +	sysconfdir=d.get("sysconfdir")
> +	for line in fileinput.FileInput("." + sysconfdir + "/init.d/busybox-mdev", inplace=1):
> +		if d.get("USE_busybox_mdev_dash_s"):
> +			line=line.replace("mdev_dash_s PLACEHOLDER_1",
> +				"# Create tmpfs for /dev\n" +
> +				"echo \"Creating tmpfs at /dev\"\n" +
> +				"mount -t tmpfs tmpfs /dev -o size=64k,mode=0755")
> +			line=line.replace("mdev_dash_s PLACEHOLDER_2",
> +				"# Populate /dev from /sys info\n" +
> +				"echo \"Populating /dev/ using mdev\"\n" +
> +				"$MDEV -s")
> +		else:
> +			line=line.replace("mdev_dash_s PLACEHOLDER_1", "")
> +			line=line.replace("mdev_dash_s PLACEHOLDER_2", "")
> +		print line,
> +}
> diff --git a/recipes/busybox/files/busybox-mdev b/recipes/busybox/files/busybox-mdev
> index c068b94..5d307dd 100755
> --- a/recipes/busybox/files/busybox-mdev
> +++ b/recipes/busybox/files/busybox-mdev
> @@ -34,16 +34,12 @@ if mountpoint -q /dev/shm/; then
>    umount -l /dev/shm/
>  fi
>  
> -# Create tmpfs for /dev
> -echo "Creating tmpfs at /dev"
> -mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
> +mdev_dash_s PLACEHOLDER_1
>  
>  # Register mdev as hotplug event helper
>  echo "$MDEV" > /proc/sys/kernel/hotplug
>  
> -# Populate /dev from /sys info
> -echo "Populating /dev using mdev"
> -$MDEV -s
> +mdev_dash_s PLACEHOLDER_2
>  
>  # Touch .udev to inform scripts that /dev needs no further setup
>  touch /dev/.udev

Please resubmit with the changes listed above.

/Esben

Patch

diff --git a/recipes/busybox/busybox-configure.inc b/recipes/busybox/busybox-configure.inc
index 037cd97..7032257 100644
--- a/recipes/busybox/busybox-configure.inc
+++ b/recipes/busybox/busybox-configure.inc
@@ -118,6 +118,8 @@  DEFAULT_USE_busybox_mdev_sysvinit_start = "10"
 RECIPE_FLAGS += "busybox_mdev_splashutils_progress busybox_mdev_splashutils_msg"
 SPLASHUTILS_INITSCRIPTS:>USE_busybox_mdev += " busybox_mdev"
 DEFAULT_USE_busybox_mdev_splashutils_msg = "\"Starting Mdev\""
+RECIPE_FLAGS += "busybox_mdev_dash_s"
+DEFAULT_USE_busybox_mdev_dash_s = "1"
 
 RECIPE_FLAGS += "busybox_klogd \
         busybox_klogd_sysvinit_start busybox_klogd_conlevel"
diff --git a/recipes/busybox/busybox-install.inc b/recipes/busybox/busybox-install.inc
index bfb0c11..b94e8c2 100644
--- a/recipes/busybox/busybox-install.inc
+++ b/recipes/busybox/busybox-install.inc
@@ -135,3 +135,29 @@  do_install () {
 		sysvinit_install_script ${SRCDIR}/busybox-httpd
 	fi
 }
+
+do_install[postfuncs] += "${BUSYBOX_INSTALL_POSTFUNCS}"
+BUSYBOX_INSTALL_POSTFUNCS = ""
+BUSYBOX_INSTALL_POSTFUNCS:>USE_busybox_mdev = " do_install_fix_mdev"
+#do_install[postfuncs] += "do_install_fix_mdev"
+
+python do_install_fix_mdev () {
+	import os, fileinput
+	path = d.get("D")
+	os.chdir(path)
+	sysconfdir=d.get("sysconfdir")
+	for line in fileinput.FileInput("." + sysconfdir + "/init.d/busybox-mdev", inplace=1):
+		if d.get("USE_busybox_mdev_dash_s"):
+			line=line.replace("mdev_dash_s PLACEHOLDER_1",
+				"# Create tmpfs for /dev\n" +
+				"echo \"Creating tmpfs at /dev\"\n" +
+				"mount -t tmpfs tmpfs /dev -o size=64k,mode=0755")
+			line=line.replace("mdev_dash_s PLACEHOLDER_2",
+				"# Populate /dev from /sys info\n" +
+				"echo \"Populating /dev/ using mdev\"\n" +
+				"$MDEV -s")
+		else:
+			line=line.replace("mdev_dash_s PLACEHOLDER_1", "")
+			line=line.replace("mdev_dash_s PLACEHOLDER_2", "")
+		print line,
+}
diff --git a/recipes/busybox/files/busybox-mdev b/recipes/busybox/files/busybox-mdev
index c068b94..5d307dd 100755
--- a/recipes/busybox/files/busybox-mdev
+++ b/recipes/busybox/files/busybox-mdev
@@ -34,16 +34,12 @@  if mountpoint -q /dev/shm/; then
   umount -l /dev/shm/
 fi
 
-# Create tmpfs for /dev
-echo "Creating tmpfs at /dev"
-mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
+mdev_dash_s PLACEHOLDER_1
 
 # Register mdev as hotplug event helper
 echo "$MDEV" > /proc/sys/kernel/hotplug
 
-# Populate /dev from /sys info
-echo "Populating /dev using mdev"
-$MDEV -s
+mdev_dash_s PLACEHOLDER_2
 
 # Touch .udev to inform scripts that /dev needs no further setup
 touch /dev/.udev