下面是一个使用libfdt库修改FDT Chosen Bootargs属性的示例代码: #include<stdio.h>#include<stdlib.h>#include<libfdt.h>intmain(intargc,char*argv[]){constchar*dtb_file="/path/to/device-tree";constchar*bootargs="console=ttyS0,115200 root=/dev/mmcblk0p2";// 打开设备树文件intfd=open(dtb_file,...
fdt_chosen(working_fdt); @@ -1083,8 +1083,8 @@ static char fdt_help_text[] = "fdt rsvmem print - Show current mem reserves\n" "fdt rsvmem add <addr> <size> - Add a mem reserve\n" "fdt rsvmem delete <index> - Delete a mem reserves\n" "fdt chosen [<start> <end>] - ...
> > > > > > - debug("fdt_chosen: %s\n", fdt_strerror(ret)); > > > > > > - return ret; > > > > > > - } > > > > > > - > > > > > > - nodeoffset = fdt_find_or_add_subnode(blob, 0, "chosen"); > > > > > > - if (nodeoffset < 0) { > > > > >...
qemu-system-riscv64: findnode_nofail Couldn't find node /chosen: FDT_ERR_NOTFOUND 设备树
int fdtdec_get_chosen_node(const void *blob, const char *name) { const char *prop; int chosen_node; int len; if (!blob) return -FDT_ERR_NOTFOUND; chosen_node = fdt_path_offset(blob, "/chosen"); prop = fdt_getprop(blob, chosen_node, name, &len); if (!prop) return -FDT_ER...