You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. # $Id$
  3. PATH=/sbin:/bin
  4. echo Busybox /linuxrc starting
  5. echo Mounting /proc filesystem
  6. mount -t proc none /proc
  7. echo=echo
  8. if grep '\bquiet\b' /proc/cmdline > /dev/null; then
  9. echo=true
  10. quiet=1
  11. fi
  12. $echo Creating root device
  13. mknod /dev/root b 1 0 2>/dev/null
  14. chmod 700 /dev/root
  15. echo 0x100 > /proc/sys/kernel/real-root-dev
  16. $echo Inserting modules
  17. if [ -z "$quiet" ]; then
  18. /bin/insert-modules
  19. else
  20. /bin/insert-modules >/dev/null
  21. fi
  22. $echo Bringing up loopback interface
  23. ifconfig lo 127.0.0.1 up
  24. route add -net 127.0.0.0 netmask 255.0.0.0 lo
  25. # Hack required for prism2 cards
  26. # It is not yet possible to use iwconfig to configure these cards,
  27. # so we need wlanctl.
  28. if ifconfig wlan0 down 2> /dev/null; then
  29. $echo Setting up wireless link
  30. wlanctl wlan0 lnxreq_ifstate ifstate=enable
  31. wlanctl wlan0 lnxreq_autojoin ssid= authtype=opensystem
  32. fi
  33. $echo Obtaining IP address via DHCP
  34. $echo Trying to obtain IP address via wired link [eth0]
  35. if udhcpc -i eth0 -f -n -q -s /bin/udhcpc-post; then
  36. $echo Successfully obtained IP address via wired link [eth0]
  37. else
  38. $echo Failed to obtain IP address via wired link [eth0]
  39. $echo Trying to obtain IP address via wireless link [wlan0]
  40. udhcpc -i wlan0 -f -n -q -s /bin/udhcpc-post
  41. fi
  42. if [ -d /sysroot/initrd ]; then
  43. $echo Unmounting /proc prior to pivot_root
  44. umount /proc
  45. $echo Pivoting root to /sysroot
  46. pivot_root /sysroot /sysroot/initrd
  47. cd /
  48. $echo Remounting devfs at correct place
  49. mount -t devfs none /dev
  50. $echo Releasing locks on old devfs
  51. exec 0</dev/null
  52. exec 1>/dev/console
  53. exec 2>/dev/console
  54. $echo Unmounting old devfs
  55. umount /initrd/dev
  56. else
  57. # Failed to mount root: report error and hang
  58. echo FATAL ERROR: Failed to mount root filesystem
  59. echo Press Alt-SysRq-B or hit the reset switch to reboot
  60. while : ; do sleep 6000 ; done
  61. fi