1 # U-boot script for tizen VF2 and QEMU
3 if test -z "${devtype}"; then
4 setenv devtype "${bootdevtype}"
5 if test "${target}" = "virtio0"; then;
8 if test "${target}" = "mmc0" -o "${target}" = "mmc1"; then;
11 if test "${target}" = "usb0"; then;
14 if test "${target}" = "nvme" -o "${target}" = "nvme0"; then;
19 if test -e $devtype $devnum:$informpart $slotfile; then;
20 ext4load $devtype $devnum:$informpart $slot_addr $slotfile;
21 if itest.b *${slot_addr} == 0x62; then;
22 setenv ramdiskpart 0xf
25 echo "boot from slot_b";
30 echo "boot from slot_a";
36 echo "boot from slot_a";
39 if test -e $devtype $devnum:$informpart $rebootparamfile; then;
40 ext4load $devtype $devnum:$informpart $rebootparam_addr $rebootparamfile;
41 if itest.l *${rebootparam_addr} == ${upgrade_val}; then;
42 if test "${partition_ab}" = "b"; then
43 setenv ramdiskpart 0x10
46 setenv ramdiskpart 0xa
50 elif itest.l *${rebootparam_addr} == ${recovery_val}; then;
51 if test "${partition_ab}" = "b"; then
52 setenv ramdiskpart 0x10
55 setenv ramdiskpart 0xa
58 setenv bootmode recovery
59 elif itest.l *${rebootparam_addr} == ${download_val}; then;
60 if test "${partition_ab}" = "b"; then
61 setenv ramdiskpart 0x10
64 setenv ramdiskpart 0xa
68 elif itest.l *${rebootparam_addr} == ${nodef_val}; then;
69 echo "This reboot parameter is not supported...";
73 # This is for jumping to flash mode on u-boot.
74 if test "${bootmode}" = "download"; then;
75 if test "${partition_ab}" = "b"; then
76 setenv ramdiskpart 0x10
79 setenv ramdiskpart 0xa
85 if test "${bootmode}" = "flash"; then;
86 if test -n "${ipaddr}"; then;
87 ip_opt=\"ip=${ipaddr}::${gateway}:${netmask}::eth0:off\"
91 # setting console device if noting is set
92 if test -z "${console}"; then;
93 setenv console "console=ttyS0,115200 earlycon"
95 echo "console: ${console}"
98 if setexpr pcb_revision sub "^VF7110(.).*" "\\1" "${serial#}"; then
99 if test "${pcb_revision}" = "A" -o "${pcb_revision}" = "a"; then
100 setenv fdtfile "jh7110-starfive-visionfive-2-v1.2a.dtb"
102 if test "${pcb_revision}" = "B" -o "${pcb_revision}" = "b"; then
103 setenv fdtfile "jh7110-starfive-visionfive-2-v1.3b.dtb"
107 setenv boot_prefixes \"/\"
109 # Find the ramdisk offset and block count
110 part start $devtype $devnum $ramdiskpart ramdisk_start
111 part size $devtype $devnum $ramdiskpart ramdisk_size
113 # Set to ramdisksize with real partition size. (Need to multiply block-size 0x200)
114 setexpr ramdisksize $ramdisk_size * 200
115 setexpr tizen_kernel_addr_r $ramdisk_addr_r + $ramdisksize
117 # boot from ramdisk if there is sbin or it is initramfs
118 if test -e $devtype $devnum:$ramdiskpart sbin/init; then;
120 echo "Loading Ramdisk from partition" ${part};
121 echo "Environment value of ramdiskpart is" ${ramdiskpart};
123 $devtype read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
125 # Check for gzip (initramfs) magic
126 $devtype dev $devnum;
127 $devtype read $ramdisk_addr_r $ramdisk_start 1;
128 if itest.w *$ramdisk_addr_r == 0x8b1f; then;
130 echo "Loading initramfs from partition ${part}";
131 echo "Environment value of ramdiskpart is" ${ramdiskpart};
132 $devtype read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
134 if test "${devtype}" = "mmc"; then;
135 setenv rootdev mmcblk${devnum}p${rootpart}
137 if test "${devtype}" = "usb"; then;
138 setenv rootdev sda${rootpart}
140 if test "${devtype}" = "nvme"; then;
141 setenv rootdev nvme0n1p${rootpart}
143 if test "${devtype}" = "virtio"; then;
144 setenv rootdev vda${rootpart}
146 setenv bootmode normal
150 # To use cmdline for using serial console. /* Normal mode */
151 setenv bootargs \"${tizen_bootarg} root=/dev/${rootdev} rw bootmode=${bootmode} partition_ab=${partition_ab} rootwait ${console} ${opts} ${ip_opt} stmmaceth=chain_mode:1\"
153 echo "Searching for kernel in"; for prefix in $boot_prefixes; do
154 if load $devtype $devnum:$distro_bootpart $tizen_kernel_addr_r $prefix$kernel; then;
155 echo ${bootmode} "boot";
157 if test "${board_name}" = "qemu-riscv"; then
158 # If running in QEMU use the DeviceTree provided by
159 # the emulator. It is the most accurate description of
161 fdt move $fdt_addr $fdt_addr_r
163 load $devtype $devnum:$distro_bootpart $fdt_addr_r $prefix$fdtfile
165 booti $tizen_kernel_addr_r $ramdisk_addr_r:$ramdisksize $fdt_addr_r;