2009-12-08 10:04:51     error setting up hotplug

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2009-12-08 10:04:51     error setting up hotplug

Steve ten Pas (UNITED STATES)

Message: 83246   

 

I am trying to get hotplugging to work.  I have the kernel setup for hotplug.

 

I have the following lines in my etc/rc script:

 

mount -t proc proc /proc

mount -t sysfs sysfs /sys

 

echo /bin/mdev > /proc/sys/kernel/hotplug

/bin/mdev -s

 

 

I get the following error when the system boots:

 

/proc/sys/kernel/hotplug: can't create

 

 

 

Any ideas on why I am getting this error?

 

 

 

Thanks,

 

Steve

QuoteReplyEditDelete

 

 

2009-12-08 15:16:27     Re: error setting up hotplug

Steve ten Pas (UNITED STATES)

Message: 83253   

 

I changed my rc and the error went away.   I changed the echo line to:

 

    [ -e /proc/sys/kernel/hotplug ] && echo /bin/mdev > /proc/sys/kernel/hotplug

 

 

I still do not see  hotplug in the  /proc/sys/kernel directory.  I have noticed that I can do a remove of the "g_file_storage" module and it will run my hotplug script.  I am trying to get the hotplug script to run run I unplug the bf527ez kit from my PC.  I am using the file storage method to see my ez kit board from my PC.  That all seems to be working, I just can't get the hotplug part to work.  Any ideas?

QuoteReplyEditDelete

 

 

2009-12-08 18:23:55     Re: error setting up hotplug

Mike Frysinger (UNITED STATES)

Message: 83258   

 

do you actually have the /proc/sys/kernel/hotplug file ?

 

why dont you use the stock rc file that comes with all ADI boards

QuoteReplyEditDelete

 

 

2009-12-09 12:54:29     Re: error setting up hotplug

Steve ten Pas (UNITED STATES)

Message: 83308   

 

I am using the stock rc file with a couple of added lines.  I have included the rc and hotplug file that I am using.

 

The /proc/sys/kernel/hotplug file never gets created.  I have the included hotplug file in the /sbin directory.

 

 

 

Thanks,

 

Steve

QuoteReplyEditDelete

 

 

2009-12-09 13:12:51     Re: error setting up hotplug

Steve ten Pas (UNITED STATES)

Message: 83309   

 

I am using the stock rc file with a couple of added lines.  Here is what I am using:

 

####START OF RC FILE#####

 

# This file targets a *development* system.  Many things are not

# needed for *production* systems.  Comment out what you do not need.

 

hostname blackfin

 

mount -t proc proc /proc -o noexec,nosuid,nodev

mount -t sysfs sysfs /sys -o noexec,nosuid,nodev

 

#

# Setup dynamic /dev and let mdev manage it for us

#

if [ -e /bin/mdev ] ; then

 

    mount -t tmpfs mdev /dev -o exec,nosuid,mode=0755,size=10M

    [ -e /proc/sys/kernel/hotplug ] && echo /bin/mdev > /proc/sys/kernel/hotplug

    /bin/mdev -s

 

    # some people want this (like to be verbose in their scripts?)

    ln -s /proc/self/fd /dev/fd

    ln -s fd/0 /dev/stdin

    ln -s fd/1 /dev/stdout

    ln -s fd/2 /dev/stderr

     

fi

#

# Setup dynamic pseudo-terminal file system ... needed by any system that

# uses telnet or ssh (like dropbear) rather than the old static pty system.

# You should give this a dedicated gid and set the mode to 0650.

#

mkdir -p /dev/pts

mount -t devpts devpts /dev/pts -o noexec,nosuid

 

#

# Give the log/state/runtime files in /var temporary storage that'll be

# lost when we reboot.

#

mount -t ramfs var /var

mkdir /var/tmp /var/log /var/run /var/lock

 

#

# Give temp files a read/write location not in flash/etc...

#

mount -t tmpfs tmp /tmp -o nosuid,nodev

 

#

# Needed if you plan on doing anything USB related

#

[ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb

 

#

# Needed if you run an NFS server on the board

#

grep -qs nfsd /proc/filesystems && mount -t nfsd nfsd /proc/fs/nfsd

 

#

# Useful for debugging only

#

[ -d /sys/kernel/debug ] && mount -t debugfs debugfs /sys/kernel/debug

 

#

# Create your own interpreters for random file formats

#

[ -d /proc/sys/fs/binfmt_misc ] && mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc

 

#

# User interface to security modules (selinux, etc...)

#

[ -d /sys/kernel/security ] && mount -t securityfs securityfs /sys/kernel/security

 

#

# the default calculated values for these kernel controls are too small for

# an embedded nommu system, so override them.  For more info check out

# - ./Documentation/sysctl/vm.txt

# - ./Documentation/filesystems/proc.txt

#

echo 4096 > /proc/sys/vm/min_free_kbytes

echo 300  > /proc/sys/vm/vfs_cache_pressure

 

#

# Do random network setup

#

#dhcpcd &

#ifconfig eth0 10.100.4.251 up

#ifconfig lo 127.0.0.1

 

#cat /etc/issue

cat /etc/motd

 

sleep 1

 

mount -t yaffs2 /dev/mtdblock2 /mnt/ffs

mount -t vfat /mnt/ffs/vfat.bin /mnt/vfat

modprobe /lib/modules/2.6.28.10-ADI-2009R1/kernel/drivers/usb/gadget/g_file_storage.ko file=/mnt/ffs/vfat.bin removable=y

 

modprobe /lib/modules/2.6.28.10-ADI-2009R1/kernel/drivers/media/video/blackfin/blackfin_cam.ko

 

 

####END OF RC FILE#####

 

 

 

The "proc/sys/kernel/hotplug file does not get created.  I do have a hotplug script in the /sbin directory.  It gets called as devices are added/removed, but it does not get called when the usb on board is disconneted from the PC.  Here is the hotplug script that I am using.

 

 

 

#######START OF HOTPLUG######

 

#!/bin/sh

#

#

 

/bin/mdev

# Define where to put the output message

 

output=/dev/console

 

# We only manage sda1 events

 

#echo hotplug script > $output

echo devpath $DEVPATH ":" $SUBSYSTEM > $output

#echo subsystem $SUBSYSTEM > $output

#echo action $ACTION > $output

 

echo $DEVPATH | grep sda1

if [ $? -ne 0 ]

then

exit 0

fi

 

echo "Hotplug Script begin" > $output

 

 

if [ $ACTION = "add" ]

then

echo "Key mounted" > $output

fi

 

# If key removed, umount it

if [ $ACTION = "remove" ]

then

echo "Key unmounted" > $output

fi

 

echo "Hotplug Script end" > $output

####END OF HOTPLUG###

 

 

 

Thanks,

 

Steve

QuoteReplyEditDelete

 

 

2009-12-09 15:41:12     Re: error setting up hotplug

Mike Frysinger (UNITED STATES)

Message: 83313   

 

the lines you quoted originally are not in the stock rc file

 

the echo into /proc/ doesnt *create* anything.  it writes a value to an already existing file.

 

you need to review your kernel configuration to make sure you didnt disable things like CONFIG_HOTPLUG

QuoteReplyEditDelete

 

 

2009-12-11 09:09:07     Re: error setting up hotplug

Steve ten Pas (UNITED STATES)

Message: 83401   

 

The original lines came from the mdev.txt file.  I tried those because there was no proc/sys/kernel/hotplug file.

 

I have double checked my kernel config and I have hotplug enabled.  Should I be seeing a hotplug file in the proc/kernel/sys directory?  I have included my kernel config file.  I am trying to get notification when the usb is disconnected from the PC.  I am using the file backed storage so that I can transfer files between my ez kit and the pc.  This all works except the notification part.

 

 

 

Thanks for your help.  See my kernel config file below.

 

config

QuoteReplyEditDelete

 

 

2009-12-15 13:34:53     Re: error setting up hotplug

Mike Frysinger (UNITED STATES)

Message: 83535   

 

the sysctl setting apparently relies on CONFIG_NET which you've disabled

 

try editing linux-2.6.x/kernel/sysctl.c and removing the CONFIG_NET check around the "hotplug" array entry

Attachments

Outcomes