board: ti: am57xx: Change to using .env

Move to using .env file for setting up environment variables
for am57xx and dra7xx.

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
This commit is contained in:
Anurag Dutta
2025-09-01 11:46:57 +05:30
committed by Tom Rini
parent 5138d3a561
commit bc020bf53a
4 changed files with 175 additions and 42 deletions

View File

@@ -9,6 +9,18 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "am57xx_evm"
config ENV_SOURCE_FILE
default "am57xx"
source "board/ti/common/Kconfig"
endif
if TARGET_DRA7XX_EVM
config ENV_SOURCE_FILE
default "am57xx"
source "board/ti/common/Kconfig"
endif

162
board/ti/am57xx/am57xx.env Normal file
View File

@@ -0,0 +1,162 @@
#include <env/ti/ti_common.env>
#include <env/ti/mmc.env>
#include <env/ti/dfu.env>
bootpart=0:2
bootdir=/boot
get_name_kern=
if test $boot_fit -eq 1; then
setenv bootfile fitImage;
else
setenv bootfile zImage;
fi
get_fit_config=setenv name_fit_config ${fdtfile}
console=ttyS2,115200n8
fdtfile=undefined
finduuid=part uuid mmc 0:2 uuid
usbtty=cdc_acm
vram=16M
#if CONFIG_CMD_AVB
avb_verify=avb init 1; avb verify $slot_suffix;
#endif
partitions=uuid_disk=${uuid_gpt_disk};
name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};
name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}
partitions_android=
uuid_disk=${uuid_gpt_disk};
name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};
name=bootloader,size=2048K,uuid=${uuid_gpt_bootloader};
name=uboot-env,start=2432K,size=256K,uuid=${uuid_gpt_reserved};
name=misc,size=128K,uuid=${uuid_gpt_misc};
name=boot_a,size=20M,uuid=${uuid_gpt_boot_a};
name=boot_b,size=20M,uuid=${uuid_gpt_boot_b};
name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};
name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};
name=vbmeta_a,size=64K,uuid=${uuid_gpt_vbmeta_a};
name=vbmeta_b,size=64K,uuid=${uuid_gpt_vbmeta_b};
name=recovery,size=64M,uuid=${uuid_gpt_recovery};
name=super,size=2560M,uuid=${uuid_gpt_super};
name=metadata,size=16M,uuid=${uuid_gpt_metadata};
name=userdata,size=-,uuid=${uuid_gpt_userdata}
optargs=
dofastboot=0
emmc_android_boot=
setenv mmcdev 1;
mmc dev $mmcdev;
mmc rescan;
#if CONFIG_CMD_BCB
#if CONFIG_ANDROID_AB
if part number mmc 1 misc control_part_number; then
echo "misc partition number:${control_part_number};"
bcb ab_select slot_name mmc ${mmcdev}:${control_part_number};
else
echo "misc partition not found;"
exit;
fi;
setenv slot_suffix _${slot_name};
#endif
#endif
if bcb load CONFIG_FASTBOOT_FLASH_MMC_DEV misc; then
setenv ardaddr -;
if bcb test command = bootonce-bootloader; then
echo "Android: Bootloader boot...";
bcb clear command; bcb store;
fastboot 1;
exit;
elif bcb test command = boot-recovery; then
echo "Android: Recovery boot...";
setenv ardaddr $loadaddr;
setenv apart recovery;
else
echo "Android: Normal boot...";
setenv ardaddr $loadaddr;
setenv apart boot${slot_suffix};
fi;
else
echo "Warning: BCB is corrupted or does not exist";
echo "Android: Normal boot...";
fi;
setenv eval_bootargs setenv bootargs $bootargs;
run eval_bootargs;
setenv machid fe6;
#if CONFIG_CMD_AVB
if run avb_verify; then
echo "AVB verification OK.";
set bootargs $bootargs $avb_bootargs;
else
echo "AVB verification failed.";
exit;
fi;
#endif
#if CONFIG_CMD_BCB
#if CONFIG_ANDROID_AB
setenv bootargs_ab androidboot.slot_suffix=${slot_suffix};
echo "A/B cmdline addition: ${bootargs_ab}";
setenv bootargs ${bootargs} ${bootargs_ab};
#endif
#endif
if part start mmc $mmcdev $apart boot_start; then
part size mmc $mmcdev $apart boot_size;
mmc read $loadaddr $boot_start $boot_size;
echo "Preparing FDT...";
if test $board_name = am57xx_evm_reva3; then
echo " Reading DTBO partition...";
part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start;
part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size;
mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size};
echo " Reading DTB for AM57x EVM RevA3...";
abootimg get dtb --index=0 dtb_start dtb_size;
cp.b $dtb_start $fdtaddr $dtb_size;
fdt addr $fdtaddr 0x80000;
echo " Applying DTBOs for AM57x EVM RevA3...";
adtimg addr $dtboaddr;
adtimg get dt --index=0 dtbo0_addr dtbo0_size;
fdt apply $dtbo0_addr;
adtimg get dt --index=1 dtbo1_addr dtbo1_size;
fdt apply $dtbo1_addr;
elif test $board_name = beagle_x15_revc; then
echo " Reading DTB for Beagle X15 RevC...";
abootimg get dtb --index=0 dtb_start dtb_size;
cp.b $dtb_start $fdtaddr $dtb_size;
fdt addr $fdtaddr 0x80000;
else
echo "Error: Android boot is not supported for $board_name";
exit;
fi;
bootm $loadaddr $ardaddr $fdtaddr;
else
echo "$apart partition not found";
exit;
fi;
get_overlay_mmc=
fdt address ${fdtaddr};
fdt resize 0x100000;
for overlay in $name_overlays;
do;
load mmc ${bootpart} ${dtboaddr} ${bootdir}/dtb/${overlay};
fdt apply ${dtboaddr};
done;
#if CONFIG_CMD_NET
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
nfsopts=nolock
rootpath=/export/rootfs
netloadimage=tftp ${loadaddr} ${bootfile}
netloadfdt=tftp ${fdtaddr} ${fdtfile}
netargs=setenv bootargs console=${console} ${optargs}
root=/dev/nfs
nfsroot=${serverip}:${rootpath},${nfsopts} rw
ip=dhcp
netboot=echo Booting from network ...;
setenv autoload no;
dhcp;
run netloadimage;
run netloadfdt;
run netargs;
bootz ${loadaddr} - ${fdtaddr}
#endif
#if CONFIG_MTD_RAW_NAND
#include <env/ti/nand.env>
#endif
dfu_bufsiz=0x10000

