.. SPDX-License-Identifier: GPL-2.0+ */ .. Copyright (c) 2014 The Chromium OS Authors. .. sectionauthor:: Simon Glass Sandbox ======= Native Execution of U-Boot -------------------------- The 'sandbox' architecture is designed to allow U-Boot to run under Linux on almost any hardware. To achieve this it builds U-Boot (so far as possible) as a normal C application with a main() and normal C libraries. All of U-Boot's architecture-specific code therefore cannot be built as part of the sandbox U-Boot. The purpose of running U-Boot under Linux is to test all the generic code, not specific to any one architecture. The idea is to create unit tests which we can run to test this upper level code. Sandbox allows development of many types of new features in a traditional way, rather than needing to test each iteration on real hardware. Many U-Boot features were developed on sandbox, including the core driver model, most uclasses, verified boot, bloblist, logging and dozens of others. Sandbox has enabled many large-scale code refactors as well. CONFIG_SANDBOX is defined when building a native board. The board name is 'sandbox' but the vendor name is unset, so there is a single board in board/sandbox. CONFIG_SANDBOX_BIG_ENDIAN should be defined when running on big-endian machines. There are two versions of the sandbox: One using 32-bit-wide integers, and one using 64-bit-wide integers. The 32-bit version can be build and run on either 32 or 64-bit hosts by either selecting or deselecting CONFIG_SANDBOX_32BIT; by default, the sandbox it built for a 32-bit host. The sandbox using 64-bit-wide integers can only be built on 64-bit hosts. Note that standalone/API support is not available at present. Prerequisites ------------- Install the dependencies noted in :doc:`../../build/gcc`. Basic Operation --------------- To run sandbox U-Boot use something like:: make sandbox_defconfig all ./u-boot Note: If you get errors about 'sdl-config: Command not found' you may need to install libsdl2.0-dev or similar to get SDL support. Alternatively you can build sandbox without SDL (i.e. no display/keyboard support) by disabling CONFIG_SANDBOX_SDL in the .config file. U-Boot will start on your computer, showing a sandbox emulation of the serial console:: U-Boot 2014.04 (Mar 20 2014 - 19:06:00) DRAM: 128 MiB Using default environment In: serial Out: lcd Err: lcd => You can issue commands as your would normally. If the command you want is not supported you can add it to include/configs/sandbox.h. To exit, type 'poweroff' or press Ctrl-C. Console / LCD support --------------------- Assuming that CONFIG_SANDBOX_SDL is enabled when building, you can run the sandbox with LCD and keyboard emulation, using something like:: ./u-boot -d u-boot.dtb -l This will start U-Boot with a window showing the contents of the LCD. If that window has the focus then you will be able to type commands as you would on the console. You can adjust the display settings in the device tree file - see arch/sandbox/dts/sandbox.dts. Command-line Options -------------------- Various options are available, mostly for test purposes. Use -h to see available options. Some of these are described below: --autoboot_keyed Use this to enable keyed autoboot. Sandbox disables this function by default even if CONFIG_AUTOBOOT_KEYED is enabled, since it interfers with tests and normal usage -A, --no_term_present Assume no terminal is present. This is used for pager testing. -b. boot The distro boot feature doesn't run by default on sandbox, since it normally not vert useful. For the distro_bootcmds to succeed, quite a bit of setup is required (e.g. network configured or host image bound), so running them by default isn't that useful. Note that standard boot has surplanted distro boot in any case. -B, --bind