Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 
0003 #include <linux/init.h>
0004 #include <linux/of_fdt.h>
0005 #include <linux/printk.h>
0006 #include <linux/memblock.h>
0007 #include <init.h>
0008 
0009 #include "um_arch.h"
0010 
0011 static char *dtb __initdata;
0012 
0013 void uml_dtb_init(void)
0014 {
0015     long long size;
0016     void *area;
0017 
0018     area = uml_load_file(dtb, &size);
0019     if (!area)
0020         return;
0021 
0022     if (!early_init_dt_scan(area)) {
0023         pr_err("invalid DTB %s\n", dtb);
0024         memblock_free(area, size);
0025         return;
0026     }
0027 
0028     early_init_fdt_scan_reserved_mem();
0029     unflatten_device_tree();
0030 }
0031 
0032 static int __init uml_dtb_setup(char *line, int *add)
0033 {
0034     dtb = line;
0035     return 0;
0036 }
0037 
0038 __uml_setup("dtb=", uml_dtb_setup,
0039 "dtb=<file>\n"
0040 "    Boot the kernel with the devicetree blob from the specified file.\n"
0041 );