diff options
author | Simon Glass <sjg@chromium.org> | 2022-10-21 03:23:03 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-10-31 18:02:44 +0300 |
commit | 44ad35a0f699b0b49ef6efaa1405b6f99c703ea8 (patch) | |
tree | 5e747333f41e62e7641ed2d968c14890820359e3 /test | |
parent | b2d93c6aaa99f3f90470c0df3e49bd5ed265d350 (diff) | |
download | u-boot-44ad35a0f699b0b49ef6efaa1405b6f99c703ea8.tar.xz |
image: Add the concept of a phase to FIT
We want to be able to mark an image as related to a phase, so we can
easily load all the images for SPL or for U-Boot proper.
Add this to the FIT specification, along with some access functions.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/boot/Makefile | 1 | ||||
-rw-r--r-- | test/boot/image.c | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/test/boot/Makefile b/test/boot/Makefile index 5bb3f88975..d724629d3b 100644 --- a/test/boot/Makefile +++ b/test/boot/Makefile @@ -3,6 +3,7 @@ # Copyright 2021 Google LLC obj-$(CONFIG_BOOTSTD) += bootdev.o bootstd_common.o bootflow.o bootmeth.o +obj-$(CONFIG_FIT) += image.o ifdef CONFIG_OF_LIVE obj-$(CONFIG_BOOTMETH_VBE_SIMPLE) += vbe_simple.o diff --git a/test/boot/image.c b/test/boot/image.c new file mode 100644 index 0000000000..2844b05785 --- /dev/null +++ b/test/boot/image.c @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test for vbe-simple bootmeth. All start with 'vbe_simple' + * + * Copyright 2023 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#include <common.h> +#include <image.h> +#include <test/suites.h> +#include <test/ut.h> +#include "bootstd_common.h" + +/* Test of image phase */ +static int test_image_phase(struct unit_test_state *uts) +{ + int val; + + ut_asserteq_str("U-Boot phase", genimg_get_phase_name(IH_PHASE_U_BOOT)); + ut_asserteq_str("SPL Phase", genimg_get_phase_name(IH_PHASE_SPL)); + ut_asserteq_str("any", genimg_get_phase_name(IH_PHASE_NONE)); + ut_asserteq_str("Unknown Phase", genimg_get_phase_name(-1)); + + ut_asserteq(IH_PHASE_U_BOOT, genimg_get_phase_id("u-boot")); + ut_asserteq(IH_PHASE_SPL, genimg_get_phase_id("spl")); + ut_asserteq(IH_PHASE_NONE, genimg_get_phase_id("none")); + ut_asserteq(-1, genimg_get_phase_id("fred")); + + val = image_ph(IH_PHASE_SPL, IH_TYPE_FIRMWARE); + ut_asserteq(IH_PHASE_SPL, image_ph_phase(val)); + ut_asserteq(IH_TYPE_FIRMWARE, image_ph_type(val)); + + return 0; +} +BOOTSTD_TEST(test_image_phase, 0); |