All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yegor Yefremov <yegor_sub1@visionsystems.de>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/4] Create menu entry to select device creation method
Date: Thu, 30 Sep 2010 14:57:53 +0200	[thread overview]
Message-ID: <4CA48951.60903@visionsystems.de> (raw)
In-Reply-To: <4CA32E7B.4000506@visionsystems.de>

Create menu entry to select device creation method:

- static method uses device table as before
- devtmpfs method enables this feature in kernel
- mdev method adds mdev starting script to the file system
  and selects mdev itself for installation
- udev method selects udev for installation 

All dynamic methods are base on devtmpfs, so one doesn't
need to care about /dev folder.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

Index: b/fs/Config.in
===================================================================
--- a/fs/Config.in	2010-09-30 14:52:42.000000000 +0200
+++ b/fs/Config.in	2010-09-30 14:54:12.000000000 +0200
@@ -15,13 +15,34 @@
 	  only argument. Make sure the exit code of that script is 0,
 	  otherwise make will stop after calling it.
 
+choice
+	prompt "/dev management"
+	default BR2_ROOTFS_DEVICE_CREATION_STATIC
+
+config BR2_ROOTFS_DEVICE_CREATION_STATIC
+	bool "Static using device table"
+
+config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS
+	bool "Dynamic using devtmpfs only"
+
+config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV
+	bool "Dynamic using mdev"
+	select BR2_PACKAGE_BUSYBOX
+
+config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
+	bool "Dynamic using udev"
+	select BR2_PACKAGE_UDEV
+
+endchoice
+
 config BR2_ROOTFS_DEVICE_TABLE
-       string "Path to the device table"
-       default "target/generic/device_table.txt"
-       help
-         Specify the location of a device table, that will be passed
-         to the makedevs utility to create all the special device
-         files in the target filesystem.
+	string "Path to the device table"
+	depends on BR2_ROOTFS_DEVICE_CREATION_STATIC
+	default "target/generic/device_table.txt"
+	help
+	  Specify the location of a device table, that will be passed
+	  to the makedevs utility to create all the special device
+	  files in the target filesystem.
 
 choice
 	prompt "Root FS skeleton"
Index: b/package/busybox/S10mdev
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ b/package/busybox/S10mdev	2010-09-30 14:54:12.000000000 +0200
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Start mdev....
+#
+
+case "$1" in
+  start)
+ 	echo "Starting mdev..."
+	/sbin/mdev -s
+	;;
+  stop)
+	;;
+  restart|reload)
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
+
+
Index: b/package/busybox/busybox.mk
===================================================================
--- a/package/busybox/busybox.mk	2010-09-30 14:52:43.000000000 +0200
+++ b/package/busybox/busybox.mk	2010-09-30 14:54:12.000000000 +0200
@@ -20,6 +20,19 @@
 	BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
 endif
 
+# If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
+ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
+define BUSYBOX_INSTALL_MDEV_SCRIPT
+	install -m 0755 package/busybox/S10mdev $(TARGET_DIR)/etc/init.d
+endef
+define BUSYBOX_SET_MDEV
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MDEV,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_CONF,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_EXEC,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_LOAD_FIRMWARE,$(BUSYBOX_BUILD_CONFIG))
+endef
+endif
+
 # If we have external syslogd, force busybox to use it
 ifeq ($(BR2_PACKAGE_SYSKLOGD),y)
 define BUSYBOX_SET_SYSKLOGD
@@ -114,6 +127,7 @@
 	$(BUSYBOX_SET_IPV6)
 	$(BUSYBOX_SET_RPC)
 	$(BUSYBOX_PREFER_STATIC)
+	$(BUSYBOX_SET_MDEV)
 	$(BUSYBOX_NETKITBASE)
 	$(BUSYBOX_NETKITTELNET)
 	@yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \
@@ -142,6 +156,7 @@
 define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_BINARY)
 	-chmod a+rx $(TARGET_DIR)/usr/share/udhcpc/default.script
+	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
 endef
 
 define BUSYBOX_UNINSTALL_TARGET_CMDS
Index: b/linux/linux.mk
===================================================================
--- a/linux/linux.mk	2010-09-30 14:52:54.000000000 +0200
+++ b/linux/linux.mk	2010-09-30 14:54:12.000000000 +0200
@@ -109,6 +109,13 @@
 	$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,\"$(BINARIES_DIR)/rootfs.initramfs\",$(@D)/.config)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_INITRAMFS_COMPRESSION_GZIP,$(@D)/.config)
 endif
+ifneq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS,$(@D)/.config)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config)
+endif
+ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
+	$(call KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$(@D)/.config)
+endif
 	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(@D) oldconfig
 	$(Q)touch $@
 

  reply	other threads:[~2010-09-30 12:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24  7:35 [Buildroot] [PATCH 0/4] /etc/inittab stuff and device creation stuff Yegor Yefremov
     [not found] ` <4C9C54FC.4040609@visionsystems.de>
2010-09-24  7:37   ` [Buildroot] [PATCH 2/4] Enable terminal type configuration for /etc/inittab Yegor Yefremov
2010-09-24  7:38     ` [Buildroot] [PATCH 3/4] Create menu entry to select device creation method Yegor Yefremov
2010-09-24  7:39       ` [Buildroot] [PATCH 4/4] Add network scripting folders to fs/skeleton Yegor Yefremov
2010-09-28 17:40         ` Thomas Petazzoni
2010-11-22 18:47         ` Thomas Petazzoni
2010-09-28 17:35       ` [Buildroot] [PATCH 3/4] Create menu entry to select device creation method Thomas Petazzoni
2010-09-29 12:18         ` Yegor Yefremov
2010-09-30 12:57           ` Yegor Yefremov [this message]
2010-11-22 18:47             ` Thomas Petazzoni
2010-09-28 17:28     ` [Buildroot] [PATCH 2/4] Enable terminal type configuration for /etc/inittab Thomas Petazzoni
2010-09-29  8:31       ` Yegor Yefremov
2010-09-27  8:53 ` [Buildroot] [PATCH 1/4] Added new menu item to specify a custom port " Yegor Yefremov
2010-09-28 17:26   ` Thomas Petazzoni
2010-09-29  8:36     ` Yegor Yefremov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CA48951.60903@visionsystems.de \
    --to=yegor_sub1@visionsystems.de \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.