aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2007-11-17 11:09:49 -0500
committerBryan Wu <bryan.wu@analog.com>2007-11-17 11:09:49 -0500
commitaf8a5af3ff73055f7554a3a66307ad58792f09d5 (patch)
treeeb9d60acd20667fbf4e552d7e7417a1c520b6a60 /arch
parenta961d659637b7d77c916597017e2e3730859c333 (diff)
Blackfin arch: fix bug kernel not to boot up with mtd filesystems
Revert this patch: move the init sections to the end of memory, so that after they are free, run time memory is all continugous - this should help decrease memory fragementation. When doing this, we also pack some of the other sections a little closer together, to make sure we don't waste memory. To make this happen, we need to rename the .data.init_task section to .init_task.data, so it doesn't get picked up by the linker script glob. Since it causes the kernel not to boot up with mtd filesystems. Signed-off-by: Bernd Schmidt <bernd.schmidt@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/blackfin/kernel/init_task.c2
-rw-r--r--arch/blackfin/kernel/setup.c8
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S47
3 files changed, 24 insertions, 33 deletions
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
index c640154030e2..673c860ffc23 100644
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -57,5 +57,5 @@ EXPORT_SYMBOL(init_task);
57 * "init_task" linker map entry. 57 * "init_task" linker map entry.
58 */ 58 */
59union thread_union init_thread_union 59union thread_union init_thread_union
60 __attribute__ ((__section__(".init_task.data"))) = { 60 __attribute__ ((__section__(".data.init_task"))) = {
61INIT_THREAD_INFO(init_task)}; 61INIT_THREAD_INFO(init_task)};
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index eee5a1fcb64c..d2822010b7ce 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -237,7 +237,7 @@ void __init setup_arch(char **cmdline_p)
237 /* by now the stack is part of the init task */ 237 /* by now the stack is part of the init task */
238 memory_end = _ramend - DMA_UNCACHED_REGION; 238 memory_end = _ramend - DMA_UNCACHED_REGION;
239 239
240 _ramstart = (unsigned long)_end; 240 _ramstart = (unsigned long)__bss_stop;
241 memory_start = PAGE_ALIGN(_ramstart); 241 memory_start = PAGE_ALIGN(_ramstart);
242 242
243#if defined(CONFIG_MTD_UCLINUX) 243#if defined(CONFIG_MTD_UCLINUX)
@@ -286,7 +286,7 @@ void __init setup_arch(char **cmdline_p)
286 } 286 }
287 287
288 /* Relocate MTD image to the top of memory after the uncached memory area */ 288 /* Relocate MTD image to the top of memory after the uncached memory area */
289 dma_memcpy((char *)memory_end, _end, mtd_size); 289 dma_memcpy((char *)memory_end, __bss_stop, mtd_size);
290 290
291 memory_mtd_start = memory_end; 291 memory_mtd_start = memory_end;
292 _ebss = memory_mtd_start; /* define _ebss for compatible */ 292 _ebss = memory_mtd_start; /* define _ebss for compatible */
@@ -358,10 +358,10 @@ void __init setup_arch(char **cmdline_p)
358 printk(KERN_INFO "Memory map:\n" 358 printk(KERN_INFO "Memory map:\n"
359 KERN_INFO " text = 0x%p-0x%p\n" 359 KERN_INFO " text = 0x%p-0x%p\n"
360 KERN_INFO " rodata = 0x%p-0x%p\n" 360 KERN_INFO " rodata = 0x%p-0x%p\n"
361 KERN_INFO " bss = 0x%p-0x%p\n"
362 KERN_INFO " data = 0x%p-0x%p\n" 361 KERN_INFO " data = 0x%p-0x%p\n"
363 KERN_INFO " stack = 0x%p-0x%p\n" 362 KERN_INFO " stack = 0x%p-0x%p\n"
364 KERN_INFO " init = 0x%p-0x%p\n" 363 KERN_INFO " init = 0x%p-0x%p\n"
364 KERN_INFO " bss = 0x%p-0x%p\n"
365 KERN_INFO " available = 0x%p-0x%p\n" 365 KERN_INFO " available = 0x%p-0x%p\n"
366#ifdef CONFIG_MTD_UCLINUX 366#ifdef CONFIG_MTD_UCLINUX
367 KERN_INFO " rootfs = 0x%p-0x%p\n" 367 KERN_INFO " rootfs = 0x%p-0x%p\n"
@@ -371,10 +371,10 @@ void __init setup_arch(char **cmdline_p)
371#endif 371#endif
372 , _stext, _etext, 372 , _stext, _etext,
373 __start_rodata, __end_rodata, 373 __start_rodata, __end_rodata,
374 __bss_start, __bss_stop,
375 _sdata, _edata, 374 _sdata, _edata,
376 (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000), 375 (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000),
377 __init_begin, __init_end, 376 __init_begin, __init_end,
377 __bss_start, __bss_stop,
378 (void *)_ramstart, (void *)memory_end 378 (void *)_ramstart, (void *)memory_end
379#ifdef CONFIG_MTD_UCLINUX 379#ifdef CONFIG_MTD_UCLINUX
380 , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size) 380 , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 5bdc0f79bb1a..9b75bc83c71f 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -41,9 +41,6 @@ _jiffies = _jiffies_64;
41SECTIONS 41SECTIONS
42{ 42{
43 . = CONFIG_BOOT_LOAD; 43 . = CONFIG_BOOT_LOAD;
44 /* Neither the text, ro_data or bss section need to be aligned
45 * So pack them back to back
46 */
47 .text : 44 .text :
48 { 45 {
49 __text = .; 46 __text = .;
@@ -61,25 +58,22 @@ SECTIONS
61 *(__ex_table) 58 *(__ex_table)
62 ___stop___ex_table = .; 59 ___stop___ex_table = .;
63 60
61 . = ALIGN(4);
64 __etext = .; 62 __etext = .;
65 } 63 }
66 64
67 /* Just in case the first read only is a 32-bit access */ 65 RO_DATA(PAGE_SIZE)
68 RO_DATA(4)
69
70 .bss :
71 {
72 . = ALIGN(4);
73 ___bss_start = .;
74 *(.bss .bss.*)
75 *(COMMON)
76 ___bss_stop = .;
77 }
78 66
79 .data : 67 .data :
80 { 68 {
69 /* make sure the init_task is aligned to the
70 * kernel thread size so we can locate the kernel
71 * stack properly and quickly.
72 */
81 __sdata = .; 73 __sdata = .;
82 /* This gets done first, so the glob doesn't suck it in */ 74 . = ALIGN(THREAD_SIZE);
75 *(.data.init_task)
76
83 . = ALIGN(32); 77 . = ALIGN(32);
84 *(.data.cacheline_aligned) 78 *(.data.cacheline_aligned)
85 79
@@ -87,22 +81,10 @@ SECTIONS
87 *(.data.*) 81 *(.data.*)
88 CONSTRUCTORS 82 CONSTRUCTORS
89 83
90 /* make sure the init_task is aligned to the
91 * kernel thread size so we can locate the kernel
92 * stack properly and quickly.
93 */
94 . = ALIGN(THREAD_SIZE); 84 . = ALIGN(THREAD_SIZE);
95 *(.init_task.data)
96
97 __edata = .; 85 __edata = .;
98 } 86 }
99 87
100 /* The init section should be last, so when we free it, it goes into
101 * the general memory pool, and (hopefully) will decrease fragmentation
102 * a tiny bit. The init section has a _requirement_ that it be
103 * PAGE_SIZE aligned
104 */
105 . = ALIGN(PAGE_SIZE);
106 ___init_begin = .; 88 ___init_begin = .;
107 89
108 .init.text : 90 .init.text :
@@ -197,7 +179,16 @@ SECTIONS
197 . = ALIGN(PAGE_SIZE); 179 . = ALIGN(PAGE_SIZE);
198 ___init_end = .; 180 ___init_end = .;
199 181
200 __end =.; 182 .bss :
183 {
184 . = ALIGN(4);
185 ___bss_start = .;
186 *(.bss .bss.*)
187 *(COMMON)
188 . = ALIGN(4);
189 ___bss_stop = .;
190 __end = .;
191 }
201 192
202 STABS_DEBUG 193 STABS_DEBUG
203 194