rpi: tizen-boot: rpi3: pass network arguments on flash mode
[platform/kernel/u-boot.git] / board / raspberrypi / rpi / tizen-boot-rpi3.scr
1 # U-boot script for tizen
2 boardname=rpi3
3 mmcbootdev=0
4 mmcbootpart=1
5 mmcrootdev=0
6 mmcrootpart=2
7 mmcinformpart=9
8
9 #
10 # Tizen kernel image is over than 16MB, it will be overlapped with other address.
11 # To avoid this behaivor, change to 0x02d00000 from 0x01000000
12 #
13 # NOTE: booti command will move kernel image to 0x80000 (text offset), and
14 # ramdisk is loaded to $ramdisk_addr_r (0x02100000), so kernel should be equal
15 # or less than 32.5MB to load ramdisk properly.
16 #
17 tizen_kernel_addr_r=0x02d00000
18
19 dummy=0x24000000
20 rebootparamfile=reboot-param.bin
21 # use the ram address of ramdisk before loading ramdisk image
22 rebootparam_addr=0x3a62b000
23 # 0x72677075 is ascii code for representing string "upgr"
24 upgrade_val=72677075
25 # 0x72766372 is ascii code for representing string "rcvr"
26 recovery_val=72766372
27 # 0x6665646e is ascii code for representing string "ndef"
28 nodef_val=6665646e
29 # 0x6c6e7764 is ascii code for representing string "dwnl"
30 download_val=6c6e7764
31
32 # Normal ramdisk : partition 7
33 # Ramdisk Recovery : Partition 8
34 ramdiskpart=7
35 ramdisksize=800000
36 bootmode=ramdisk
37
38 # Device that included the image.
39 bootdev=mmc
40
41 if test -e $bootdev $mmcbootdev:$mmcinformpart $rebootparamfile; then;
42         ext4load $bootdev $mmcbootdev:$mmcinformpart $rebootparam_addr $rebootparamfile;
43         if itest.l *${rebootparam_addr} == ${upgrade_val}; then;
44                 ramdiskpart=8
45                 ramdisksize=c00000
46                 bootmode=fota
47         elif itest.l *${rebootparam_addr} == ${recovery_val}; then;
48                 ramdiskpart=8
49                 ramdisksize=c00000
50                 bootmode=recovery
51         elif itest.l *${rebootparam_addr} == ${download_val}; then;
52                 ramdiskpart=8
53                 ramdisksize=c00000
54                 bootmode=flash
55         elif itest.l *${rebootparam_addr} == ${nodef_val}; then;
56                 echo "This reboot parameter is not supported...";
57         fi
58 fi
59
60 if test "${bootmode}" = "flash"; then;
61         if test -n "${ipaddr}"; then;
62                 ip_opt=\"ip=${ipaddr}::${gateway}:${netmask}\"
63         else
64                 ip_opt=\"ip=dhcp\"
65         fi
66 fi
67
68 # boot from ram0 if there is sbin
69 if test -e $bootdev $mmcrootdev:$ramdiskpart sbin/init; then;
70 rootdev=ram0
71 else
72 rootdev=mmcblk${mmcrootdev}p${mmcrootpart}
73 bootmode=normal
74 fi
75
76 # setting console device if noting is set
77 if test -z "${console}"; then;
78         setenv console "console=ttyS0,115200n8 earlycon=uart8250,mmio32,0x3f215040"
79 fi
80 echo "console: ${console}"
81
82 # Kernel image
83 kernel=Image
84 # DT image by model
85 if itest.l ${board_rev} == 0xd; then;
86         setenv fdtfile \"bcm2710-rpi-3-b-plus.dtb\"
87 else
88         setenv fdtfile \"bcm2710-rpi-3-b.dtb\"
89 fi
90 setenv boot_prefixes \"/\"
91
92 # To use comdline for using serial console. /* Normal mode */
93 setenv bootargs \"8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2709.serial=0xed6687d3 bcm2709.uart_clock=48000000 smsc95xx.macaddr=${ethaddr} root=/dev/${rootdev} rw bootmode=${bootmode} bcm2709.boardrev=0xa02082 rootwait ${console} vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 ${opts} ${ip_opt}\"
94
95 # Find the ramdisk offset and block count
96 part start $bootdev $mmcrootdev $ramdiskpart ramdisk_start
97 part size $bootdev $mmcrootdev $ramdiskpart ramdisk_size
98
99 echo "Searching for kernel in"; for prefix in $boot_prefixes; do
100 if load $bootdev $mmcbootdev:$mmcbootpart $tizen_kernel_addr_r $prefix$kernel; then;
101         echo ${bootmode} "boot";
102         load $bootdev $mmcbootdev:$mmcbootpart $fdt_addr_r $fdtfile;
103         if test -e mmc $mmcrootdev:$ramdiskpart sbin/init; then;
104                 echo "Loading Ramdisk from partition"${ramdiskpart};
105                 mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
106         fi
107         booti $tizen_kernel_addr_r $ramdisk_addr_r:$ramdisksize $fdt_addr_r;
108 fi
109 done