MIPS: Remove addinitrd and CONFIG_PROBE_INITRD_HEADER
authorRalf Baechle <ralf@linux-mips.org>
Thu, 17 Dec 2009 01:57:07 +0000 (01:57 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 17 Dec 2009 01:57:07 +0000 (01:57 +0000)
Addinitrd has been superseded by initramfs ages ago.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Kconfig
arch/mips/boot/Makefile
arch/mips/boot/addinitrd.c [deleted file]
arch/mips/configs/ar7_defconfig
arch/mips/configs/cavium-octeon_defconfig
arch/mips/configs/rbtx49xx_defconfig
arch/mips/kernel/setup.c

index 20b223b..a16b6df 100644 (file)
@@ -2041,15 +2041,6 @@ config STACKTRACE_SUPPORT
 
 source "init/Kconfig"
 
-config PROBE_INITRD_HEADER
-       bool "Probe initrd header created by addinitrd"
-       depends on BLK_DEV_INITRD
-       help
-         Probe initrd header at the last page of kernel image.
-         Say Y here if you are using arch/mips/boot/addinitrd.c to
-         add initrd or initramfs image to the kernel image.
-         Otherwise, say N.
-
 source "kernel/Kconfig.freezer"
 
 menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
index 2a209d7..094bc84 100644 (file)
@@ -25,7 +25,7 @@ strip-flags   = $(addprefix --remove-section=,$(drop-sections))
 
 VMLINUX = vmlinux
 
-all: vmlinux.ecoff vmlinux.srec addinitrd
+all: vmlinux.ecoff vmlinux.srec
 
 vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX)
        $(obj)/elf2ecoff $(VMLINUX) vmlinux.ecoff $(E2EFLAGS)
@@ -39,11 +39,7 @@ vmlinux.bin: $(VMLINUX)
 vmlinux.srec: $(VMLINUX)
        $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec
 
-$(obj)/addinitrd: $(obj)/addinitrd.c
-       $(HOSTCC) -o $@ $^
-
-clean-files += addinitrd \
-              elf2ecoff \
+clean-files += elf2ecoff \
               vmlinux.bin \
               vmlinux.ecoff \
               vmlinux.srec
