windows_vm: windows-2019
ubuntu_vm: ubuntu-22.04
macos_vm: macOS-12
- ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230624-20Jul2023
+ ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230804-25Aug2023
# Add '-u 0' options for Azure pipelines, otherwise we get "permission
# denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
# since our $(ci_runner_image) user is not root.
. /tmp/venv/bin/activate
pip install -r test/py/requirements.txt
pip install -r tools/buildman/requirements.txt
- export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
+ export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
- ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl
+ ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only
set -ex
./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
./tools/buildman/buildman -t
ln -s /opt/nokia/libc6_2.5.1-1eglibc27+0m5_armel.deb nokia_rx51_tmp/
ln -s /opt/nokia/busybox_1.10.2.legal-1osso30+0m5_armel.deb nokia_rx51_tmp/
ln -s /opt/nokia/qemu-system-arm nokia_rx51_tmp/
- export PATH=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin:$PATH
+ export PATH=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin:$PATH
test/nokia_rx51_test.sh
- job: pylint
export PATH=${PATH}:~/.local/bin
echo "[MASTER]" >> .pylintrc
echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
- export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
- ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl
+ export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
+ ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only
set -ex
pylint --version
export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
TEST_PY_BD: "sandbox"
BUILD_ENV: "FTRACE=1 NO_LTO=1"
TEST_PY_TEST_SPEC: "trace"
- OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000"
+ OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000"
coreboot:
TEST_PY_BD: "coreboot"
TEST_PY_ID: "--id qemu"
- stage: world_build
jobs:
- job: build_the_world
+ timeoutInMinutes: 0 # Use the maximum allowed
displayName: 'Build the World'
pool:
vmImage: $(ubuntu_vm)
F: drivers/iommu/apple_dart.c
F: drivers/nvme/nvme_apple.c
F: drivers/pci/pcie_apple.c
+F: drivers/phy/phy-apple-atc.c
F: drivers/pinctrl/pinctrl-apple.c
F: drivers/watchdog/apple_wdt.c
F: include/configs/apple.h
ENVIRONMENT
S: Maintained
F: env/
F: include/env*
ENVIRONMENT AS TEXT
S: Maintained
F: doc/usage/environment.rst
F: scripts/env2string.awk
F: include/power/
POWERPC
- S: Maintained
+ S: Orphan (Since 2022-10-21)
F: arch/powerpc/
POWERPC MPC8XX
#endif /* CONFIG_CPU */
}
- static int riscv_cpu_probe(void)
+ static int riscv_cpu_probe(void *ctx, struct event *event)
{
#ifdef CONFIG_CPU
int ret;
return 0;
}
+ EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe);
/*
* This is called on secondary harts just after the IPI is init'd. Currently
}
#endif
-int riscv_cpu_setup(void *ctx, struct event *event)
+int riscv_cpu_setup(void)
{
int ret;
- ret = riscv_cpu_probe();
+ ret = riscv_cpu_probe(ctx, event);
if (ret)
return ret;
return 0;
}
-EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, riscv_cpu_setup);
int arch_early_init_r(void)
{
- int ret;
-
- ret = riscv_cpu_probe();
- if (ret)
- return ret;
-
if (IS_ENABLED(CONFIG_SYSRESET_SBI))
device_bind_driver(gd->dm_root, "sbi-sysreset",
"sbi-sysreset", NULL);
config BOOTMETH_CROS
bool "Bootdev support for Chromium OS"
- depends on X86 || SANDBOX
- default y
+ depends on X86 || ARM || SANDBOX
+ default y if !ARM
+ select EFI_PARTITION
+ select PARTITION_TYPE_GUID
+ select PARTITION_UUIDS
help
Enables support for booting Chromium OS using bootdevs. This uses the
kernel A slot and obtains the kernel command line from the parameters
config BOOTSTAGE_STASH_ADDR
hex "Address to stash boot timing information"
- default 0
+ default 0x0
help
Provide an address which will not be overwritten by the OS when it
starts, so that it can read this information when ready.
This enables the boot menu, controlled by environment variables
defined by the board. The menu starts after running the 'preboot'
environmnent variable (if enabled) and before handling the boot delay.
- See README.bootmenu for more details.
+ See doc/usage/cmd/bootmenu.rst for more details.
config BOOTMENU_DISABLE_UBOOT_CONSOLE
bool "Disallow bootmenu to enter the U-Boot console"
PART_TYPE_LEN);
newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0';
newpart->gpt_part_info.bootable = info->bootable;
-#ifdef CONFIG_PARTITION_UUIDS
- strncpy(newpart->gpt_part_info.uuid, (const char *)info->uuid,
- UUID_STR_LEN);
- /* UUID_STR_LEN is correct, as uuid[]'s length is UUID_STR_LEN+1 chars */
- newpart->gpt_part_info.uuid[UUID_STR_LEN] = '\0';
-#endif
+ if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) {
+ strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info),
+ UUID_STR_LEN + 1);
+ }
newpart->partnum = partnum;
return newpart;
int ret;
int i;
+ if (part_drv->test(desc))
+ continue;
+
for (i = 1; i < part_drv->max_entries; i++) {
ret = part_drv->get_info(desc, i, &pinfo);
- if (ret) {
- /* no more entries in table */
- break;
- }
+ if (ret)
+ continue;
ptr = &part_list[str_len];
tmp_len = strlen((const char *)pinfo.name);
/* One byte for space(" ") delimiter */
ptr[tmp_len] = ' ';
}
+ if (*part_list)
+ part_list[strlen(part_list) - 1] = 0;
+ break;
}
- if (*part_list)
- part_list[strlen(part_list) - 1] = 0;
debug("setenv gpt_partition_list %s\n", part_list);
return env_set("gpt_partition_list", part_list);
if (ret)
goto fail;
- ret = env_set_ulong("gpt_partition_entry", i);
+ ret = env_set_hex("gpt_partition_entry", i);
if (ret)
goto fail;
for (i = 1; i < part_drv->max_entries; i++) {
ret = part_drv->get_info(desc, i, &pinfo);
- if (ret) {
- /* no more entries in table */
- break;
- }
+ if (ret)
+ continue;
if (!strcmp(name, (const char *)pinfo.name)) {
/* match found, setup environment variables */
" gpt_partition_name, gpt_partition_entry\n"
" gpt enumerate mmc 0\n"
" - store list of partitions to gpt_partition_list environment variable\n"
- " read <interface> <dev>\n"
- " - read GPT into a data structure for manipulation\n"
" gpt guid <interface> <dev>\n"
" - print disk GUID\n"
" gpt guid <interface> <dev> <varname>\n"
/* Events related to driver model */
"dm_post_init_f",
+ "dm_post_init_r",
"dm_pre_probe",
"dm_post_probe",
"dm_pre_remove",
/* init hooks */
"misc_init_f",
+ "fsp_init_r",
+ "last_stage_init",
/* Fpga load hook */
"fpga_load",
_Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
#endif
-static const char *event_type_name(enum event_t type)
+const char *event_type_name(enum event_t type)
{
#if CONFIG_IS_ENABLED(EVENT_DEBUG)
return type_name[type];
log_debug("Sending event %x/%s to spy '%s'\n", ev->type,
event_type_name(ev->type), event_spy_id(spy));
- ret = spy->func(NULL, ev);
+ if (spy->flags & EVSPYF_SIMPLE) {
+ const struct evspy_info_simple *simple;
+
+ simple = (struct evspy_info_simple *)spy;
+ ret = simple->func();
+ } else {
+ ret = spy->func(NULL, ev);
+ }
/*
* TODO: Handle various return codes to
am62x_sk
../toradex/verdin-am62
+ am64x_evm
am65x_evm
j7200_evm
j721e_evm
to after it has finished loading everything into internal SRAM.
.. image:: img/boot_flow_01.svg
+ :alt: Boot flow up to wakeup domain SPL
The wakeup SPL, running on a wakeup domain core, will initialize DDR and
any peripherals needed load the larger binaries inside the `tispl.bin`
OP-TEE and the main domain's U-Boot SPL.
.. image:: img/boot_flow_02.svg
+ :alt: Boot flow up to main domain SPL
The main domain's SPL, running on a 64bit application core, has
virtually unlimited space (billions of bytes now that DDR is working) to
finally prepare the main domain to run Linux.
.. image:: img/boot_flow_03.svg
+ :alt: Complete boot flow up to Linux
This is the typical boot flow for all K3 based SoCs, however this flow
offers quite a lot in the terms of flexibility, especially on High
| **source:** https://github.com/OP-TEE/optee_os.git
| **branch:** master
- * **TI Firmware (TIFS, DM, DSMC)**
+ * **TI Firmware (TIFS, DM, SYSFW)**
| **source:** https://git.ti.com/git/processor-firmware/ti-linux-firmware.git
| **branch:** ti-linux-firmware
+ .. note::
+
+ The TI Firmware required for functionality of the system can be
+ one of the following combination (see platform specific boot diagram for
+ further information as to which component runs on which processor):
+
+ * **TIFS** - TI Foundational Security Firmware - Consists of purely firmware
+ meant to run on the security enclave.
+ * **DM** - Device Management firmware also called TI System Control Interface
+ server (TISCI Server) - This component purely plays the role of managing
+ device resources such as power, clock, interrupts, dma etc. This firmware
+ runs on a dedicated or multi-use microcontroller outside the security
+ enclave.
+
+ OR
+
+ * **SYSFW** - System firmware - consists of both TIFS and DM both running on
+ the security enclave.
+
.. k3_rst_include_end_boot_sources
Build Procedure
.. k3_rst_include_end_common_env_vars_desc
.. k3_rst_include_start_common_env_vars_defn
- .. code-block:: bash
+ .. prompt:: bash
- $ export CC32=arm-linux-gnueabihf-
- $ export CC64=aarch64-linux-gnu-
- $ export LNX_FW_PATH=path/to/ti-linux-firmware
- $ export TFA_PATH=path/to/trusted-firmware-a
- $ export OPTEE_PATH=path/to/optee_os
+ export CC32=arm-linux-gnueabihf-
+ export CC64=aarch64-linux-gnu-
+ export LNX_FW_PATH=path/to/ti-linux-firmware
+ export TFA_PATH=path/to/trusted-firmware-a
+ export OPTEE_PATH=path/to/optee_os
.. k3_rst_include_end_common_env_vars_defn
We will also need some common environment variables set up for the various
uses the split binary flow)
.. k3_rst_include_start_build_steps_spl_r5
- .. code-block:: bash
+ .. prompt:: bash
- $ # inside u-boot source
- $ make $UBOOT_CFG_CORTEXR
- $ make CROSS_COMPILE=$CC32 BINMAN_INDIRS=$LNX_FW_PATH
+ # inside u-boot source
+ make $UBOOT_CFG_CORTEXR
+ make CROSS_COMPILE=$CC32 BINMAN_INDIRS=$LNX_FW_PATH
.. k3_rst_include_end_build_steps_spl_r5
At this point you should have all the needed binaries to boot the wakeup
application cores on the main domain.
.. k3_rst_include_start_build_steps_tfa
- .. code-block:: bash
+ .. prompt:: bash
- $ # inside trusted-firmware-a source
- $ make CROSS_COMPILE=$CC64 ARCH=aarch64 PLAT=k3 SPD=opteed $TFA_EXTRA_ARGS \
- TARGET_BOARD=$TFA_BOARD
+ # inside trusted-firmware-a source
+ make CROSS_COMPILE=$CC64 ARCH=aarch64 PLAT=k3 SPD=opteed $TFA_EXTRA_ARGS \
+ TARGET_BOARD=$TFA_BOARD
.. k3_rst_include_end_build_steps_tfa
Typically all `j7*` devices will use `TARGET_BOARD=generic` or `TARGET_BOARD
using the TrustZone technology built into the core.
.. k3_rst_include_start_build_steps_optee
- .. code-block:: bash
+ .. prompt:: bash
- $ # inside optee_os source
- $ make CROSS_COMPILE=$CC32 CROSS_COMPILE64=$CC64 CFG_ARM64_core=y $OPTEE_EXTRA_ARGS \
- PLATFORM=$OPTEE_PLATFORM
+ # inside optee_os source
+ make CROSS_COMPILE=$CC32 CROSS_COMPILE64=$CC64 CFG_ARM64_core=y $OPTEE_EXTRA_ARGS \
+ PLATFORM=$OPTEE_PLATFORM
.. k3_rst_include_end_build_steps_optee
4. Finally, after TF-A has initialized the main domain and OP-TEE has
64bit core in the main domain.
.. k3_rst_include_start_build_steps_uboot
- .. code-block:: bash
+ .. prompt:: bash
- $ # inside u-boot source
- $ make $UBOOT_CFG_CORTEXA
- $ make CROSS_COMPILE=$CC64 BINMAN_INDIRS=$LNX_FW_PATH \
+ # inside u-boot source
+ make $UBOOT_CFG_CORTEXA
+ make CROSS_COMPILE=$CC64 BINMAN_INDIRS=$LNX_FW_PATH \
BL31=$TFA_PATH/build/k3/$TFA_BOARD/release/bl31.bin \
TEE=$OPTEE_PATH/out/arm-plat-k3/core/tee-raw.bin
.. k3_rst_include_end_build_steps_uboot
be passing to mkimage for signing the fitImage and embedding the key in
the u-boot dtb.
- .. code-block:: bash
+ .. prompt:: bash
mkimage -r -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K
$UBOOT_PATH/build/a72/dts/dt.dtb
For signing a secondary platform, pass the -K parameter to that DTB
- .. code-block:: bash
+ .. prompt:: bash
mkimage -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K
$UBOOT_PATH/build/a72/arch/arm/dts/k3-j721e-sk.dtb
**Writing to MMC/EMMC**
- .. code-block::
+ .. prompt:: bash
+ :prompts: =>
- => env export -t $loadaddr <list of variables>
- => fatwrite mmc ${mmcdev} ${loadaddr} ${bootenvfile} ${filesize}
+ env export -t $loadaddr <list of variables>
+ fatwrite mmc ${mmcdev} ${loadaddr} ${bootenvfile} ${filesize}
**Reading from MMC/EMMC**
If manually needs to be done then the environment can be read from the
filesystem and then imported
- .. code-block::
+ .. prompt:: bash
+ :prompts: =>
- => fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
- => env import -t ${loadaddr} ${filesize}
+ fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
+ env import -t ${loadaddr} ${filesize}
.. _k3_rst_refer_openocd:
The overall structure of this setup is in the following figure.
.. image:: img/openocd-overview.svg
+ :alt: Overview of OpenOCD setup.
.. note::
box support by OpenOCD. The board-specific documentation will
cover the details and any adapter/dongle recommendations.
- .. code-block:: bash
+ .. prompt:: bash
openocd -v
other package managers. Please refer to the `OpenOCD Documentation
<https://openocd.org/>`_ for more recent installation steps.
- .. code-block:: bash
+ .. prompt:: bash
- $ # Check the packages to be installed: needs deb-src in sources.list
- $ sudo apt build-dep openocd
- $ # The following list is NOT complete - please check the latest
- $ sudo apt-get install libtool pkg-config texinfo libusb-dev \
+ # Check the packages to be installed: needs deb-src in sources.list
+ sudo apt build-dep openocd
+ # The following list is NOT complete - please check the latest
+ sudo apt-get install libtool pkg-config texinfo libusb-dev \
libusb-1.0.0-dev libftdi-dev libhidapi-dev autoconf automake
- $ git clone https://github.com/openocd-org/openocd.git openocd
- $ cd openocd
- $ git submodule init
- $ git submodule update
- $ ./bootstrap
- $ ./configure --prefix=/usr/local/
- $ make -j`nproc`
- $ sudo make install
+ git clone https://github.com/openocd-org/openocd.git openocd
+ cd openocd
+ git submodule init
+ git submodule update
+ ./bootstrap
+ ./configure --prefix=/usr/local/
+ make -j`nproc`
+ sudo make install
.. note::
if building from a source, ensure that the udev rules are installed
correctly to ensure a sane system.
- .. code-block:: bash
+ .. prompt:: bash
# Go to the OpenOCD source directory
- $ cd openocd
- # Copy the udev rules to the correct system location
- $ sudo cp ./contrib/60-openocd.rules \
- ./src/JTAG/drivers/libjaylink/contrib/99-libjaylink.rules \
+ cd openocd
+ Copy the udev rules to the correct system location
+ sudo cp ./contrib/60-openocd.rules \
+ ./src/jtag/drivers/libjaylink/contrib/99-libjaylink.rules \
/etc/udev/rules.d/
# Get Udev to load the new rules up
- $ sudo udevadm control --reload-rules
+ sudo udevadm control --reload-rules
# Use the new rules on existing connected devices
- $ sudo udevadm trigger
+ sudo udevadm trigger
Step 2: Setup GDB
^^^^^^^^^^^^^^^^^
Most systems come with gdb-multiarch package.
- .. code-block:: bash
+ .. prompt:: bash
# Install gdb-multiarch package
- $ sudo apt-get install gdb-multiarch
+ sudo apt-get install gdb-multiarch
Though using GDB natively is normal, developers with interest in using IDE
may find a few of these interesting:
In this example, we will debug ``board_init_f`` inside
``arch/arm/mach-k3/{soc}_init.c``. Since some sections of U-Boot
will be executed multiple times during the bootup process of K3
- devices, we will need to include either ``CONFIG_CPU_ARM64`` or
+ devices, we will need to include either ``CONFIG_ARM64`` or
``CONFIG_CPU_V7R`` to catch the CPU at the desired place during the
bootup process (Main or Wakeup domains). For example, modify the
file as follows (depending on need):
}
...
/* Code to run on the ARMV8 (Main Domain) */
- if (IS_ENABLED(CONFIG_CPU_ARM64)) {
+ if (IS_ENABLED(CONFIG_ARM64)) {
volatile int x = 1;
while(x) {};
}
.. k3_rst_include_start_openocd_cfg_XDS110
- .. code-block:: bash
+ .. prompt:: bash
openocd -f board/{board_of_choice}.cfg
<https://github.com/openocd-org/openocd/blob/master/tcl/target/ti_k3.cfg#L59>`_
to decide if the SoC is supported or not.
- .. code-block:: bash
+ .. prompt:: bash
openocd -f openocd_connect.cfg
GDB-based IDE. To start up GDB in the terminal, run the following
command.
- .. code-block:: bash
+ .. prompt:: bash
gdb-multiarch
Controlling ordering
--------------------
+ By default, faster bootdevs (or those which are assumed to be faster) are used
+ first, since they are more likely to be able to boot the device quickly.
+
Several options are available to control the ordering of boot scanning:
bootmeths
~~~~~~~~~
+ By default bootmeths are checked in name order. Use `bootmeth list` to see the
+ ordering. Note that the `extlinux` and `script` bootmeth is first, to preserve the behaviour
+ used by the old distro scripts.
+
This environment variable can be used to control the list of bootmeths used and
their ordering for example::
The :ref:`usage/cmd/bootmeth:bootmeth command` (`bootmeth order`) operates in
the same way as setting this variable.
-
Bootdev uclass
--------------
partition. If that works it tries to detect a file system. If that works then it
calls the bootmeth device once more, this time to read the bootflow.
-Note: At present a filesystem is needed for the bootmeth to be called on block
-devices, simply because we don't have any examples where this is not the case.
-This feature can be added as needed. Note that sandbox is a special case, since
-in that case the host filesystem can be accessed even though the block device
-is NULL.
+Note: Normally a filesystem is needed for the bootmeth to be called on block
+devices, but bootmeths which don't need that can set the BOOTMETHF_ANY_PART
+flag to indicate that they can scan any partition. An example is the ChromiumOS
+bootmeth which can store a kernel in a raw partition. Note also that sandbox is
+a special case, since in that case the host filesystem can be accessed even
+though the block device is NULL.
If we take the example of the `bootmeth_extlinux` driver, this call ends up at
`extlinux_read_bootflow()`. It has the filesystem ready, so tries various
* @EVT_DM_PRE_PROBE: Device is about to be probed
*/
enum event_t {
- EVT_NONE,
+ /**
+ * @EVT_NONE: This zero value is not used for events.
+ */
+ EVT_NONE = 0,
+
+ /**
+ * @EVT_TEST: This event is used in unit tests.
+ */
EVT_TEST,
- /* Events related to driver model */
+ /**
+ * @EVT_DM_POST_INIT_F:
+ * This event is triggered after pre-relocation initialization of the
+ * driver model. Its parameter is NULL.
+ * A non-zero return code from the event handler let's the boot process
+ * fail.
+ */
EVT_DM_POST_INIT_F,
+
+ /**
+ * @EVT_DM_POST_INIT_R:
+ * This event is triggered after post-relocation initialization of the
+ * driver model. Its parameter is NULL.
+ * A non-zero return code from the event handler let's the boot process
+ * fail.
+ */
+ EVT_DM_POST_INIT_R,
+
+ /**
+ * @EVT_DM_PRE_PROBE:
+ * This event is triggered before probing a device. Its parameter is the
+ * device to be probed.
+ * A non-zero return code from the event handler lets the device not
+ * being probed.
+ */
EVT_DM_PRE_PROBE,
+
+ /**
+ * @EVT_DM_POST_PROBE:
+ * This event is triggered after probing a device. Its parameter is the
+ * device that was probed.
+ * A non-zero return code from the event handler leaves the device in
+ * the unprobed state and therefore not usable.
+ */
EVT_DM_POST_PROBE,
+
+ /**
+ * @EVT_DM_PRE_REMOVE:
+ * This event is triggered after removing a device. Its parameter is
+ * the device to be removed.
+ * A non-zero return code from the event handler stops the removal of
+ * the device before any changes.
+ */
EVT_DM_PRE_REMOVE,
+
+ /**
+ * @EVT_DM_POST_REMOVE:
+ * This event is triggered before removing a device. Its parameter is
+ * the device that was removed.
+ * A non-zero return code stops from the event handler the removal of
+ * the device after all removal changes. The previous state is not
+ * restored. All children will be gone and the device may not be
+ * functional.
+ */
EVT_DM_POST_REMOVE,
- /* Init hooks */
+ /**
+ * @EVT_MISC_INIT_F:
+ * This event is triggered during the initialization sequence before
+ * relocation. Its parameter is NULL.
+ * A non-zero return code from the event handler let's the boot process
+ * fail.
+ */
EVT_MISC_INIT_F,
- /* Fpga load hook */
+ /*
+ * Emitted before relocation to set up Firmware Support Package
+ *
+ * Where U-Boot relies on binary blobs to handle part of the system
+ * init, this event can be used to set up the blobs. This is used on
+ * some Intel platforms
+ */
+ EVT_FSP_INIT_F,
+
+ /*
+ * Emitted just before jumping to the main loop
+ *
+ * Some boards need to perform initialisation immediately before control
+ * is passed to the command-line interpreter (e.g. for init that depend
+ * on later phases in the init sequence).
+ *
+ * Some parts can be only initialized if all others (like Interrupts)
+ * are up and running (e.g. the PC-style ISA keyboard).
+ */
+ EVT_LAST_STAGE_INIT,
+
+ /**
+ * @EVT_FPGA_LOAD:
+ * The FPGA load hook is called after loading an FPGA with a new binary.
+ * Its parameter is of type struct event_fpga_load and contains
+ * information about the loaded image.
+ */
EVT_FPGA_LOAD,
- /* Device tree fixups before booting */
+ /**
+ * @EVT_FT_FIXUP:
+ * This event is triggered during device-tree fix up after all
+ * other device-tree fixups have been executed.
+ * Its parameter is of type struct event_ft_fixup which contains
+ * the address of the device-tree to fix up and the list of images to be
+ * booted.
+ * A non-zero return code from the event handler let's booting the
+ * images fail.
+ */
EVT_FT_FIXUP,
- /* To be called once, before calling main_loop() */
+ /**
+ * @EVT_MAIN_LOOP:
+ * This event is triggered immediately before calling main_loop() which
+ * is the entry point of the command line. Its parameter is NULL.
+ * A non-zero return value causes the boot to fail.
+ */
EVT_MAIN_LOOP,
+ /**
+ * @EVT_COUNT:
+ * This constants holds the maximum event number + 1 and is used when
+ * looping over all event classes.
+ */
EVT_COUNT
};
union event_data data;
};
+/* Flags for event spy */
+enum evspy_flags {
+ EVSPYF_SIMPLE = 1 << 0,
+};
+
/** Function type for event handlers */
typedef int (*event_handler_t)(void *ctx, struct event *event);
+/** Function type for simple event handlers */
+typedef int (*event_handler_simple_t)(void);
+
/**
* struct evspy_info - information about an event spy
*
* @func: Function to call when the event is activated (must be first)
* @type: Event type
+ * @flag: Flags for this spy
* @id: Event id string
*/
struct evspy_info {
event_handler_t func;
- enum event_t type;
+ u8 type;
+ u8 flags;
+#if CONFIG_IS_ENABLED(EVENT_DEBUG)
+ const char *id;
+#endif
+};
+
+/**
+ * struct evspy_info_simple - information about an event spy
+ *
+ * THis is the 'simple' record, the only difference being the handler function
+ *
+ * @func: Function to call when the event is activated (must be first)
+ * @type: Event type
+ * @flag: Flags for this spy
+ * @id: Event id string
+ */
+struct evspy_info_simple {
+ event_handler_simple_t func;
+ u8 type;
+ u8 flags;
#if CONFIG_IS_ENABLED(EVENT_DEBUG)
const char *id;
#endif
/* Declare a new event spy */
#if CONFIG_IS_ENABLED(EVENT_DEBUG)
-#define _ESPY_REC(_type, _func) { _func, _type, #_func, }
+#define _ESPY_REC(_type, _func) { _func, _type, 0, #_func, }
+#define _ESPY_REC_SIMPLE(_type, _func) { _func, _type, EVSPYF_SIMPLE, #_func, }
#else
#define _ESPY_REC(_type, _func) { _func, _type, }
+#define _ESPY_REC_SIMPLE(_type, _func) { _func, _type, EVSPYF_SIMPLE }
#endif
static inline const char *event_spy_id(struct evspy_info *spy)
* away the linker-list entry sometimes, e.g. with the EVT_FT_FIXUP entry in
* vbe_simple.c - so for now, make it global.
*/
-#define EVENT_SPY(_type, _func) \
+#define EVENT_SPY_FULL(_type, _func) \
__used ll_entry_declare(struct evspy_info, _type ## _3_ ## _func, \
evspy_info) = _ESPY_REC(_type, _func)
+/* Simple spy with no function arguemnts */
+#define EVENT_SPY_SIMPLE(_type, _func) \
+ __used ll_entry_declare(struct evspy_info_simple, \
+ _type ## _3_ ## _func, \
+ evspy_info) = _ESPY_REC_SIMPLE(_type, _func)
+
/**
* event_register - register a new spy
*
*/
int event_manual_reloc(void);
+/**
+ * event_type_name() - Get the name of an event type
+ *
+ * @type: Type to check
+ * Return: Name of event, or "(unknown)" if not known
+ */
+const char *event_type_name(enum event_t type);
+
/**
* event_notify() - notify spies about an event
*
* Convert enum video_log2_bpp to bytes and bits. Note we omit the outer
* brackets to allow multiplication by fractional pixels.
*/
-#define VNBYTES(bpix) (1 << (bpix)) / 8
+#define VNBYTES(bpix) ((1 << (bpix)) / 8)
#define VNBITS(bpix) (1 << (bpix))
int video_sync(struct udevice *vid, bool force);
/**
- * video_sync_all() - Sync all devices' frame buffers with there hardware
+ * video_sync_all() - Sync all devices' frame buffers with their hardware
*
* This calls video_sync() on all active video devices.
*/
obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
obj-$(CONFIG_SMBIOS_PARSER) += smbios-parser.o
obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o
+obj-y += initcall.o
obj-y += ldiv.o
obj-$(CONFIG_XXHASH) += xxhash.o
obj-y += net_utils.o
obj-$(CONFIG_$(SPL_)RSA) += rsa/
obj-$(CONFIG_HASH) += hash-checksum.o
obj-$(CONFIG_BLAKE2) += blake2/blake2b.o
- obj-$(CONFIG_SHA1) += sha1.o
- obj-$(CONFIG_SHA256) += sha256.o
- obj-$(CONFIG_SHA512) += sha512.o
+ obj-$(CONFIG_$(SPL_)SHA1) += sha1.o
+ obj-$(CONFIG_$(SPL_)SHA256) += sha256.o
+ obj-$(CONFIG_$(SPL_)SHA512) += sha512.o
obj-$(CONFIG_CRYPT_PW) += crypt/
obj-$(CONFIG_$(SPL_)ASN1_DECODER) += asn1_decoder.o
DECLARE_GLOBAL_DATA_PTR;
- extern U_BOOT_DRIVER(bootmeth_script);
+extern U_BOOT_DRIVER(bootmeth_cros);
+ extern U_BOOT_DRIVER(bootmeth_2script);
static int inject_response(struct unit_test_state *uts)
{
ut_assert_nextline("Seq Method State Uclass Part Name Filename");
ut_assert_nextlinen("---");
ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':");
- ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole <NULL>");
+ ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole ");
ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported");
- ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole <NULL>");
+ ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole ");
ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported");
ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':");
- ut_assert_nextline(" 2 extlinux media mmc 0 mmc1.bootdev.whole <NULL>");
+ ut_assert_nextline(" 2 extlinux media mmc 0 mmc1.bootdev.whole ");
ut_assert_nextline(" ** No partition found, err=-2: No such file or directory");
- ut_assert_nextline(" 3 efi media mmc 0 mmc1.bootdev.whole <NULL>");
+ ut_assert_nextline(" 3 efi media mmc 0 mmc1.bootdev.whole ");
ut_assert_nextline(" ** No partition found, err=-2: No such file or directory");
ut_assert_nextline(" 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf");
ut_assert_nextline(" 5 efi fs mmc 1 mmc1.bootdev.part_1 efi/boot/bootsbox.efi");
ut_assert_skip_to_line("Scanning bootdev 'mmc0.bootdev':");
- ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole <NULL>");
+ ut_assert_skip_to_line(
+ " 3f efi media mmc 0 mmc0.bootdev.whole ");
ut_assert_nextline(" ** No partition found, err=-93: Protocol not supported");
ut_assert_nextline("No more bootdevs");
ut_assert_nextlinen("---");
ut_assert_nextline("Showing all bootflows");
ut_assert_nextline("Seq Method State Uclass Part Name Filename");
ut_assert_nextlinen("---");
- ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole <NULL>");
- ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole <NULL>");
- ut_assert_skip_to_line(" 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf");
- ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole <NULL>");
+ ut_assert_nextline(" 0 extlinux media mmc 0 mmc2.bootdev.whole ");
+ ut_assert_nextline(" 1 efi media mmc 0 mmc2.bootdev.whole ");
+ ut_assert_skip_to_line(
+ " 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf");
+ ut_assert_skip_to_line(" 3f efi media mmc 0 mmc0.bootdev.whole ");
ut_assert_nextlinen("---");
ut_assert_nextline("(64 bootflows, 1 valid)");
ut_assert_console_end();
console_record_reset_enable();
ut_assertok(run_command("bootflow scan -lH", 0));
ut_assert_skip_to_line(
- " 0 efi_mgr ready (none) 0 <NULL> <NULL>");
+ " 0 efi_mgr ready (none) 0 <NULL> ");
ut_assert_skip_to_line("No more bootdevs");
ut_assert_skip_to_line("(2 bootflows, 2 valid)");
ut_assert_console_end();
BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
/**
- * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian
+ * prep_mmc_bootdev() - Set up an mmc bootdev so we can access other distros
*
* @uts: Unit test state
+ * @mmc_dev: MMC device to use, e.g. "mmc4"
* Returns 0 on success, -ve on failure
*/
-static int prep_mmc4_bootdev(struct unit_test_state *uts)
+static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
+ bool bind_cros)
{
- static const char *order[] = {"mmc2", "mmc1", "mmc4", NULL};
+ const char *order[] = {"mmc2", "mmc1", mmc_dev, NULL};
struct udevice *dev, *bootstd;
struct bootstd_priv *std;
const char **old_order;
- ofnode node;
+ ofnode root, node;
/* Enable the mmc4 node since we need a second bootflow */
- node = ofnode_path("/mmc4");
+ root = oftree_root(oftree_default());
+ node = ofnode_find_subnode(root, mmc_dev);
+ ut_assert(ofnode_valid(node));
ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false));
/* Enable the script bootmeth too */
ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
- ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_script),
+ ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_2script),
"bootmeth_script", 0, ofnode_null(), &dev));
- /* Change the order to include mmc4 */
+ /* Enable the cros bootmeth if needed */
+ if (bind_cros) {
+ ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
+ ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_cros),
+ "cros", 0, ofnode_null(), &dev));
+ }
+
+ /* Change the order to include the device */
std = dev_get_priv(bootstd);
old_order = std->bootdev_order;
std->bootdev_order = order;
return 0;
}
+/**
+ * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian
+ *
+ * @uts: Unit test state
+ * Returns 0 on success, -ve on failure
+ */
+static int prep_mmc4_bootdev(struct unit_test_state *uts)
+{
+ ut_assertok(prep_mmc_bootdev(uts, "mmc4", false));
+
+ return 0;
+}
+
/* Check 'bootflow menu' to select a bootflow */
static int bootflow_cmd_menu(struct unit_test_state *uts)
{
return 0;
}
BOOTSTD_TEST(bootflow_cmdline, 0);
+
+/* Test ChromiumOS bootmeth */
+static int bootflow_cros(struct unit_test_state *uts)
+{
+ ut_assertok(prep_mmc_bootdev(uts, "mmc5", true));
+ ut_assertok(run_command("bootflow list", 0));
+
+ ut_assert_nextlinen("Showing all");
+ ut_assert_nextlinen("Seq");
+ ut_assert_nextlinen("---");
+ ut_assert_nextlinen(" 0 extlinux");
+ ut_assert_nextlinen(" 1 cros ready mmc 2 mmc5.bootdev.part_2 ");
+ ut_assert_nextlinen(" 2 cros ready mmc 4 mmc5.bootdev.part_4 ");
+ ut_assert_nextlinen("---");
+ ut_assert_skip_to_line("(3 bootflows, 3 valid)");
+
+ ut_assert_console_end();
+
+ return 0;
+}
+BOOTSTD_TEST(bootflow_cros, 0);