1.. SPDX-License-Identifier: GPL-2.0
2
3.. include:: ../disclaimer-zh_TW.rst
4
5:Original: Documentation/admin-guide/bootconfig.rst
6
7:������: ��������� Wu XiangCheng <bobwxc@email.cn>
8
9========
10������������
11========
12
13:������: Masami Hiramatsu <mhiramat@kernel.org>
14
15������
16====
17
18���������������������������������������������������������������������������������������������������������������
19���������������������������������������������������������������������������������
20
21������������������
22============
23
24���������������������������������������������������������������������������������������������������������������
25��������� ``=`` ������������������������ ``;`` ������������������ ``\n`` ���������������������������
26��������������������� ``,`` ������������::
27
28  KEY[.WORD[...]] = VALUE[, VALUE2[...]][;]
29
30������������������������������������������ ``=`` ������������������������
31
32������������������������������������������������������ ``-`` ������������������ ``_`` ������������������
33��������������������������������������� ``;`` ������������������ ``\n`` ��������������� ``,`` ������
34��������� ``#`` ��������������������� ``}`` ������������������������
35
36��������������������������������������������������������������������� ``"VALUE"`` ���������������
37��� ``'VALUE'`` ���������������������������������������������
38
39���������������������������������������������������������������������������������������������������
40
41������������
42--------
43
44������������������������������������������������������������������������������������������������::
45
46 foo.bar.baz = value1
47 foo.bar.qux.quux = value2
48
49���������������::
50
51 foo.bar {
52    baz = value1
53    qux.quux = value2
54 }
55
56������������������������������::
57
58 foo.bar { baz = value1; qux.quux = value2 }
59
60���������������������������������������������������������������������������������������������������������������
61���������
62
63���������������������
64--------------
65
66������������������������������������������������������������������::
67
68 foo = bar, baz
69 foo = qux  # !������! ������������������������������������������
70
71������������������������������������������������������������ ``:=`` ���������::
72
73 foo = bar, baz
74 foo := qux
75
76������ ``foo`` ��������������������������� ``qux`` ���������������������������������������������������
77������������������������������������������������������������������������
78
79������������������������������������������������������������������������ ``+=`` ������������������::
80
81 foo = bar, baz
82 foo += qux
83
84��������� ``foo`` ��������������������������� ``bar`` ��� ``baz`` ��� ``qux`` ���
85
86������������������������������������������������������������
87������������������������������������::
88
89 foo = value1
90 foo.bar = value2
91 foo := value3 # ������������foo���������
92
93������������������������������������������������������������������������������������������������::
94
95 foo {
96     bar = value1
97     bar {
98         baz = value2
99         qux = value3
100     }
101 }
102
103���������������������������������������������������������������������������������������������������������������
104���������������������������������������������������������������������������::
105
106 foo.bar = value1
107 foo = value2
108
109������������������/proc/bootconfig������������������������������::
110
111 foo = value2
112 foo.bar = value1
113
114������
115----
116
117������������������shell������������������������������������������ ``#`` ������������������������
118��� ``\n`` ������������
119
120::
121
122 # comment line
123 foo = value # value is set to foo.
124 bar = 1, # 1st element
125       2, # 2nd element
126       3  # 3rd element
127
128���������������::
129
130 foo = value
131 bar = 1, 2, 3
132
133������������������������������������������������ ``,`` ��� ``;`` ������������������������������������������::
134
135 key = 1 # comment
136       ,2
137
138
139/proc/bootconfig
140================
141
142/proc/bootconfig������������������������������������������/proc/cmdline���������������������������
143���������������������������
144������������������������������������::
145
146 KEY[.WORDS...] = "[VALUE]"[,"VALUE2"...]
147
148
149���������������������������
150==================
151
152���������������������������������������������������������������������initrd���������������������������������
153
154*initrd: initial RAM disk���������������������*
155
156������������������������initrd
157----------------------
158
159���������������������������������������������initrd������������������������������������initrd���initramfs���
160������������������������������������������������������������������12���������������������������::
161
162 [initrd][bootconfig][padding][size(le32)][checksum(le32)][#BOOTCONFIG\n]
163
164���������������������������������������32������������������
165
166������������������������initrd������������������������������������������4��������������������� ``\0`` ���
167������������������������������ ``size`` ���������������������������������+������������������
168
169Linux������������������������initrd������������������������������������������������������������������������������
170���������������������������������������������������initrd������������������������������������������������������
171������������������������������������������������������������������������������������������������������������������
172������
173
174Linux���������tools/bootconfig������������ ``bootconfig`` ������������������������������������
175���������������initrd���������������������������������������������������������������������������::
176
177 # make -C tools/bootconfig
178
179������initrd���������������������������������������������������������������������������������������������::
180
181 # tools/bootconfig/bootconfig -a your-config /boot/initrd.img-X.Y.Z
182
183������������������������������������������-d������::
184
185 # tools/bootconfig/bootconfig -d /boot/initrd.img-X.Y.Z
186
187��������������������������������� ``bootconfig`` ���������������initrd���������������������������������
188
189���������������������������
190------------------
191
192���������������������initrd������������������Kconfig������������������������������������������������������
193���������������������������������������������������::
194
195 CONFIG_BOOT_CONFIG_EMBED=y
196 CONFIG_BOOT_CONFIG_EMBED_FILE="/������������/������/���/������"
197
198``CONFIG_BOOT_CONFIG_EMBED_FILE`` ������������������������������������������������������������
199������/���������������������������������������������������������������
200
201���������������������������initrd������������������������������������������������ ``bootconfig`` ������
202���������������������������������������
203
204���������������������������������������������������������������initrd������������������������������������������
205���������
206
207������������������������������������
208========================
209
210������������������������������������������������������������������������������ ``kernel`` ������������������
211������������������������������������������������������ ``init`` ������������������������������������������
212init������������������������������������������������������������������������������������������������������������
213������������������������������������������������������������������������������������������������������������������
214���������::
215
216 [bootconfig params][cmdline params] -- [bootconfig init params][cmdline init params]
217
218���������������������������������kernel/init���������::
219
220 kernel {
221   root = 01234567-89ab-cdef-0123-456789abcd
222 }
223 init {
224  splash
225 }
226
227������������������������������������������������������������::
228
229 root="01234567-89ab-cdef-0123-456789abcd" -- splash
230
231���������������������������������������::
232
233 ro bootconfig -- quiet
234
235���������������������������������::
236
237 root="01234567-89ab-cdef-0123-456789abcd" ro bootconfig -- splash quiet
238
239
240���������������������
241==============
242
243������������������������������32KB������������������������������������������������������1024������������
244���������������������������������������������������������������������2���������������������������������������������
245���������������������������512������������������������������������������3���������������������256���������������
246���������������������������������������������������100������������������8KB������������������������������������
247���������������1024������������������������������������������������������32KB���������������������������������
248���������������������������������
249��������������������� ``bootconfig`` ������������������������������initrd������������������������������
250������������������������������������
251
252
253������������API
254===========
255
256������������������������������������������������������������������������������������������������������������������
257���������
258
259������������������������������������������������������������ xbc_find_value() ���������������������������
260������������������������������������������������������������ xbc_for_each_key_value() ������������������
261��������������������������� xbc_array_for_each_value() ���������������������������::
262
263 vnode = NULL;
264 xbc_find_value("key.word", &vnode);
265 if (vnode && xbc_node_is_array(vnode))
266    xbc_array_for_each_value(vnode, value) {
267      printk("%s ", value);
268    }
269
270������������������������������������������������������������ xbc_find_node() ���������������������������
271������������������ xbc_node_for_each_key_value() ������������������������������
272
273���������������������������������������������������������������������������������������::
274
275 root = xbc_find_node("key.prefix");
276 value = xbc_node_find_value(root, "option", &vnode);
277 ...
278 xbc_node_for_each_array_value(root, "array-option", value, anode) {
279    ...
280 }
281
282������������������key.prefix.option���������������key.prefix.array-option���������������
283
284������������������������������������������������������������������������������������������������������������������������
285
286
287������������������
288============
289
290���������������kernel-doc���������
291
292 - include/linux/bootconfig.h
293 - lib/bootconfig.c
294
295