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;
18 if test "${devtype}" = "usb"; then;
19 setenv opts "${opts} rootdelay=2"
22 if test -e $devtype $devnum:$informpart $slotfile; then;
23 ext4load $devtype $devnum:$informpart $slot_addr $slotfile;
24 if itest.b *${slot_addr} == 0x62; then;
25 setenv ramdiskpart 0xf
28 echo "boot from slot_b";
33 echo "boot from slot_a";
39 echo "boot from slot_a";
42 if test -e $devtype $devnum:$informpart $rebootparamfile; then;
43 ext4load $devtype $devnum:$informpart $rebootparam_addr $rebootparamfile;
44 if itest.l *${rebootparam_addr} == ${upgrade_val}; then;
45 if test "${partition_ab}" = "b"; then
46 setenv ramdiskpart 0x10
49 setenv ramdiskpart 0xa
53 elif itest.l *${rebootparam_addr} == ${recovery_val}; then;
54 if test "${partition_ab}" = "b"; then
55 setenv ramdiskpart 0x10
58 setenv ramdiskpart 0xa
61 setenv bootmode recovery
62 elif itest.l *${rebootparam_addr} == ${download_val}; then;
63 if test "${partition_ab}" = "b"; then
64 setenv ramdiskpart 0x10
67 setenv ramdiskpart 0xa
71 elif itest.l *${rebootparam_addr} == ${nodef_val}; then;
72 echo "This reboot parameter is not supported...";
76 # This is for jumping to flash mode on u-boot.
77 if test "${bootmode}" = "download"; then;
78 if test "${partition_ab}" = "b"; then
79 setenv ramdiskpart 0x10
82 setenv ramdiskpart 0xa
88 if test "${bootmode}" = "flash"; then;
89 if test -n "${ipaddr}"; then;
90 ip_opt=\"ip=${ipaddr}::${gateway}:${netmask}::eth0:off\"
94 # setting console device if noting is set
95 if test -z "${console}"; then;
96 setenv console "console=ttyS0,115200 earlycon"
98 echo "console: ${console}"
101 if setexpr pcb_revision sub "^VF7110(.).*" "\\1" "${serial#}"; then
102 if test "${pcb_revision}" = "A" -o "${pcb_revision}" = "a"; then
103 setenv fdtfile "jh7110-starfive-visionfive-2-v1.2a.dtb"
105 if test "${pcb_revision}" = "B" -o "${pcb_revision}" = "b"; then
106 setenv fdtfile "jh7110-starfive-visionfive-2-v1.3b.dtb"
110 setenv boot_prefixes \"/\"
112 # Find the ramdisk offset and block count
113 part start $devtype $devnum $ramdiskpart ramdisk_start
114 part size $devtype $devnum $ramdiskpart ramdisk_size
116 # Set to ramdisksize with real partition size. (Need to multiply block-size 0x200)
117 setexpr ramdisksize $ramdisk_size * 200
118 setexpr tizen_kernel_addr_r $ramdisk_addr_r + $ramdisksize
120 # boot from ramdisk if there is sbin or it is initramfs
121 if test -e $devtype $devnum:$ramdiskpart sbin/init; then;
123 echo "Loading Ramdisk from partition" ${part};
124 echo "Environment value of ramdiskpart is" ${ramdiskpart};
126 $devtype read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
128 # Check for gzip (initramfs) magic
129 $devtype dev $devnum;
130 $devtype read $ramdisk_addr_r $ramdisk_start 1;
131 if itest.w *$ramdisk_addr_r == 0x8b1f; then;
133 echo "Loading initramfs from partition ${part}";
134 echo "Environment value of ramdiskpart is" ${ramdiskpart};
135 $devtype read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
137 if test "${devtype}" = "mmc"; then;
138 setenv rootdev mmcblk${devnum}p${rootpart}
140 if test "${devtype}" = "usb"; then;
141 setenv rootdev sda${rootpart}
143 if test "${devtype}" = "nvme"; then;
144 setenv rootdev nvme0n1p${rootpart}
146 if test "${devtype}" = "virtio"; then;
147 setenv rootdev vda${rootpart}
149 setenv bootmode normal
153 # To use cmdline for using serial console. /* Normal mode */
154 setenv bootargs \"${tizen_bootarg} root=/dev/${rootdev} rw bootmode=${bootmode} partition_ab=${partition_ab} rootwait ${console} ${opts} ${ip_opt} stmmaceth=chain_mode:1\"
156 echo "Searching for kernel in"; for prefix in $boot_prefixes; do
157 if load $devtype $devnum:$distro_bootpart $tizen_kernel_addr_r $prefix$kernel; then;
158 echo ${bootmode} "boot";
160 if test "${board_name}" = "qemu-riscv"; then
161 # If running in QEMU use the DeviceTree provided by
162 # the emulator. It is the most accurate description of
164 fdt move $fdt_addr $fdt_addr_r
166 load $devtype $devnum:$distro_bootpart $fdt_addr_r $prefix$fdtfile
168 booti $tizen_kernel_addr_r $ramdisk_addr_r:$ramdisksize $fdt_addr_r;