Is there a way to modify the device tree on a live system? i.MX8M nano yocto Linux I'd like to test device tree changes without going through a build process. Is there a way to modify device-tree settings on a live system? This https://developer.ridgerun.com/wiki/index.php/Edit_device_tree_at_run_time mentions tools for doing what I want, but they are not installed on the nano and I doubt they could be without rebuilding the kernel. i.MX 8M | i.MX 8M Mini | i.MX 8M Nano Linux Yocto Project Re: Is there a way to modify the device tree on a live system? Interesting, but it involves building Linux which I'm trying to avoid (for the time being). Re: Is there a way to modify the device tree on a live system? Yes, live system, at runtime. I didn't want to build since that has been problematic for me. Actually, I did build as standalone, but I don't know how to get the DT onto the device without reinstalling the kernel image which has also been problematic for me. The uboot tool is the sort of thing I was hoping for. I can modify just the DT without touching anything else. Thanks. Re: Is there a way to modify the device tree on a live system? If the "live" you mean is runtime , then the following documents give a good demonstration of how to modify dtb at runtime under u-boot. The document also includes using dtc to modify dtb files. I have tested all of these according to the document, and they are all feasible. https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/u-boot-runtime-modify-Linux-device-tree-dtb/ta-p/1347212 https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Device-Tree-Standalone-Compile-under-Windows/ta-p/1855271 Moreover, the code of nxp's u-boot itself uses this technology. For example, the following code reads the fuse to know the number of cores of the chip and modifies the dtb file at runtime. There are a lot of such codes in this file. https://github.com/nxp-imx/uboot-imx/blob/lf-6.6.52-2.2.0/arch/arm/mach-imx/imx8m/soc.c if (is_imx8md())
disable_cpu_nodes(blob, 2);
#elif defined(CONFIG_IMX8MM)
if (is_imx8mml() || is_imx8mmdl() || is_imx8mmsl())
disable_vpu_nodes(blob);
if (is_imx8mmd() || is_imx8mmdl())
disable_cpu_nodes(blob, 2);
else if (is_imx8mms() || is_imx8mmsl())
disable_cpu_nodes(blob, 3);
static int disable_cpu_nodes(void *blob, u32 disabled_cores)
{
static const char * const nodes_path[] = {
"/cpus/cpu@1",
"/cpus/cpu@2",
"/cpus/cpu@3",
};
u32 i = 0;
int rc;
int nodeoff;
if (disabled_cores > 3)
return -EINVAL;
i = 3 - disabled_cores;
for (; i < 3; i++) {
nodeoff = fdt_path_offset(blob, nodes_path[i]);
if (nodeoff < 0)
continue; /* Not found, skip it */
debug("Found %s node\n", nodes_path[i]);
rc = fdt_del_node(blob, nodeoff);
if (rc < 0) {
printf("Unable to delete node %s, err=%s\n",
nodes_path[i], fdt_strerror(rc));
} else {
printf("Delete node %s\n", nodes_path[i]);
}
}
disable_thermal_cpu_nodes(blob, disabled_cores);
disable_pmu_cpu_nodes(blob, disabled_cores);
return 0;
}
Re: Is there a way to modify the device tree on a live system? Hello @chillinwithscb
For the i.MX processors, the Device tree is loaded from the bootloader "U-boot", when Linux kernel boots, the device tree was loaded.
You can install the device-tree-compiler tool for yocto adding the below line in /conf/local.conf:
CORE_IMAGE_EXTRA_INSTALL += "dtc"
Then, recompile it.
But this just will allow to you to compile device trees in the platform.
The only way at moment is to rebuild device tree, this is quick in an Standalone environment, you can see this post in step 7.
I hpe this information can helps to you.
Best regards,
Salas.
記事全体を表示