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