mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-05 11:00:15 +00:00
41a29f284c
Add a command to load SEAMA (Seattle Image), a NAND flash on-flash storage format. This type of flash image is found in some D-Link routers such as DIR-645, DIR-842, DIR-859, DIR-860L, DIR-885L, DIR890L and DCH-M225, as well as in WD and NEC routers on the ath79 (MIPS), Broadcom BCM53xx, and RAMIPS platforms. This U-Boot command will read and decode a SEAMA image from raw NAND flash on any platform. As it is always using big endian format for the data decoding is always necessary on platforms such as ARM. The command is needed to read a SEAMA-encoded boot image on the D-Link DIR-890L router for boot from NAND flash in an upcoming port of U-Boot to the Broadcom Northstar (BCM4709, BCM53xx) architecture. A basic test and documentation is added as well. The test must be run on a target with NAND flash support and at least one resident SEAMA image in flash. Cc: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
71 lines
2.1 KiB
C
71 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Executes tests for SEAMA (SEAttle iMAge) command
|
|
*
|
|
* Copyright (C) 2021 Linus Walleij <linus.walleij@linaro.org>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <command.h>
|
|
#include <dm.h>
|
|
#include <test/suites.h>
|
|
#include <test/test.h>
|
|
#include <test/ut.h>
|
|
|
|
#define SEAMA_TEST(_name, _flags) UNIT_TEST(_name, _flags, seama_test)
|
|
|
|
static int seama_test_noargs(struct unit_test_state *uts)
|
|
{
|
|
/* Test that 'seama' with no arguments fails gracefully */
|
|
console_record_reset();
|
|
run_command("seama", 0);
|
|
ut_assert_nextlinen("seama - Load the SEAMA image and sets envs");
|
|
ut_assert_skipline();
|
|
ut_assert_skipline();
|
|
ut_assert_skipline();
|
|
ut_assert_skipline();
|
|
ut_assert_console_end();
|
|
return 0;
|
|
}
|
|
SEAMA_TEST(seama_test_noargs, UT_TESTF_CONSOLE_REC);
|
|
|
|
static int seama_test_addr(struct unit_test_state *uts)
|
|
{
|
|
/* Test that loads SEAMA image 0 to address 0x01000000 */
|
|
console_record_reset();
|
|
run_command("seama 0x01000000", 0);
|
|
ut_assert_nextlinen("Loading SEAMA image 0 from nand0");
|
|
ut_assert_nextlinen("SEMA IMAGE:");
|
|
ut_assert_nextlinen(" metadata size ");
|
|
ut_assert_nextlinen(" image size ");
|
|
ut_assert_nextlinen(" checksum ");
|
|
ut_assert_nextlinen("Decoding SEAMA image 0x01000040..");
|
|
ut_assert_console_end();
|
|
return 0;
|
|
}
|
|
SEAMA_TEST(seama_test_addr, UT_TESTF_CONSOLE_REC);
|
|
|
|
static int seama_test_index(struct unit_test_state *uts)
|
|
{
|
|
/* Test that loads SEAMA image 0 exlicitly specified */
|
|
console_record_reset();
|
|
run_command("seama 0x01000000 0", 0);
|
|
ut_assert_nextlinen("Loading SEAMA image 0 from nand0");
|
|
ut_assert_nextlinen("SEMA IMAGE:");
|
|
ut_assert_nextlinen(" metadata size ");
|
|
ut_assert_nextlinen(" image size ");
|
|
ut_assert_nextlinen(" checksum ");
|
|
ut_assert_nextlinen("Decoding SEAMA image 0x01000040..");
|
|
ut_assert_console_end();
|
|
return 0;
|
|
}
|
|
SEAMA_TEST(seama_test_index, UT_TESTF_CONSOLE_REC);
|
|
|
|
int do_ut_seama(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|
{
|
|
struct unit_test *tests = UNIT_TEST_SUITE_START(seama_test);
|
|
const int n_ents = UNIT_TEST_SUITE_COUNT(seama_test);
|
|
|
|
return cmd_ut_category("seama", "seama_test_", tests, n_ents, argc,
|
|
argv);
|
|
}
|