libfdt: Use correct property format
Since its beginning, libfdt has used an incorrect definition of the format for a property, putting the name offset before length, rather than the other way around as described in booting-without-of.txt. This corrects the error, making libfdt actually produce and use trees which are compatible with the kernel and dtc. Signed-of-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
2
fdt.c
2
fdt.c
@@ -83,7 +83,7 @@ uint32_t _fdt_next_tag(const void *fdt, int offset, int *nextoffset)
|
||||
return FDT_END;
|
||||
break;
|
||||
case FDT_PROP:
|
||||
lenp = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, sizeof(*lenp));
|
||||
lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp));
|
||||
if (! lenp)
|
||||
return FDT_END;
|
||||
/* skip name offset, length and value */
|
||||
|
||||
2
fdt.h
2
fdt.h
@@ -36,8 +36,8 @@ struct fdt_node_header {
|
||||
|
||||
struct fdt_property {
|
||||
uint32_t tag;
|
||||
uint32_t nameoff;
|
||||
uint32_t len;
|
||||
uint32_t nameoff;
|
||||
char data[0];
|
||||
};
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ tree: \
|
||||
|
||||
#define PROPHDR(tree, name, len) \
|
||||
FDTLONG(FDT_PROP) ; \
|
||||
FDTLONG(tree##_##name - tree##_strings) ; \
|
||||
FDTLONG(len) ;
|
||||
FDTLONG(len) ; \
|
||||
FDTLONG(tree##_##name - tree##_strings) ;
|
||||
|
||||
#define PROP_INT(tree, name, val) \
|
||||
PROPHDR(tree, name, 4) \
|
||||
|
||||
Reference in New Issue
Block a user