aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-10-18sandbox: Add a test for disabling CONFIG_CMDLINETEST/v4-tidy-up-use-of-CONFIG_CMDLINESimon Glass1-0/+20
Now that everything is working, add a test to make sure that this builds correctly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-18boot: Make preboot and bootcmd require CMDLINETom Rini1-0/+2
In order for a predefined "preboot" or "bootcmd" to be executed by the running system we must have a command line. Add CMDLINE as a dependency. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18bootmeth_script: Depend on CMDLINETom Rini1-1/+2
As this particular bootmeth requires the command line and assorted commands to function, make sure we have CMDLINE enabled. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18bootmeth_cros: Require bootm.o and bootm_os.oTom Rini1-1/+1
In order to use bootmeth_cros, at least on non-X86, we need to be able to start any type of kernel that the "bootm" code paths can handle. Add these objects to the required list for this option. Signed-off-by: Tom Rini <trini@konsulko.com> --- Cc: Simon Glass <sjg@chromium.org>
2023-10-18boot: Move SYS_BOOTM_LEN to be by LEGACY_IMAGE_FORMATTom Rini2-11/+11
This particular option is required for booting all image types, regardless of if we are starting an OS via command line or something else. Move the question for SYS_BOOTM_LEN to be by the question for LEGACY_IMAGE_FORMAT, as that's where our generic OS questions start. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18sandbox: Avoid requiring CMDLINESimon Glass1-3/+3
Add some dependencies on features that we had been selecting so that we can still disable CMDLINE. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> --- Changes in v4: - Reword the commit slightly (Tom) - Rework overall to select if CMDLINE Changes in v3: - Reorder the Kconfig options a little
2023-10-18sandbox: Disable CONFIG_DISTRO_DEFAULTSSimon Glass7-6/+3
This is not used for sandbox, so drop it. Enable the things that it controls to avoid dstrastic changes in the config settings for sandbox builds. The end result is that these are enabled: BOOTMETH_DISTRO BOOTSTD_DEFAULTS and these are disabled: USE_BOOTCOMMAND BOOTCOMMAND (was "run distro_bootcmd") DISTRO_DEFAULTS Note that the tools-only build has already disabled DISTRO_DEFAULTS and BOOTSTD_FULL Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> --- Changes in v4: - Only modify sandbox and restrict the changes to only DISTRO_DEFAULTS
2023-10-18cmd: Make most commands depend on CMDLINESimon Glass2-13/+9
If we disable CMDLINE then we should not ask about enabling the hush parser nor any of the commands that would be run on the command line as it is no longer available. Convert the CMDLINE option into a menuconfig and make every command referenced under cmd/Kconfig depend on it. This leaves as future work moving the commands that are not under the cmd/ hierarchy as future work. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> --- Changes in v4: - Reword the commit message slightly. - Make this not depend on other patches
2023-10-18boot: Rework BOOT_DEFAULTS to allow for CMDLINE to be disabledTom Rini1-8/+15
We split BOOT_DEFAULTS to have BOOT_DEFAULTS_FEATURES and BOOT_DEFAULTS_CMDS that in turn list general features or commands that we want enabled when BOOT_DEFAULTS is selected. We only select BOOT_DEFAULTS_CMDS if CMDLINE is set. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18cli_simple: Rework this support slightlyTom Rini2-39/+40
The interactive portion of our non-HUSH 'simple' parser is guarded by CONFIG_CMDLINE already. Much of the code behind this simple parser is also used as "input" parser, such as from menu interfaces and so forth and not strictly command line input. To support this, always build the assorted cli object files, but guard the interactive portions of cli_simple.c with a CMDLINE check. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18boot: Make DISTRO_DEFAULTS select CMDLINETom Rini1-0/+1
The implementation of DISTRO_DEFAULTS is done in environment scripts and requires the command line in order to work. Because of this, select CMDLINE here. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18video: Don't require the font commandSimon Glass2-2/+1
While it is nice to have the font command, using 'select' makes it impossible to build the console code without it. Stop using 'select' and make it default if CONSOLE_TRUETYPE is enabled when asking the command. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> --- Changes in v4: - Rework to have the command itself be default y if CONSOLE_TRUETYPE instead of selecting it. (Tom)
2023-10-18efi: Rearrange the Kconfig for CMD_BOOTEFI_BOOTMGRSimon Glass3-5/+14
The command should not be used to enable library functionality. Add a new BOOTEFI_BOOTMGR Kconfig for that. Adjust the conditions so that the same code is built. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org> --- Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Changes in v4: - Integrate AKASHI Takahiro's feedback from v3 - Reword the help text on CMD_BOOTEFI_BOOTMGR slightly
2023-10-18sifive: Drop an unnecessary #ifdefSimon Glass1-1/+1
This code is normally compiled for sifive, but sandbox can also compile it. We should not use UNIT_TEST as a synonym for SANDBOX, since it is possible to disable UNIT_TEST for sandbox. Drop the condition since it isn't needed. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Sean Anderson <seanga2@gmail.com>
2023-10-18test: Make UNIT_TEST depend on CMDLINESimon Glass1-0/+1
Many tests make some use of the command line, so require it for all test code. This could be teased apart, perhaps with a test flag indicating that it uses the command line. Leave that for later. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-18autoboot: Correct dependencies on CMDLINESimon Glass1-10/+19
Make AUTOBOOT depend on CMDLINE since it is mostly meaningless without it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-18bootmeth: Make BOOTMETH_EFILOADER depend on CMD_BOOTEFITom Rini1-2/+2
Today, the bootmeth for using the EFI loader via bootefi depends on calling the bootefi command directly, so make this in turn depend on CMD_BOOTEFI. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18env: Move env_set out of cmd/nvedit.c and in to env/common.cTom Rini3-116/+113
Inside of env/common.c we already have our helper env_set_xxx functions. Move env_set itself out of cmd/nvedit.c and in to env/common.c. We also move env_get_id() here as well as it's also required in order to know if our environment has changed in a progmatic fashion since last checked. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18common: Reword CONSOLE_RECORD_.*SIZE help textsTom Rini1-8/+8
Make it clear that in the options for setting the console record buffer sizes that we are talking about buffers for that feature specifically and not the general console buffers. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18Kconfig: Move CONFIG_SYS_[CP]BSIZE to common/KconfigTom Rini2-14/+23
Move CONFIG_SYS_CBSIZE (console buffer size) and CONFIG_SYS_PBSIZE (console print buffer size) out of cmd/Kconfig and in to common/Kconfig. Create help entries for both which explain their usage and why they are both not entirely command centric. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18qemu: Correct CMD_QFW dependencies in KconfigTom Rini3-3/+4
Rather than selecting CMD_QFW, we should make the option itself by enabled by default on these platforms. Then in the board-specific Kconfig we should select the appropriate back-end as needed if the command is enabled. Signed-off-by: Tom Rini <trini@konsulko.com> --- Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Cc: Bin Meng <bmeng.cn@gmail.com>
2023-10-18version: Separate our version string from the version commandTom Rini3-9/+17
In order to be able to disable all commands we need to construct our version string in a common file, and have the version command reference that string, like the other users of it do. Create common/version.c with just the strings. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18dfu: Make DFU_TFTP depend on NETDEVICESTom Rini1-0/+1
In order to do a DFU update over TFTP we need to have some network device available, so make this depend on NETDEVICES Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-18virtio: Make VIRTIO_NET depend on NETDEVICESTom Rini1-1/+1
As VIRTIO_NET is the symbol for enabling network devices, make this depend on NETDEVICES Signed-off-by: Tom Rini <trini@konsulko.com> --- Cc: Bin Meng <bmeng.cn@gmail.com>
2023-10-18Merge branch '2023-10-17-spl-test-some-load-methods'Tom Rini70-161/+1994
To quote the author: This series adds some tests for various SPL load methods, with the intent of helping debug v6 of [1]. With that in mind, notable omissions include NAND and ROMAPI, which both lack sandbox implementations, and OS_BOOT, which I have deferred due to its complexity. Semihosting is also omitted, but I think we can test that with qemu. In order to test all of these methods, we must first generate suitable images, possibly on filesystems. While other tests have historically generated these images using external tools (e.g. mkimage, mkfs, etc.), I have chosen to generate them on the fly. This is for a few reasons: - By removing external dependencies on pytest to create certain files, the tests become self-contained. This makes them easier to iterate on and debug. - By generating tests at runtime, we can dynamically vary the content. This helps detect test failures, as even if tests are loaded to the same location, the expected content will be different. - We are not testing the image parsers themselves (e.g. spl_load_simple_fit or fs_read) but rather the load methods (e.g. spl_mmc_load_image). It is unnecessary to exercise full functionality or generate 100% correct images. - By reducing functionality to only what is necessary, the complexity of various formats can often be greatly reduced. This series depends on [2-3], which are small fixes identified through this patch set. The organization of patches in this series is as follows: - General fixes for bugs which are unlikely to be triggered outside of this series - Changes to IMX8 container images to facilitate testing - General prep. work, particularly regarding linker issues - The tests themselves Passing CI at [4]. [1] https://lore.kernel.org/all/20230731224304.111081-1-sean.anderson@seco.com/ [2] https://lore.kernel.org/all/20230930204246.515254-1-seanga2@gmail.com/ [3] https://lore.kernel.org/all/20231008014748.1987840-1-seanga2@gmail.com/ [4] https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/18128
2023-10-17test: spl: Add a test for the SPI load methodSean Anderson8-0/+78
Add test for the SPI load method. This one is pretty straightforward. We can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image doesn't know the total image size and has to guess from fdt_totalsize. This doesn't include external data, so loading it will fail. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for the NOR load methodSean Anderson8-6/+316
Add a test for the NOR load method. Since NOR is memory-mapped we can substitute a buffer instead. The only major complication is testing LZMA decompression. It's too complex to implement LZMA compression in a test, and we have no in-tree compressor, so we just include some pre-compressed data. This data was generated through something like generate_data(plain, plain_size, "lzma") cat plain.dat | lzma | hexdump -C and was cleaned up further in my editor. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for the NET load methodSean Anderson6-1/+272
Add a test for loading U-Boot over TFTP. As with other sandbox net routines, we need to initialize our packets manually since things like net_set_ether and net_set_udp_header always use "our" addresses. We use BOOTP instead of DHCP, since DHCP has a tag/length-based format which is harder to parse. Our TFTP implementation doesn't define as many constants as I'd like, so I create some here. Note that the TFTP block size is one-based, but offsets are zero-based. In order to avoid address errors, we need to set up/define some additional address information settings. dram_init_banksize would be a good candidate for settig up bi_dram, but it gets called too late in board_init_r. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for the MMC load methodSean Anderson6-5/+137
Add a test for the MMC load method. This shows the general shape of tests to come: The main test function calls do_spl_test_load with an appropriate callback to write the image to the medium. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add a test for spl_blk_load_imageSean Anderson3-1/+67
Add a test for spl_blk_load_image, currently used only by NVMe. Because there is no sandbox NVMe driver, just use MMC instead. Avoid falling back to raw images to make failures more obvious. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add functions to create filesystemsSean Anderson5-0/+328
Add some functions for creating fat/ext2 filesystems with a single file and a test for them. Filesystems require block devices, and it is easiest to just use MMC for this. To get an MMC, we must also pull in the test device tree. SPL_TIMER is necessary for SPL_MMC, perhaps because it uses a timeout. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Add functions to create imagesSean Anderson8-3/+493
This add some basic functions to create images, and a test for said functions. This is not intended to be a test of the image parsing functions, but rather a framework for creating minimal images for testing load methods. That said, it does do an OK job at finding bugs in the image parsing directly. Since we have two methods for loading/parsing FIT images, add LOAD_FIT_FULL as a separate CI run. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Fix spl_test_load not failing if fname doesn't existSean Anderson2-4/+3
Returning a negative value from a unit test doesn't automatically fail the test. We have to fail an assertion. Modify the test to do so. This now causes the test to count as a failure on VPL. This is because the fname of SPL (and U-Boot) is generated with make_exec in os_jump_to_image. The original name of SPL is gone, and we can't determine the name of U-Boot from the generated name. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17test: spl: Split tests up and use some configsSean Anderson6-79/+106
In order to make adding new spl unit tests easier, especially when they may have many dependencies, add some Kconfigs for the existing image test. Split it into the parts which are generic (such as callbacks) and the test-specific parts. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17sandbox: Support -T in splSean Anderson1-2/+7
The test devicetree is only compiled for U-Boot proper. When accessing it in SPL we need to go up one directory. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: Use map_sysmem where appropriateSean Anderson11-35/+69
All "physical" addresses in SPL must be converted to virtual addresses before access in order for sandbox to work. Add some calls to map_sysmem in appropriate places. We do not generally call unmap_sysmem, since we need the image memory to still be mapped when we jump to the image. This doesn't matter at the moment since unmap_sysmem is a no-op. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: Add callbacks to invalidate cached devicesSean Anderson3-1/+34
Several SPL functions try to avoid performing initialization twice by caching devices. This is fine for regular boot, but does not work with UNIT_TEST, since all devices are torn down after each test. Add some functions to invalidate the caches which can be called before testing these load methods. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17net: bootp: Fall back to BOOTP from DHCP when unit testingSean Anderson1-0/+6
If we sent a DHCP packet and get a BOOTP response from the server, we shouldn't try to send a DHCPREQUEST packet, since it won't be DHCPACKed. Transition straight to BIND. This is only enabled for UNIT_TEST to avoid bloat, since I suspect the number of BOOTP servers in the wild is vanishingly small. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17net: bootp: Move port numbers to headerSean Anderson2-3/+3
These defines are useful when testing bootp. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-10-17net: Fix compiling SPL when fastboot is enabledSean Anderson2-4/+4
When fastboot is enabled in U-Boot proper and SPL_NET is enabled, we will try to (unsuccessfully) reference it in SPL. Fix these linker errors by conditioning on SPL_UDP/TCP_FUNCTION_FASTBOOT. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-17fs: ext4: Add some defines for testingSean Anderson2-0/+15
Add various defines which are not necessary for reading/writing filesystems, but which are useful for creating them. These mostly come from Linux v6.5-rc2 (what I had checked out). Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17fs: ext4: Fix building ext4 in SPL if write is enabledSean Anderson3-0/+8
If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but not CRC16. Add an option to enable CRC16 to avoid linker errors. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17fs: Disable sandbox filesystem in SPLSean Anderson1-1/+1
Don't bother compiling the sandbox filesystem in SPL for now, as it is not needed. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17lib: acpi: Fix linking SPL when ACPIGEN is enabledSean Anderson2-2/+2
lib/acpi/acpigen.o is only compiled into SPL when SPL_ACPIGEN is enabled. Update several files which reference these functions accordingly. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17spl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same timeSean Anderson6-7/+10
Sandbox unit tests in U-Boot proper load a test device tree to have some devices to work with. In order to do the same in SPL, we must enable SPL_OF_REAL. However, we already have SPL_OF_PLATDATA enabled. When generating platdata from a devicetree, it is expected that we will not need devicetree access functions (even though SPL_OF_CONTROL is enabled). This expectation does not hold for sandbox, so allow user control of SPL_OF_REAL. There are several places in the tree where conditions involving OF_PLATDATA or OF_REAL no longer function correctly when both of these options can be selected at the same time. Adjust these conditions accordingly. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17Move i.MX8 container image loading support to common/splSean Anderson6-14/+17
To facilitate testing loading i.MX8 container images, move the parse-container code to common/spl. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17arm: imx: Check header before calling spl_load_imx_containerSean Anderson18-14/+34
Make sure we have an IMX header before calling spl_load_imx_container, since if we don't it will fail with -ENOENT. This allows us to fall back to legacy/raw images if they are also enabled. This is a functional change, one which likely should have been in place from the start, but a functional change nonetheless. Previously, all non-IMX8 images (except FITs without FIT_FULL) would be optimized out if the only image load method enabled supported IMX8 images. With this change, support for other image types now has an effect. There are seven boards with SPL_LOAD_IMX_CONTAINER enabled: three with SPL_BOOTROM_SUPPORT: imx93_11x11_evk_ld imx93_11x11_evk imx8ulp_evk and four with SPL_MMC: deneb imx8qxp_mek giedi imx8qm_mek All of these boards also have SPL_RAW_IMAGE_SUPPORT and SPL_LEGACY_IMAGE_FORMAT enabled as well. However, none have FIT support enabled. Of the six load methods affected by this patch, only SPL_MMC and SPL_BOOTROM_SUPPORT are enabled with SPL_LOAD_IMX_CONTAINER. spl_romapi_load_image_seekable does not support legacy or raw images, so there is no growth. However, mmc_load_image_raw_sector does support loading legacy/raw images. Since these images could not have been booted before, I have disabled support for legacy/raw images on these four boards. This reduces bloat from around 800 bytes to around 200. There are no in-tree boards with SPL_LOAD_IMX_CONTAINER and AHAB_BOOT both enabled, so we do not need to worry about potentially falling back to legacy images in a secure boot scenario. Future work could include merging imx_container.h with imx8image.h, since they appear to define mostly the same structures. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17arm: imx: Add function to validate i.MX8 containersSean Anderson6-5/+15
Add a function to abstract the common task of validating i.MX8 container image headers. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17arm: imx: Use log_err for errors in read_auth_containerSean Anderson1-2/+3
To allow for more flexible handling of errors, use log_err instead of printf. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-10-17arm: imx: Add newlines after error messagesSean Anderson1-2/+2
These error messages are missing newlines. Add them. Fixes: 6e81ca220e0 ("imx: parse-container: Use malloc for container processing") Signed-off-by: Sean Anderson <seanga2@gmail.com>