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