rpi: tizen-boot: add rpi3 32bit script
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 23 Jan 2018 01:31:45 +0000 (10:31 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 17 Oct 2023 04:19:18 +0000 (13:19 +0900)
Add rpi3 32bit tizen-boot script.

For 32bit, kernel dt image should be loaded to $fdt_addr instead of
$fdt_addr_r and kernel image name is zImage instead of Image. Also,
boot command should be bootz instead of booti.

Change-Id: Ia7a942837dd7a9ed398567f82aa89a81784a7591
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
board/raspberrypi/rpi/tizen-boot-rpi3-32b.scr [new file with mode: 0644]

diff --git a/board/raspberrypi/rpi/tizen-boot-rpi3-32b.scr b/board/raspberrypi/rpi/tizen-boot-rpi3-32b.scr
new file mode 100644 (file)
index 0000000..9210217
--- /dev/null
@@ -0,0 +1,84 @@
+# U-boot script for tizen
+boardname=rpi3
+mmcbootdev=0
+mmcbootpart=1
+mmcrootdev=0
+mmcrootpart=2
+mmcinformpart=9
+
+#
+# Tizen kernel image is over than 16MB, it will be overlapped with other address.
+# To avoid this behaivor, change to 0x02d00000 from 0x01000000
+#
+# NOTE: booti command will move kernel image to 0x80000 (text offset), and
+# ramdisk is loaded to $ramdisk_addr_r (0x02100000), so kernel should be equal
+# or less than 32.5MB to load ramdisk properly.
+#
+tizen_kernel_addr_r=0x02d00000
+
+dummy=0x24000000
+rebootparamfile=reboot-param.bin
+# use the ram address of ramdisk before loading ramdisk image
+rebootparam_addr=0x3a62b000
+# 0x72677075 is ascii code for representing string "upgr"
+upgrade_val=72677075
+# 0x72766372 is ascii code for representing string "rcvr"
+recovery_val=72766372
+# 0x6665646e is ascii code for representing string "ndef"
+nodef_val=6665646e
+
+# Normal ramdisk : partition 7
+# Ramdisk Recovery : Partition 8
+ramdiskpart=7
+ramdisksize=800000
+bootmode=ramdisk
+
+# Device that included the image.
+bootdev=mmc
+
+if test -e $bootdev $mmcbootdev:$mmcinformpart $rebootparamfile; then;
+       ext4load $bootdev $mmcbootdev:$mmcinformpart $rebootparam_addr $rebootparamfile;
+       if itest.l *${rebootparam_addr} == ${upgrade_val}; then;
+               ramdiskpart=8
+               ramdisksize=c00000
+               bootmode=fota
+       elif itest.l *${rebootparam_addr} == ${recovery_val}; then;
+               ramdiskpart=8
+               ramdisksize=c00000
+               bootmode=recovery
+       elif itest.l *${rebootparam_addr} == ${nodef_val}; then;
+               echo "This reboot parameter is not supported...";
+       fi
+fi
+
+# boot from ram0 if there is sbin
+if test -e $bootdev $mmcrootdev:$ramdiskpart sbin/init; then;
+rootdev=ram0
+else
+rootdev=mmcblk${mmcrootdev}p${mmcrootpart}
+bootmode=normal
+fi
+
+# Kernel image
+kernel=zImage
+setenv fdtfile \"bcm2710-rpi-3-b.dtb\"
+setenv boot_prefixes \"/\"
+
+# To use comdline for using serial console. /* Normal mode */
+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=ttyS0,115200n8 earlycon=uart8250,mmio32,0x3f215040 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 ${opts}\"
+
+# Find the ramdisk offset and block count
+part start $bootdev $mmcrootdev $ramdiskpart ramdisk_start
+part size $bootdev $mmcrootdev $ramdiskpart ramdisk_size
+
+echo "Searching for kernel in"; for prefix in $boot_prefixes; do
+if load $bootdev $mmcbootdev:$mmcbootpart $tizen_kernel_addr_r $prefix$kernel; then;
+       echo ${bootmode} "boot";
+       load $bootdev $mmcbootdev:$mmcbootpart $fdt_addr $fdtfile;
+       if test -e mmc $mmcrootdev:$ramdiskpart sbin/init; then;
+               echo "Loading Ramdisk from partition"${ramdiskpart};
+               mmc read $ramdisk_addr_r $ramdisk_start $ramdisk_size;
+       fi
+       bootz $tizen_kernel_addr_r $ramdisk_addr_r:$ramdisksize $fdt_addr;
+fi
+done