From 032e7f6ef8c9c463bfd085eb6915dc088c8fa8cf Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:23 -0600 Subject: [PATCH 01/21] dtoc: Further improve documentation about warnings Split this information into subsections and expand it. Signed-off-by: Simon Glass --- doc/develop/driver-model/of-plat.rst | 92 ++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 4 deletions(-) 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: From 130401e0171f4a17511bfd8ba061a11dc10ff18a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:24 -0600 Subject: [PATCH 02/21] sandbox: Correct handling of --rm_memory This option has no argument so we should not trip to skip one. Fix it. Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 1103530941..151f42a5d6 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -690,7 +690,6 @@ static int add_args(char ***argvp, char *add_args[], int count) continue; } } else if (!strcmp(arg, "--rm_memory")) { - ap++; continue; } argv[argc++] = arg; From 7dcc2f7e7a9d45cce8f7b1728cd42df46a840957 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:25 -0600 Subject: [PATCH 03/21] sandbox: Add license headers to the dts files Many of these files are missing a header. Fix this. Signed-off-by: Simon Glass --- arch/sandbox/dts/overlay0.dts | 5 +++++ arch/sandbox/dts/overlay1.dts | 5 +++++ arch/sandbox/dts/sandbox.dts | 5 +++++ arch/sandbox/dts/sandbox.dtsi | 1 + arch/sandbox/dts/sandbox64.dts | 4 ++++ arch/sandbox/dts/test.dts | 9 +++++++++ 6 files changed, 29 insertions(+) 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 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 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 From 64acd46a82f06dfae7a181437e256a4194e612d8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:26 -0600 Subject: [PATCH 04/21] btrfs: Suppress the message about missing filesystem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This message comes up a lot when scanning filesystems. It suggests to the user that there is some sort of error, but in fact there is no reason to expect that a particular partition has a btrfs filesystem. Other filesystems don't print this error. Turn it into a debug message. Signed-off-by: Simon Glass Reviewed-by: Marek Behún Reviewed-by: Qu Wenruo --- fs/btrfs/disk-io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } From ad6ddc57eeecbcad62177b47b1e2b63027bcf6a9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:27 -0600 Subject: [PATCH 05/21] sqfs: Suppress the message about missing filesystem This message comes up a lot when scanning filesystems. It suggests to the user that there is some sort of error, but in fact there is no reason to expect that a particular partition has a sqfs filesystem. Other filesystems don't print this error. Turn it into a debug message. Signed-off-by: Simon Glass Reviewed-by: Miquel Raynal --- fs/squashfs/sqfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From 127ca104677e5dd0ac4d5d991faa2ebb704da6f1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:28 -0600 Subject: [PATCH 06/21] test: Tidy a comment in the bloblist test Fix up a copy error. Signed-off-by: Simon Glass --- test/bloblist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 79b3f367304dc743518200eb6b82556890c9ae05 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:29 -0600 Subject: [PATCH 07/21] dm: core: Fix a few incorrect comments on first/next functions Tighten up these comments to make the behaviour clearer. Signed-off-by: Simon Glass --- include/dm/device.h | 4 ++-- include/dm/uclass.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 */ From b4467fae06e7c5b48635cd28e0b168b8508ad168 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:30 -0600 Subject: [PATCH 08/21] sandbox: Add a way to find the size of a file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a function to return the size of a file. This is useful in situations where we need to allocate memory for it before reading it. Signed-off-by: Simon Glass Reviewed-by: Marek Behún --- arch/sandbox/cpu/os.c | 22 ++++++++++++++++------ include/os.h | 8 ++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 151f42a5d6..a4262881c5 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); diff --git a/include/os.h b/include/os.h index 7b20d606dd..7661078d33 100644 --- a/include/os.h +++ b/include/os.h @@ -51,6 +51,14 @@ off_t os_lseek(int fd, off_t offset, int whence); #define OS_SEEK_CUR 1 #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 * From b9274095c2cd1ae42f232c823e9e9557696be91a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:31 -0600 Subject: [PATCH 09/21] sandbox: Add a way to map a file into memory It is useful to map a file into memory so that it can be accessed using simple pointers. Add a function to support this. Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 29 +++++++++++++++++++++++++++++ include/os.h | 13 +++++++++++++ 2 files changed, 42 insertions(+) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index a4262881c5..b72dafca2b 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -182,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; diff --git a/include/os.h b/include/os.h index 7661078d33..770d76e02f 100644 --- a/include/os.h +++ b/include/os.h @@ -406,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 * From 2e09008c3c938dac28440d948a27b1c4190f36d2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 18 Aug 2021 21:40:33 -0600 Subject: [PATCH 10/21] test: Add a way to skip console checking until a string matches Some tests produce a lot of output that does not need to be individually checked by an assertion. Add a macro to handle this. Signed-off-by: Simon Glass --- include/test/ut.h | 24 ++++++++++++++++++++++++ test/ut.c | 26 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) 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 @@ -82,6 +82,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 * @@ -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/test/ut.c b/test/ut.c index 1eec2a57df..28da417686 100644 --- a/test/ut.c +++ b/test/ut.c @@ -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; From 6252fd05a2842211ab035e5fbb90549225afadd1 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 17 Sep 2021 12:05:20 -0400 Subject: [PATCH 11/21] m68k: Add missing ENTRY entry in linker script Currently, there is no ENTRY() entry in the m68k linker script. However, since they currently contain a version_string symbol, which then overrides the default weak version_string symbol, the linker decides we must keep start.o in the resulting link. Add an ENTRY() line so that the linker will know to keep this, even when version_string is no longer provided in start.S Cc: Huan Wang Cc: Angelo Dureghello Signed-off-by: Tom Rini --- arch/m68k/cpu/u-boot.lds | 1 + 1 file changed, 1 insertion(+) 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 OUTPUT_ARCH(m68k) +ENTRY(_start) #ifndef LDS_BOARD_TEXT #define LDS_BOARD_TEXT From 0072f5fce3c981de626ae2b334bbdf7ecf362586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:28 +0200 Subject: [PATCH 12/21] Remove #include from files which do not need it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pali Rohár Reviewed-by: Tom Rini --- arch/m68k/cpu/mcf5445x/start.S | 1 - net/cdp.c | 3 --- 2 files changed, 4 deletions(-) diff --git a/arch/m68k/cpu/mcf5445x/start.S b/arch/m68k/cpu/mcf5445x/start.S index 7007d78c83..40c4974365 100644 --- a/arch/m68k/cpu/mcf5445x/start.S +++ b/arch/m68k/cpu/mcf5445x/start.S @@ -10,7 +10,6 @@ #include #include #include -#include #include "version.h" #include diff --git a/net/cdp.c b/net/cdp.c index fac0204681..a8f890e752 100644 --- a/net/cdp.c +++ b/net/cdp.c @@ -11,9 +11,6 @@ #include #include -#if defined(CONFIG_CDP_VERSION) -#include -#endif #include "cdp.h" From a79f82331437909c8f99217c616bb17e26013448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:29 +0200 Subject: [PATCH 13/21] Remove #include from files which do not need it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pali Rohár Reviewed-by: Tom Rini --- arch/arm/mach-rockchip/px30-board-tpl.c | 1 - arch/nios2/cpu/start.S | 1 - arch/x86/lib/acpi_table.c | 1 - board/atmel/sama5d2_ptc_ek/sama5d2_ptc_ek.c | 1 - board/l+g/vinco/vinco.c | 1 - board/renesas/grpeach/lowlevel_init.S | 1 - drivers/usb/gadget/f_rockusb.c | 1 - include/configs/bcmstb.h | 1 - 8 files changed, 8 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 #include #include -#include #include #include #include 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 #include -#include /* * icache and dcache configuration used only for start.S. 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 #include #include -#include #include #include #include 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 #include #include -#include #include #include #include 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 #include #include -#include 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 -#include #include /* Watchdog Registers */ 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 #include #include -#include #include #include 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 #ifndef __ASSEMBLY__ From fa9c5da70206621b42530e58882680fb1c4079cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:30 +0200 Subject: [PATCH 14/21] efi_loader: Use directly version_string variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Macro U_BOOT_VERSION_STRING is already stored in variable version_string. So use directly this variable instead of storing U_BOOT_VERSION_STRING into temporary variable. Signed-off-by: Pali Rohár [trini: This area was reworked since posted, what is here is now really inspired by the previous version, so drop Ilias' Acked-by] Signed-off-by: Tom Rini --- lib/efi_loader/efi_tcg2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index cb48919223..578b69e38f 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -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; } From bdfb6d70bb45da6e31785171fed70cb93b0ff36b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:31 +0200 Subject: [PATCH 15/21] version: Move version_string[] from version.h to version_string.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit More C files do not use compile time timestamp macros and do not have to be recompiled every time when SOURCE_DATE_EPOCH changes. This patch moves version_string[] from version.h to version_string.h and updates other C files which only needs version_string[] string to include version_string.h instead of version.h. After applying this patch these files are not recompiled every time when SOURCE_DATE_EPOCH changes. Signed-off-by: Pali Rohár Reviewed-by: Tom Rini --- board/ge/b1x5v2/b1x5v2.c | 2 +- board/ge/bx50v3/bx50v3.c | 2 +- board/ge/mx53ppd/mx53ppd.c | 2 +- cmd/version.c | 1 + common/main.c | 2 +- drivers/video/cfb_console.c | 3 +-- include/version.h | 3 --- include/version_string.h | 8 ++++++++ lib/display_options.c | 2 +- lib/efi_loader/efi_tcg2.c | 2 +- test/print_ut.c | 2 +- 11 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 include/version_string.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 #include #include -#include +#include #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 #include #include -#include +#include #include #include #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 #include #include -#include +#include #include #include "ppd_gpio.h" #include diff --git a/cmd/version.c b/cmd/version.c index 685b458ce2..965ac2e214 100644 --- a/cmd/version.c +++ b/cmd/version.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #ifdef CONFIG_SYS_COREBOOT #include 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 #include #include -#include +#include #include static void run_preboot_environment_command(void) 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 #include #include -#include +#include #include #include #include @@ -108,7 +108,6 @@ * Console device */ -#include #include #include #include diff --git a/include/version.h b/include/version.h index 2d24451569..0a3b29adb8 100644 --- a/include/version.h +++ b/include/version.h @@ -16,7 +16,4 @@ #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/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 #include #include -#include +#include #include #include diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 578b69e38f..7bacf9ce29 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include 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 #include #include -#include +#include #include #include #include From ad5720a357d89ff2c6911c10cc8f074ef597f3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:32 +0200 Subject: [PATCH 16/21] m68k: mcf: Remove overloading version_string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no need to overload version_string at the end of start.S files. Common implementation of version_string should be fine. Signed-off-by: Pali Rohár [trini: Keep the align, it's important for the rest of linkage] Signed-off-by: Tom Rini --- arch/m68k/cpu/mcf5227x/start.S | 4 ---- arch/m68k/cpu/mcf523x/start.S | 4 ---- arch/m68k/cpu/mcf52x2/start.S | 4 ---- arch/m68k/cpu/mcf530x/start.S | 6 ------ arch/m68k/cpu/mcf532x/start.S | 4 ---- arch/m68k/cpu/mcf5445x/start.S | 4 ---- 6 files changed, 26 deletions(-) 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 #include -#include "version.h" #include #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 #include -#include "version.h" #include #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 #include -#include "version.h" #include #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 #include -#include "version.h" #include #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 #include -#include "version.h" #include #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 40c4974365..e010ac0cf7 100644 --- a/arch/m68k/cpu/mcf5445x/start.S +++ b/arch/m68k/cpu/mcf5445x/start.S @@ -10,7 +10,6 @@ #include #include #include -#include "version.h" #include #define _START _start @@ -609,7 +608,4 @@ _int_handler: /******************************************************************************/ -.globl version_string -version_string: -.ascii U_BOOT_VERSION_STRING, "\0" .align 4 From d502c5f3b479fa49b57d255d956d8b9528b64dce Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 16 Sep 2021 15:30:08 -0400 Subject: [PATCH 17/21] powerpc: Drop version_string placement optimization As explained by Wolfgang, historically PowerPC would do a number of things to hand-optimize placement of the binary on NOR flash in order to maximize utilization of very scarce resources. These days, we simply aren't optimizing our binary layout for NOR flash placement and it's quite likely this wasn't working as intended. Furthermore, this level of optimization makes it difficult to have version_string be a global, instead of a weak and overridden value, and so make more progress on reproducible builds, which is a current concern. Move to having PowerPC no longer store version_string in the early part of text so that it might be part of the first page of NOR and instead use the same declaration everyone else does. Link: https://lore.kernel.org/r/96716.1629798400@gemini.denx.de/ Signed-off-by: Tom Rini --- arch/powerpc/cpu/mpc83xx/start.S | 7 ------- arch/powerpc/cpu/mpc85xx/start.S | 5 ----- arch/powerpc/cpu/mpc8xx/start.S | 4 ---- 3 files changed, 16 deletions(-) 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 #include #include -#include #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 #include #include -#include #include #include @@ -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 #include #include -#include #include #include @@ -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 From 7629b52a949a13eefa31ef8979763591066d7b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:35 +0200 Subject: [PATCH 18/21] version: Do not make version_string[] variable as a weak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no platform which needs to overload version_string[] variable, so remove weak symbol mark. Signed-off-by: Pali Rohár Reviewed-by: Tom Rini --- cmd/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/version.c b/cmd/version.c index 965ac2e214..2f9b898655 100644 --- a/cmd/version.c +++ b/cmd/version.c @@ -13,7 +13,7 @@ #include #endif -const char __weak version_string[] = U_BOOT_VERSION_STRING; +const char version_string[] = U_BOOT_VERSION_STRING; static int do_version(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) From fd004950804a60ebcba8dcc0cc850d793c3aa1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:36 +0200 Subject: [PATCH 19/21] x86: quark: MRC: Remove U_BOOT_DATE and U_BOOT_TIME from debug log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit U_BOOT_DATE and U_BOOT_TIME are updated on every run of make command. Therefore mrc.c file is recompiled every time when running make which means that whole U-Boot binary is recompiled on every run of make command. Simplify it and do not recompile U-Boot binary on every run of make command by not depending on macros U_BOOT_DATE and U_BOOT_TIME. Signed-off-by: Pali Rohár Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/quark/mrc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 -#include #include #include #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); From bc21ccbaaa7dda32ec6250cac5f9c9e47e5b629a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:37 +0200 Subject: [PATCH 20/21] version: Remove global macro U_BOOT_VERSION_STRING from version.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version string is available in global variable char version_string[]. Macro U_BOOT_VERSION_STRING is not used by any other file, so remove it completely from version.h. Other files were already converted to use variable version_string[]. Signed-off-by: Pali Rohár Reviewed-by: Tom Rini --- cmd/version.c | 3 +++ doc/develop/version.rst | 21 ++++++++++++--------- include/version.h | 3 --- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cmd/version.c b/cmd/version.c index 2f9b898655..130e31cd84 100644 --- a/cmd/version.c +++ b/cmd/version.c @@ -13,6 +13,9 @@ #include #endif +#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, 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/include/version.h b/include/version.h index 0a3b29adb8..8ee07134fd 100644 --- a/include/version.h +++ b/include/version.h @@ -13,7 +13,4 @@ #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 - #endif /* __VERSION_H__ */ From 121a165c51cd281e61c9d45c3919608af42ca9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 2 Aug 2021 15:18:38 +0200 Subject: [PATCH 21/21] Remove including timestamp.h in version.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Header file version.h does not use anything from timestamp.h. Including of timestamp.h has side effect which cause recompiling object file at every make run because timestamp.h changes at every run. So remove timestamp.h from version.h and include timestamp.h in files which needs it. This change reduce recompilation time of final U-Boot binary when U-Boot source files were not changed as less source files needs to be recompiled. Signed-off-by: Pali Rohár Reviewed-by: Simon Glass Reviewed-by: Tom Rini [trini: Add in lib/acpi/acpi_table.c and test/dm/acpi.c, rework a few others] Signed-off-by: Tom Rini --- arch/arm/mach-rockchip/tpl.c | 4 ++++ board/work-microwave/work_92105/work_92105_display.c | 1 + cmd/version.c | 1 + common/spl/spl.c | 3 +++ drivers/rtc/emul_rtc.c | 2 +- include/version.h | 2 -- lib/acpi/acpi_table.c | 1 + test/dm/acpi.c | 1 + 8 files changed, 12 insertions(+), 3 deletions(-) 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 #include +#if CONFIG_IS_ENABLED(BANNER_PRINT) +#include +#endif + #define TIMER_LOAD_COUNT_L 0x00 #define TIMER_LOAD_COUNT_H 0x04 #define TIMER_CONTROL_REG 0x10 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 #include #include +#include #include #include #include diff --git a/cmd/version.c b/cmd/version.c index 130e31cd84..f83f6aff92 100644 --- a/cmd/version.c +++ b/cmd/version.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include 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 #include #include +#if CONFIG_IS_ENABLED(BANNER_PRINT) +#include +#endif #include #include #include 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 #include #include -#include #include +#include /** * struct emul_rtc - private data for emulated RTC driver diff --git a/include/version.h b/include/version.h index 8ee07134fd..5955b21e89 100644 --- a/include/version.h +++ b/include/version.h @@ -7,8 +7,6 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -#include - #ifndef DO_DEPS_ONLY #include "generated/version_autogenerated.h" #endif 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 #include #include +#include #include #include #include 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 #include #include +#include #include #include #include