51 lines
1.2 KiB
Bash
Executable File
51 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#===============================================================================
|
|
#
|
|
# mdev
|
|
#
|
|
# Copyright (C) 2013 by Digi International Inc.
|
|
# All rights reserved.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License version 2 as published by
|
|
# the Free Software Foundation.
|
|
#
|
|
# Description: Device nodes bootscript
|
|
#
|
|
#===============================================================================
|
|
|
|
set -e
|
|
|
|
if [ "${1}" != "start" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
MDEV="/sbin/mdev"
|
|
MAKEDEVS="/sbin/makedevs"
|
|
CONFIG="/etc/device_table"
|
|
|
|
# Create shared memory mount point
|
|
mkdir -p /dev/shm
|
|
|
|
# Register mdev as hotplug to create devices.
|
|
if [ -f /proc/sys/kernel/hotplug ]; then
|
|
echo > /dev/mdev.seq
|
|
echo "${MDEV}" > /proc/sys/kernel/hotplug
|
|
fi
|
|
|
|
# Create all device nodes scanning /sys.
|
|
${MDEV} -s
|
|
|
|
# Create rest device nodes via configuration file.
|
|
[ -f "${CONFIG}" ] && ${MAKEDEVS} -d "${CONFIG}" / >/dev/null 2>&1
|
|
|
|
# mount storage devices
|
|
usbmount
|
|
mmc-mount
|
|
|
|
# fire *add* event for ADC so the nodes are created in case of built-in driver
|
|
for i in $(echo /sys/bus/platform/drivers/*adc*/uevent); do
|
|
[ "${i}" = "/sys/bus/platform/drivers/*adc*/uevent" ] && continue
|
|
echo add > $i
|
|
done
|