char *prop; /* property */
int nodeoffset; /* node offset from libfdt */
static char data[SCRATCHPAD]; /* storage for the property */
+ const void *ptmp;
int len; /* new length of the property */
int ret; /* return value */
pathp = argv[2];
prop = argv[3];
- if (argc == 4) {
- len = 0;
- } else {
- ret = fdt_parse_prop(&argv[4], argc - 4, data, &len);
- if (ret != 0)
- return ret;
- }
nodeoffset = fdt_path_offset (working_fdt, pathp);
if (nodeoffset < 0) {
return 1;
}
+ if (argc == 4) {
+ len = 0;
+ } else {
+ ptmp = fdt_getprop(working_fdt, nodeoffset, prop, &len);
+ if (len > SCRATCHPAD) {
+ printf("prop (%d) doesn't fit in scratchpad!\n",
+ len);
+ return 1;
+ }
+ memcpy(data, ptmp, len);
+ ret = fdt_parse_prop(&argv[4], argc - 4, data, &len);
+ if (ret != 0)
+ return ret;
+ }
+
ret = fdt_setprop(working_fdt, nodeoffset, prop, data, len);
if (ret < 0) {
printf ("libfdt fdt_setprop(): %s\n", fdt_strerror(ret));
cp = newp;
tmp = simple_strtoul(cp, &newp, 0);
- *(fdt32_t *)data = cpu_to_fdt32(tmp);
+ if (*cp != '?')
+ *(fdt32_t *)data = cpu_to_fdt32(tmp);
+ else
+ newp++;
+
data += 4;
*len += 4;