boot 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2006-2011 OpenWrt.org
  3. START=10
  4. STOP=98
  5. uci_apply_defaults() {
  6. . /lib/functions/system.sh
  7. cd /etc/uci-defaults || return 0
  8. files="$(ls)"
  9. [ -z "$files" ] && return 0
  10. mkdir -p /tmp/.uci
  11. for file in $files; do
  12. ( . "./$(basename $file)" ) && rm -f "$file"
  13. done
  14. uci commit
  15. }
  16. boot() {
  17. [ -f /proc/mounts ] || /sbin/mount_root
  18. [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
  19. [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
  20. mkdir -p /var/run
  21. mkdir -p /var/log
  22. mkdir -p /var/lock
  23. mkdir -p /var/state
  24. mkdir -p /var/tmp
  25. mkdir -p /tmp/.uci
  26. chmod 0700 /tmp/.uci
  27. touch /var/log/wtmp
  28. touch /var/log/lastlog
  29. touch /tmp/resolv.conf.auto
  30. ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
  31. grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
  32. [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
  33. /sbin/kmodloader
  34. # allow wifi modules time to settle
  35. sleep 1
  36. /sbin/wifi detect > /tmp/wireless.tmp
  37. [ -s /tmp/wireless.tmp ] && {
  38. cat /tmp/wireless.tmp >> /etc/config/wireless
  39. }
  40. rm -f /tmp/wireless.tmp
  41. /bin/board_detect
  42. uci_apply_defaults
  43. # temporary hack until configd exists
  44. /sbin/reload_config
  45. # create /dev/root if it doesn't exist
  46. [ -e /dev/root -o -h /dev/root ] || {
  47. rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline)
  48. [ -n "$rootdev" ] && ln -s "$rootdev" /dev/root
  49. }
  50. }