Tom Rini | 44bd892 | 2022-06-13 22:57:34 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (C) 2017 Armadeus Systems |
| 5 | */ |
| 6 | |
| 7 | /* Environment is stored in the eMMC boot partition */ |
| 8 | |
| 9 | env_version=100 |
| 10 | consoledev=ttymxc0 |
| 11 | board_name=opos6ul |
| 12 | fdt_addr=0x88000000 |
| 13 | fdt_high=0xffffffff |
| 14 | fdt_name=opos6uldev |
| 15 | initrd_high=0xffffffff |
| 16 | ip_dyn=yes |
| 17 | stdin=serial |
| 18 | stdout=serial |
| 19 | stderr=serial |
| 20 | mmcdev=0 |
| 21 | mmcpart=2 |
| 22 | mmcroot=/dev/mmcblk0p2 ro |
| 23 | mmcrootfstype=ext4 rootwait |
| 24 | kernelimg=opos6ul-linux.bin |
| 25 | splashpos=0,0 |
| 26 | splashimage=CONFIG_SYS_LOAD_ADDR |
| 27 | videomode=video=ctfb:x:800,y:480,depth:18,pclk:33033,le:96,ri:96,up:20,lo:21,hs:64,vs:4,sync:0,vmode:0 |
| 28 | check_env=if test -n ${flash_env_version}; |
| 29 | then env default env_version; |
| 30 | else env set flash_env_version ${env_version}; env save; |
| 31 | fi; |
| 32 | if itest ${flash_env_version} != ${env_version}; then |
| 33 | echo "*** Warning - Environment version |
| 34 | change suggests: run flash_reset_env; reset"; |
| 35 | env default flash_reset_env; |
| 36 | else exit; fi; |
| 37 | flash_reset_env=env default -f -a && saveenv && |
| 38 | echo Environment variables erased! |
| 39 | download_uboot_spl=tftpboot ${loadaddr} ${board_name}-u-boot.spl |
| 40 | flash_uboot_spl= |
| 41 | if mmc dev 0 1; then |
| 42 | setexpr sz ${filesize} / 0x200; |
| 43 | setexpr sz ${sz} + 1; |
| 44 | if mmc write ${loadaddr} 0x2 ${sz}; then |
Michal Simek | 22dc113 | 2023-06-05 13:58:59 +0200 | [diff] [blame] | 45 | echo Flashing of U-Boot SPL succeed; |
| 46 | else echo Flashing of U-Boot SPL failed; |
Tom Rini | 44bd892 | 2022-06-13 22:57:34 -0400 | [diff] [blame] | 47 | fi; |
| 48 | fi; |
| 49 | download_uboot_img=tftpboot ${loadaddr} ${board_name}-u-boot.img |
| 50 | flash_uboot_img= |
| 51 | if mmc dev 0 1; then |
| 52 | setexpr sz ${filesize} / 0x200; |
| 53 | setexpr sz ${sz} + 1; |
| 54 | if mmc write ${loadaddr} 0x8a ${sz}; then |
Michal Simek | 22dc113 | 2023-06-05 13:58:59 +0200 | [diff] [blame] | 55 | echo Flashing of U-Boot image succeed; |
| 56 | else echo Flashing of U-Boot image failed; |
Tom Rini | 44bd892 | 2022-06-13 22:57:34 -0400 | [diff] [blame] | 57 | fi; |
| 58 | fi; |
| 59 | update_uboot=run download_uboot_spl flash_uboot_spl |
| 60 | download_uboot_img flash_uboot_img |
| 61 | download_kernel=tftpboot ${loadaddr} ${kernelimg} |
| 62 | flash_kernel= |
| 63 | if ext4write mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} ${filesize}; then |
| 64 | echo kernel update succeed; |
| 65 | else echo kernel update failed; |
| 66 | fi; |
| 67 | update_kernel=run download_kernel flash_kernel |
| 68 | download_dtb=tftpboot ${fdt_addr} imx6ul-${fdt_name}.dtb |
| 69 | flash_dtb= |
| 70 | if ext4write mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb ${filesize}; then |
| 71 | echo dtb update succeed; |
| 72 | else echo dtb update in failed; |
| 73 | fi; |
| 74 | update_dtb=run download_dtb flash_dtb |
| 75 | download_rootfs=tftpboot ${loadaddr} ${board_name}-rootfs.ext4 |
| 76 | flash_rootfs= |
| 77 | if mmc dev 0 0; then |
| 78 | setexpr nbblocks ${filesize} / 0x200; |
| 79 | setexpr nbblocks ${nbblocks} + 1; |
| 80 | if mmc write ${loadaddr} 0x40800 ${nbblocks}; then |
| 81 | echo Flashing of rootfs image succeed; |
| 82 | else echo Flashing of rootfs image failed; |
| 83 | fi; |
| 84 | fi; |
| 85 | update_rootfs=run download_rootfs flash_rootfs |
| 86 | flash_failsafe= |
| 87 | if mmc dev 0 0; then |
| 88 | setexpr nbblocks ${filesize} / 0x200; |
| 89 | setexpr nbblocks ${nbblocks} + 1; |
| 90 | if mmc write ${loadaddr} 0x800 ${nbblocks}; then |
| 91 | echo Flashing of rootfs image in failsafe partition succeed; |
| 92 | else echo Flashing of rootfs image in failsafe partition failed; |
| 93 | fi; |
| 94 | fi; |
| 95 | update_failsafe=run download_rootfs flash_failsafe |
| 96 | download_userdata=tftpboot ${loadaddr} ${board_name}-user_data.ext4 |
| 97 | flash_userdata= |
| 98 | if mmc dev 0 0; then |
| 99 | setexpr nbblocks ${filesize} / 0x200; |
| 100 | setexpr nbblocks ${nbblocks} + 1; |
| 101 | if mmc write ${loadaddr} 0 ${nbblocks}; then |
| 102 | echo Flashing of user_data image succeed; |
| 103 | else echo Flashing of user_data image failed; |
| 104 | fi; |
| 105 | fi; |
| 106 | update_userdata=run download_userdata flash_userdata; mmc rescan |
| 107 | erase_userdata= |
| 108 | if mmc dev 0 0; then |
| 109 | echo Erasing eMMC User Data partition, no way out...; |
| 110 | mw ${loadaddr} 0 0x200000; |
| 111 | mmc write ${loadaddr} 0 0x1000; |
| 112 | mmc write ${loadaddr} 0x800 0x1000; |
| 113 | mmc write ${loadaddr} 0x40800 0x1000; |
| 114 | mmc write ${loadaddr} 0x440800 0x1000; |
| 115 | fi; |
| 116 | mmc rescan |
| 117 | update_all=run update_rootfs update_uboot |
| 118 | initargs=setenv bootargs console=${consoledev},${baudrate} ${extrabootargs} |
| 119 | addipargs=setenv bootargs ${bootargs} |
| 120 | ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off |
| 121 | addmmcargs=setenv bootargs ${bootargs} root=${mmcroot} |
| 122 | rootfstype=${mmcrootfstype} |
| 123 | emmcboot=run initargs; run addmmcargs; |
| 124 | load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} && |
| 125 | load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb && |
| 126 | bootz ${loadaddr} - ${fdt_addr}; |
| 127 | emmcsafeboot=setenv mmcpart 1; setenv mmcroot /dev/mmcblk0p1 ro; run emmcboot; |
| 128 | addnfsargs=setenv bootargs ${bootargs} root=/dev/nfs rw |
| 129 | nfsroot=${serverip}:${rootpath} |
| 130 | nfsboot=run initargs; run addnfsargs addipargs; |
| 131 | nfs ${loadaddr} ${serverip}:${rootpath}/boot/${kernelimg} && |
| 132 | nfs ${fdt_addr} ${serverip}:${rootpath}/boot/imx6ul-${fdt_name}.dtb && |
| 133 | bootz ${loadaddr} - ${fdt_addr}; |