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

2022-10-12 Thread Jernej Škrabec
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 
> ---
>  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 

Best regards,
Jernej

>   */
>  #define BOOTM_SIZE__stringify(0x170)
> -#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(050))
> -#define FDT_ADDR_R__stringify(SDRAM_OFFSET(0C0))
> -#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(0C5))
> -#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(0D0))
> -#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(0D5))
> -#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(0D6))
> +#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(100))
> +#define FDT_ADDR_R__stringify(SDRAM_OFFSET(1d5))
> +#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(1d4))
> +#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(1d0))
> +#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(1d2))
> +#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(180))
> 
>  #else
>  #error Need at least 32MB of DRAM. Please adjust load addresses.
> --
> 2.25.1




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

2022-10-12 Thread Andre Przywara
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 
---
 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)
  */
 #define BOOTM_SIZE__stringify(0x170)
-#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(050))
-#define FDT_ADDR_R__stringify(SDRAM_OFFSET(0C0))
-#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(0C5))
-#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(0D0))
-#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(0D5))
-#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(0D6))
+#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(100))
+#define FDT_ADDR_R__stringify(SDRAM_OFFSET(1d5))
+#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(1d4))
+#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(1d0))
+#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(1d2))
+#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(180))
 
 #else
 #error Need at least 32MB of DRAM. Please adjust load addresses.
-- 
2.25.1