Files
u-boot/board/sunxi/sunxi.env
Simon Glass dadcfcb889 sunxi: Move to text environment
Convert these boards to use a text environment.

For the boards check, the only differences are extra spaces after the
semicolons in 'dfu_alt_info_ram' and 'partitions', both of which are
permitted.

Add in the special boot command for old kernels, dropping the
unnecessary and confusing hex prefixes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-12-05 13:58:19 -07:00

141 lines
4.4 KiB
Bash

// SPDX-License-Identifier: GPL-2.0+
/*
* Common sunxi environment
*
* Copyright 2024 Google LLC
* Written by Simon Glass <sjg@chromium.org>
/
/****************************************************************************
* environment variables holding default load addresses *
****************************************************************************/
/*
* We cannot use expressions here, because expressions won't be evaluated in
* autoconf.mk.
*/
#ifdef CONFIG_ARM64
/*
* Boards seem to come with at least 512MB of DRAM.
* The kernel should go at 512K, which is the default text offset (that will
* be adjusted at runtime if needed).
* There is no compression for arm64 kernels (yet), so leave some space
* for really big kernels, say 256MB for now.
* Scripts, PXE and DTBs should go afterwards, leaving the rest for the initrd.
*/
#define BOOTM_SIZE 0xa000000
#define KERNEL_ADDR_R SDRAM_OFFSET(0080000)
#define KERNEL_COMP_ADDR_R SDRAM_OFFSET(4000000)
#define KERNEL_COMP_SIZE 0xb000000
#define FDT_ADDR_R SDRAM_OFFSET(FA00000)
#define SCRIPT_ADDR_R SDRAM_OFFSET(FC00000)
#define PXEFILE_ADDR_R SDRAM_OFFSET(FD00000)
#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(FE00000)
#define RAMDISK_ADDR_R SDRAM_OFFSET(FF00000)
#elif (CONFIG_SUNXI_MINIMUM_DRAM_MB >= 256)
/*
* 160M RAM (256M minimum minus 64MB heap + 32MB for u-boot, stack, fb, etc.
* 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
* 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
*/
#define BOOTM_SIZE 0xa000000
#define KERNEL_ADDR_R SDRAM_OFFSET(2000000)
#define FDT_ADDR_R SDRAM_OFFSET(3000000)
#define SCRIPT_ADDR_R SDRAM_OFFSET(3100000)
#define PXEFILE_ADDR_R SDRAM_OFFSET(3200000)
#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(3300000)
#define RAMDISK_ADDR_R SDRAM_OFFSET(3400000)
#elif (CONFIG_SUNXI_MINIMUM_DRAM_MB >= 64)
/*
* 64M RAM minus 2MB heap + 16MB for u-boot, stack, fb, etc.
* 16M uncompressed kernel, 8M compressed kernel, 1M fdt,
* 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
*/
#define BOOTM_SIZE 0x2e00000
#define KERNEL_ADDR_R SDRAM_OFFSET(1000000)
#define FDT_ADDR_R SDRAM_OFFSET(1800000)
#define SCRIPT_ADDR_R SDRAM_OFFSET(1900000)
#define PXEFILE_ADDR_R SDRAM_OFFSET(1A00000)
#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(1B00000)
#define RAMDISK_ADDR_R SDRAM_OFFSET(1C00000)
#elif (CONFIG_SUNXI_MINIMUM_DRAM_MB >= 32)
/*
* 32M RAM minus 2.5MB for u-boot, heap, stack, etc.
* 16M uncompressed kernel, 7M compressed kernel, 128K fdt, 64K script,
* 128K DT overlay, 128K PXE and the ramdisk in the rest (max. 5MB)
*/
#define BOOTM_SIZE 0x1700000
#define KERNEL_ADDR_R SDRAM_OFFSET(1000000)
#define FDT_ADDR_R SDRAM_OFFSET(1d50000)
#define SCRIPT_ADDR_R SDRAM_OFFSET(1d40000)
#define PXEFILE_ADDR_R SDRAM_OFFSET(1d00000)
#define FDTOVERLAY_ADDR_R SDRAM_OFFSET(1d20000)
#define RAMDISK_ADDR_R SDRAM_OFFSET(1800000)
#else
#error Need at least 32MB of DRAM. Please adjust load addresses.
#endif
stdin=serial
#ifdef CONFIG_USB_KEYBOARD
stdin+=,usbkbd
#endif
stdout=serial
stderr=serial
#ifdef CONFIG_VIDEO
stdout+=,vidconsole
stderr+=,vidconsole
#endif
bootm_size=BOOTM_SIZE
kernel_addr_r=KERNEL_ADDR_R
fdt_addr_r=FDT_ADDR_R
scriptaddr=SCRIPT_ADDR_R
pxefile_addr_r=PXEFILE_ADDR_R
fdtoverlay_addr_r=FDTOVERLAY_ADDR_R
ramdisk_addr_r=RAMDISK_ADDR_R
#ifdef CONFIG_ARM64
kernel_comp_addr_r=KERNEL_COMP_ADDR_R
kernel_comp_size=KERNEL_COMP_SIZE
#endif
dfu_alt_info_ram=
kernel ram KERNEL_ADDR_R 0x1000000;
fdt ram FDT_ADDR_R 0x100000;
ramdisk ram RAMDISK_ADDR_R 0x4000000
fdtfile=DEFAULT_DEVICE_TREE.dtb
console=ttyS0,115200
uuid_gpt_esp=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
#ifdef CONFIG_ARM64
uuid_gpt_system=b921b045-1df0-41c3-af44-4c6f280d3fae
#else
uuid_gpt_system=69dad710-2ce4-4e3c-b16c-21a1d49abed3
#endif
partitions=
name=loader1,start=8k,size=32k,uuid=${uuid_gpt_loader1};
name=loader2,size=984k,uuid=${uuid_gpt_loader2};
name=esp,size=128M,bootable,uuid=${uuid_gpt_esp};
name=system,size=-,uuid=${uuid_gpt_system};
/* support booting a very old kernel */
#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
bootcmd_sunxi_compat=
setenv root /dev/mmcblk0p3 rootwait;
if ext2load mmc 0 44000000 uEnv.txt; then
echo Loaded environment from uEnv.txt;
env import -t 44000000 ${filesize};
fi;
setenv bootargs console=${console} root=${root} ${extraargs};
ext2load mmc 0 43000000 script.bin &&
ext2load mmc 0 48000000 uImage &&
bootm 48000000
#endif