bootscript.hush 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. # $Header$
  2. # hush bootscript for PPCBOOT on L1
  3. # note: all #s are in hex, do _NOT_ prefix it with 0x
  4. flash_rfs=ffc00000
  5. flash_krl=fff00000
  6. tftp_addr=100000
  7. tftp2_addr=1000000
  8. if printenv booted
  9. then
  10. echo already booted before
  11. else
  12. echo first boot in environment, create and save settings
  13. setenv booted OK
  14. saveenv
  15. fi
  16. setenv autoload no
  17. # clear out stale env stuff, so we get fresh from dhcp.
  18. for setting in initrd fromflash kernel rootfs rootpath
  19. do
  20. setenv $setting
  21. done
  22. dhcp
  23. # if host provides us with a different bootscript, us it.
  24. if printenv bootscript
  25. then
  26. tftp $tftp_addr $bootcript
  27. if imi $tftp_addr
  28. then
  29. source $tftp_addr
  30. fi
  31. fi
  32. # default base kernel arguments.
  33. setenv bootargs $xbootargs devfs=mount ip=$ipaddr:$serverip:$gatewayip:$netmask:L1:eth0:off wdt=120
  34. # Have a kernel in flash?
  35. if imi $flash_krl
  36. then
  37. echo ok kernel to boot from $flash_krl
  38. setenv kernel $flash_krl
  39. else
  40. echo no kernel to boot from $flash_krl, need tftp
  41. fi
  42. # Have a rootfs in flash?
  43. echo test for SQUASHfs at $flash_rfs
  44. if imi $flash_rfs
  45. then
  46. echo appears to be a good initrd image at base of flash OK
  47. setenv rootfs $flash_rfs
  48. else
  49. echo no image at base of flash, need nfsroot or initrd
  50. fi
  51. # I boot from flash if told to and I can.
  52. if printenv fromflash && printenv kernel && printenv rootfs
  53. then
  54. echo booting entirely from flash
  55. setenv bootargs root=/dev/ram0 rw $bootargs
  56. bootm $kernel $rootfs
  57. echo oh no failed so I try some other stuff
  58. fi
  59. # TFTP down a kernel
  60. if printenv bootfile
  61. then
  62. tftp $tftp_addr $bootfile
  63. setenv kernel $tftp_addr
  64. echo I will boot the TFTP kernel
  65. else
  66. if printenv kernel
  67. then
  68. echo no bootfile specified, will use one from flash
  69. else
  70. setenv bootfile /opt/crayx1/craymcu/l1/flash/linux.image
  71. echo OH NO! we have no bootfile,nor flash kernel! try default: $bootfile
  72. tftp $tftp_addr $bootfile
  73. setenv kernel $tftp_addr
  74. fi
  75. fi
  76. # the rootfs.
  77. if printenv rootpath
  78. then
  79. echo rootpath is $rootpath
  80. if printenv initrd
  81. then
  82. echo initrd is also specified, so use $initrd
  83. tftp $tftp2_addr $initrd
  84. setenv bootargs root=/dev/ram0 rw cwsroot=$serverip:$rootpath $bootargs
  85. bootm $kernel $tftp2_addr
  86. else
  87. echo initrd is not specified, so use NFSROOT $rootpat
  88. setenv bootargs root=/dev/nfs ro nfsroot=$serverip:$rootpath $bootargs
  89. bootm $kernel
  90. fi
  91. else
  92. echo we have no rootpath check for one in flash
  93. if printenv rootfs
  94. then
  95. echo I will use the one in flash
  96. setenv bootargs root=/dev/mtdblock/0 ro rootfstype=squashfs $bootargs
  97. bootm $kernel
  98. else
  99. setenv rootpath /export/crayl1
  100. echo OH NO! we have no rootpath,nor flash kernel! try default: $rootpath
  101. setenv bootargs root=/dev/mtdblock/0 ro rootfstype=squashfs $bootargs
  102. bootm $kernel
  103. fi
  104. fi
  105. reset