Commit 7696d1ecd0fe4805b630161d276a169c01f80e91
1 parent
48c50a62
microblaze: Conditionalize FDT features.
If libfdt is not available, disable the fdt manipulation features. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Showing
1 changed file
with
17 additions
and
2 deletions
hw/petalogix_s3adsp1800_mmu.c
| ... | ... | @@ -52,12 +52,15 @@ static int petalogix_load_device_tree(target_phys_addr_t addr, |
| 52 | 52 | target_phys_addr_t initrd_size, |
| 53 | 53 | const char *kernel_cmdline) |
| 54 | 54 | { |
| 55 | +#ifdef HAVE_FDT | |
| 55 | 56 | void *fdt; |
| 56 | 57 | char *path = NULL; |
| 57 | - int fdt_size; | |
| 58 | 58 | int pathlen; |
| 59 | 59 | int r; |
| 60 | +#endif | |
| 61 | + int fdt_size; | |
| 60 | 62 | |
| 63 | +#ifdef HAVE_FDT | |
| 61 | 64 | /* Try the local "mb.dtb" override. */ |
| 62 | 65 | fdt = load_device_tree("mb.dtb", &fdt_size); |
| 63 | 66 | if (!fdt) { |
| ... | ... | @@ -74,8 +77,20 @@ static int petalogix_load_device_tree(target_phys_addr_t addr, |
| 74 | 77 | r = qemu_devtree_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline); |
| 75 | 78 | if (r < 0) |
| 76 | 79 | fprintf(stderr, "couldn't set /chosen/bootargs\n"); |
| 77 | - printf("write fdt to addr=%x fdtsize=%d\n", addr, fdt_size); | |
| 78 | 80 | cpu_physical_memory_write (addr, (void *)fdt, fdt_size); |
| 81 | +#else | |
| 82 | + /* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob | |
| 83 | + to the kernel. */ | |
| 84 | + fdt_size = load_image_targphys("mb.dtb", addr, 0x10000); | |
| 85 | + if (fdt_size < 0) { | |
| 86 | + fdt_size = load_image_targphys(BINARY_DEVICE_TREE_FILE, addr, 0x10000); | |
| 87 | + } | |
| 88 | + | |
| 89 | + if (kernel_cmdline) { | |
| 90 | + fprintf(stderr, | |
| 91 | + "Warning: missing libfdt, cannot pass cmdline to kernel!\n"); | |
| 92 | + } | |
| 93 | +#endif | |
| 79 | 94 | return fdt_size; |
| 80 | 95 | } |
| 81 | 96 | ... | ... |