File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed
include/arch/arm/aarch64/scripts Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -31,5 +31,6 @@ zephyr_library_sources_ifdef(CONFIG_GEN_SW_ISR_TABLE isr_wrapper.S)
31
31
zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c)
32
32
zephyr_library_sources_ifdef(CONFIG_THREAD_LOCAL_STORAGE ../common/tls.c)
33
33
zephyr_library_sources_ifdef(CONFIG_ARM_PSCI smccc-call.S)
34
+ zephyr_library_sources_ifdef(CONFIG_AARCH64_IMAGE_HEADER header.S)
34
35
35
36
add_subdirectory_ifdef(CONFIG_ARM_MMU mmu)
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ config CMSIS_V2_THREAD_DYNAMIC_STACK_SIZE
56
56
config IPM_CONSOLE_STACK_SIZE
57
57
default 2048
58
58
59
+ config AARCH64_IMAGE_HEADER
60
+ bool "Add image header"
61
+ help
62
+ This option enables standard ARM64 boot image header used by Linux
63
+ and understood by loaders such as u-boot on Xen xl tool.
64
+
59
65
if CPU_CORTEX_A
60
66
61
67
config ARMV8_A_NS
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2020 EPAM Systems
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ #include <linker/sections.h>
8
+ #include <arch/cpu.h>
9
+ #include "mmu/arm_mmu.h"
10
+
11
+ #if CONFIG_MMU_PAGE_SIZE == 4096
12
+ #define HEADER_PGSIZE 1
13
+ #elif CONFIG_MMU_PAGE_SIZE == 16384
14
+ #define HEADER_PGSIZE 2
15
+ #elif CONFIG_MMU_PAGE_SIZE == 65536
16
+ #define HEADER_PGSIZE 3
17
+ #else
18
+ #define HEADER_PGSIZE 0
19
+ #warning "Can't determine page size for header flags"
20
+ #endif
21
+
22
+ #define HEADER_FLAGS (HEADER_PGSIZE << 1 )
23
+
24
+ _ASM_FILE_PROLOGUE
25
+
26
+ SECTION_SUBSEC_FUNC(image_header,_image_header_section,_image_header)
27
+ b __start // branch to kernel start
28
+ .long 0 // reserved
29
+ .quad 0 // Image load offset from start
30
+ // of RAM, little-endian
31
+
32
+ .quad _flash_used // Effective size of kernel
33
+ // image, little-endian
34
+
35
+ .quad HEADER_FLAGS // Informative flags,
36
+ // little-endian
37
+
38
+ .quad 0 // reserved
39
+ .quad 0 // reserved
40
+ .quad 0 // reserved
41
+ .ascii "ARM\x64" // Magic number
42
+ .long 0 // reserved
Original file line number Diff line number Diff line change @@ -107,6 +107,12 @@ SECTIONS
107
107
#ifndef CONFIG_XIP
108
108
z_mapped_start = .;
109
109
#endif
110
+
111
+ #ifdef CONFIG_AARCH64_IMAGE_HEADER
112
+ KEEP (*(.image_header ))
113
+ KEEP (*(" .image_header.*" ))
114
+ #endif
115
+
110
116
_vector_start = .;
111
117
KEEP (*(.exc_vector_table ))
112
118
KEEP (*(" .exc_vector_table.*" ))
You can’t perform that action at this time.
0 commit comments