sunxi: fix 32MB load address layout

The default load addresses for the various payloads (kernel, DT,
ramdisk) on systems with just 32MB of DRAM have some issues:
For a start the preceding comment doesn't match the actual values:
apparently they were copied from the 64MB S3 layout, then halved, but
since 0x5 is NOT the half of 0x10, they don't match up.
Also those projected maximum sizes are quite restrictive: it's not easy
to build a compressed kernel image with just 4MB. The only defconfig in
mainline Linux that supports the F1C100s (the only 32MB user so far)
creates a 6MB compressed / 15MB uncompressed kernel.
Rearrange the default load addresses to accommodate such a kernel: we
allow an 7MB/16MB kernel, and up to 5MB of ramdisk, stuffing the smaller
binaries like the DTB towards the end, just before the relocated U-Boot.
Shrink the size for DTB and scripts on the way, there is no need for
allowing up to 512K for them.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
This commit is contained in:
Andre Przywara 2022-10-06 18:16:34 +01:00
parent 1bf98bd4e2
commit c8b9ba4bb2

View file

@ -165,17 +165,17 @@
#elif (CONFIG_SUNXI_MINIMUM_DRAM_MB >= 32)
/*
* 32M RAM minus 1MB heap + 8MB for u-boot, stack, fb, etc.
* 8M uncompressed kernel, 4M compressed kernel, 512K fdt,
* 512K script, 512K pxe and the ramdisk at the end.
* 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 __stringify(0x1700000)
#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(0500000))
#define FDT_ADDR_R __stringify(SDRAM_OFFSET(0C00000))
#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(0C50000))
#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(0D00000))
#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(0D50000))
#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(0D60000))
#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(1000000))
#define FDT_ADDR_R __stringify(SDRAM_OFFSET(1d50000))
#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(1d40000))
#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(1d00000))
#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(1d20000))
#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(1800000))
#else
#error Need at least 32MB of DRAM. Please adjust load addresses.