@@ -15,7 +15,12 @@ _jiffies = _jiffies_64;
1515
1616SECTIONS
1717{
18+ #ifdef CONFIG_RAMKERNEL
1819 . = CONFIG_BOOT_LOAD;
20+ #else
21+ . = CONFIG_ROM_BASE;
22+ #endif
23+
1924 /* Neither the text, ro_data or bss section need to be aligned
2025 * So pack them back to back
2126 */
@@ -31,6 +36,12 @@ SECTIONS
3136 LOCK_TEXT
3237 IRQENTRY_TEXT
3338 KPROBES_TEXT
39+ #ifdef CONFIG_ROMKERNEL
40+ __sinittext = .;
41+ INIT_TEXT
42+ __einittext = .;
43+ EXIT_TEXT
44+ #endif
3445 *(.text .*)
3546 *(.fixup)
3647
@@ -50,8 +61,14 @@ SECTIONS
5061
5162 /* Just in case the first read only is a 32-bit access */
5263 RO_DATA(4 )
64+ __rodata_end = .;
5365
66+ #ifdef CONFIG_ROMKERNEL
67+ . = CONFIG_BOOT_LOAD;
68+ .bss : AT(__rodata_end)
69+ #else
5470 .bss :
71+ #endif
5572 {
5673 . = ALIGN(4 );
5774 ___bss_start = .;
@@ -67,7 +84,11 @@ SECTIONS
6784 ___bss_stop = .;
6885 }
6986
87+ #if defined(CONFIG_ROMKERNEL)
88+ .data : AT(LOADADDR(.bss ) + SIZEOF(.bss ))
89+ #else
7090 .data :
91+ #endif
7192 {
7293 __sdata = .;
7394 /* This gets done first, so the glob doesn't suck it in */
@@ -94,6 +115,8 @@ SECTIONS
94115
95116 __edata = .;
96117 }
118+ __data_lma = LOADADDR(.data );
119+ __data_len = SIZEOF(.data );
97120
98121 /* The init section should be last, so when we free it, it goes into
99122 * the general memory pool, and (hopefully) will decrease fragmentation
@@ -103,6 +126,7 @@ SECTIONS
103126 . = ALIGN(PAGE_SIZE);
104127 ___init_begin = .;
105128
129+ #ifdef CONFIG_RAMKERNEL
106130 INIT_TEXT_SECTION(PAGE_SIZE)
107131
108132 /* We have to discard exit text and such at runtime, not link time, to
@@ -125,6 +149,35 @@ SECTIONS
125149 }
126150
127151 .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data))
152+ #else
153+ .init.data : AT(__data_lma + __data_len)
154+ {
155+ __sinitdata = .;
156+ INIT_DATA
157+ INIT_SETUP(16 )
158+ INIT_CALLS
159+ CON_INITCALL
160+ SECURITY_INITCALL
161+ INIT_RAM_FS
162+
163+ . = ALIGN(4 );
164+ ___per_cpu_load = .;
165+ ___per_cpu_start = .;
166+ *(.data .percpu.first)
167+ *(.data .percpu.page_aligned)
168+ *(.data .percpu)
169+ *(.data .percpu.shared_aligned)
170+ ___per_cpu_end = .;
171+
172+ EXIT_DATA
173+ __einitdata = .;
174+ }
175+ __init_data_lma = LOADADDR(.init.data);
176+ __init_data_len = SIZEOF(.init.data);
177+ __init_data_end = .;
178+
179+ .text_l1 L1_CODE_START : AT(__init_data_lma + __init_data_len)
180+ #endif
128181 {
129182 . = ALIGN(4 );
130183 __stext_l1 = .;
@@ -205,7 +258,11 @@ SECTIONS
205258 /* Force trailing alignment of our init section so that when we
206259 * free our init memory, we don't leave behind a partial page.
207260 */
261+ #ifdef CONFIG_RAMKERNEL
208262 . = __l2_lma + __l2_len;
263+ #else
264+ . = __init_data_end;
265+ #endif
209266 . = ALIGN(PAGE_SIZE);
210267 ___init_end = .;
211268
0 commit comments