uloop_done 5.2 hotplug配置文件 /etc/hotplug-preinit.json定义了add FIRMWARE热插拔行为: [ ["case","ACTION", {"add": [ ["if", ["has","FIRMWARE"], [ ["exec","/sbin/hotplug-call","%SUBSYSTEM%"], ["load-firmware","/lib/firmware"], ["return"] ] ] ] } ], ["if", ["eq","...
cat /sbin/hotplug-call #!/bin/sh #Copyright (C) 2006-2010 OpenWrt.org export HOTPLUG_TYPE="$1" . /lib/functions.sh PATH=/usr/sbin:/usr/bin:/sbin:/bin LOGNAME=root USER=root export PATH LOGNAME USER export DEVICENAME="${DEVPATH##*/}" [ \! -z "$1" -a -d /etc/hotplug.d/...
当接口状态出现ifup或者ifdown时,netifd守护进程会调用call_hotplug()(/interface-event.c)来处理这个事件,call_hotplug()执行run_cmd(),并且设置系统环境变量$ACTION, $INTERFACE, $DEVICE, 同时调用hotplug_cmd_path(=DEFAULT_HOTPLUG_PATH=/sbin/hotplug-call, 在netifd.h中)并传入参数iface。下表是上述变量的介绍。
3.网络检测添加LED闪烁(/sbin/hotplug-call) 3.1 zdetect网络检测模块 在zrouter/zpackages/zihome/utils/zdetect/src/zdetect.c里面会发送hotplug event当网络变化的时候: static void inet_hotplug(const char* action) { char *argv[3]; int pid; pid = fork(); if (pid < 0) { dbg_printf(MSG_INF...
1)/etc/hotplug.json 这个文件的格式,大致如下: [ ["case","ACTION", { "add":[ ["if", ["has","FIRMWARE"], [ ["exec","/sbin/hotplug-call","%SUBSYSTEM%"], ["load-firmware","/lib/firmware"], ["return"] ] ], ], "remove" :[ ...
8、1024);print(s=mt/2)l)?mt-l:s /proc/meminfo)mount tmpfs /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777if grep devfs /proc/filesystems /dev/null; thenmount devfs /dev -t devfsM0=/dev/pty/m0M1=/dev/pty/m1HOTPLUG=/sbin/hotplug-callelif -x /sbin/hotplug2 ; thenmount ...
1.gpio-button-hotplug(内核层发送hotplug到procd) gpio-button-hotplug为kernel的一个package,位于package/kernel/gpio-button-hotplug/ 要把CONFIG_PACKAGE_kmod-gpio-button-hotplug=y选项打开 1.1驱动 "gpio-keys"和"gpio-keys-polled"就是两个platform设备,如下: ...
exec /sbin/hotplug-call %SUBSYSTEM% } DEVICENAME == watchdog { exec /sbin/watchdog -t 5 /dev/watchdog next-event } The second step is to find out the internal name of the button you want to use: some images use generic names such asBTN_1,BTN_2, others have more specific ones ...
OpenWrt是⼀个开放的linux平台,主要⽤于带wifi的⽆线路由上。类似于Ubuntu、Red Hat、之类的linux发⾏版本,它也有⼀套⾃⼰的启动流程。下⾯,我就以我的Linksys 的WRT54G为平台介绍⼀下,OpenWrt的启动流程。⾸先,CFE(common firmware environment)--它就是⼀个bootloader,类似u-boot,...
openwrt下有很多开源的内核模块位于package/kernel/下,如gpio-button-hotplug、mwlwifi等。这些模块都是文件系统启动后,通过autoload的方式进行insmod载入的。 1、正常思路 在《Openwrt add function module to package》章节里面有介绍,如何添加一个内核模块。