Tom Rini | 7c32905 | 2022-06-13 22:57:37 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (C) 2013 Gateworks Corporation |
| 4 | */ |
| 5 | |
| 6 | splashpos=m,m |
| 7 | splashimage=CONFIG_SYS_LOAD_ADDR |
| 8 | usb_pgood_delay=2000 |
| 9 | console=ttymxc1 |
| 10 | bootdevs=usb mmc sata flash |
| 11 | hwconfig=_UNKNOWN_ |
| 12 | |
| 13 | disk=0 |
| 14 | part=1 |
| 15 | |
| 16 | fdt_high=0xffffffff |
| 17 | fdt_addr=0x18000000 |
| 18 | initrd_high=0xffffffff |
| 19 | fixfdt=fdt addr ${fdt_addr} |
| 20 | bootdir=boot |
| 21 | loadfdt= |
| 22 | if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then |
| 23 | echo Loaded DTB from ${bootdir}/${fdt_file}; |
| 24 | run fixfdt; |
| 25 | elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then |
| 26 | echo Loaded DTB from ${bootdir}/${fdt_file1}; |
| 27 | run fixfdt; |
| 28 | elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then |
| 29 | echo Loaded DTB from ${bootdir}/${fdt_file2}; |
| 30 | run fixfdt; |
| 31 | fi |
| 32 | |
| 33 | fs=ext4 |
| 34 | script=6x_bootscript-ventana |
| 35 | loadscript= |
| 36 | if ${fsload} ${loadaddr} ${bootdir}/${script}; then |
| 37 | source ${loadaddr}; |
| 38 | fi |
| 39 | |
| 40 | uimage=uImage |
| 41 | mmc_root=mmcblk0p1 |
| 42 | mmc_boot= |
| 43 | setenv fsload "${fs}load mmc ${disk}:${part}"; |
| 44 | mmc dev ${disk} && mmc rescan && |
| 45 | setenv dtype mmc; run loadscript; |
| 46 | if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then |
| 47 | setenv bootargs console=${console},${baudrate} |
| 48 | root=/dev/${mmc_root} rootfstype=${fs} |
| 49 | rootwait rw ${video} ${extra}; |
| 50 | if run loadfdt; then |
| 51 | bootm ${loadaddr} - ${fdt_addr}; |
| 52 | else |
| 53 | bootm; |
| 54 | fi; |
| 55 | fi |
| 56 | |
| 57 | sata_boot= |
| 58 | setenv fsload "${fs}load sata ${disk}:${part}"; |
| 59 | sata init && |
| 60 | setenv dtype sata; run loadscript; |
| 61 | if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then |
| 62 | setenv bootargs console=${console},${baudrate} |
| 63 | root=/dev/sda1 rootfstype=${fs} |
| 64 | rootwait rw ${video} ${extra}; |
| 65 | if run loadfdt; then |
| 66 | bootm ${loadaddr} - ${fdt_addr}; |
| 67 | else |
| 68 | bootm; |
| 69 | fi; |
| 70 | fi |
| 71 | |
| 72 | usb_boot= |
| 73 | setenv fsload "${fs}load usb ${disk}:${part}"; |
| 74 | usb start && usb dev ${disk} && |
| 75 | setenv dtype usb; run loadscript; |
| 76 | if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then |
| 77 | setenv bootargs console=${console},${baudrate} |
| 78 | root=/dev/sda1 rootfstype=${fs} |
| 79 | rootwait rw ${video} ${extra}; |
| 80 | if run loadfdt; then |
| 81 | bootm ${loadaddr} - ${fdt_addr}; |
| 82 | else |
| 83 | bootm; |
| 84 | fi; |
| 85 | fi |
| 86 | |
| 87 | #ifdef CONFIG_SPI_FLASH |
| 88 | image_os=ventana/openwrt-imx6-imx6q-gw5400-a-squashfs.bin |
| 89 | image_uboot=ventana/u-boot_spi.imx |
| 90 | |
| 91 | spi_koffset=0x90000 |
| 92 | spi_klen=0x200000 |
| 93 | |
| 94 | spi_updateuboot=echo Updating uboot from |
| 95 | ${serverip}:${image_uboot}...; |
| 96 | tftpboot ${loadaddr} ${image_uboot} && |
| 97 | sf probe && sf erase 0 80000 && |
| 98 | sf write ${loadaddr} 400 ${filesize} |
| 99 | spi_update=echo Updating OS from ${serverip}:${image_os} |
| 100 | to ${spi_koffset} ...; |
| 101 | tftp ${loadaddr} ${image_os} && |
| 102 | sf probe && |
| 103 | sf update ${loadaddr} ${spi_koffset} ${filesize} |
| 104 | |
| 105 | flash_boot= |
| 106 | if sf probe && |
| 107 | sf read ${loadaddr} ${spi_koffset} ${spi_klen}; then |
| 108 | setenv bootargs console=${console},${baudrate} |
| 109 | root=/dev/mtdblock3 |
| 110 | rootfstype=squashfs,jffs2 |
| 111 | ${video} ${extra}; |
| 112 | bootm; |
| 113 | fi |
| 114 | #else |
| 115 | image_rootfs=openwrt-imx6-ventana-rootfs.ubi |
| 116 | nand_update=echo Updating NAND from ${serverip}:${image_rootfs}...; |
| 117 | tftp ${loadaddr} ${image_rootfs} && |
| 118 | nand erase.part rootfs && |
| 119 | nand write ${loadaddr} rootfs ${filesize} |
| 120 | |
| 121 | flash_boot= |
| 122 | setenv fsload 'ubifsload'; |
| 123 | ubi part rootfs; |
| 124 | if ubi check boot; then |
| 125 | ubifsmount ubi0:boot; |
| 126 | setenv root ubi0:rootfs ubi.mtd=2 |
| 127 | rootfstype=squashfs,ubifs; |
| 128 | setenv bootdir; |
| 129 | elif ubi check rootfs; then |
| 130 | ubifsmount ubi0:rootfs; |
| 131 | setenv root ubi0:rootfs ubi.mtd=2 |
| 132 | rootfstype=ubifs; |
| 133 | fi; |
| 134 | setenv dtype nand; run loadscript; |
| 135 | if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then |
| 136 | setenv bootargs console=${console},${baudrate} |
| 137 | root=${root} ${video} ${extra}; |
| 138 | if run loadfdt; then |
| 139 | ubifsumount; |
| 140 | bootm ${loadaddr} - ${fdt_addr}; |
| 141 | else |
| 142 | ubifsumount; bootm; |
| 143 | fi; |
| 144 | fi |
| 145 | #endif |