example for hotplug:
################ Step 1. add kernel hotplug config ################
CONFIG_HOTPLUG=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_FAKE=y
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_SHPC=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
for this sdk case ,it using ueven,some system may using busybox mdev.
################ step 2.add follow hotplug script on your rootfs ################
-----------------------------------------------------------------------
#! /bin/sh
#mount sysfs on /sys
sysfs=/sys
#firmware path
fwpath=/tmp
lpath=$sysfs/$DEVPATH
fw=$fwpath/$FIRMWARE
#
# We only support firmware subsystem
#
if [ "$1" != "firmware" ]
then
exit 0
fi
case "$ACTION" in
add)
if [ ! -e $lpath/loading ]
then
sleep 1
fi
if [ -f $fw ]
then
echo 1 > $lpath/loading
cp $fw $lpath/data
echo 0 > $lpath/loading
else
echo -1 > $lpath/loading
fi
;;
remove)
;;
*)
exit 1
;;
esac
exit 0
--------------------------------------------------------------------------------------
add above script on your rcS or any initial script when system up.
echo "/tmp/hotplug" > /sys/kernel/uevent_helper
################ step 3 ################
on kernel driver ,you can using folloe kernel api to get firmware on local flash file system .
if ((result = request_firmware(&fw, XXXXXXXX_YYYYYYYY_IMG, &pdev->dev)) == -ENOENT) {
/*
* No firmware found in the firmware directory, skip firmware downloading process
* boot from flash directly on target
*/
printk( "firmware NOT found , image downloading error code : %d\n",result);
// error handle .
}