diff mbox series

[2/6] sunxi: fix 32MB load address layout

Message ID 20221012163458.1968900-3-andre.przywara@arm.com
State Accepted
Delegated to: Andre Przywara
Headers show
Series sunxi: improve F1C200s support | expand

Commit Message

Andre Przywara Oct. 12, 2022, 4:34 p.m. UTC
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>
---
 include/configs/sunxi-common.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Jernej Škrabec Oct. 12, 2022, 9:37 p.m. UTC | #1
Hi Andre,

Dne sreda, 12. oktober 2022 ob 18:34:54 CEST je Andre Przywara napisal(a):
> 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>
> ---
>  include/configs/sunxi-common.h | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 416a0422861..fe90d55bd45 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -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)

DT overlays and PXE could be even much smaller, but I guess it doesn't make 
much of a difference.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

>   */
>  #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.
> --
> 2.25.1
diff mbox series

Patch

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 416a0422861..fe90d55bd45 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -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.