diff --git a/arch/mips/boot/addinitrd.c b/arch/mips/boot/addinitrd.c
deleted file mode 100644 (file)
index b5b3feb..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * addinitrd - program to add a initrd image to an ecoff kernel
- *
- * (C) 1999 Thomas Bogendoerfer
- * minor modifications, cleanup: Guido Guenther <agx@sigxcpu.org>
- * further cleanup: Maciej W. Rozycki
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <netinet/in.h>
-
-#include "ecoff.h"
-
-#define MIPS_PAGE_SIZE 4096
-#define MIPS_PAGE_MASK (MIPS_PAGE_SIZE-1)
-
-#define swab16(x) \
-        ((unsigned short)( \
-                (((unsigned short)(x) & (unsigned short)0x00ffU) << 8) | \
-                (((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
-
-#define swab32(x) \
-        ((unsigned int)( \
-                (((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) | \
-                (((unsigned int)(x) & (unsigned int)0x0000ff00UL) <<  8) | \
-                (((unsigned int)(x) & (unsigned int)0x00ff0000UL) >>  8) | \
-                (((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24) ))
-
-#define SWAB(a)        (swab ? swab32(a) : (a))
-
-void die(char *s)
-{
-       perror(s);
-       exit(1);
-}
-
-int main(int argc, char *argv[])
-{
-       int fd_vmlinux, fd_initrd, fd_outfile;
-       FILHDR efile;
-       AOUTHDR eaout;
-       SCNHDR esecs[3];
-       struct stat st;
-       char buf[1024];
-       unsigned long loadaddr;
-       unsigned long initrd_header[2];
-       int i, cnt;
-       int swab = 0;
-
-       if (argc != 4) {
-               printf("Usage: %s <vmlinux> <initrd> <outfile>\n", argv[0]);
-               exit(1);
-       }
-
-       if ((fd_vmlinux = open (argv[1], O_RDONLY)) < 0)
-                die("open vmlinux");
-       if (read (fd_vmlinux, &efile, sizeof efile) != sizeof efile)
-               die("read file header");
-       if (read (fd_vmlinux, &eaout, sizeof eaout) != sizeof eaout)
-               die("read aout header");
-       if (read (fd_vmlinux, esecs, sizeof esecs) != sizeof esecs)
-               die("read section headers");
-       /*
-        * check whether the file is good for us
-        */
-       /* TBD */
-
-       /*
-        * check, if we have to swab words
-        */
-       if (ntohs(0xaa55) == 0xaa55) {
-               if (efile.f_magic == swab16(MIPSELMAGIC))
-                       swab = 1;
-       } else {
-               if (efile.f_magic == swab16(MIPSEBMAGIC))
-                       swab = 1;
-       }
-
-       /* make sure we have an empty data segment for the initrd */
-       if (eaout.dsize || esecs[1].s_size) {
-               fprintf(stderr, "Data segment not empty. Giving up!\n");
-               exit(1);
-       }
-       if ((fd_initrd = open (argv[2], O_RDONLY)) < 0)
-               die("open initrd");
-       if (fstat (fd_initrd, &st) < 0)
-               die("fstat initrd");
-       loadaddr = ((SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)
-                       + MIPS_PAGE_SIZE-1) & ~MIPS_PAGE_MASK) - 8;
-       if (loadaddr < (SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)))
-               loadaddr += MIPS_PAGE_SIZE;
-       initrd_header[0] = SWAB(0x494E5244);
-       initrd_header[1] = SWAB(st.st_size);
-       eaout.dsize = esecs[1].s_size = initrd_header[1] = SWAB(st.st_size+8);
-       eaout.data_start = esecs[1].s_vaddr = esecs[1].s_paddr = SWAB(loadaddr);
-
-       if ((fd_outfile = open (argv[3], O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
-               die("open outfile");
-       if (write (fd_outfile, &efile, sizeof efile) != sizeof efile)
-               die("write file header");
-       if (write (fd_outfile, &eaout, sizeof eaout) != sizeof eaout)
-               die("write aout header");
-       if (write (fd_outfile, esecs, sizeof esecs) != sizeof esecs)
-               die("write section headers");
-       /* skip padding */
-       if(lseek(fd_vmlinux, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
-               die("lseek vmlinux");
-       if(lseek(fd_outfile, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
-               die("lseek outfile");
-       /* copy text segment */
-       cnt = SWAB(eaout.tsize);
-       while (cnt) {
-               if ((i = read (fd_vmlinux, buf, sizeof buf)) <= 0)
-                       die("read vmlinux");
-               if (write (fd_outfile, buf, i) != i)
-                       die("write vmlinux");
-               cnt -= i;
-       }
-       if (write (fd_outfile, initrd_header, sizeof initrd_header) != sizeof initrd_header)
-               die("write initrd header");
-       while ((i = read (fd_initrd, buf, sizeof buf)) > 0)
-               if (write (fd_outfile, buf, i) != i)
-                       die("write initrd");
-       close(fd_vmlinux);
-       close(fd_initrd);
-       return 0;
-}
index 3564830..2cb304a 100644 (file)
@@ -265,7 +265,6 @@ CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
-CONFIG_PROBE_INITRD_HEADER=y
 # CONFIG_FREEZER is not set
 
 #
index 7afaa28..1819a4c 100644 (file)
@@ -269,7 +269,6 @@ CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
 CONFIG_CLASSIC_RCU=y
-# CONFIG_PROBE_INITRD_HEADER is not set
 # CONFIG_FREEZER is not set
 
 #
index 6c6a19a..4f3b970 100644 (file)
@@ -284,7 +284,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
-# CONFIG_PROBE_INITRD_HEADER is not set
 # CONFIG_FREEZER is not set
 
 #
index fd138c9..bd55f71 100644 (file)
@@ -166,26 +166,8 @@ static unsigned long __init init_initrd(void)
         * already set up initrd_start and initrd_end. In these cases
         * perfom sanity checks and use them if all looks good.
         */
-       if (!initrd_start || initrd_end <= initrd_start) {
-#ifdef CONFIG_PROBE_INITRD_HEADER
-               u32 *initrd_header;
-
-               /*
-                * See if initrd has been added to the kernel image by
-                * arch/mips/boot/addinitrd.c. In that case a header is
-                * prepended to initrd and is made up by 8 bytes. The first
-                * word is a magic number and the second one is the size of
-                * initrd.  Initrd start must be page aligned in any cases.
-                */
-               initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
-               if (initrd_header[0] != 0x494E5244)
-                       goto disable;
-               initrd_start = (unsigned long)(initrd_header + 2);
-               initrd_end = initrd_start + initrd_header[1];
-#else
+       if (!initrd_start || initrd_end <= initrd_start)
                goto disable;
-#endif
-       }
 
        if (initrd_start & ~PAGE_MASK) {
                pr_err("initrd start must be page aligned\n");