1
2
3
4
5
6
7
8
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/delay.h>
12#include <linux/interrupt.h>
13#include <linux/fb.h>
14#include <linux/module.h>
15#include <linux/mm.h>
16#include <linux/console.h>
17#include <linux/errno.h>
18#include <linux/string.h>
19#include <linux/bootmem.h>
20#include <linux/seq_file.h>
21#include <linux/init.h>
22#include <linux/initrd.h>
23#include <linux/root_dev.h>
24#include <linux/rtc.h>
25
26#include <asm/setup.h>
27#include <asm/irq.h>
28#include <asm/machdep.h>
29#include <asm/pgtable.h>
30#include <asm/sections.h>
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63static void __init parse_uboot_commandline(char *commandp, int size)
64{
65 extern unsigned long _init_sp;
66 unsigned long *sp;
67 unsigned long uboot_kbd;
68 unsigned long uboot_initrd_start, uboot_initrd_end;
69 unsigned long uboot_cmd_start, uboot_cmd_end;
70
71 sp = (unsigned long *)_init_sp;
72 uboot_kbd = sp[1];
73 uboot_initrd_start = sp[2];
74 uboot_initrd_end = sp[3];
75 uboot_cmd_start = sp[4];
76 uboot_cmd_end = sp[5];
77
78 if (uboot_cmd_start && uboot_cmd_end)
79 strncpy(commandp, (const char *)uboot_cmd_start, size);
80#if defined(CONFIG_BLK_DEV_INITRD)
81 if (uboot_initrd_start && uboot_initrd_end &&
82 (uboot_initrd_end > uboot_initrd_start)) {
83 initrd_start = uboot_initrd_start;
84 initrd_end = uboot_initrd_end;
85 ROOT_DEV = Root_RAM0;
86 pr_info("initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
87 }
88#endif
89}
90
91__init void process_uboot_commandline(char *commandp, int size)
92{
93 int len, n;
94
95 n = strnlen(commandp, size);
96 commandp += n;
97 len = size - n;
98 if (len) {
99
100 *commandp++ = ' ';
101 len--;
102 }
103
104 parse_uboot_commandline(commandp, len);
105 commandp[size - 1] = 0;
106}
107