diff options
author | Tom Rini <trini@konsulko.com> | 2021-09-22 14:54:21 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-09-22 14:54:21 -0400 |
commit | 63823da4b9e25d2f6a81f1e9adb06391837055cb (patch) | |
tree | 3ee694f9c5342307b1bbb4123276a5eeff77d57f | |
parent | 44131caa4025455a659e958281f0e337bdf83f89 (diff) | |
parent | 121a165c51cd281e61c9d45c3919608af42ca9cd (diff) |
Merge branch '2021-09-22-general-updates' into next
- Some sandbox improvements
- Make cleanups related to the overusage of the exact build time
variable.
54 files changed, 294 insertions, 105 deletions
diff --git a/arch/arm/mach-rockchip/px30-board-tpl.c b/arch/arm/mach-rockchip/px30-board-tpl.c index 085e650620..637a5e1b18 100644 --- a/arch/arm/mach-rockchip/px30-board-tpl.c +++ b/arch/arm/mach-rockchip/px30-board-tpl.c @@ -9,7 +9,6 @@ #include <init.h> #include <ram.h> #include <spl.h> -#include <version.h> #include <asm/io.h> #include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/sdram_px30.h> diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c index cca638bbef..3c007bb450 100644 --- a/arch/arm/mach-rockchip/tpl.c +++ b/arch/arm/mach-rockchip/tpl.c @@ -16,6 +16,10 @@ #include <asm/arch-rockchip/bootrom.h> #include <linux/bitops.h> +#if CONFIG_IS_ENABLED(BANNER_PRINT) +#include <timestamp.h> +#endif + #define TIMER_LOAD_COUNT_L 0x00 #define TIMER_LOAD_COUNT_H 0x04 #define TIMER_CONTROL_REG 0x10 diff --git a/arch/m68k/cpu/mcf5227x/start.S b/arch/m68k/cpu/mcf5227x/start.S index 86c93ba3fa..5415c51edd 100644 --- a/arch/m68k/cpu/mcf5227x/start.S +++ b/arch/m68k/cpu/mcf5227x/start.S @@ -6,7 +6,6 @@ #include <asm-offsets.h> #include <config.h> -#include "version.h" #include <asm/cache.h> #define _START _start @@ -489,7 +488,4 @@ _int_handler: /******************************************************************************/ -.globl version_string -version_string: -.ascii U_BOOT_VERSION_STRING, "\0" .align 4 diff --git a/arch/m68k/cpu/mcf523x/start.S b/arch/m68k/cpu/mcf523x/start.S index 8c5a164955..4c9c96d783 100644 --- a/arch/m68k/cpu/mcf523x/start.S +++ b/arch/m68k/cpu/mcf523x/start.S @@ -6,7 +6,6 @@ #include <asm-offsets.h> #include <config.h> -#include "version.h" #include <asm/cache.h> #define _START _start @@ -253,7 +252,4 @@ _int_handler: /******************************************************************************/ -.globl version_string -version_string: -.ascii U_BOOT_VERSION_STRING, "\0" .align 4 diff --git a/arch/m68k/cpu/mcf52x2/start.S b/arch/m68k/cpu/mcf52x2/start.S index 747a518f6c..d3cdc42176 100644 --- a/arch/m68k/cpu/mcf52x2/start.S +++ b/arch/m68k/cpu/mcf52x2/start.S @@ -6,7 +6,6 @@ #include <asm-offsets.h> #include <config.h> -#include "version.h" #include <asm/cache.h> #define _START _start @@ -335,7 +334,4 @@ _int_handler: /******************************************************************************/ -.globl version_string -version_string: -.ascii U_BOOT_VERSION_STRING, "\0" .align 4 diff --git a/arch/m68k/cpu/mcf530x/start.S b/arch/m68k/cpu/mcf530x/start.S index 32356d875e..0daff5d0c4 100644 --- a/arch/m68k/cpu/mcf530x/start.S +++ b/arch/m68k/cpu/mcf530x/start.S @@ -6,7 +6,6 @@ #include <asm-offsets.h> #include <config.h> -#include "version.h" #include <asm/cache.h> #define _START _start @@ -258,9 +257,4 @@ _int_handler: /******************************************************************************/ -.globl version_string -version_string: -.ascii U_BOOT_VERSION -.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")" -.ascii CONFIG_IDENT_STRING, "\0" .align 4 diff --git a/arch/m68k/cpu/mcf532x/start.S b/arch/m68k/cpu/mcf532x/start.S index e2d7c72cee..2672891916 100644 --- a/arch/m68k/cpu/mcf532x/start.S +++ b/arch/m68k/cpu/mcf532x/start.S @@ -9,7 +9,6 @@ #include <asm-offsets.h> #include <config.h> -#include "version.h" #include <asm/cache.h> #define _START _start @@ -268,7 +267,4 @@ _int_handler: /******************************************************************************/ -.globl version_string -version_string: -.ascii U_BOOT_VERSION_STRING, "\0" .align 4 diff --git a/arch/m68k/cpu/mcf5445x/start.S b/arch/m68k/cpu/mcf5445x/start.S index 7007d78c83..e010ac0cf7 100644 --- a/arch/m68k/cpu/mcf5445x/start.S +++ b/arch/m68k/cpu/mcf5445x/start.S @@ -10,8 +10,6 @@ #include <common.h> #include <asm-offsets.h> #include <config.h> -#include <timestamp.h> -#include "version.h" #include <asm/cache.h> #define _START _start @@ -610,7 +608,4 @@ _int_handler: /******************************************************************************/ -.globl version_string -version_string: -.ascii U_BOOT_VERSION_STRING, "\0" .align 4 diff --git a/arch/m68k/cpu/u-boot.lds b/arch/m68k/cpu/u-boot.lds index 64cf2ff5ef..affb2d9374 100644 --- a/arch/m68k/cpu/u-boot.lds +++ b/arch/m68k/cpu/u-boot.lds @@ -9,6 +9,7 @@ #include <config.h> OUTPUT_ARCH(m68k) +ENTRY(_start) #ifndef LDS_BOARD_TEXT #define LDS_BOARD_TEXT diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S index f5ad184e8d..acb8ca686e 100644 --- a/arch/nios2/cpu/start.S +++ b/arch/nios2/cpu/start.S @@ -6,7 +6,6 @@ #include <asm-offsets.h> #include <config.h> -#include <version.h> /* * icache and dcache configuration used only for start.S. diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S index 9da22ce486..c4953df4a2 100644 --- a/arch/powerpc/cpu/mpc83xx/start.S +++ b/arch/powerpc/cpu/mpc83xx/start.S @@ -13,7 +13,6 @@ #include <asm-offsets.h> #include <config.h> #include <mpc83xx.h> -#include <version.h> #define CONFIG_83XX 1 /* needed for Linux kernel header files*/ @@ -92,12 +91,6 @@ */ .long 0x27051956 /* U-Boot Magic Number */ - .globl version_string -version_string: - .ascii U_BOOT_VERSION_STRING, "\0" - - .align 2 - .globl enable_addr_trans enable_addr_trans: /* enable address translation */ diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S index f41e82ad18..aca31b24c0 100644 --- a/arch/powerpc/cpu/mpc85xx/start.S +++ b/arch/powerpc/cpu/mpc85xx/start.S @@ -14,7 +14,6 @@ #include <asm-offsets.h> #include <config.h> #include <mpc85xx.h> -#include <version.h> #include <ppc_asm.tmpl> #include <ppc_defs.h> @@ -1138,11 +1137,7 @@ switch_as: .globl _start _start: .long 0x27051956 /* U-BOOT Magic Number */ - .globl version_string -version_string: - .ascii U_BOOT_VERSION_STRING, "\0" - .align 4 .globl _start_cont _start_cont: /* Setup the stack in initial RAM,could be L2-as-SRAM or L1 dcache*/ diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S index ed735cdee0..0ebb7b33a8 100644 --- a/arch/powerpc/cpu/mpc8xx/start.S +++ b/arch/powerpc/cpu/mpc8xx/start.S @@ -23,7 +23,6 @@ #include <asm-offsets.h> #include <config.h> #include <mpc8xx.h> -#include <version.h> #include <ppc_asm.tmpl> #include <ppc_defs.h> @@ -62,9 +61,6 @@ */ .text .long 0x27051956 /* U-Boot Magic Number */ - .globl version_string -version_string: - .ascii U_BOOT_VERSION_STRING, "\0" . = EXC_OFF_SYS_RESET .globl _start diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 1103530941..b72dafca2b 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -133,6 +133,19 @@ int os_write_file(const char *fname, const void *buf, int size) return 0; } +int os_filesize(int fd) +{ + off_t size; + + size = os_lseek(fd, 0, OS_SEEK_END); + if (size < 0) + return -errno; + if (os_lseek(fd, 0, OS_SEEK_SET) < 0) + return -errno; + + return size; +} + int os_read_file(const char *fname, void **bufp, int *sizep) { off_t size; @@ -144,15 +157,12 @@ int os_read_file(const char *fname, void **bufp, int *sizep) printf("Cannot open file '%s'\n", fname); goto err; } - size = os_lseek(fd, 0, OS_SEEK_END); + size = os_filesize(fd); if (size < 0) { - printf("Cannot seek to end of file '%s'\n", fname); - goto err; - } - if (os_lseek(fd, 0, OS_SEEK_SET) < 0) { - printf("Cannot seek to start of file '%s'\n", fname); + printf("Cannot get file size of '%s'\n", fname); goto err; } + *bufp = os_malloc(size); if (!*bufp) { printf("Not enough memory to read file '%s'\n", fname); @@ -172,6 +182,35 @@ err: return ret; } +int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep) +{ + void *ptr; + int size; + int ifd; + + ifd = os_open(pathname, os_flags); + if (ifd < 0) { + printf("Cannot open file '%s'\n", pathname); + return -EIO; + } + size = os_filesize(ifd); + if (size < 0) { + printf("Cannot get file size of '%s'\n", pathname); + return -EIO; + } + + ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, ifd, 0); + if (ptr == MAP_FAILED) { + printf("Can't map file '%s': %s\n", pathname, strerror(errno)); + return -EPERM; + } + + *bufp = ptr; + *sizep = size; + + return 0; +} + /* Restore tty state when we exit */ static struct termios orig_term; static bool term_setup; @@ -690,7 +729,6 @@ static int add_args(char ***argvp, char *add_args[], int count) continue; } } else if (!strcmp(arg, "--rm_memory")) { - ap++; continue; } argv[argc++] = arg; diff --git a/arch/sandbox/dts/overlay0.dts b/arch/sandbox/dts/overlay0.dts index 70c6cf77aa..9e5f38962b 100644 --- a/arch/sandbox/dts/overlay0.dts +++ b/arch/sandbox/dts/overlay0.dts @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Overlay test file + */ + /dts-v1/; /plugin/; diff --git a/arch/sandbox/dts/overlay1.dts b/arch/sandbox/dts/overlay1.dts index 51621b3110..303e713f33 100644 --- a/arch/sandbox/dts/overlay1.dts +++ b/arch/sandbox/dts/overlay1.dts @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Overlay test file + */ + /dts-v1/; /plugin/; diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index a8938a3acc..127f168f02 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Main sandbox devicetree + */ + /dts-v1/; #include <config.h> diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 200fcab6a4..6cf5f14cd1 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * This is the common sandbox device-tree nodes. This is shared between sandbox * and sandbox64 builds. diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts index a39f94feec..ec53106af9 100644 --- a/arch/sandbox/dts/sandbox64.dts +++ b/arch/sandbox/dts/sandbox64.dts @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Main sandbox64 devicetree + */ /dts-v1/; #include <config.h> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 1399a14929..b36447c4a7 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1,3 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Devicetree file for running sandbox tests + * + * This includes lots of extra devices used by various tests. + * + * Note that SPL use the main sandbox.dts file + */ + /dts-v1/; #include <dt-bindings/gpio/gpio.h> diff --git a/arch/x86/cpu/quark/mrc.c b/arch/x86/cpu/quark/mrc.c index 3e8c0bc28c..ce3c2b8ab4 100644 --- a/arch/x86/cpu/quark/mrc.c +++ b/arch/x86/cpu/quark/mrc.c @@ -33,7 +33,6 @@ */ #include <common.h> -#include <version.h> #include <asm/arch/mrc.h> #include <asm/arch/msg_port.h> #include "mrc_util.h" @@ -191,8 +190,7 @@ void mrc_init(struct mrc_params *mrc_params) { ENTERFN(); - DPF(D_INFO, "MRC Version %04x %s %s\n", MRC_VERSION, - U_BOOT_DATE, U_BOOT_TIME); + DPF(D_INFO, "MRC Version %04x\n", MRC_VERSION); /* Set up the data structures used by mrc_mem_init() */ mrc_adjust_params(mrc_params); diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 5ec31301d0..3f847711e2 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -16,7 +16,6 @@ #include <dm/uclass-internal.h> #include <mapmem.h> #include <serial.h> -#include <version.h> #include <acpi/acpigen.h> #include <acpi/acpi_device.h> #include <acpi/acpi_table.h> diff --git a/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c b/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c index a6937e7d52..2a2439c53a 100644 --- a/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c +++ b/board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c @@ -10,7 +10,6 @@ #include <i2c.h> #include <init.h> #include <nand.h> -#include <version.h> #include <asm/global_data.h> #include <asm/io.h> #include <asm/arch/at91_common.h> diff --git a/board/ge/b1x5v2/b1x5v2.c b/board/ge/b1x5v2/b1x5v2.c index de4cb0d5af..a2cbd1512e 100644 --- a/board/ge/b1x5v2/b1x5v2.c +++ b/board/ge/b1x5v2/b1x5v2.c @@ -30,7 +30,7 @@ #include <panel.h> #include <rtc.h> #include <spi_flash.h> -#include <version.h> +#include <version_string.h> #include "../common/vpd_reader.h" diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 7fcebba026..ed700f4e1d 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -34,7 +34,7 @@ #include <power/pmic.h> #include <input.h> #include <pwm.h> -#include <version.h> +#include <version_string.h> #include <stdlib.h> #include <dm/root.h> #include "../common/ge_rtc.h" diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c index 9c48883648..cc462d53da 100644 --- a/board/ge/mx53ppd/mx53ppd.c +++ b/board/ge/mx53ppd/mx53ppd.c @@ -33,7 +33,7 @@ #include <fsl_pmic.h> #include <linux/fb.h> #include <ipu_pixfmt.h> -#include <version.h> +#include <version_string.h> #include <watchdog.h> #include "ppd_gpio.h" #include <stdlib.h> diff --git a/board/l+g/vinco/vinco.c b/board/l+g/vinco/vinco.c index f221f05261..9c4c5fdc4a 100644 --- a/board/l+g/vinco/vinco.c +++ b/board/l+g/vinco/vinco.c @@ -30,7 +30,6 @@ #include <netdev.h> #include <nand.h> #include <spi.h> -#include <version.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/board/renesas/grpeach/lowlevel_init.S b/board/renesas/grpeach/lowlevel_init.S index 9a66dfa6c6..b83c4e8686 100644 --- a/board/renesas/grpeach/lowlevel_init.S +++ b/board/renesas/grpeach/lowlevel_init.S @@ -4,7 +4,6 @@ * Copyright (C) 2017 Chris Brandt */ #include <config.h> -#include <version.h> #include <asm/macro.h> /* Watchdog Registers */ diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c index e8e559ce1f..5f625e6f52 100644 --- a/board/work-microwave/work_92105/work_92105_display.c +++ b/board/work-microwave/work_92105/work_92105_display.c @@ -20,6 +20,7 @@ #include <env.h> #include <spi.h> #include <i2c.h> +#include <timestamp.h> #include <version.h> #include <vsprintf.h> #include <linux/delay.h> diff --git a/cmd/version.c b/cmd/version.c index 685b458ce2..f83f6aff92 100644 --- a/cmd/version.c +++ b/cmd/version.c @@ -6,13 +6,18 @@ #include <common.h> #include <command.h> +#include <timestamp.h> #include <version.h> +#include <version_string.h> #include <linux/compiler.h> #ifdef CONFIG_SYS_COREBOOT #include <asm/cb_sysinfo.h> #endif -const char __weak version_string[] = U_BOOT_VERSION_STRING; +#define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \ + U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING + +const char version_string[] = U_BOOT_VERSION_STRING; static int do_version(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/common/main.c b/common/main.c index ae5bcdb32f..3f5214fd44 100644 --- a/common/main.c +++ b/common/main.c @@ -15,7 +15,7 @@ #include <env.h> #include <init.h> #include <net.h> -#include <version.h> +#include <version_string.h> #include <efi_loader.h> static void run_preboot_environment_command(void) diff --git a/common/spl/spl.c b/common/spl/spl.c index 2a9f54ef70..31516e1eed 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -24,6 +24,9 @@ #include <nand.h> #include <fat.h> #include <u-boot/crc.h> +#if CONFIG_IS_ENABLED(BANNER_PRINT) +#include <timestamp.h> +#endif #include <version.h> #include <image.h> #include <malloc.h> diff --git a/doc/develop/driver-model/of-plat.rst b/doc/develop/driver-model/of-plat.rst index 8a8eaed4c1..0bd978759c 100644 --- a/doc/develop/driver-model/of-plat.rst +++ b/doc/develop/driver-model/of-plat.rst @@ -600,6 +600,11 @@ as a macro included in the driver definition:: Problems -------- +This section shows some common problems and how to fix them. + +Driver not found +~~~~~~~~~~~~~~~~ + In some cases you will you see something like this:: WARNING: the driver rockchip_rk3188_grf was not found in the driver list @@ -633,6 +638,9 @@ the devicetree. For example, if the devicetree has:: then dtoc looks at the first compatible string ("rockchip,rk3188-grf"), converts that to a C identifier (rockchip_rk3188_grf) and then looks for that. +Missing .compatible or Missing .id +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Various things can cause dtoc to fail to find the driver and it tries to warn about these. For example: @@ -649,6 +657,82 @@ Checks are also made to confirm that the referenced driver has a .compatible member and a .id member. The first provides the array of compatible strings and the second provides the uclass ID. +Missing parent +~~~~~~~~~~~~~~ + +When a device is used, its parent must be present as well. If you see an error +like:: + + Node '/i2c@0/emul/emul0' requires parent node '/i2c@0/emul' but it is not in + the valid list + +it indicates that you are using a node whose parent is not present in the +devicetree. In this example, if you look at the device tree output +(e.g. fdtdump tpl/u-boot-tpl.dtb in your build directory), you may see something +like this:: + + emul { + emul0 { + compatible = "sandbox,i2c-rtc-emul"; + #emul-cells = <0x00000000>; + phandle = <0x00000003>; + }; + }; + +In this example, 'emul0' exists but its parent 'emul' has no properties. These +have been dropped by fdtgrep in an effort to reduce the devicetree size. This +indicates that the two nodes have different phase settings. Looking at the +source .dts:: + + i2c_emul: emul { + u-boot,dm-spl; + reg = <0xff>; + compatible = "sandbox,i2c-emul-parent"; + emul0: emul0 { + u-boot,dm-pre-reloc; + compatible = "sandbox,i2c-rtc-emul"; + #emul-cells = <0>; + }; + }; + +you can see that the child node 'emul0' usees 'u-boot,dm-pre-reloc', indicating +that the node is present in all SPL builds, but its parent uses 'u-boot,dm-spl' +indicating it is only present in SPL, not TPL. For a TPL build, this will fail +with the above message. The fix is to change 'emul0' to use the same +'u-boot,dm-spl' condition, so that it is not present in TPL, like its parent. + +Link errors / undefined reference +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes dtoc does not find the problem for you, but something is wrong and +you get a link error, e.g.:: + + :(.u_boot_list_2_udevice_2_spl_test5+0x0): undefined reference to + `_u_boot_list_2_driver_2_sandbox_spl_test' + /usr/bin/ld: dts/dt-uclass.o:(.u_boot_list_2_uclass_2_misc+0x8): + undefined reference to `_u_boot_list_2_uclass_driver_2_misc' + +The first one indicates that the device cannot find its driver. This means that +there is a driver 'sandbox_spl_test' but it is not compiled into the build. +Check your Kconfig settings to make sure it is. If you don't want that in the +build, adjust your phase settings, e.g. by using 'u-boot,dm-spl' in the node +to exclude it from the TPL build:: + + spl-test5 { + u-boot,dm-tpl; + compatible = "sandbox,spl-test"; + stringarray = "tpl"; + }; + +We can drop the 'u-boot,dm-tpl' line so this node won't appear in the TPL +devicetree and thus the driver won't be needed. + +The second error above indicates that the MISC uclass is needed by the driver +(since it is in the MISC uclass) but that uclass is not compiled in the build. +The fix above would fix this error too. But if you do want this uclass in the +build, check your Kconfig settings to make sure the uclass is being built +(CONFIG_MISC in this case). + Caveats ------- @@ -697,7 +781,7 @@ Internals --------- Generated files -``````````````` +~~~~~~~~~~~~~~~ When enabled, dtoc generates the following five files: @@ -738,7 +822,7 @@ spl/dt-plat.c. CONFIG options -`````````````` +~~~~~~~~~~~~~~ Several CONFIG options are used to control the behaviour of of-platdata, all available for both SPL and TPL: @@ -793,7 +877,7 @@ READ_ONLY the nodes cannot be updated, OF_PLATDATA_NO_BIND is enabled. Data structures -``````````````` +~~~~~~~~~~~~~~~ A few extra data structures are used with of-platdata: @@ -821,7 +905,7 @@ A few extra data structures are used with of-platdata: `device_get_by_ofplat_idx()`. Other changes -````````````` +~~~~~~~~~~~~~ Some other changes are made with of-platdata: diff --git a/doc/develop/version.rst b/doc/develop/version.rst index 066901bcd2..8f3231b761 100644 --- a/doc/develop/version.rst +++ b/doc/develop/version.rst @@ -60,15 +60,6 @@ The following are available: This is used as part of the banner string when U-Boot starts. - U_BOOT_VERSION_STRING (string #define) - U_BOOT_VERSION followed by build-time information - and CONFIG_IDENT_STRING. - - Examples:: - - U-Boot 2020.10 (Jan 06 2021 - 08:50:36 -0700) - U-Boot 2021.01-rc5-00248-g60dd854f3ba-dirty (Jan 06 2021 - 08:50:36 -0700) for spring - U_BOOT_VERSION_NUM (integer #define) Release year, e.g. 2021 for release 2021.01. Note this is an integer, not a string. @@ -77,6 +68,18 @@ The following are available: Patch number, e.g. 1 for release 2020.01. Note this is an integer, not a string. +Human readable U-Boot version string is available in header file +include/version_string.h in following variable: + + version_string (const char[]) + U_BOOT_VERSION followed by build-time information + and CONFIG_IDENT_STRING. + + Examples:: + + U-Boot 2020.10 (Jan 06 2021 - 08:50:36 -0700) + U-Boot 2021.01-rc5-00248-g60dd854f3ba-dirty (Jan 06 2021 - 08:50:36 -0700) for spring + Build date/time is also included. See the generated file include/generated/timestamp_autogenerated.h for the available fields. For example:: diff --git a/drivers/rtc/emul_rtc.c b/drivers/rtc/emul_rtc.c index 8f0e1ab5ac..6f47d82522 100644 --- a/drivers/rtc/emul_rtc.c +++ b/drivers/rtc/emul_rtc.c @@ -9,8 +9,8 @@ #include <div64.h> #include <dm.h> #include <env.h> -#include <generated/timestamp_autogenerated.h> #include <rtc.h> +#include <timestamp.h> /** * struct emul_rtc - private data for emulated RTC driver diff --git a/drivers/usb/gadget/f_rockusb.c b/drivers/usb/gadget/f_rockusb.c index bd846ce9a7..98a7ffa2a7 100644 --- a/drivers/usb/gadget/f_rockusb.c +++ b/drivers/usb/gadget/f_rockusb.c @@ -17,7 +17,6 @@ #include <linux/usb/gadget.h> #include <linux/usb/composite.h> #include <linux/compiler.h> -#include <version.h> #include <g_dnl.h> #include <asm/arch-rockchip/f_rockusb.h> diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 5e1ee061e8..830ea80f4b 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -71,7 +71,7 @@ #include <fdtdec.h> #include <gzip.h> #include <log.h> -#include <version.h> +#include <version_string.h> #include <malloc.h> #include <video.h> #include <asm/global_data.h> @@ -108,7 +108,6 @@ * Console device */ -#include <version.h> #include <linux/types.h> #include <stdio_dev.h> #include <video_font.h> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 12f9579fcf..eb7736d53e 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -918,7 +918,11 @@ static int btrfs_scan_fs_devices(struct blk_desc *desc, ret = btrfs_scan_one_device(desc, part, fs_devices, &total_devs); if (ret) { - fprintf(stderr, "No valid Btrfs found\n"); + /* + * Avoid showing this when probing for a possible Btrfs + * + * fprintf(stderr, "No valid Btrfs found\n"); + */ return ret; } return 0; @@ -1007,7 +1011,7 @@ struct btrfs_fs_info *open_ctree_fs_info(struct blk_desc *desc, disk_super = fs_info->super_copy; ret = btrfs_read_dev_super(desc, part, disk_super); if (ret) { - printk("No valid btrfs found\n"); + debug("No valid btrfs found\n"); goto out_devices; } diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 92ab8ac631..e2d91c654c 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1090,7 +1090,7 @@ int sqfs_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition /* Make sure it has a valid SquashFS magic number*/ if (get_unaligned_le32(&sblk->s_magic) != SQFS_MAGIC_NUMBER) { - printf("Bad magic number for SquashFS image.\n"); + debug("Bad magic number for SquashFS image.\n"); ret = -EINVAL; goto error; } diff --git a/include/configs/bcmstb.h b/include/configs/bcmstb.h index 7f1c298cdc..564425ef56 100644 --- a/include/configs/bcmstb.h +++ b/include/configs/bcmstb.h @@ -10,7 +10,6 @@ #ifndef __BCMSTB_H #define __BCMSTB_H -#include "version.h" #include <linux/sizes.h> #ifndef __ASSEMBLY__ diff --git a/include/dm/device.h b/include/dm/device.h index 0a9718a5b8..ef6241bca8 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -738,7 +738,7 @@ int device_find_next_child(struct udevice **devp); * * @parent: Parent device to search * @uclass_id: Uclass to look for - * @devp: Returns device found, if any + * @devp: Returns device found, if any, else NULL * @return 0 if found, else -ENODEV */ int device_find_first_inactive_child(const struct udevice *parent, @@ -750,7 +750,7 @@ int device_find_first_inactive_child(const struct udevice *parent, * * @parent: Parent device to search * @uclass_id: Uclass to look for - * @devp: Returns first child device in that uclass, if any + * @devp: Returns first child device in that uclass, if any, else NULL * @return 0 if found, else -ENODEV */ int device_find_first_child_by_uclass(const struct udevice *parent, diff --git a/include/dm/uclass.h b/include/dm/uclass.h index da0c1bfadb..15e5f9ef5b 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -354,7 +354,7 @@ int uclass_next_device(struct udevice **devp); * The device returned is probed if necessary, and ready for use * * @devp: On entry, pointer to device to lookup. On exit, returns pointer - * to the next device in the uclass if no error occurred, or -ENODEV if + * to the next device in the uclass if no error occurred, or NULL if * there is no next device. * @return 0 if found, -ENODEV if not found, other -ve on error */ diff --git a/include/os.h b/include/os.h index 7b20d606dd..770d76e02f 100644 --- a/include/os.h +++ b/include/os.h @@ -52,6 +52,14 @@ off_t os_lseek(int fd, off_t offset, int whence); #define OS_SEEK_END 2 /** + * os_filesize() - Calculate the size of a file + * + * @fd: File descriptor as returned by os_open() + * Return: file size or negative error code + */ +int os_filesize(int fd); + +/** * Access to the OS open() system call * * @pathname: Pathname of file to open @@ -398,6 +406,19 @@ int os_write_file(const char *name, const void *buf, int size); */ int os_read_file(const char *name, void **bufp, int *sizep); +/** + * os_map_file() - Map a file from the host filesystem into memory + * + * This can be useful when to provide a backing store for an emulated device + * + * @pathname: File pathname to map + * @os_flags: Flags, like OS_O_RDONLY, OS_O_RDWR + * @bufp: Returns buffer containing the file + * @sizep: Returns size of data + * Return: 0 if OK, -ve on error + */ +int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep); + /* * os_find_text_base() - Find the text section in this running process * diff --git a/include/test/ut.h b/include/test/ut.h index 656e25fe57..fb2e5fcff2 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -83,6 +83,21 @@ int ut_check_console_linen(struct unit_test_state *uts, const char *fmt, ...) int ut_check_skipline(struct unit_test_state *uts); /** + * ut_check_skip_to_line() - skip output until a line is found + * + * This creates a string and then checks it against the following lines of + * console output obtained with console_record_readline() until it is found. + * + * After the function returns, uts->expect_str holds the expected string and + * uts->actual_str holds the actual string read from the console. + * + * @uts: Test state + * @fmt: printf() format string to look for, followed by args + * @return 0 if OK, -ENOENT if not found, other value on error + */ +int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...); + +/** * ut_check_console_end() - Check there is no more console output * * After the function returns, uts->actual_str holds the actual string read @@ -286,6 +301,15 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); return CMD_RET_FAILURE; \ } \ +/* Assert that a following console output line matches */ +#define ut_assert_skip_to_line(fmt, args...) \ + if (ut_check_skip_to_line(uts, fmt, ##args)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", "\nExpected '%s',\n got to '%s'", \ + uts->expect_str, uts->actual_str); \ + return CMD_RET_FAILURE; \ + } \ + /* Assert that there is no more console output */ #define ut_assert_console_end() \ if (ut_check_console_end(uts)) { \ diff --git a/include/version.h b/include/version.h index 2d24451569..5955b21e89 100644 --- a/include/version.h +++ b/include/version.h @@ -7,16 +7,8 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -#include <timestamp.h> - #ifndef DO_DEPS_ONLY #include "generated/version_autogenerated.h" #endif -#define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \ - U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING - -#ifndef __ASSEMBLY__ -extern const char version_string[]; -#endif /* __ASSEMBLY__ */ #endif /* __VERSION_H__ */ diff --git a/include/version_string.h b/include/version_string.h new file mode 100644 index 0000000000..a89a6e4370 --- /dev/null +++ b/include/version_string.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __VERSION_STRING_H__ +#define __VERSION_STRING_H__ + +extern const char version_string[]; + +#endif /* __VERSION_STRING_H__ */ diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c index 2f07741784..7ea4b2e87e 100644 --- a/lib/acpi/acpi_table.c +++ b/lib/acpi/acpi_table.c @@ -11,6 +11,7 @@ #include <log.h> #include <mapmem.h> #include <tables_csum.h> +#include <timestamp.h> #include <version.h> #include <acpi/acpi_table.h> #include <asm/global_data.h> diff --git a/lib/display_options.c b/lib/display_options.c index 4da1f5244f..360b01bcf5 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -8,7 +8,7 @@ #include <compiler.h> #include <console.h> #include <div64.h> -#include <version.h> +#include <version_string.h> #include <linux/ctype.h> #include <asm/io.h> diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index cb48919223..7bacf9ce29 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -14,7 +14,7 @@ #include <efi_tcg2.h> #include <log.h> #include <malloc.h> -#include <version.h> +#include <version_string.h> #include <tpm-v2.h> #include <u-boot/hash-checksum.h> #include <u-boot/sha1.h> @@ -1337,10 +1337,11 @@ out: */ static efi_status_t efi_append_scrtm_version(struct udevice *dev) { - u8 ver[] = U_BOOT_VERSION_STRING; efi_status_t ret; - ret = tcg2_measure_event(dev, 0, EV_S_CRTM_VERSION, sizeof(ver), ver); + ret = tcg2_measure_event(dev, 0, EV_S_CRTM_VERSION, + strlen(version_string) + 1, + (u8 *)version_string); return ret; } @@ -11,9 +11,6 @@ #include <common.h> #include <net.h> -#if defined(CONFIG_CDP_VERSION) -#include <timestamp.h> -#endif #include "cdp.h" diff --git a/test/bloblist.c b/test/bloblist.c index 4104e6a92f..b48be38dc3 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -14,7 +14,7 @@ DECLARE_GLOBAL_DATA_PTR; -/* Declare a new compression test */ +/* Declare a new bloblist test */ #define BLOBLIST_TEST(_name, _flags) \ UNIT_TEST(_name, _flags, bloblist_test) diff --git a/test/dm/acpi.c b/test/dm/acpi.c index 2edab7be54..6f0025814e 100644 --- a/test/dm/acpi.c +++ b/test/dm/acpi.c @@ -11,6 +11,7 @@ #include <dm.h> #include <malloc.h> #include <mapmem.h> +#include <timestamp.h> #include <version.h> #include <tables_csum.h> #include <version.h> diff --git a/test/print_ut.c b/test/print_ut.c index e2bcfbef00..11d8580e55 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -9,7 +9,7 @@ #include <display_options.h> #include <log.h> #include <mapmem.h> -#include <version.h> +#include <version_string.h> #include <test/suites.h> #include <test/test.h> #include <test/ut.h> @@ -121,6 +121,32 @@ int ut_check_skipline(struct unit_test_state *uts) return 0; } +int ut_check_skip_to_line(struct unit_test_state *uts, const char *fmt, ...) +{ + va_list args; + int len; + int ret; + + va_start(args, fmt); + len = vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args); + va_end(args); + if (len >= sizeof(uts->expect_str)) { + ut_fail(uts, __FILE__, __LINE__, __func__, + "unit_test_state->expect_str too small"); + return -EOVERFLOW; + } + while (1) { + if (!console_record_avail()) + return -ENOENT; + ret = readline_check(uts); + if (ret < 0) + return ret; + + if (!strcmp(uts->expect_str, uts->actual_str)) + return 0; + } +} + int ut_check_console_end(struct unit_test_state *uts) { int ret; |