Commit b884e838 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Move saved_command_line to init/main.c

From: Rusty Russell <rusty@rustcorp.com.au>

Currently every arch declares its own char saved_command_line[].  Make sure
every arch defines COMMAND_LINE_SIZE in asm/setup.h, and declare
saved_command_line in linux/init.h (init/main.c contains the definition).
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4d4f4cc4
......@@ -122,7 +122,6 @@ static void get_sysnames(unsigned long, unsigned long, unsigned long,
static void determine_cpu_caches (unsigned int);
static char command_line[COMMAND_LINE_SIZE];
char saved_command_line[COMMAND_LINE_SIZE];
/*
* The format of "screen_info" is strange, and due to early
......
......@@ -97,7 +97,6 @@ unsigned char aux_device_present;
char elf_platform[ELF_PLATFORM_SIZE];
EXPORT_SYMBOL(elf_platform);
char saved_command_line[COMMAND_LINE_SIZE];
unsigned long phys_initrd_start __initdata = 0;
unsigned long phys_initrd_size __initdata = 0;
......
......@@ -76,7 +76,6 @@ struct processor processor;
unsigned char aux_device_present;
char elf_platform[ELF_PLATFORM_SIZE];
char saved_command_line[COMMAND_LINE_SIZE];
unsigned long phys_initrd_start __initdata = 0;
unsigned long phys_initrd_size __initdata = 0;
......
......@@ -29,10 +29,7 @@ unsigned char aux_device_present;
extern int root_mountflags;
extern char _etext, _edata, _end;
#define COMMAND_LINE_SIZE 256
static char command_line[COMMAND_LINE_SIZE] = { 0, };
char saved_command_line[COMMAND_LINE_SIZE];
extern const unsigned long text_start, edata; /* set by the linker script */
extern unsigned long dram_start, dram_end;
......
......@@ -30,6 +30,7 @@
#include <linux/major.h>
#include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <asm/setup.h>
#include <asm/irq.h>
......@@ -54,8 +55,7 @@ unsigned long rom_length;
unsigned long memory_start;
unsigned long memory_end;
char command_line[512];
char saved_command_line[512];
char command_line[COMMAND_LINE_SIZE];
extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
extern int _ramstart, _ramend;
......
......@@ -87,12 +87,11 @@ static void gzip_release(void **);
*/
static unsigned char *real_mode; /* Pointer to real-mode data */
#define EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
#define RM_EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
#ifndef STANDARD_MEMORY_BIOS_CALL
#define ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
#define RM_ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
#endif
#define SCREEN_INFO (*(struct screen_info *)(real_mode+0))
#define EDID_INFO (*(struct edid_info *)(real_mode+0x440))
#define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0))
extern char input_data[];
extern int input_len;
......@@ -174,8 +173,8 @@ static void putstr(const char *s)
int x,y,pos;
char c;
x = SCREEN_INFO.orig_x;
y = SCREEN_INFO.orig_y;
x = RM_SCREEN_INFO.orig_x;
y = RM_SCREEN_INFO.orig_y;
while ( ( c = *s++ ) != '\0' ) {
if ( c == '\n' ) {
......@@ -196,8 +195,8 @@ static void putstr(const char *s)
}
}
SCREEN_INFO.orig_x = x;
SCREEN_INFO.orig_y = y;
RM_SCREEN_INFO.orig_x = x;
RM_SCREEN_INFO.orig_y = y;
pos = (x + cols * y) * 2; /* Update cursor position */
outb_p(14, vidport);
......@@ -306,9 +305,9 @@ struct {
static void setup_normal_output_buffer(void)
{
#ifdef STANDARD_MEMORY_BIOS_CALL
if (EXT_MEM_K < 1024) error("Less than 2MB of memory");
if (RM_EXT_MEM_K < 1024) error("Less than 2MB of memory");
#else
if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory");
if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory");
#endif
output_data = (char *)0x100000; /* Points to 1M */
free_mem_end_ptr = (long)real_mode;
......@@ -323,9 +322,11 @@ static void setup_output_buffer_if_we_run_high(struct moveparams *mv)
{
high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
#ifdef STANDARD_MEMORY_BIOS_CALL
if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory");
if (RM_EXT_MEM_K < (3*1024)) error("Less than 4MB of memory");
#else
if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory");
if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) <
(3*1024))
error("Less than 4MB of memory");
#endif
mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
......@@ -358,7 +359,7 @@ asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode)
{
real_mode = rmode;
if (SCREEN_INFO.orig_video_mode == 7) {
if (RM_SCREEN_INFO.orig_video_mode == 7) {
vidmem = (char *) 0xb0000;
vidport = 0x3b4;
} else {
......@@ -366,8 +367,8 @@ asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode)
vidport = 0x3d4;
}
lines = SCREEN_INFO.orig_video_lines;
cols = SCREEN_INFO.orig_video_cols;
lines = RM_SCREEN_INFO.orig_video_lines;
cols = RM_SCREEN_INFO.orig_video_cols;
if (free_mem_ptr < 0x100000) setup_normal_output_buffer();
else setup_output_buffer_if_we_run_high(mv);
......
......@@ -127,7 +127,6 @@ unsigned long saved_videomode;
#define RAMDISK_LOAD_FLAG 0x4000
static char command_line[COMMAND_LINE_SIZE];
char saved_command_line[COMMAND_LINE_SIZE];
unsigned char __initdata boot_params[PARAM_SIZE];
......
......@@ -88,10 +88,6 @@ unsigned char aux_device_present = 0xaa; /* XXX remove this when legacy I
unsigned long ia64_max_iommu_merge_mask = ~0UL;
EXPORT_SYMBOL(ia64_max_iommu_merge_mask);
#define COMMAND_LINE_SIZE 512
char saved_command_line[COMMAND_LINE_SIZE]; /* used in proc filesystem */
/*
* We use a special marker for the end of memory and it uses the extra (+1) slot
*/
......
......@@ -62,7 +62,6 @@ struct mem_info m68k_memory[NUM_MEMINFO];
static struct mem_info m68k_ramdisk;
static char m68k_command_line[CL_SIZE];
char saved_command_line[CL_SIZE];
char m68k_debug_device[6] = "";
......
......@@ -64,7 +64,6 @@ void q40_set_vectors (void);
extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/ );
extern char *saved_command_line;
extern char m68k_debug_device[];
static void q40_mem_console_write(struct console *co, const char *b,
unsigned int count);
......
......@@ -31,6 +31,7 @@
#include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h>
#include <linux/init.h>
#include <asm/setup.h>
#include <asm/irq.h>
......@@ -44,8 +45,7 @@ unsigned long rom_length;
unsigned long memory_start;
unsigned long memory_end;
char command_line[512];
char saved_command_line[512];
char command_line[COMMAND_LINE_SIZE];
/* setup some dummy routines */
static void dummy_waitbut(void)
......
......@@ -71,7 +71,6 @@ EXPORT_SYMBOL(mips_machgroup);
struct boot_mem_map boot_mem_map;
static char command_line[CL_SIZE];
char saved_command_line[CL_SIZE];
char arcs_cmdline[CL_SIZE]=CONFIG_CMDLINE;
/*
......
......@@ -45,8 +45,6 @@
#include <asm/pdc_chassis.h>
#include <asm/io.h>
#define COMMAND_LINE_SIZE 1024
char saved_command_line[COMMAND_LINE_SIZE];
char command_line[COMMAND_LINE_SIZE];
/* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
......
......@@ -54,7 +54,6 @@ extern void ppc6xx_idle(void);
extern void power4_idle(void);
extern boot_infos_t *boot_infos;
char saved_command_line[COMMAND_LINE_SIZE];
unsigned char aux_device_present;
struct ide_machdep_calls ppc_ide_md;
char *sysmap;
......
......@@ -33,7 +33,6 @@
#include <asm/hw_irq.h>
#include <asm/prep_nvram.h>
extern char saved_command_line[];
extern void lopec_find_bridges(void);
/*
......
......@@ -103,8 +103,6 @@ int has_l2cache = 0;
static int current_root_goodness = -1;
extern char saved_command_line[];
extern int pmac_newworld;
#define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
......
......@@ -48,8 +48,6 @@
TODC_ALLOC();
extern char saved_command_line[];
extern void pplus_setup_hose(void);
extern void pplus_set_VIA_IDE_native(void);
......
......@@ -76,7 +76,6 @@ extern void rs_nvram_write_val(int addr,
extern void ibm_prep_init(void);
extern void prep_find_bridges(void);
extern char saved_command_line[];
int _prep_type;
......
......@@ -35,6 +35,7 @@
#include <asm/offsets.h>
#include <asm/bug.h>
#include <asm/cputable.h>
#include <asm/setup.h>
#ifdef CONFIG_PPC_ISERIES
#define DO_SOFT_DISABLE
......@@ -2222,4 +2223,4 @@ stab_array:
*/
.globl cmd_line
cmd_line:
.space 512 /* COMMAND_LINE_SIZE */
.space COMMAND_LINE_SIZE
......@@ -82,7 +82,6 @@ unsigned long decr_overclock_proc0_set = 0;
int powersave_nap;
char saved_command_line[COMMAND_LINE_SIZE];
unsigned char aux_device_present;
void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5,
......
......@@ -76,7 +76,6 @@ extern int _text,_etext, _edata, _end;
#include <asm/setup.h>
static char command_line[COMMAND_LINE_SIZE] = { 0, };
char saved_command_line[COMMAND_LINE_SIZE];
static struct resource code_resource = { "Kernel code", 0x100000, 0 };
static struct resource data_resource = { "Kernel data", 0, 0 };
......
......@@ -85,14 +85,12 @@ static struct sh_machine_vector* __init get_mv_byname(const char* name);
#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014))
/* ... */
#define COMMAND_LINE ((char *) (PARAM+0x100))
#define COMMAND_LINE_SIZE 256
#define RAMDISK_IMAGE_START_MASK 0x07FF
#define RAMDISK_PROMPT_FLAG 0x8000
#define RAMDISK_LOAD_FLAG 0x4000
static char command_line[COMMAND_LINE_SIZE] = { 0, };
char saved_command_line[COMMAND_LINE_SIZE];
struct resource standard_io_resources[] = {
{ "dma1", 0x00, 0x1f },
......
......@@ -244,8 +244,7 @@ extern unsigned short ram_flags;
extern int root_mountflags;
char saved_command_line[256];
char reboot_command[256];
char reboot_command[COMMAND_LINE_SIZE];
enum sparc_cpu sparc_cpu_model;
struct tt_entry *sparc_ttable;
......
......@@ -11,6 +11,7 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/types.h>
#include <linux/string.h>
......@@ -74,7 +75,6 @@ extern void *__memscan_zero(void *, size_t);
extern void *__memscan_generic(void *, int, size_t);
extern int __memcmp(const void *, const void *, __kernel_size_t);
extern int __strncmp(const char *, const char *, __kernel_size_t);
extern char saved_command_line[];
extern void bcopy (const char *, char *, int);
extern int __ashrdi3(int, int);
......
......@@ -451,8 +451,7 @@ extern unsigned short ram_flags;
extern int root_mountflags;
char saved_command_line[256];
char reboot_command[256];
char reboot_command[COMMAND_LINE_SIZE];
static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };
......
......@@ -24,6 +24,7 @@
#include <linux/socket.h>
#include <linux/syscalls.h>
#include <linux/percpu.h>
#include <linux/init.h>
#include <net/compat.h>
#include <asm/oplib.h>
......@@ -76,7 +77,6 @@ extern int __memcmp(const void *, const void *, __kernel_size_t);
extern int __strncmp(const char *, const char *, __kernel_size_t);
extern __kernel_size_t __strlen(const char *);
extern __kernel_size_t strlen(const char *);
extern char saved_command_line[];
extern void linux_sparc_syscall(void);
extern void rtrap(void);
extern void show_regs(struct pt_regs *);
......
......@@ -34,7 +34,6 @@
#define COMMAND_LINE_SIZE _POSIX_ARG_MAX
/* Changed in linux_main and setup_arch, which run before SMP is started */
char saved_command_line[COMMAND_LINE_SIZE] = { 0 };
char command_line[COMMAND_LINE_SIZE] = { 0 };
void add_arg(char *cmd_line, char *arg)
......
......@@ -20,6 +20,7 @@
#include <linux/major.h>
#include <linux/root_dev.h>
#include <linux/mtd/mtd.h>
#include <linux/init.h>
#include <asm/irq.h>
......@@ -40,8 +41,7 @@ extern char _root_fs_image_start __attribute__ ((__weak__));
extern char _root_fs_image_end __attribute__ ((__weak__));
char command_line[512];
char saved_command_line[512];
char command_line[COMMAND_LINE_SIZE];
/* Memory not used by the kernel. */
static unsigned long total_ram_pages;
......
......@@ -100,7 +100,6 @@ extern int root_mountflags;
extern char _text, _etext, _edata, _end;
char command_line[COMMAND_LINE_SIZE];
char saved_command_line[COMMAND_LINE_SIZE];
struct resource standard_io_resources[] = {
{ "dma1", 0x00, 0x1f, IORESOURCE_BUSY | IORESOURCE_IO },
......
......@@ -149,7 +149,6 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
char buffer[OPROMMAXPARAM+1], *buf;
struct openpromio *opp;
int bufsize, len, error = 0;
extern char saved_command_line[];
static int cnt;
if (cmd == OPROMSETOPT)
......
......@@ -18,6 +18,7 @@
#include <linux/elfcore.h>
#include <linux/vmalloc.h>
#include <linux/highmem.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/io.h>
......@@ -84,8 +85,6 @@ kclist_del(void *addr)
return 0;
}
extern char saved_command_line[];
static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
{
size_t try, size;
......
......@@ -518,7 +518,6 @@ static int filesystems_read_proc(char *page, char **start, off_t off,
static int cmdline_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
extern char saved_command_line[];
int len;
len = sprintf(page, "%s\n", saved_command_line);
......
#ifndef __ALPHA_SETUP_H
#define __ALPHA_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif
......@@ -43,7 +43,6 @@
*/
#define PARAM ZERO_PGE
#define COMMAND_LINE ((char*)(PARAM + 0x0000))
#define COMMAND_LINE_SIZE 256
#define INITRD_START (*(unsigned long *) (PARAM+0x100))
#define INITRD_SIZE (*(unsigned long *) (PARAM+0x108))
......
#ifndef _CRIS_SETUP_H
#define _CRIS_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif
/* Nothing do */
#ifndef __H8300_SETUP_H
#define __H8300_SETUP_H
#define COMMAND_LINE_SIZE 512
#endif
......@@ -18,5 +18,6 @@
#endif
#define MAXHOSTNAMELEN 64 /* max length of hostname */
#define COMMAND_LINE_SIZE 256
#endif
#ifndef __IA64_SETUP_H
#define __IA64_SETUP_H
#define COMMAND_LINE_SIZE 512
#endif
......@@ -357,6 +357,7 @@ extern int m68k_is040or060;
#define NUM_MEMINFO 4
#define CL_SIZE 256
#define COMMAND_LINE_SIZE CL_SIZE
#ifndef __ASSEMBLY__
extern int m68k_num_memory; /* # of memory blocks found (and used) */
......
#include <asm-m68k/setup.h>
/* We have a bigger command line buffer. */
#undef COMMAND_LINE_SIZE
#define COMMAND_LINE_SIZE 512
......@@ -12,6 +12,7 @@
#define _ASM_BOOTINFO_H
#include <linux/types.h>
#include <asm/setup.h>
/*
* The MACH_GROUP_ IDs are the equivalent to PCI vendor IDs; the remaining
......@@ -209,7 +210,7 @@
#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
#define CL_SIZE (256)
#define CL_SIZE COMMAND_LINE_SIZE
const char *get_system_type(void);
......
#ifdef __KERNEL__
#ifndef _MIPS_SETUP_H
#define _MIPS_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif /* __SETUP_H */
#endif /* __KERNEL__ */
/*
* Just a place holder. We don't want to have to test x86 before
* we include stuff
*/
#ifndef _PARISC_SETUP_H
#define _PARISC_SETUP_H
#ifndef _i386_SETUP_H
#define _i386_SETUP_H
#define COMMAND_LINE_SIZE 1024
#endif /* _i386_SETUP_H */
#endif /* _PARISC_SETUP_H */
......@@ -106,7 +106,6 @@ struct machdep_calls {
};
extern struct machdep_calls ppc_md;
#define COMMAND_LINE_SIZE 512
extern char cmd_line[COMMAND_LINE_SIZE];
extern void setup_pci_ptrs(void);
......
......@@ -6,6 +6,9 @@
#define m68k_memory memory
#include <asm-m68k/setup.h>
/* We have a bigger command line buffer. */
#undef COMMAND_LINE_SIZE
#define COMMAND_LINE_SIZE 512
#endif /* _PPC_SETUP_H */
#endif /* __KERNEL__ */
......@@ -11,6 +11,7 @@
#include <linux/config.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
struct pt_regs;
......@@ -112,9 +113,7 @@ struct machdep_calls {
};
extern struct machdep_calls ppc_md;
#define COMMAND_LINE_SIZE 512
extern char cmd_line[COMMAND_LINE_SIZE];
extern char saved_command_line[COMMAND_LINE_SIZE];
/* Functions to produce codes on the leds.
* The SRC code should be unique for the message category and should
......
#ifndef _PPC_SETUP_H
#define _PPC_SETUP_H
/* This is a place holder include */
#define COMMAND_LINE_SIZE 512
#endif /* _PPC_SETUP_H */
#ifdef __KERNEL__
#ifndef _SH_SETUP_H
#define _SH_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif /* _SH_SETUP_H */
#endif /* __KERNEL__ */
......@@ -5,5 +5,6 @@
#ifndef _SPARC_SETUP_H
#define _SPARC_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif /* _SPARC_SETUP_H */
......@@ -5,5 +5,6 @@
#ifndef _SPARC64_SETUP_H
#define _SPARC64_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif /* _SPARC64_SETUP_H */
#ifndef SETUP_H_INCLUDED
#define SETUP_H_INCLUDED
#define COMMAND_LINE_SIZE 512
#endif /* SETUP_H_INCLUDED */
#ifndef _V850_SETUP_H
#define _V850_SETUP_H
#define COMMAND_LINE_SIZE 512
#endif /* __SETUP_H */
......@@ -30,7 +30,6 @@ extern char x86_boot_params[2048];
#define EDD_NR (*(unsigned char *) (PARAM+EDDNR))
#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
#define COMMAND_LINE saved_command_line
#define COMMAND_LINE_SIZE 256
#define RAMDISK_IMAGE_START_MASK 0x07FF
#define RAMDISK_PROMPT_FLAG 0x8000
......
/*
* Just a place holder. We don't want to have to test x86 before
* we include stuff
*/
#ifndef _x8664_SETUP_H
#define _x8664_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif
......@@ -3,6 +3,7 @@
#include <linux/config.h>
#include <linux/compiler.h>
#include <asm/setup.h>
/* These macros are used to mark some functions or
* initialized data (doesn't apply to uninitialized data)
......@@ -66,6 +67,9 @@ typedef void (*exitcall_t)(void);
extern initcall_t __con_initcall_start, __con_initcall_end;
extern initcall_t __security_initcall_start, __security_initcall_end;
/* Defined in init/main.c */
extern char saved_command_line[COMMAND_LINE_SIZE];
#endif
#ifndef MODULE
......@@ -107,25 +111,33 @@ extern initcall_t __security_initcall_start, __security_initcall_end;
struct obs_kernel_param {
const char *str;
int (*setup_func)(char *);
int early;
};
/* OBSOLETE: see moduleparam.h for the right way. */
#define __setup_param(str, unique_id, fn) \
/* Only for really core code. See moduleparam.h for the normal way. */
#define __setup_param(str, unique_id, fn, early) \
static char __setup_str_##unique_id[] __initdata = str; \
static struct obs_kernel_param __setup_##unique_id \
__attribute_used__ \
__attribute__((__section__(".init.setup"))) \
= { __setup_str_##unique_id, fn }
= { __setup_str_##unique_id, fn, early }
#define __setup_null_param(str, unique_id) \
__setup_param(str, unique_id, NULL)
__setup_param(str, unique_id, NULL, 0)
#define __setup(str, fn) \
__setup_param(str, fn, fn)
__setup_param(str, fn, fn, 0)
#define __obsolete_setup(str) \
__setup_null_param(str, __LINE__)
/* NOTE: fn is as per module_param, not __setup! Emits warning if fn
* returns non-zero. */
#define early_param(str, fn) \
__setup_param(str, fn, fn, 1)
/* Relies on saved_command_line being set */
void __init parse_early_param(void);
#endif /* __ASSEMBLY__ */
/**
......
......@@ -111,6 +111,9 @@ extern void time_init(void);
void (*late_time_init)(void);
extern void softirq_init(void);
/* Untouched command line (eg. for /proc) saved by arch-specific code. */
char saved_command_line[COMMAND_LINE_SIZE];
static char *execute_command;
/* Setup configured maximum number of CPUs to activate */
......@@ -157,8 +160,14 @@ static int __init obsolete_checksetup(char *line)
do {
int n = strlen(p->str);
if (!strncmp(line, p->str, n)) {
if (!p->setup_func) {
printk(KERN_WARNING "Parameter %s is obsolete, ignored\n", p->str);
if (p->early) {
/* Already done in parse_early_param? (Needs
* exact match on param part) */
if (line[n] == '\0' || line[n] == '=')
return 1;
} else if (!p->setup_func) {
printk(KERN_WARNING "Parameter %s is obsolete,"
" ignored\n", p->str);
return 1;
} else if (p->setup_func(line + n))
return 1;
......@@ -393,6 +402,38 @@ static void noinline rest_init(void)
cpu_idle();
}
/* Check for early params. */
static int __init do_early_param(char *param, char *val)
{
struct obs_kernel_param *p;
extern struct obs_kernel_param __setup_start, __setup_end;
for (p = &__setup_start; p < &__setup_end; p++) {
if (p->early && strcmp(param, p->str) == 0) {
if (p->setup_func(val) != 0)
printk(KERN_WARNING
"Malformed early option '%s'\n", param);
}
}
/* We accept everything at this stage. */
return 0;
}
/* Arch code calls this early on, or if not, just before other parsing. */
void __init parse_early_param(void)
{
static __initdata int done = 0;
static __initdata char tmp_cmdline[COMMAND_LINE_SIZE];
if (done)
return;
/* All fall through to do_early_param. */
strlcpy(tmp_cmdline, saved_command_line, COMMAND_LINE_SIZE);
parse_args("early options", tmp_cmdline, NULL, 0, do_early_param);
done = 1;
}
/*
* Activate the first processor.
*/
......@@ -400,7 +441,6 @@ static void noinline rest_init(void)
asmlinkage void __init start_kernel(void)
{
char * command_line;
extern char saved_command_line[];
extern struct kernel_param __start___param[], __stop___param[];
/*
* Interrupts are still disabled. Do necessary setups, then
......@@ -428,6 +468,7 @@ asmlinkage void __init start_kernel(void)
build_all_zonelists();
page_alloc_init();
printk("Kernel command line: %s\n", saved_command_line);
parse_early_param();
parse_args("Booting kernel", command_line, __start___param,
__stop___param - __start___param,
&unknown_bootoption);
......@@ -676,3 +717,16 @@ static int init(void * unused)
panic("No init found. Try passing init= option to kernel.");
}
static int early_param_test(char *rest)
{
printk("early_parm_test: %s\n", rest ?: "(null)");
return rest ? 0 : -EINVAL;
}
early_param("testsetup", early_param_test);
static int early_setup_test(char *rest)
{
printk("early_setup_test: %s\n", rest ?: "(null)");
return 0;
}
__setup("testsetup_long", early_setup_test);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment