[libfdt]: does not create array nodes properly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
device-tree-compiler (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Note: this is a bug of DTC version 1.4.0 that is working properly with 1.4.2 (don't know what version actually solved the bug)
Way to reproduce:
compile the test program below:
gcc -o testdt testdt.c -lfdt
./testdt > test.dtb
fdtdump test.dtb
The values of reg are incorrect for 1.4.0 and correct for 1.4.2
-----
# testdt.c
#include <libfdt.h>
#include <stdlib.h>
#include <stdio.h>
#define _FDT(code) \
{ \
int err = (code); \
if (err) \
fprintf(stderr, #code ": %s", fdt_strerror(err)); \
}
static inline int fdt_property_
{
struct {
fdt64_t address;
fdt32_t size;
} __attribute_
val.address = cpu_to_fdt64(val1);
val.size = cpu_to_fdt32(val2);
return fdt_property(fdt, name, (void*)&val, sizeof(val));
}
int main(void)
{
#define SIZE 4096
void *staging_fdt = calloc(SIZE, 1);
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
_FDT(fdt_
fwrite(
return 0;
}