blob: 31f729fd8381896eb05e45c4f8763e546e7c6dbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fbos/dt.h>
int main(void)
{
FILE *fh = fopen("./test/testdata/qemu.dtb", "rb");
assert(fh);
fseek(fh, 0, SEEK_END);
long fsize = ftell(fh);
rewind(fh);
uint32_t *contents = malloc((unsigned long)fsize + 1);
fread(contents, (unsigned long)fsize, sizeof(uint32_t *), fh);
fclose(fh);
contents[fsize] = 0;
struct initrd_addr addr = find_dt_initrd_addr(contents);
free(contents);
assert(addr.start == 0x84200000);
assert(addr.end == 0x84200c00);
exit(0);
}
|