aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2009-12-16 20:57:07 -0500
committerRalf Baechle <ralf@linux-mips.org>2009-12-16 20:57:07 -0500
commit32028f1f7bce32e72183129dc55fc23656e7081c (patch)
tree1ff4b992a66bc3b2dcc097fabc15ae2ce1507057 /arch/mips
parent0e8cccc40665a2943f2bf93b9036579e85a716f4 (diff)
MIPS: Remove addinitrd and CONFIG_PROBE_INITRD_HEADER
Addinitrd has been superseded by initramfs ages ago. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig9
-rw-r--r--arch/mips/boot/Makefile8
-rw-r--r--arch/mips/boot/addinitrd.c131
-rw-r--r--arch/mips/configs/ar7_defconfig1
-rw-r--r--arch/mips/configs/cavium-octeon_defconfig1
-rw-r--r--arch/mips/configs/rbtx49xx_defconfig1
-rw-r--r--arch/mips/kernel/setup.c20
7 files changed, 3 insertions, 168 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 20b223ba654d..a16b6dfe3bc3 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2041,15 +2041,6 @@ config STACKTRACE_SUPPORT
2041 2041
2042source "init/Kconfig" 2042source "init/Kconfig"
2043 2043
2044config PROBE_INITRD_HEADER
2045 bool "Probe initrd header created by addinitrd"
2046 depends on BLK_DEV_INITRD
2047 help
2048 Probe initrd header at the last page of kernel image.
2049 Say Y here if you are using arch/mips/boot/addinitrd.c to
2050 add initrd or initramfs image to the kernel image.
2051 Otherwise, say N.
2052
2053source "kernel/Kconfig.freezer" 2044source "kernel/Kconfig.freezer"
2054 2045
2055menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)" 2046menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index 2a209d74f0b4..094bc84765a3 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -25,7 +25,7 @@ strip-flags = $(addprefix --remove-section=,$(drop-sections))
25 25
26VMLINUX = vmlinux 26VMLINUX = vmlinux
27 27
28all: vmlinux.ecoff vmlinux.srec addinitrd 28all: vmlinux.ecoff vmlinux.srec
29 29
30vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) 30vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX)
31 $(obj)/elf2ecoff $(VMLINUX) vmlinux.ecoff $(E2EFLAGS) 31 $(obj)/elf2ecoff $(VMLINUX) vmlinux.ecoff $(E2EFLAGS)
@@ -39,11 +39,7 @@ vmlinux.bin: $(VMLINUX)
39vmlinux.srec: $(VMLINUX) 39vmlinux.srec: $(VMLINUX)
40 $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec 40 $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec
41 41
42$(obj)/addinitrd: $(obj)/addinitrd.c 42clean-files += elf2ecoff \
43 $(HOSTCC) -o $@ $^
44
45clean-files += addinitrd \
46 elf2ecoff \
47 vmlinux.bin \ 43 vmlinux.bin \
48 vmlinux.ecoff \ 44 vmlinux.ecoff \
49 vmlinux.srec 45 vmlinux.srec
diff --git a/arch/mips/boot/addinitrd.c b/arch/mips/boot/addinitrd.c
deleted file mode 100644
index b5b3febc10cc..000000000000
--- a/arch/mips/boot/addinitrd.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * addinitrd - program to add a initrd image to an ecoff kernel
3 *
4 * (C) 1999 Thomas Bogendoerfer
5 * minor modifications, cleanup: Guido Guenther <agx@sigxcpu.org>
6 * further cleanup: Maciej W. Rozycki
7 */
8
9#include <sys/types.h>
10#include <sys/stat.h>
11#include <fcntl.h>
12#include <unistd.h>
13#include <stdio.h>
14#include <netinet/in.h>
15
16#include "ecoff.h"
17
18#define MIPS_PAGE_SIZE 4096
19#define MIPS_PAGE_MASK (MIPS_PAGE_SIZE-1)
20
21#define swab16(x) \
22 ((unsigned short)( \
23 (((unsigned short)(x) & (unsigned short)0x00ffU) << 8) | \
24 (((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
25
26#define swab32(x) \
27 ((unsigned int)( \
28 (((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) | \
29 (((unsigned int)(x) & (unsigned int)0x0000ff00UL) << 8) | \
30 (((unsigned int)(x) & (unsigned int)0x00ff0000UL) >> 8) | \
31 (((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24) ))
32
33#define SWAB(a) (swab ? swab32(a) : (a))
34
35void die(char *s)
36{
37 perror(s);
38 exit(1);
39}
40
41int main(int argc, char *argv[])
42{
43 int fd_vmlinux, fd_initrd, fd_outfile;
44 FILHDR efile;
45 AOUTHDR eaout;
46 SCNHDR esecs[3];
47 struct stat st;
48 char buf[1024];
49 unsigned long loadaddr;
50 unsigned long initrd_header[2];
51 int i, cnt;
52 int swab = 0;
53
54 if (argc != 4) {
55 printf("Usage: %s <vmlinux> <initrd> <outfile>\n", argv[0]);
56 exit(1);
57 }
58
59 if ((fd_vmlinux = open (argv[1], O_RDONLY)) < 0)
60 die("open vmlinux");
61 if (read (fd_vmlinux, &efile, sizeof efile) != sizeof efile)
62 die("read file header");
63 if (read (fd_vmlinux, &eaout, sizeof eaout) != sizeof eaout)
64 die("read aout header");
65 if (read (fd_vmlinux, esecs, sizeof esecs) != sizeof esecs)
66 die("read section headers");
67 /*
68 * check whether the file is good for us
69 */
70 /* TBD */
71
72 /*
73 * check, if we have to swab words
74 */
75 if (ntohs(0xaa55) == 0xaa55) {
76 if (efile.f_magic == swab16(MIPSELMAGIC))
77 swab = 1;
78 } else {
79 if (efile.f_magic == swab16(MIPSEBMAGIC))
80 swab = 1;
81 }
82
83 /* make sure we have an empty data segment for the initrd */
84 if (eaout.dsize || esecs[1].s_size) {
85 fprintf(stderr, "Data segment not empty. Giving up!\n");
86 exit(1);
87 }
88 if ((fd_initrd = open (argv[2], O_RDONLY)) < 0)
89 die("open initrd");
90 if (fstat (fd_initrd, &st) < 0)
91 die("fstat initrd");
92 loadaddr = ((SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)
93 + MIPS_PAGE_SIZE-1) & ~MIPS_PAGE_MASK) - 8;
94 if (loadaddr < (SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)))
95 loadaddr += MIPS_PAGE_SIZE;
96 initrd_header[0] = SWAB(0x494E5244);
97 initrd_header[1] = SWAB(st.st_size);
98 eaout.dsize = esecs[1].s_size = initrd_header[1] = SWAB(st.st_size+8);
99 eaout.data_start = esecs[1].s_vaddr = esecs[1].s_paddr = SWAB(loadaddr);
100
101 if ((fd_outfile = open (argv[3], O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
102 die("open outfile");
103 if (write (fd_outfile, &efile, sizeof efile) != sizeof efile)
104 die("write file header");
105 if (write (fd_outfile, &eaout, sizeof eaout) != sizeof eaout)
106 die("write aout header");
107 if (write (fd_outfile, esecs, sizeof esecs) != sizeof esecs)
108 die("write section headers");
109 /* skip padding */
110 if(lseek(fd_vmlinux, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
111 die("lseek vmlinux");
112 if(lseek(fd_outfile, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
113 die("lseek outfile");
114 /* copy text segment */
115 cnt = SWAB(eaout.tsize);
116 while (cnt) {
117 if ((i = read (fd_vmlinux, buf, sizeof buf)) <= 0)
118 die("read vmlinux");
119 if (write (fd_outfile, buf, i) != i)
120 die("write vmlinux");
121 cnt -= i;
122 }
123 if (write (fd_outfile, initrd_header, sizeof initrd_header) != sizeof initrd_header)
124 die("write initrd header");
125 while ((i = read (fd_initrd, buf, sizeof buf)) > 0)
126 if (write (fd_outfile, buf, i) != i)
127 die("write initrd");
128 close(fd_vmlinux);
129 close(fd_initrd);
130 return 0;
131}
diff --git a/arch/mips/configs/ar7_defconfig b/arch/mips/configs/ar7_defconfig
index 35648302f7cc..2cb304a226ad 100644
--- a/arch/mips/configs/ar7_defconfig
+++ b/arch/mips/configs/ar7_defconfig
@@ -265,7 +265,6 @@ CONFIG_DEFAULT_DEADLINE=y
265# CONFIG_DEFAULT_CFQ is not set 265# CONFIG_DEFAULT_CFQ is not set
266# CONFIG_DEFAULT_NOOP is not set 266# CONFIG_DEFAULT_NOOP is not set
267CONFIG_DEFAULT_IOSCHED="deadline" 267CONFIG_DEFAULT_IOSCHED="deadline"
268CONFIG_PROBE_INITRD_HEADER=y
269# CONFIG_FREEZER is not set 268# CONFIG_FREEZER is not set
270 269
271# 270#
diff --git a/arch/mips/configs/cavium-octeon_defconfig b/arch/mips/configs/cavium-octeon_defconfig
index 7afaa28a3768..1819a4c907ba 100644
--- a/arch/mips/configs/cavium-octeon_defconfig
+++ b/arch/mips/configs/cavium-octeon_defconfig
@@ -269,7 +269,6 @@ CONFIG_DEFAULT_CFQ=y
269# CONFIG_DEFAULT_NOOP is not set 269# CONFIG_DEFAULT_NOOP is not set
270CONFIG_DEFAULT_IOSCHED="cfq" 270CONFIG_DEFAULT_IOSCHED="cfq"
271CONFIG_CLASSIC_RCU=y 271CONFIG_CLASSIC_RCU=y
272# CONFIG_PROBE_INITRD_HEADER is not set
273# CONFIG_FREEZER is not set 272# CONFIG_FREEZER is not set
274 273
275# 274#
diff --git a/arch/mips/configs/rbtx49xx_defconfig b/arch/mips/configs/rbtx49xx_defconfig
index 6c6a19aebe1f..4f3b970006fc 100644
--- a/arch/mips/configs/rbtx49xx_defconfig
+++ b/arch/mips/configs/rbtx49xx_defconfig
@@ -284,7 +284,6 @@ CONFIG_DEFAULT_AS=y
284# CONFIG_DEFAULT_CFQ is not set 284# CONFIG_DEFAULT_CFQ is not set
285# CONFIG_DEFAULT_NOOP is not set 285# CONFIG_DEFAULT_NOOP is not set
286CONFIG_DEFAULT_IOSCHED="anticipatory" 286CONFIG_DEFAULT_IOSCHED="anticipatory"
287# CONFIG_PROBE_INITRD_HEADER is not set
288# CONFIG_FREEZER is not set 287# CONFIG_FREEZER is not set
289 288
290# 289#
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index fd138c9b33ef..bd55f71055ba 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -166,26 +166,8 @@ static unsigned long __init init_initrd(void)
166 * already set up initrd_start and initrd_end. In these cases 166 * already set up initrd_start and initrd_end. In these cases
167 * perfom sanity checks and use them if all looks good. 167 * perfom sanity checks and use them if all looks good.
168 */ 168 */
169 if (!initrd_start || initrd_end <= initrd_start) { 169 if (!initrd_start || initrd_end <= initrd_start)
170#ifdef CONFIG_PROBE_INITRD_HEADER
171 u32 *initrd_header;
172
173 /*
174 * See if initrd has been added to the kernel image by
175 * arch/mips/boot/addinitrd.c. In that case a header is
176 * prepended to initrd and is made up by 8 bytes. The first
177 * word is a magic number and the second one is the size of
178 * initrd. Initrd start must be page aligned in any cases.
179 */
180 initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
181 if (initrd_header[0] != 0x494E5244)
182 goto disable;
183 initrd_start = (unsigned long)(initrd_header + 2);
184 initrd_end = initrd_start + initrd_header[1];
185#else
186 goto disable; 170 goto disable;
187#endif
188 }
189 171
190 if (initrd_start & ~PAGE_MASK) { 172 if (initrd_start & ~PAGE_MASK) {
191 pr_err("initrd start must be page aligned\n"); 173 pr_err("initrd start must be page aligned\n");