1 /* SPDX-License-Identifier: GPL-2.0+ */
3 /* Common env settings */
7 * console: string, tty, etc.
8 * baudrate: string, tty baudrate
12 * bootargs: string, default boot string
14 #define ENV_BOOTARGS_DEFAULT "set_bootargs=" \
16 "console=${console} " \
20 /** set_bootargs_net()
27 #define ENV_NET_FCT_NETARGS "set_bootargs_net=" \
29 "setenv bootfile ${project_dir}/boot/${kernel_name};" \
30 "setenv bootdtb ${project_dir}/boot/${dtb_name_nfs}.dtb;" \
31 "setenv rootpath /home/projects/${project_dir}/;" \
32 "setenv bootargs ${bootargs} " \
34 "nfsroot=${serverip}:${rootpath},${nfsopts} " \
35 "ip=${ipaddr}:${serverip}:" \
36 "${gatewayip}:${netmask}:${hostname}:eth0:off\0"
42 #define ENV_NET_FCT_BOOT "net_nfs=" \
43 "echo Booting from network ...; " \
44 "run set_bootargs_net; " \
45 "tftpboot ${dtb_loadaddr} ${serverip}:${bootdtb};" \
48 "echo Loading default.dtb!;" \
49 "tftpboot ${dtb_loadaddr} ${serverip}:${project_dir}/boot/${dtb_name_default}.dtb;" \
51 "tftpboot ${kernel_loadaddr} ${serverip}:${bootfile};" \
52 "printenv bootargs;" \
53 "booti ${kernel_loadaddr} - ${dtb_loadaddr}\0"
57 * upgrade_available: [0|1], if set to 1 check bootcount variables
58 * bootcount: int, bootcount
59 * bootlimit: int, limit cootcount
60 * toggle_partition(): - toggles active partition set
62 * upgrade_available: [0|1], set to 0 if bootcount > bootlimit
64 #define ENV_FCT_CHECK_UPGRADE "check_upgrade="\
65 "if test ${upgrade_available} -eq 1; " \
67 "echo upgrade_available is set; " \
68 "if test ${bootcount} -gt ${bootlimit}; " \
70 "setenv upgrade_available 0;" \
71 "echo toggle partition;" \
72 "run toggle_partition;" \
76 /** toggle_partition()
78 * partitionset_active: [A|B], selected partition set
80 * partitionset_active: [A|B], toggle
82 #define ENV_FCT_TOGGLE_PARTITION "toggle_partition="\
83 "setenv ${partitionset_active} true;" \
86 "setenv partitionset_active B; " \
91 "setenv partitionset_active A; " \
98 * partitionset_active: [A|B], selected partition set
99 * rootfs_name: string, mmc device file in kernel, e.g. /dev/mmcblk0
101 * mmc_active_vol: string, mmc partition device file in kernel, e.g. /dev/mmcblk0p2
102 * mmc_part_nr: int, partition number of mmc, e.g. /dev/mmcblk0p2 --> 2
104 #define ENV_EMMC_FCT_SET_ACTIVE_PARTITION "set_partition=" \
105 "setenv ${partitionset_active} true;" \
106 "if test -n ${A}; " \
108 "setenv mmc_part_nr 1;" \
110 "if test -n ${B}; " \
112 "setenv mmc_part_nr 2;" \
114 "setenv mmc_active_vol ${rootfs_name}p${mmc_part_nr} \0"
116 /** set_bootargs_mmc()
118 * bootargs: string, default bootargs
119 * mmc_active_vol string, mmc partition device file in kernel, e.g. /dev/mmcblk0p2
120 * ip_method: string, [none|?]
124 #define ENV_EMMC_FCT_SET_EMMC_BOOTARGS "set_bootargs_mmc=" \
125 "setenv bootargs ${bootargs} " \
126 "root=${mmc_active_vol} rw " \
127 "rootdelay=1 rootwait " \
131 /** mmc_load_bootfiles()
139 #define ENV_EMMC_FCT_LOADFROM_EMMC "mmc_load_bootfiles=" \
140 "echo Loading from eMMC ...;" \
141 "ext4load mmc 0:${mmc_part_nr} ${dtb_loadaddr} boot/${dtb_name}.dtb;" \
142 "if test $? -eq 1;" \
144 "echo Loading default.dtb!;" \
145 "ext4load mmc 0:${mmc_part_nr} ${dtb_loadaddr} boot/${dtb_name_default}.dtb;" \
147 "ext4load mmc 0:${mmc_part_nr} ${kernel_loadaddr} boot/${kernel_name};" \
148 "printenv bootargs;\0"
158 #define ENV_EMMC_FCT_EMMC_BOOT "mmc_boot=" \
159 "run set_bootargs;" \
160 "run check_upgrade; " \
161 "run set_partition;" \
162 "run set_bootargs_mmc;" \
163 "run mmc_load_bootfiles;" \
164 "echo Booting from eMMC ...; " \
165 "booti ${kernel_loadaddr} - ${dtb_loadaddr} \0"
167 #define ENV_EMMC_ALIASES "" \
168 "flash_self=run mmc_boot\0" \
169 "flash_self_test=setenv testargs test; " \
172 #define ENV_COMMON "" \
173 "project_dir=targetdir/rootfs\0" \
174 "serverip=192.168.251.2\0" \
175 "ipaddr=192.168.251.1\0" \
176 "dtb_name_nfs=default\0" \
177 "dtb_name_default=default\0" \
178 "kernel_name=Image\0" \
179 "partitionset_active=A\0" \
180 "dtb_loadaddr=0x83000000\0" \
181 "kernel_loadaddr=0x80280000\0" \
183 "rootfs_name=/dev/mmcblk0\0" \
184 "upgrade_available=0\0" \
186 "altbootcmd=run bootcmd\0" \
189 /**********************************************************************/
191 #define ENV_EMMC ENV_EMMC_FCT_EMMC_BOOT \
192 ENV_EMMC_FCT_LOADFROM_EMMC \
193 ENV_EMMC_FCT_SET_EMMC_BOOTARGS \
194 ENV_EMMC_FCT_SET_ACTIVE_PARTITION \
195 ENV_FCT_CHECK_UPGRADE \
197 ENV_FCT_TOGGLE_PARTITION
199 #define ENV_NET ENV_NET_FCT_BOOT \
200 ENV_NET_FCT_NETARGS \