blob: f2f78ad5c30f3f01d2917bf100f725fb931b26b5 [file] [log] [blame]
wdenk7f70e852003-05-20 14:25:27 +00001# $Header$
2# hush bootscript for PPCBOOT on L1
3# note: all #s are in hex, do _NOT_ prefix it with 0x
4
5flash_rfs=ffc00000
6flash_krl=fff00000
7tftp_addr=100000
8tftp2_addr=1000000
9
10if printenv booted
11then
12 echo already booted before
13else
14 echo first boot in environment, create and save settings
15 setenv booted OK
16 saveenv
17fi
18
19setenv autoload no
20# clear out stale env stuff, so we get fresh from dhcp.
21for setting in initrd fromflash kernel rootfs rootpath
22do
23setenv $setting
24done
25
26dhcp
27
28# if host provides us with a different bootscript, us it.
29if printenv bootscript
30 then
31 tftp $tftp_addr $bootcript
32 if imi $tftp_addr
33 then
Wolfgang Denk74de7ae2009-04-01 23:34:12 +020034 source $tftp_addr
wdenk7f70e852003-05-20 14:25:27 +000035 fi
36fi
37
38# default base kernel arguments.
39setenv bootargs $xbootargs devfs=mount ip=$ipaddr:$serverip:$gatewayip:$netmask:L1:eth0:off wdt=120
40
41# Have a kernel in flash?
42if imi $flash_krl
43then
44 echo ok kernel to boot from $flash_krl
45 setenv kernel $flash_krl
46else
47 echo no kernel to boot from $flash_krl, need tftp
48fi
49
Wolfgang Denk93e14592013-10-04 17:43:24 +020050# Have a rootfs in flash?
wdenk7f70e852003-05-20 14:25:27 +000051echo test for SQUASHfs at $flash_rfs
52
53if imi $flash_rfs
54then
55 echo appears to be a good initrd image at base of flash OK
56 setenv rootfs $flash_rfs
57else
58 echo no image at base of flash, need nfsroot or initrd
59fi
60
61# I boot from flash if told to and I can.
62if printenv fromflash && printenv kernel && printenv rootfs
63then
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
68fi
69
70# TFTP down a kernel
71if printenv bootfile
Wolfgang Denk93e14592013-10-04 17:43:24 +020072then
wdenk7f70e852003-05-20 14:25:27 +000073 tftp $tftp_addr $bootfile
74 setenv kernel $tftp_addr
75 echo I will boot the TFTP kernel
76else
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
86fi
87
88# the rootfs.
89if printenv rootpath
90then
91 echo rootpath is $rootpath
92 if printenv initrd
Wolfgang Denk93e14592013-10-04 17:43:24 +020093 then
wdenk7f70e852003-05-20 14:25:27 +000094 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
103else
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
116fi
117reset