2006-10-04 20:05:48 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2011-11-07 22:58:34 +00:00
|
|
|
# Copyright (C) 2006-2011 OpenWrt.org
|
2006-06-27 00:36:13 +00:00
|
|
|
|
2006-10-15 21:03:30 +00:00
|
|
|
START=10
|
2019-01-13 21:43:48 +00:00
|
|
|
STOP=90
|
2007-03-06 21:28:57 +00:00
|
|
|
|
2014-04-07 10:01:54 +00:00
|
|
|
uci_apply_defaults() {
|
2014-04-07 10:29:47 +00:00
|
|
|
. /lib/functions/system.sh
|
|
|
|
|
2014-04-07 10:01:54 +00:00
|
|
|
cd /etc/uci-defaults || return 0
|
|
|
|
files="$(ls)"
|
|
|
|
[ -z "$files" ] && return 0
|
|
|
|
mkdir -p /tmp/.uci
|
|
|
|
for file in $files; do
|
|
|
|
( . "./$(basename $file)" ) && rm -f "$file"
|
|
|
|
done
|
|
|
|
uci commit
|
|
|
|
}
|
|
|
|
|
2013-11-07 12:45:57 +00:00
|
|
|
boot() {
|
2006-10-04 20:05:48 +00:00
|
|
|
[ -f /proc/mounts ] || /sbin/mount_root
|
|
|
|
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
|
2008-05-13 09:21:17 +00:00
|
|
|
[ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
|
2007-05-09 20:54:41 +00:00
|
|
|
|
2006-10-04 20:05:48 +00:00
|
|
|
mkdir -p /var/run
|
|
|
|
mkdir -p /var/log
|
|
|
|
mkdir -p /var/lock
|
2007-06-16 00:01:33 +00:00
|
|
|
mkdir -p /var/state
|
2015-10-19 10:09:46 +00:00
|
|
|
mkdir -p /var/tmp
|
2008-02-03 06:48:15 +00:00
|
|
|
mkdir -p /tmp/.uci
|
2009-01-06 21:53:45 +00:00
|
|
|
chmod 0700 /tmp/.uci
|
2006-10-04 20:05:48 +00:00
|
|
|
touch /var/log/wtmp
|
|
|
|
touch /var/log/lastlog
|
2020-01-01 02:11:54 +00:00
|
|
|
mkdir -p /tmp/resolv.conf.d
|
|
|
|
touch /tmp/resolv.conf.d/resolv.conf.auto
|
|
|
|
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
|
2013-12-27 21:15:09 +00:00
|
|
|
grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
|
2020-07-22 13:28:06 +00:00
|
|
|
grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
|
2006-10-04 20:05:48 +00:00
|
|
|
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
|
2007-06-25 08:32:25 +00:00
|
|
|
|
2013-06-21 16:53:59 +00:00
|
|
|
/sbin/kmodloader
|
2011-11-03 20:02:25 +00:00
|
|
|
|
base-files, mac80211, broadcom-wl: wifi detection and configuration
Currently, the wifi detection script is executed as part of
the (early) boot process. Pluggable wifi USB devices, which
are inserted at a later time are not automatically
detected and therefore they don't show up in LuCI.
A user has to deal with wifi detection manually, or restart
the router.
However, the current "sleep 1" window - which the boot
process waits for wifi devices to "settle down" - is too
short to detect wifi devices for some routers anyway.
For example, this can happen with USB WLAN devices on the
WNDR4700. This is because the usb controller needs to load
its firmware from UBI and initialize, before it can operate.
The issue can be seen on a BT HomeHub 5A as well as soon as
the caldata are on an ubi volume. This is because the ath9k
card has to be initialized by owl-loader first. Which has to
wait for the firmware extraction script to retrieve the pci
initialization values inside the caldata.
This patch moves the wifi configuration to hotplug scripts.
For mac80211, the wifi configuration will now automatically
run any time a "ieee80211" device is added. Likewise
broadcom-wl's script checks for new "net" devices which
have the "wl$NUMBER" moniker.
Issues with spawning multiple interface configuration - in
case the detection script is run concurrently - have been
resolved by using a named section for the initial
configuration. Concurrent configuration scripts will now
simply overwrite the same existing configuration.
A workaround which preserves the "sleep 1" window for just
the first boot has been added. This allows the existing
brcm47xx boot and mvebu uci-default scripts to correctly
setup the initial mac addresses and regulatory domain.
And finally, the patch renames the "wifi detect" into
"wifi config". As the script no longer produces any output
that has to be redirected or appended to the configuration
file.
Thanks to Martin Blumenstingl for helping with the implementation
and testing of the patch.
Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-10-17 13:59:14 +00:00
|
|
|
[ ! -f /etc/config/wireless ] && {
|
2020-02-07 14:42:54 +00:00
|
|
|
# compat for bcm47xx and mvebu
|
base-files, mac80211, broadcom-wl: wifi detection and configuration
Currently, the wifi detection script is executed as part of
the (early) boot process. Pluggable wifi USB devices, which
are inserted at a later time are not automatically
detected and therefore they don't show up in LuCI.
A user has to deal with wifi detection manually, or restart
the router.
However, the current "sleep 1" window - which the boot
process waits for wifi devices to "settle down" - is too
short to detect wifi devices for some routers anyway.
For example, this can happen with USB WLAN devices on the
WNDR4700. This is because the usb controller needs to load
its firmware from UBI and initialize, before it can operate.
The issue can be seen on a BT HomeHub 5A as well as soon as
the caldata are on an ubi volume. This is because the ath9k
card has to be initialized by owl-loader first. Which has to
wait for the firmware extraction script to retrieve the pci
initialization values inside the caldata.
This patch moves the wifi configuration to hotplug scripts.
For mac80211, the wifi configuration will now automatically
run any time a "ieee80211" device is added. Likewise
broadcom-wl's script checks for new "net" devices which
have the "wl$NUMBER" moniker.
Issues with spawning multiple interface configuration - in
case the detection script is run concurrently - have been
resolved by using a named section for the initial
configuration. Concurrent configuration scripts will now
simply overwrite the same existing configuration.
A workaround which preserves the "sleep 1" window for just
the first boot has been added. This allows the existing
brcm47xx boot and mvebu uci-default scripts to correctly
setup the initial mac addresses and regulatory domain.
And finally, the patch renames the "wifi detect" into
"wifi config". As the script no longer produces any output
that has to be redirected or appended to the configuration
file.
Thanks to Martin Blumenstingl for helping with the implementation
and testing of the patch.
Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-10-17 13:59:14 +00:00
|
|
|
sleep 1
|
|
|
|
}
|
2011-11-03 20:02:25 +00:00
|
|
|
|
2016-08-13 12:04:23 +00:00
|
|
|
/bin/config_generate
|
2014-04-07 10:01:54 +00:00
|
|
|
uci_apply_defaults
|
2013-07-11 17:00:54 +00:00
|
|
|
|
|
|
|
# temporary hack until configd exists
|
|
|
|
/sbin/reload_config
|
2006-10-04 20:05:48 +00:00
|
|
|
}
|