head.S and init_task.c vs addinitrd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
short: 
The attached patch modifies head.S/init_task.c to restore the old habit
of merging all sections(besides .reginfo) into one segment which lets
elf2ecoff/addinitrd work again.

long:
some of the recent head.S/init_task.c changes break addinitrd. In 2.4.16
we had two segments which allowed elf2ecoff to put everything (besides
bss) into one text section (dropping REGINFO) in the ecoff image leaving
the data section emtpy. Addinitrd then later merged the initial ramdisk
into that empty data section.

ELF kernel:
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  REGINFO        0x1c2ae0 0x881c3ae0 0x881c3ae0 0x00018 0x00018 R   0x4
  LOAD           0x001000 0x88002000 0x88002000 0x1e8000 0x1ff560 RWE 0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .reginfo 
   01     .text .fixup .kstrtab __ex_table __ksymtab .text.init .data.init .setup.init .initcall.init .data.cacheline_aligned .reginfo .data .bss

ECOFF kernel:
Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         001e8000  0000000088002000  0000000088002000  000000d0  2**4
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         00000000  00000000881ea000  00000000881ea000  001e80d0  2**4
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00017560  00000000881ea000  00000000881ea000  001e80d0  2**4
                  CONTENTS, ALLOC, NEVER_LOAD

Now as of 2.4.17+ we have three segments described in the program
header:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  REGINFO        0x1c4ae0 0x881c5ae0 0x881c5ae0 0x00018 0x00018 R   0x4
  LOAD           0x001000 0x88002000 0x88002000 0x1ab140 0x1ab140 R E 0x1000
  LOAD           0x1ad000 0x881ae000 0x881ae000 0x43000 0x5a560 RWE 0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .reginfo 
   01     .text .fixup .kstrtab __ex_table __ksymtab 
   02     .data.init_task .text.init .data.init .setup.init .initcall.init .data.cacheline_aligned .reginfo .data .bss

so there's no emtpy section left in the ecoff image for the initial
ramdisk. What was the reasoning for the above change? And why exactly
does this change cause a splitting into data and text segment where as
of 2.4.16 there was only a "data" segment?
Regards,
 -- Guido
diff --exclude=*.orig --exclude=.* -Naur ../../kernel-source-2.4.17/arch/mips/kernel/head.S arch/mips/kernel/head.S
--- ../../kernel-source-2.4.17/arch/mips/kernel/head.S	Thu Mar  7 22:49:57 2002
+++ arch/mips/kernel/head.S	Sat Apr 13 14:09:31 2002
@@ -178,10 +178,15 @@
 	.type	\name, @object
 	.endm
 
-	.data
-	.align	12
+	.text
 
 	page	swapper_pg_dir, PGD_ORDER
 	page	empty_bad_page, 0
 	page	empty_bad_page_table, 0
 	page	invalid_pte_table, 0
+
+/*
+ * Align to 8kb boundary for init_task_union which follows in the
+ * .text segment.
+ */
+	.align	13
diff --exclude=*.orig --exclude=.* -Naur ../../kernel-source-2.4.17/arch/mips/kernel/init_task.c arch/mips/kernel/init_task.c
--- ../../kernel-source-2.4.17/arch/mips/kernel/init_task.c	Thu Mar  7 22:49:57 2002
+++ arch/mips/kernel/init_task.c	Sat Apr 13 14:09:31 2002
@@ -20,5 +20,5 @@
  * The things we do for performance..
  */
 union task_union init_task_union
-	__attribute__((__section__(".data.init_task"))) =
+	__attribute__((__section__(".text"))) =
 		{ INIT_TASK(init_task_union.task) };

Attachment: pgp00175.pgp
Description: PGP signature


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux