spl: Only support bl_len when we have to

Aligning addresses and sizes causes overhead which is unnecessary when we
are not loading from block devices. Remove bl_len when it is not needed.

For example, on iot2050 we save 144 bytes with this patch (once the rest of
this series is applied):

add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-144 (-144)
Function                                     old     new   delta
spl_load_simple_fit                          920     904     -16
load_simple_fit                              496     444     -52
spl_spi_load_image                           384     308     -76
Total: Before=87431, After=87287, chg -0.16%

We use panic() instead of BUILD_BUG_ON in spl_set_bl_len because we still
need to be able to compile it for things like mmc_load_image_raw_sector,
even if that function will not be used.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/test/image/Kconfig b/test/image/Kconfig
index 6f0bb81..45b6e8c 100644
--- a/test/image/Kconfig
+++ b/test/image/Kconfig
@@ -52,6 +52,7 @@
 config SPL_UT_LOAD_OS
 	bool "Test loading from the host OS"
 	depends on SANDBOX && SPL_LOAD_FIT
+	select SPL_LOAD_BLOCK
 	default y
 	help
 	  Smoke test to ensure that loading U-boot works in sandbox.
diff --git a/test/image/spl_load.c b/test/image/spl_load.c
index ab4c14d..35ceed6 100644
--- a/test/image/spl_load.c
+++ b/test/image/spl_load.c
@@ -342,12 +342,11 @@
 		if (check_image_info(uts, &info_write, &info_read))
 			return CMD_RET_FAILURE;
 	} else {
-		struct spl_load_info load = {
-			.bl_len = 1,
-			.priv = img,
-			.read = spl_test_read,
-		};
+		struct spl_load_info load;
 
+		spl_set_bl_len(&load, 1);
+		load.priv = img;
+		load.read = spl_test_read;
 		if (type == IMX8)
 			ut_assertok(spl_load_imx_container(&info_read, &load,
 							   0));
diff --git a/test/image/spl_load_os.c b/test/image/spl_load_os.c
index f46df90..26228a8 100644
--- a/test/image/spl_load_os.c
+++ b/test/image/spl_load_os.c
@@ -51,7 +51,7 @@
 	int fd;
 
 	memset(&load, '\0', sizeof(load));
-	load.bl_len = 512;
+	spl_set_bl_len(&load, 512);
 	load.read = read_fit_image;
 
 	ret = sandbox_find_next_phase(fname, sizeof(fname), true);