/etc/inittab stuff and device creation stuff
cover /etc/inittab stuff and device creation stuff
Hi Peter and Thomas,
we've discussed mdev/udev handling and I've made some patches concerning this issue. The main idea is to provide 4 methods on how devices are created:
1. static - using the device_table.txt
2. dynamic - using devtmpfs only
3. dynamic - using devtmpfs and mdev
4. dynamic - using devtmpfs and udev
All methods are suitable for both read-only and full-featured file systems. The patches select appropriate options for kernel/BusyBox/packages, so it should be sufficient just to choose the proper method in "Target filesystem option".
Due to the fact, that device_table.txt not only creates devices, but also some folders in /etc/network. So I made a patch that creates this folders in default skeleton.
The second path of the patches enables custom console port configuration and also terminal type will be made configurable.
Please review the patches.
Best regards,
Yegor
PATCH 2/4 Enable terminal type configuration for /etc/inittab
In reply to a message not in the archive--- target/generic/Config.in | 6 ++++++ target/generic/Makefile.in | 3 ++- 2 files changed, 8 insertions(+), 1 deletions(-)
target/generic/Config.in +6 -0
@@ -164,6 +164,12 @@ config BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200 bool "115200" endchoice +config BR2_TARGET_GENERIC_GETTY_TERMINAL_TYPE + string "Terminal type" + default "vt100" + help + Specify a terminal type like vt100, linux etc. + config BR2_TARGET_GENERIC_GETTY_BAUDRATE string default "0" if BR2_TARGET_GENERIC_GETTY_BAUDRATE_KEEP
target/generic/Makefile.in +2 -1
@@ -2,6 +2,7 @@ TARGET_GENERIC_HOSTNAME:=$(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME)) TARGET_GENERIC_ISSUE:=$(call qstrip,$(BR2_TARGET_GENERIC_ISSUE)) TARGET_GENERIC_GETTY:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) TARGET_GENERIC_GETTY_BAUDRATE:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) +TARGET_GENERIC_GETTY_TERMINAL_TYPE:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERMINAL_TYPE)) target-generic-hostname: mkdir -p $(TARGET_DIR)/etc
@@ -12,7 +13,7 @@ target-generic-issue: echo "$(TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue target-generic-getty: - $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(TARGET_GENERIC_GETTY)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) vt100 #~' \ + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(TARGET_GENERIC_GETTY)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERMINAL_TYPE) #~' \ $(TARGET_DIR)/etc/inittab ifneq ($(TARGET_GENERIC_HOSTNAME),)
PATCH 3/4 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.
--- fs/Config.in | 32 ++++++++++++++++++++++++++------ linux/linux.mk | 4 ++++ package/busybox/S10mdev | 26 ++++++++++++++++++++++++++ package/busybox/busybox.mk | 15 +++++++++++++++ 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 package/busybox/S10mdev
fs/Config.in +26 -6
@@ -15,13 +15,33 @@ config BR2_ROOTFS_POST_BUILD_SCRIPT only argument. Make sure the exit code of that script is 0, otherwise make will stop after calling it. +choice + prompt "Device Creation" + 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" + +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"
linux/linux.mk +4 -0
@@ -105,6 +105,10 @@ ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y) $(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 $(TARGET_MAKE_ENV) $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(@D) oldconfig $(Q)touch $@
package/busybox/S10mdev new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/sh +# +# Start the mdev.... +# + +case "$1" in + start) + echo "Starting mdev..." + /sbin/mdev -s + ;; + stop) + echo -n "Stopping mdev..." + killall mdev + ;; + restart|reload) + "$0" stop + "$0" start + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? + +
package/busybox/busybox.mk +15 -0
@@ -20,6 +20,19 @@ ifndef BUSYBOX_CONFIG_FILE 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 @@ define BUSYBOX_CONFIGURE_CMDS $(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 @@ endif 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
Signature · 1 line
1.7.1.1
PATCH 4/4 Add network scripting folders to fs/skeleton
Those folders by device_table.txt. If using the dynamic device creation method these folders will be missing.
---
0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 fs/skeleton/etc/network/if-down.d/.empty create mode 100644 fs/skeleton/etc/network/if-post-down.d/.empty create mode 100644 fs/skeleton/etc/network/if-pre-up.d/.empty create mode 100644 fs/skeleton/etc/network/if-up.d/.empty
fs/skeleton/etc/network/if-down.d/.empty new file +0 -0
fs/skeleton/etc/network/if-post-down.d/.empty new file +0 -0
fs/skeleton/etc/network/if-pre-up.d/.empty new file +0 -0
fs/skeleton/etc/network/if-up.d/.empty new file +0 -0
Signature · 1 line
1.7.1.1
PATCH 1/4 Added new menu item to specify a custom port for /etc/inittab
In reply to Yegor Yefremov--- target/generic/Config.in | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
target/generic/Config.in +9 -0
@@ -102,8 +102,16 @@ config BR2_TARGET_GENERIC_GETTY_TTYCPM2 config BR2_TARGET_GENERIC_GETTY_TTYCPM3 bool "ttyCPM3" depends on BR2_powerpc +config BR2_TARGET_GENERIC_GETTY_CUSTOM + bool "Select custom port" + endchoice +config BR2_TARGET_GENERIC_GETTY_CUSTOM_PORT + string "Port" + depends on BR2_TARGET_GENERIC_GETTY_CUSTOM + default "" + config BR2_TARGET_GENERIC_GETTY_PORT string default "#ttyS0" if BR2_TARGET_GENERIC_GETTY_NONE
@@ -134,6 +142,7 @@ config BR2_TARGET_GENERIC_GETTY_PORT default "ttyCPM1" if BR2_TARGET_GENERIC_GETTY_TTYCPM1 default "ttyCPM2" if BR2_TARGET_GENERIC_GETTY_TTYCPM2 default "ttyCPM3" if BR2_TARGET_GENERIC_GETTY_TTYCPM3 + default $(BR2_TARGET_GENERIC_GETTY_CUSTOM_PORT) if BR2_TARGET_GENERIC_GETTY_CUSTOM choice prompt "Baudrate to use"
PATCH 1/4 Added new menu item to specify a custom port for /etc/inittab
Hello,
Would people cry/complain if instead of the following patch we simply replace the TARGET_GENERIC_GETTY_PORT parameter by a single free-form text-field ?
Thomas
Quoted 39 lines · On Mon, 27 Sep 2010 10:53:36 +0200 Yegor Yefremov…
Signed-off-by Yegor Yefremov <[email protected]>--- target/generic/Config.in | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)target/generic/Config.in +9
-0@@ -102,8 +102,16 @@ config BR2_TARGET_GENERIC_GETTY_TTYCPM2 config BR2_TARGET_GENERIC_GETTY_TTYCPM3 bool "ttyCPM3" depends on BR2_powerpc +config BR2_TARGET_GENERIC_GETTY_CUSTOM + bool "Select custom port" + endchoice +config BR2_TARGET_GENERIC_GETTY_CUSTOM_PORT + string "Port" + depends on BR2_TARGET_GENERIC_GETTY_CUSTOM + default "" + config BR2_TARGET_GENERIC_GETTY_PORT string default "#ttyS0" if BR2_TARGET_GENERIC_GETTY_NONE@@ -134,6 +142,7 @@ config BR2_TARGET_GENERIC_GETTY_PORT default "ttyCPM1" if BR2_TARGET_GENERIC_GETTY_TTYCPM1 default "ttyCPM2" if BR2_TARGET_GENERIC_GETTY_TTYCPM2 default "ttyCPM3" if BR2_TARGET_GENERIC_GETTY_TTYCPM3 + default $(BR2_TARGET_GENERIC_GETTY_CUSTOM_PORT) if BR2_TARGET_GENERIC_GETTY_CUSTOM choice prompt "Baudrate to use"_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 2/4 Enable terminal type configuration for /etc/inittab
In reply to Yegor Yefremovtarget/generic/Config.in config BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200 · line 171
Quoted 13 lines · On Fri, 24 Sep 2010 09:37:34 +0200 Yegor Yefremov…
target/generic/Config.in +5
-0@@ -164,6 +164,12 @@ config BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200 bool "115200" endchoice +config BR2_TARGET_GENERIC_GETTY_TERMINAL_TYPE + string "Terminal type" + default "vt100" + help + Specify a terminal type like vt100, linux etc.
Need only one tab + 2 spaces for the indentation of the help text.
Just out of curiosity, in what cases isn't vt100 an appropriate value ?
Once the minor tab+spaces issue is fixed:
I can merge this patch (and the other patches in this patch set into my boards-cleanup work, as it is somewhat related to board-level configuration options).
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 3/4 Create menu entry to select device creation method
In reply to Yegor Yefremovfs/Config.in config BR2_ROOTFS_POST_BUILD_SCRIPT · line 20
Quoted 3 lines · On Fri, 24 Sep 2010 09:38:50 +0200 Yegor Yefremov…
fs/Config.in +3
-0+choice + prompt "Device Creation" + default BR2_ROOTFS_DEVICE_CREATION_STATIC
I would probably name this "/dev management" or something similar. In my boards-cleanup work, I'm creating a new top-level "System configuration" menu. Maybe this should belong to this place instead, but this is something I can handle if I merge this patch into my boards-cleanup branch.
fs/Config.in config BR2_ROOTFS_POST_BUILD_SCRIPT · line 29
Quoted 2 lines
fs/Config.in +2
-0+config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV + bool "Dynamic using mdev"
Maybe this should "select BR2_PACKAGE_BUSYBOX" ?
Quoted 4 lines
config
BR2_ROOTFS_DEVICE_TABLEfs/Config.in +0
-3- string "Path to the device table" - default "target/generic/device_table.txt" - help
fs/Config.in config BR2_ROOTFS_POST_BUILD_SCRIPT · line 44
Quoted 10 lines
fs/Config.in +7
-3- 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.
Something odd here with the indentation. We should only see the new line "depends on BR2_ROOTFS_DEVICE_CREATION_STATIC" and no other change.
linux/linux.mk ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y) · line 111
Quoted 4 lines
linux/linux.mk +4
-0+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
So devtmpfs is used even when mdev or udev are used ?
package/busybox/S10mdev line 3
Quoted 7 lines
index 0000000..943b73b
package/busybox/S10mdev new file +3
-0@@ -0,0 +1,26 @@ +#!/bin/sh +# +# Start the mdev....
s/the//
package/busybox/S10mdev line 9
Quoted 6 lines
package/busybox/S10mdev new file +6
-0+# + +case "$1" in + start) + echo "Starting mdev..." + /sbin/mdev -s
This is not sufficient as far as I remember: this will only populate /dev with the existing devices. mdev also needs to be registered as a hotplug event handler by writing to some /proc/sys file. See mdev documentation for details (docs/mdev.txt in Busybox sources).
package/busybox/S10mdev line 13
Quoted 3 lines
package/busybox/S10mdev new file +3
-0+ stop) + echo -n "Stopping mdev..." + killall mdev
mdev is not a daemon, so there's no point in killing it.
Quoted 33 lines
package/busybox/busybox.mk +14
-0@@ -20,6 +20,19 @@ ifndef BUSYBOX_CONFIG_FILE 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 @@ define BUSYBOX_CONFIGURE_CMDS $(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)" \
package/busybox/busybox.mk endif · line 160
Quoted 5 lines
package/busybox/busybox.mk +1
-0@@ -142,6 +156,7 @@ endif define BUSYBOX_INSTALL_TARGET_CMDS $(BUSYBOX_INSTALL_BINARY) -chmod a+rx $(TARGET_DIR)/usr/share/udhcpc/default.script + $(BUSYBOX_INSTALL_MDEV_SCRIPT) endef
This part sounds good to me.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 4/4 Add network scripting folders to fs/skeleton
In reply to Yegor YefremovQuoted 2 lines · On Fri, 24 Sep 2010 09:39:49 +0200 Yegor Yefremov…
Those folders by device_table.txt. If using the dynamic device creation method these folders will be missing.
"Those folders are currently created by device_table.txt"...
Ok on the principle, but if those directories are now part of the skeleton, they should be removed from the device_table.txt file.
However, looking at device_table.txt, I also see that it does a few things not related to device files :
/dev d 755 0 0 - - - - - /dev/pts d 755 0 0 - - - - - /dev/shm d 755 0 0 - - - - - /tmp d 1777 0 0 - - - - - /etc d 755 0 0 - - - - - /home/default d 2755 1000 1000 - - - - - #<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count> /bin/busybox f 4755 0 0 - - - - - /etc/shadow f 600 0 0 - - - - - /etc/passwd f 644 0 0 - - - - - /etc/network/if-up.d d 755 0 0 - - - - - /etc/network/if-pre-up.d d 755 0 0 - - - - - /etc/network/if-down.d d 755 0 0 - - - - - /etc/network/if-post-down.d d 755 0 0 - - - - - /usr/share/udhcpc/default.script f 755 0 0 - - - - -
For each of those lines, what will replace the usage of the device table ? For things like proper access rights
for /etc/shadow, /etc/passwd, setuid for Busybox binary, proper flags for /tmp, maybe we have no other choices than using a device table.
In that case, we could use a split device table :
* One used in all cases
* One used only in the static device case. Buildroot would concatenate this one to the previous one before doing the root filesystem generation.
Thoughts ?
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 2/4 Enable terminal type configuration for /etc/inittab
In reply to Thomas PetazzoniAm 28.09.2010 19:28, schrieb Thomas Petazzoni:
Quoted 11 lines
Quoted 8 lines · On Fri, 24 Sep 2010 09:37:34 +0200 Yegor Yefremov…
target/generic/Config.in +0
-0@@ -164,6 +164,12 @@ config BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200 bool "115200" endchoice
Quoted 8 lines
target/generic/Config.in config BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200 · line 171
Quoted 5 lines
target/generic/Config.in +5
-0+config BR2_TARGET_GENERIC_GETTY_TERMINAL_TYPE + string "Terminal type" + default "vt100" + help + Specify a terminal type like vt100, linux etc.Need only one tab + 2 spaces for the indentation of the help text.
Just out of curiosity, in what cases isn't vt100 an appropriate value ?
Good question. We just use TERM=linux for our Debian installations, so I wanted to do it also for Buildroot. But you're right vt100 should be sufficient, that's why I made it default, so the old behavior is preserved.
Best regards,
Yegor
PATCH 1/4 Added new menu item to specify a custom port for /etc/inittab
In reply to Thomas PetazzoniQuoted 3 lines
Would people cry/complain if instead of the following patch we simply replace the
TARGET_GENERIC_GETTY_PORTparameter by a single free-form text-field ?
I wouldn't ;-) Let's make it this way.
Yegor
PATCH 3/4 Create menu entry to select device creation method
In reply to Thomas PetazzoniQuoted 10 lines
fs/Config.in config BR2_ROOTFS_POST_BUILD_SCRIPT · line 20
Quoted 4 lines
fs/Config.in +3
-0+choice + prompt "Device Creation" + default BR2_ROOTFS_DEVICE_CREATION_STATICI would probably name this "/dev management" or something similar. In my boards-cleanup work, I'm creating a new top-level "System configuration" menu. Maybe this should belong to this place instead, but this is something I can handle if I merge this patch into my boards-cleanup branch.
ACK
Quoted 4 lines
fs/Config.in config BR2_ROOTFS_POST_BUILD_SCRIPT · line 29
Quoted 2 lines
fs/Config.in +2
-0+config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV + bool "Dynamic using mdev"Maybe this should "select
BR2_PACKAGE_BUSYBOX" ?
ACK
Quoted 9 lines
Quoted 9 lines
config
BR2_ROOTFS_DEVICE_TABLEfs/Config.in +2
-6- 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
Quoted 8 lines
fs/Config.in config BR2_ROOTFS_POST_BUILD_SCRIPT · line 44
Quoted 5 lines
fs/Config.in +5
-0+ 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.Something odd here with the indentation. We should only see the new line "depends on
BR2_ROOTFS_DEVICE_CREATION_STATIC" and no other change.
The indentation is already wrong in repository.
Quoted 6 lines
linux/linux.mk ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y) · line 111
Quoted 4 lines
linux/linux.mk +4
-0+ifneq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y) + $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config) +endifSo devtmpfs is used even when mdev or udev are used ?
Why not? Otherwise you'll have to take care about /dev and fill it with devices.
Quoted 9 lines
package/busybox/S10mdev line 3
Quoted 7 lines
index 0000000..943b73b
package/busybox/S10mdev new file +3
-0@@ -0,0 +1,26 @@ +#!/bin/sh +# +# Start the mdev....s/the//
ACK
Quoted 4 lines
Quoted 4 lines
package/busybox/S10mdev new file +4
-0+# + +case "$1" in + start)
Quoted 8 lines
package/busybox/S10mdev line 9
Quoted 2 lines
package/busybox/S10mdev new file +2
-0+ echo "Starting mdev..." + /sbin/mdev -sThis is not sufficient as far as I remember: this will only populate /dev with the existing devices. mdev also needs to be registered as a hotplug event handler by writing to some
/proc/sysfile. See mdev documentation for details (docs/mdev.txtin Busybox sources).
This can be done by filling the appropriate kernel option in .config UEVENT_HELPER_PATH.
Quoted 5 lines
package/busybox/S10mdev line 13
Quoted 3 lines
package/busybox/S10mdev new file +3
-0+ stop) + echo -n "Stopping mdev..." + killall mdevmdev is not a daemon, so there's no point in killing it.
ACK
Quoted 42 lines
Quoted 33 lines
package/busybox/busybox.mk +14
-0@@ -20,6 +20,19 @@ ifndef BUSYBOX_CONFIG_FILE 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 @@ define BUSYBOX_CONFIGURE_CMDS $(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)" \package/busybox/busybox.mk endif · line 160
Quoted 5 lines
package/busybox/busybox.mk +1
-0@@ -142,6 +156,7 @@ endif define BUSYBOX_INSTALL_TARGET_CMDS $(BUSYBOX_INSTALL_BINARY) -chmod a+rx $(TARGET_DIR)/usr/share/udhcpc/default.script + $(BUSYBOX_INSTALL_MDEV_SCRIPT) endefThis part sounds good to me.
Thomas
PATCH 3/4 Create menu entry to select device creation method
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.
fs/Config.in +27 -6
@@ -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"
package/busybox/S10mdev new file +22 -0
@@ -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 $? + +
package/busybox/busybox.mk +15 -0
@@ -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
linux/linux.mk +7 -0
@@ -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 $@
PATCH 4/4 Add network scripting folders to fs/skeleton
In reply to Yegor YefremovQuoted 2 lines · On Fri, 24 Sep 2010 09:39:49 +0200 Yegor Yefremov…
Those folders by device_table.txt. If using the dynamic device creation method these folders will be missing.
Thanks, merged into my for-2011.02/boards-cleanup branch.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 3/4 Create menu entry to select device creation method
In reply to Yegor YefremovQuoted 8 lines · On Thu, 30 Sep 2010 14:57:53 +0200 Yegor Yefremov…
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
Quoted 4 lines
All dynamic methods are base on devtmpfs, so one doesn't need to care about /dev folder.
Signed-off-by Yegor Yefremov <[email protected]>
Thanks, merged into my for-2011.02/boards-cleanup branch.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com