View File

@@ -11,30 +11,13 @@
#ifndef __CONFIG_AM57XX_EVM_H
#define __CONFIG_AM57XX_EVM_H
#include <env/ti/dfu.h>
#include <linux/sizes.h>
#define CFG_SYS_NS16550_COM1 UART1_BASE /* Base EVM has UART0 */
#define CFG_SYS_NS16550_COM2 UART2_BASE /* UART2 */
#define CFG_SYS_NS16550_COM3 UART3_BASE /* UART3 */
#ifndef CONFIG_XPL_BUILD
#define DFUARGS \
"dfu_bufsiz=0x10000\0" \
DFU_ALT_INFO_MMC \
DFU_ALT_INFO_EMMC \
DFU_ALT_INFO_RAM \
DFU_ALT_INFO_QSPI
#else
#ifdef CONFIG_SPL_DFU
#define DFUARGS \
"dfu_bufsiz=0x10000\0" \
DFU_ALT_INFO_RAM
#endif
#endif
#include <configs/ti_omap5_common.h>
/* CPSW Ethernet */
#include <configs/ti_omap5_common.h>
#endif /* __CONFIG_AM57XX_EVM_H */

View File

@@ -11,40 +11,16 @@
#ifndef __CONFIG_DRA7XX_EVM_H
#define __CONFIG_DRA7XX_EVM_H
#include <env/ti/dfu.h>
#define CFG_MAX_MEM_MAPPED 0x80000000
#ifndef CONFIG_QSPI_BOOT
/* MMC ENV related defines */
#endif
#if (CONFIG_CONS_INDEX == 1)
#define CONSOLEDEV "ttyS0"
#elif (CONFIG_CONS_INDEX == 3)
#define CONSOLEDEV "ttyS2"
#endif
#define CFG_SYS_NS16550_COM1 UART1_BASE /* Base EVM has UART0 */
#define CFG_SYS_NS16550_COM2 UART2_BASE /* UART2 */
#define CFG_SYS_NS16550_COM3 UART3_BASE /* UART3 */
#ifndef CONFIG_XPL_BUILD
#define DFUARGS \
"dfu_bufsiz=0x10000\0" \
DFU_ALT_INFO_MMC \
DFU_ALT_INFO_EMMC \
DFU_ALT_INFO_RAM \
DFU_ALT_INFO_QSPI
#endif
#ifdef CONFIG_XPL_BUILD
#ifdef CONFIG_SPL_DFU
#define DFUARGS \
"dfu_bufsiz=0x10000\0" \
DFU_ALT_INFO_RAM
#endif
#endif
#include <configs/ti_omap5_common.h>
/* NAND support */