int fdt_finish_reservemap(void *fdt) { return fdt_add_reservemap_entry(fdt, 0, 0); }
/** * build_tree() - Build a tree * * @fdt: Pointer to place to put tree, assumed to be large enough * @flags: Flags to control the tree creation (FDT_REG_...) * @space: Amount of space to create for later tree additions * * This creates a tree modelled on a U-Boot FIT image, with various nodes * and properties which are useful for testing the hashing features of * fdt_find_regions(). * * See h_include() below for a list of the nodes we later search for. */ static void build_tree(void *fdt, int flags, int space) { int direct_subnodes = flags & FDT_REG_DIRECT_SUBNODES; int all_subnodes = flags & FDT_REG_ALL_SUBNODES; int supernodes = flags & FDT_REG_SUPERNODES; int either = !all_subnodes && (direct_subnodes || supernodes); int err; CHECK(fdt_create(fdt, SPACE)); CHECK(fdt_add_reservemap_entry(fdt, TEST_ADDR_1, TEST_SIZE_1)); CHECK(fdt_add_reservemap_entry(fdt, TEST_ADDR_2, TEST_SIZE_2)); CHECK(fdt_finish_reservemap(fdt)); /* * This is the start of a new region because in the fdt_xxx_region() * call, we pass "/" as one of the nodes to find. */ start(fdt); /* region 0 */ CHECK(fdt_begin_node(fdt, "")); CHECK(fdt_property_string(fdt, "description", "kernel image")); CHECK(fdt_property_u32(fdt, "#address-cells", 1)); /* /images */ if (!either && !all_subnodes) stop(fdt); CHECK(fdt_begin_node(fdt, "images")); if (either) stop(fdt); CHECK(fdt_property_u32(fdt, "image-prop", 1)); /* /images/kernel@1 */ if (!all_subnodes) start(fdt); /* region 1 */ CHECK(fdt_begin_node(fdt, "kernel@1")); CHECK(fdt_property_string(fdt, "description", "exynos kernel")); stop(fdt); CHECK(fdt_property_string(fdt, "data", "this is the kernel image")); start(fdt); /* region 2 */ /* /images/kernel/hash@1 */ CHECK(fdt_begin_node(fdt, "hash@1")); CHECK(fdt_property_string(fdt, "algo", "sha1")); CHECK(fdt_end_node(fdt)); /* /images/kernel/hash@2 */ if (!direct_subnodes) stop(fdt); CHECK(fdt_begin_node(fdt, "hash@2")); if (direct_subnodes) stop(fdt); CHECK(fdt_property_string(fdt, "algo", "sha1")); if (direct_subnodes) start(fdt); /* region 3 */ CHECK(fdt_end_node(fdt)); if (!direct_subnodes) start(fdt); /* region 3 */ CHECK(fdt_end_node(fdt)); /* /images/fdt@1 */ CHECK(fdt_begin_node(fdt, "fdt@1")); CHECK(fdt_property_string(fdt, "description", "snow FDT")); if (!all_subnodes) stop(fdt); CHECK(fdt_property_string(fdt, "data", "FDT data")); if (!all_subnodes) start(fdt); /* region 4 */ /* /images/kernel/hash@1 */ CHECK(fdt_begin_node(fdt, "hash@1")); CHECK(fdt_property_string(fdt, "algo", "sha1")); CHECK(fdt_end_node(fdt)); CHECK(fdt_end_node(fdt)); if (!either && !all_subnodes) stop(fdt); CHECK(fdt_end_node(fdt)); /* /configurations */ CHECK(fdt_begin_node(fdt, "configurations")); if (either) stop(fdt); CHECK(fdt_property_string(fdt, "default", "conf@1")); /* /configurations/conf@1 */ if (!all_subnodes) start(fdt); /* region 6 */ CHECK(fdt_begin_node(fdt, "conf@1")); CHECK(fdt_property_string(fdt, "kernel", "kernel@1")); CHECK(fdt_property_string(fdt, "fdt", "fdt@1")); CHECK(fdt_end_node(fdt)); if (!all_subnodes) stop(fdt); /* /configurations/conf@2 */ CHECK(fdt_begin_node(fdt, "conf@2")); CHECK(fdt_property_string(fdt, "kernel", "kernel@1")); CHECK(fdt_property_string(fdt, "fdt", "fdt@2")); CHECK(fdt_end_node(fdt)); if (either) start(fdt); /* region 7 */ CHECK(fdt_end_node(fdt)); if (!either && !all_subnodes) start(fdt); /* region 7 */ CHECK(fdt_end_node(fdt)); CHECK(fdt_finish(fdt)); stop(fdt); /* Add in the strings */ if (flags & FDT_REG_ADD_STRING_TAB) { expect[expect_count].offset = fdt_off_dt_strings(fdt); expect[expect_count].size = fdt_size_dt_strings(fdt); expect_count++; } /* Make a bit of space */ if (space) CHECK(fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + space)); verbose_printf("Completed tree, totalsize = %d\n", fdt_totalsize(fdt)); }