1// SPDX-License-Identifier: GPL-2.0-only
2
3#include <linux/init.h>
4#include <linux/of_fdt.h>
5#include <linux/printk.h>
6#include <linux/memblock.h>
7#include <init.h>
8
9#include "um_arch.h"
10
11static char *dtb __initdata;
12
13void uml_dtb_init(void)
14{
15 long long size;
16 void *area;
17
18 area = uml_load_file(filename: dtb, size: &size);
19 if (area) {
20 if (!early_init_dt_scan(params: area)) {
21 pr_err("invalid DTB %s\n", dtb);
22 memblock_free(ptr: area, size);
23 return;
24 }
25
26 early_init_fdt_scan_reserved_mem();
27 }
28
29 unflatten_device_tree();
30}
31
32static int __init uml_dtb_setup(char *line, int *add)
33{
34 dtb = line;
35 return 0;
36}
37
38__uml_setup("dtb=", uml_dtb_setup,
39"dtb=<file>\n"
40" Boot the kernel with the devicetree blob from the specified file.\n"
41);
42

source code of linux/arch/um/kernel/dtb.c