Commit f1737152c01734749c3694d30e1aa86ab28f374e
Exists in
v2017.01-smarct4x
and in
34 other branches
Merge git://git.denx.de/u-boot-fdt
Showing 4 changed files Side-by-side Diff
common/fdt_support.c
... | ... | @@ -194,6 +194,31 @@ |
194 | 194 | return fdt_setprop_u32(fdt, nodeoffset, name, (uint32_t)val); |
195 | 195 | } |
196 | 196 | |
197 | +int fdt_root(void *fdt) | |
198 | +{ | |
199 | + char *serial; | |
200 | + int err; | |
201 | + | |
202 | + err = fdt_check_header(fdt); | |
203 | + if (err < 0) { | |
204 | + printf("fdt_root: %s\n", fdt_strerror(err)); | |
205 | + return err; | |
206 | + } | |
207 | + | |
208 | + serial = getenv("serial#"); | |
209 | + if (serial) { | |
210 | + err = fdt_setprop(fdt, 0, "serial-number", serial, | |
211 | + strlen(serial) + 1); | |
212 | + | |
213 | + if (err < 0) { | |
214 | + printf("WARNING: could not set serial-number %s.\n", | |
215 | + fdt_strerror(err)); | |
216 | + return err; | |
217 | + } | |
218 | + } | |
219 | + | |
220 | + return 0; | |
221 | +} | |
197 | 222 | |
198 | 223 | int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end) |
199 | 224 | { |
common/image-fdt.c
doc/device-tree-bindings/root.txt
include/fdt_support.h
... | ... | @@ -16,8 +16,35 @@ |
16 | 16 | const char *prop, const u32 dflt); |
17 | 17 | u32 fdt_getprop_u32_default(const void *fdt, const char *path, |
18 | 18 | const char *prop, const u32 dflt); |
19 | + | |
20 | +/** | |
21 | + * Add data to the root of the FDT before booting the OS. | |
22 | + * | |
23 | + * See doc/device-tree-bindings/root.txt | |
24 | + * | |
25 | + * @param fdt FDT address in memory | |
26 | + * @return 0 if ok, or -FDT_ERR_... on error | |
27 | + */ | |
28 | +int fdt_root(void *fdt); | |
29 | + | |
30 | +/** | |
31 | + * Add chosen data the FDT before booting the OS. | |
32 | + * | |
33 | + * In particular, this adds the kernel command line (bootargs) to the FDT. | |
34 | + * | |
35 | + * @param fdt FDT address in memory | |
36 | + * @return 0 if ok, or -FDT_ERR_... on error | |
37 | + */ | |
19 | 38 | int fdt_chosen(void *fdt); |
39 | + | |
40 | +/** | |
41 | + * Add initrd information to the FDT before booting the OS. | |
42 | + * | |
43 | + * @param fdt FDT address in memory | |
44 | + * @return 0 if ok, or -FDT_ERR_... on error | |
45 | + */ | |
20 | 46 | int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end); |
47 | + | |
21 | 48 | void do_fixup_by_path(void *fdt, const char *path, const char *prop, |
22 | 49 | const void *val, int len, int create); |
23 | 50 | void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop, |