boot 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2006-2011 OpenWrt.org
  3. START=10
  4. STOP=90
  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. applied=""
  11. for file in $files; do
  12. ( . "./$(basename $file)" ) && applied="$applied $file"
  13. done
  14. uci commit
  15. sync
  16. rm -f $applied
  17. }
  18. boot() {
  19. [ -f /proc/mounts ] || /sbin/mount_root
  20. [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
  21. mkdir -p /var/lock
  22. chmod 1777 /var/lock
  23. mkdir -p /var/log
  24. mkdir -p /var/run
  25. ln -s /var/run /run
  26. ln -s /var/lock /run/lock
  27. mkdir -p /var/state
  28. mkdir -p /var/tmp
  29. mkdir -p /tmp/.uci
  30. chmod 0700 /tmp/.uci
  31. touch /var/log/wtmp
  32. touch /var/log/lastlog
  33. mkdir -p /tmp/resolv.conf.d
  34. touch /tmp/resolv.conf.d/resolv.conf.auto
  35. ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
  36. grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug
  37. grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
  38. grep -q pstore /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t pstore pstore /sys/fs/pstore
  39. [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
  40. touch /tmp/.config_pending
  41. /sbin/kmodloader
  42. [ ! -f /etc/config/wireless ] && {
  43. # compat for bcm47xx and mvebu
  44. sleep 1
  45. }
  46. mkdir -p /tmp/.uci
  47. [ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools)
  48. /bin/config_generate
  49. rm -f /tmp/.config_pending
  50. /sbin/wifi config
  51. uci_apply_defaults
  52. sync
  53. # temporary hack until configd exists
  54. /sbin/reload_config
  55. }