spec/aarch64/raspberrypi: Rework linker script

This reworks the linker script configuration to be more comprehensible
and to remain within the 1GB guaranteed available on all Pi4 systems and
accounting for the memory dedicated to the GPU and the memory dedicated
to the low level firmware.
This commit is contained in:
Kinsey Moore
2025-06-08 21:33:48 -05:00
parent 7f30da6ec4
commit ecaa780c85

View File

@@ -28,10 +28,20 @@ content: |
* POSSIBILITY OF SUCH DAMAGE.
*/
MMU_TTB_LEN = (0x1000 * ${AARCH64_MMU_TRANSLATION_TABLE_PAGES});
NOCACHE_LEN = 16M;
LOAD_OFFSET = 0x80000;
/*
* The default GPU memory space is 76MB on Pis that have 1GB or more of RAM.
* The Pi 4 always has 1GB or more of RAM.
*/
GPU_RAM_LEN = 76M;
RAM_TOP = 0x40000000 - GPU_RAM_LEN;
MEMORY {
RAM : ORIGIN = 0x80000, LENGTH = 1024M - 0x80000 - 16M
RAM_NOCACHE : ORIGIN = 0x40000000 - 16M, LENGTH = 16M
RAM_MMU : ORIGIN = 0x40000000, LENGTH = (0x1000 * ${AARCH64_MMU_TRANSLATION_TABLE_PAGES})
RAM : ORIGIN = LOAD_OFFSET, LENGTH = RAM_TOP - LOAD_OFFSET - NOCACHE_LEN - MMU_TTB_LEN
RAM_NOCACHE : ORIGIN = RAM_TOP - NOCACHE_LEN - MMU_TTB_LEN, LENGTH = NOCACHE_LEN
RAM_MMU : ORIGIN = RAM_TOP - MMU_TTB_LEN, LENGTH = MMU_TTB_LEN
}
REGION_ALIAS ("REGION_START", RAM);