From d9f554b62440de542c482fecf9374e8da3ea3602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 3 Jul 2022 12:48:06 +0200 Subject: pci: Add checks to prevent config space overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PCIe config space has address range 0-4095. So do not allow reading from addresses outside of this range. Lot of U-Boot drivers do not expect that passed value is not in this range. PCI DM read function is extended to fill read value to all ones or zeros when it fails as U-Boot callers ignores return value. Calling U-Boot command 'pci display.b 0.0.0 0 0x2000' now stops printing config space at the end (before 0x1000 address). Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- cmd/pci.c | 16 ++++++++++++++-- drivers/pci/pci-uclass.c | 10 +++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cmd/pci.c b/cmd/pci.c index a99e8f8..6258699 100644 --- a/cmd/pci.c +++ b/cmd/pci.c @@ -358,6 +358,9 @@ static int pci_cfg_display(struct udevice *dev, ulong addr, if (length == 0) length = 0x40 / byte_size; /* Standard PCI config space */ + if (addr >= 4096) + return 1; + /* Print the lines. * once, and all accesses are with the specified bus width. */ @@ -378,7 +381,10 @@ static int pci_cfg_display(struct udevice *dev, ulong addr, rc = 1; break; } - } while (nbytes > 0); + } while (nbytes > 0 && addr < 4096); + + if (rc == 0 && nbytes > 0) + return 1; return (rc); } @@ -390,6 +396,9 @@ static int pci_cfg_modify(struct udevice *dev, ulong addr, ulong size, int nbytes; ulong val; + if (addr >= 4096) + return 1; + /* Print the address, followed by value. Then accept input for * the next value. A non-converted value exits. */ @@ -427,7 +436,10 @@ static int pci_cfg_modify(struct udevice *dev, ulong addr, ulong size, addr += size; } } - } while (nbytes); + } while (nbytes && addr < 4096); + + if (nbytes) + return 1; return 0; } diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 2c85e78..16a6a69 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -286,6 +286,8 @@ int pci_bus_write_config(struct udevice *bus, pci_dev_t bdf, int offset, ops = pci_get_ops(bus); if (!ops->write_config) return -ENOSYS; + if (offset < 0 || offset >= 4096) + return -EINVAL; return ops->write_config(bus, bdf, offset, value, size); } @@ -364,8 +366,14 @@ int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset, struct dm_pci_ops *ops; ops = pci_get_ops(bus); - if (!ops->read_config) + if (!ops->read_config) { + *valuep = pci_conv_32_to_size(~0, offset, size); return -ENOSYS; + } + if (offset < 0 || offset >= 4096) { + *valuep = pci_conv_32_to_size(0, offset, size); + return -EINVAL; + } return ops->read_config(bus, bdf, offset, valuep, size); } -- cgit v1.1 From e9ac3a939d4f11e9cdcdcb2bad090f4cb1929a85 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Sun, 31 Jul 2022 15:31:31 +0900 Subject: nvme: Do a clean NVMe shutdown The brute-force controller disable method can end up racing controller initialization and causing a crash when we shut down Apple ANS2 NVMe controllers. Do a proper controlled shutdown, which does block until things are quiesced properly. This is nicer in general for all controllers. Signed-off-by: Hector Martin Tested-by: Mark Kettenis (firefly-rk3399) --- drivers/nvme/nvme.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index a305305..5fd2fb9 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -27,9 +27,8 @@ #define IO_TIMEOUT 30 #define MAX_PRP_POOL 512 -static int nvme_wait_ready(struct nvme_dev *dev, bool enabled) +static int nvme_wait_csts(struct nvme_dev *dev, u32 mask, u32 val) { - u32 bit = enabled ? NVME_CSTS_RDY : 0; int timeout; ulong start; @@ -38,7 +37,7 @@ static int nvme_wait_ready(struct nvme_dev *dev, bool enabled) start = get_timer(0); while (get_timer(start) < timeout) { - if ((readl(&dev->bar->csts) & NVME_CSTS_RDY) == bit) + if ((readl(&dev->bar->csts) & mask) == val) return 0; } @@ -295,7 +294,7 @@ static int nvme_enable_ctrl(struct nvme_dev *dev) dev->ctrl_config |= NVME_CC_ENABLE; writel(dev->ctrl_config, &dev->bar->cc); - return nvme_wait_ready(dev, true); + return nvme_wait_csts(dev, NVME_CSTS_RDY, NVME_CSTS_RDY); } static int nvme_disable_ctrl(struct nvme_dev *dev) @@ -304,7 +303,16 @@ static int nvme_disable_ctrl(struct nvme_dev *dev) dev->ctrl_config &= ~NVME_CC_ENABLE; writel(dev->ctrl_config, &dev->bar->cc); - return nvme_wait_ready(dev, false); + return nvme_wait_csts(dev, NVME_CSTS_RDY, 0); +} + +static int nvme_shutdown_ctrl(struct nvme_dev *dev) +{ + dev->ctrl_config &= ~NVME_CC_SHN_MASK; + dev->ctrl_config |= NVME_CC_SHN_NORMAL; + writel(dev->ctrl_config, &dev->bar->cc); + + return nvme_wait_csts(dev, NVME_CSTS_SHST_MASK, NVME_CSTS_SHST_CMPLT); } static void nvme_free_queue(struct nvme_queue *nvmeq) @@ -904,6 +912,13 @@ free_nvme: int nvme_shutdown(struct udevice *udev) { struct nvme_dev *ndev = dev_get_priv(udev); + int ret; + + ret = nvme_shutdown_ctrl(ndev); + if (ret < 0) { + printf("Error: %s: Shutdown timed out!\n", udev->name); + return ret; + } return nvme_disable_ctrl(ndev); } -- cgit v1.1 From 2f03a639f36d305800b8befe066f0d3a1616aed0 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Mon, 8 Aug 2022 16:45:17 +0200 Subject: disk: part: remove dependency to ubifs for spl The spl doesn't support ubifs and thereby doesn't provide the ubifs_is_mounted function. Remove the dependency to ubifs for the spl. Signed-off-by: Stefan Herbrechtsmeier --- disk/part.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/part.c b/disk/part.c index 79955c7..de1b917 100644 --- a/disk/part.c +++ b/disk/part.c @@ -479,7 +479,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, } #endif -#ifdef CONFIG_CMD_UBIFS +#if IS_ENABLED(CONFIG_CMD_UBIFS) && !IS_ENABLED(CONFIG_SPL_BUILD) /* * Special-case ubi, ubi goes through a mtd, rather than through * a regular block device. -- cgit v1.1 From 5e730d9cf9451da4158244a5d7404289438928df Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 13 Aug 2022 11:40:40 -0600 Subject: doc: Build documentation in parallel With the addition of the revision stats this now takes over a minute. Use a parallel build to reduce it a bit (24 seconds for me). Series-changes; 2 - Use '-j auto' instead Signed-off-by: Simon Glass --- doc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Makefile b/doc/Makefile index 6081858..f5de65e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -58,6 +58,7 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) $(SPHINXBUILD) \ -j$(shell nproc) \ -b $2 \ + -j auto \ -c $(abspath $(srctree)/$(src)) \ -d $(abspath $(BUILDDIR)/.doctrees/$3) \ -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \ -- cgit v1.1 From a7091f3f8c859a29ad63b94952472bd93d60488c Mon Sep 17 00:00:00 2001 From: Sergei Antonov Date: Sun, 21 Aug 2022 16:45:08 +0300 Subject: dm: core: fix a typo in help text Signed-off-by: Sergei Antonov Reviewed-by: Simon Glass --- cmd/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/dm.c b/cmd/dm.c index eb40f08..218be85 100644 --- a/cmd/dm.c +++ b/cmd/dm.c @@ -87,7 +87,7 @@ static char dm_help_text[] = "dm drivers Dump list of drivers with uclass and instances\n" DM_MEM_HELP "dm static Dump list of drivers with static platform data\n" - "dn tree Dump tree of driver model devices ('*' = activated)\n" + "dm tree Dump tree of driver model devices ('*' = activated)\n" "dm uclass Dump list of instances for each uclass" ; #endif -- cgit v1.1 From d81eeacd48f760516abf12e69aba4ce5dd44545f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 23 Aug 2022 10:25:25 +0200 Subject: boot: fix vbe_find_first_device() uclass_find_first_device() may return NULL if no device for the uclass exists. Handle this case gracefully. Addresses-Coverity: CID 356244 ("Null pointer dereferences (FORWARD_NULL)") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- boot/vbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/vbe.c b/boot/vbe.c index e6ee087..52b3283 100644 --- a/boot/vbe.c +++ b/boot/vbe.c @@ -40,7 +40,7 @@ int vbe_find_next_device(struct udevice **devp) int vbe_find_first_device(struct udevice **devp) { uclass_find_first_device(UCLASS_BOOTMETH, devp); - if (*devp && is_vbe(*devp)) + if (!*devp || is_vbe(*devp)) return 0; return vbe_find_next_device(devp); -- cgit v1.1 From 49740e02555f72394fb319a8221bad833d8207db Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 23 Aug 2022 10:31:56 +0200 Subject: boot: simplify bootmeth_vbe_simple_ft_fixup() Don't assign a value to a variable if it is not used afterwards. Move variables to the code fragment where they are used. Addresses-Coverity: CID 356243 ("Code maintainability issues (UNUSED_VALUE)") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- boot/vbe_simple.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/boot/vbe_simple.c b/boot/vbe_simple.c index a395bc2..0fc5738 100644 --- a/boot/vbe_simple.c +++ b/boot/vbe_simple.c @@ -225,17 +225,16 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event) { oftree tree = event->data.ft_fixup.tree; struct udevice *dev; - ofnode node; - int ret; /* * Ideally we would have driver model support for fixups, but that does * not exist yet. It is a step too far to try to do this before VBE is * in place. */ - for (ret = vbe_find_first_device(&dev); dev; - ret = vbe_find_next_device(&dev)) { + for (vbe_find_first_device(&dev); dev; vbe_find_next_device(&dev)) { struct simple_state state; + ofnode node; + int ret; if (strcmp("vbe_simple", dev->driver->name)) continue; -- cgit v1.1 From 74eaa5c661688f317036cdbc46c7dad3cc38317b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Aug 2022 12:47:06 -0600 Subject: patman: Fix version table One of the changes to the version table was made by mistake. Fix it. Signed-off-by: Simon Glass --- tools/patman/patman.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst index 9226b66..f2e6d76 100644 --- a/tools/patman/patman.rst +++ b/tools/patman/patman.rst @@ -3,7 +3,7 @@ .. Simon Glass .. v1, v2, 19-Oct-11 .. revised v3 24-Nov-11 -.. revised v4 04-Jul-2020, with Patchwork integration +.. revised v4 Independence Day 2020, with Patchwork integration Patman patch manager ==================== -- cgit v1.1 From 65af8f2c60354e0e4adddac86a7062edfb6d9400 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Aug 2022 12:47:07 -0600 Subject: patman: Tidy up unnecessary blank lines and numbers Quite a few blank lines are not needed here. Drop these and use the # mechanism to number paragraphs. Signed-off-by: Simon Glass --- tools/patman/patman.rst | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst index f2e6d76..8c5c9cc 100644 --- a/tools/patman/patman.rst +++ b/tools/patman/patman.rst @@ -11,21 +11,15 @@ Patman patch manager This tool is a Python script which: - Creates patch directly from your branch - - Cleans them up by removing unwanted tags - - Inserts a cover letter with change lists - - Runs the patches through checkpatch.pl and its own checks - - Optionally emails them out to selected people It also has some Patchwork features: - shows review tags from Patchwork so you can update your local patches - - pulls these down into a new branch on request - - lists comments received on a series It is intended to automate patch creation and make it a less @@ -53,15 +47,12 @@ This tool requires a certain way of working: - Maintain a number of branches, one for each patch series you are working on - - Add tags into the commits within each branch to indicate where the series should be sent, cover letter, version, etc. Most of these are normally in the top commit so it is easy to change them with 'git commit --amend' - - Each branch tracks the upstream branch, so that this script can automatically determine the number of commits in it (optional) - - Check out a branch, and run this script to create and send out your patches. Weeks later, change the patches and repeat, knowing that you will get a consistent result each time. @@ -623,41 +614,35 @@ and it will create and send the version 2 series. General points -------------- -1. When you change back to the us-cmd branch days or weeks later all your +#. When you change back to the us-cmd branch days or weeks later all your information is still there, safely stored in the commits. You don't need to remember what version you are up to, who you sent the last lot of patches to, or anything about the change logs. - -2. If you put tags in the subject, patman will Cc the maintainers +#. If you put tags in the subject, patman will Cc the maintainers automatically in many cases. - -3. If you want to keep the commits from each series you sent so that you can +#. If you want to keep the commits from each series you sent so that you can compare change and see what you did, you can either create a new branch for each version, or just tag the branch before you start changing it: -.. code-block:: bash + .. code-block:: bash git tag sent/us-cmd-rfc # ...later... git tag sent/us-cmd-v2 -4. If you want to modify the patches a little before sending, you can do +#. If you want to modify the patches a little before sending, you can do this in your editor, but be careful! - -5. If you want to run git send-email yourself, use the -n flag which will +#. If you want to run git send-email yourself, use the -n flag which will print out the command line patman would have used. - -6. It is a good idea to add the change log info as you change the commit, +#. It is a good idea to add the change log info as you change the commit, not later when you can't remember which patch you changed. You can always go back and change or remove logs from commits. - -7. Some mailing lists have size limits and when we add binary contents to +#. Some mailing lists have size limits and when we add binary contents to our patches it's easy to exceed the size limits. Use "--no-binary" to generate patches without any binary contents. You are supposed to include a link to a git repository in your "Commit-notes", "Series-notes" or "Cover-letter" for maintainers to fetch the original commit. - -8. Patches will have no changelog entries for revisions where they did not +#. Patches will have no changelog entries for revisions where they did not change. For clarity, if there are no changes for this patch in the most recent revision of the series, a note will be added. For example, a patch with the following tags in the commit:: @@ -669,15 +654,15 @@ General points Series-changes: 4 - Another change -would have a changelog of::: + would have a changelog of::: - (no changes since v4) + (no changes since v4) - Changes in v4: - - Another change + Changes in v4: + - Another change - Changes in v2: - - Some change + Changes in v2: + - Some change Other thoughts -- cgit v1.1 From 071286021a862bf35fb92777cfa5b4f722d95394 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 18 Aug 2022 02:16:45 -0600 Subject: binman: Mention split-elf in the main docs Since we are talking about ATF, add mention of this new feature too. Signed-off-by: Simon Glass --- tools/binman/binman.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst index f94fd7e..338b550 100644 --- a/tools/binman/binman.rst +++ b/tools/binman/binman.rst @@ -236,6 +236,10 @@ variable. Within binman, this EntryArg is picked up by the `Entry_atf_bl31` etype. An EntryArg is simply an argument to the entry. The `atf-bl31-path` name is documented in :ref:`etype_atf_bl31`. +Taking this a little further, when binman is used to create a FIT, it supports +using an ELF file, e.g. `bl31.elf` and splitting it into separate pieces (with +`fit,operation = "split-elf"`), each with its own load address. + Invoking binman outside U-Boot ------------------------------ -- cgit v1.1 From 86e54468ec67bee213b855bfce34aba346c1d20e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 18 Aug 2022 02:16:46 -0600 Subject: binman: Document how to handle dependent images Binman does not support this properly at present. Add documentation about it including a work-around. Signed-off-by: Simon Glass --- tools/binman/binman.rst | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst index 338b550..4ee6f41 100644 --- a/tools/binman/binman.rst +++ b/tools/binman/binman.rst @@ -858,6 +858,55 @@ allow-repack: image description to be stored in the FDT and fdtmap. +Image dependencies +------------------ + +Binman does not currently support images that depend on each other. For example, +if one image creates `fred.bin` and then the next uses this `fred.bin` to +produce a final `image.bin`, then the behaviour is undefined. It may work, or it +may produce an error about `fred.bin` being missing, or it may use a version of +`fred.bin` from a previous run. + +Often this can be handled by incorporating the dependency into the second +image. For example, instead of:: + + binman { + multiple-images; + + fred { + u-boot { + }; + fill { + size = <0x100>; + }; + }; + + image { + blob { + filename = "fred.bin"; + }; + u-boot-spl { + }; + }; + +you can do this:: + + binman { + image { + fred { + type = "section"; + u-boot { + }; + fill { + size = <0x100>; + }; + }; + u-boot-spl { + }; + }; + + + Hashing Entries --------------- @@ -1688,6 +1737,7 @@ Some ideas: - Figure out how to make Fdt support changing the node order, so that Node.AddSubnode() can support adding a node before another, existing node. Perhaps it should completely regenerate the flat tree? +- Support images which depend on each other -- Simon Glass -- cgit v1.1 From 5cb0b256664327cbae305454b86afe0b4748b7e6 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Tue, 23 Aug 2022 12:46:09 +0200 Subject: binman: Sort tests and rework test-file numbers Tests should be in order of the test-file numbers. Sort the tests according to the test-file numbers and rework the test-file numbers to eliminate duplicate numbers. Signed-off-by: Stefan Herbrechtsmeier Reviewed-by: Simon Glass --- tools/binman/ftest.py | 113 +++++++++++---------- tools/binman/test/225_dev.key | 28 ----- tools/binman/test/225_pre_load.dts | 22 ---- tools/binman/test/226_pre_load_pkcs.dts | 23 ----- tools/binman/test/227_pre_load_pss.dts | 23 ----- tools/binman/test/228_pre_load_invalid_padding.dts | 23 ----- tools/binman/test/229_pre_load_invalid_sha.dts | 23 ----- tools/binman/test/230_dev.key | 28 +++++ tools/binman/test/230_pre_load.dts | 22 ++++ tools/binman/test/230_pre_load_invalid_algo.dts | 23 ----- tools/binman/test/230_unique_names.dts | 34 ------- tools/binman/test/231_pre_load_invalid_key.dts | 23 ----- tools/binman/test/231_pre_load_pkcs.dts | 23 +++++ tools/binman/test/231_unique_names_multi.dts | 38 ------- tools/binman/test/232_pre_load_pss.dts | 23 +++++ tools/binman/test/232_replace_with_bintool.dts | 39 ------- tools/binman/test/233_fit_extract_replace.dts | 74 -------------- tools/binman/test/233_pre_load_invalid_padding.dts | 23 +++++ tools/binman/test/234_pre_load_invalid_sha.dts | 23 +++++ tools/binman/test/234_replace_section_simple.dts | 23 ----- .../test/235_compress_dtb_prepend_invalid.dts | 17 ---- tools/binman/test/235_mkimage_name.dts | 18 ---- tools/binman/test/235_pre_load_invalid_algo.dts | 23 +++++ .../test/236_compress_dtb_prepend_length.dts | 19 ---- tools/binman/test/236_mkimage_image.dts | 21 ---- tools/binman/test/236_pre_load_invalid_key.dts | 23 +++++ tools/binman/test/237_compress_dtb_invalid.dts | 16 --- tools/binman/test/237_mkimage_image_no_content.dts | 22 ---- tools/binman/test/237_unique_names.dts | 34 +++++++ tools/binman/test/238_compress_dtb_zstd.dts | 16 --- tools/binman/test/238_mkimage_image_bad.dts | 22 ---- tools/binman/test/238_unique_names_multi.dts | 38 +++++++ tools/binman/test/239_collection_other.dts | 29 ------ tools/binman/test/239_replace_with_bintool.dts | 39 +++++++ tools/binman/test/240_fit_extract_replace.dts | 74 ++++++++++++++ tools/binman/test/240_mkimage_coll.dts | 27 ----- tools/binman/test/241_replace_section_simple.dts | 23 +++++ tools/binman/test/242_mkimage_name.dts | 18 ++++ tools/binman/test/243_mkimage_image.dts | 21 ++++ tools/binman/test/244_mkimage_image_no_content.dts | 22 ++++ tools/binman/test/245_mkimage_image_bad.dts | 22 ++++ tools/binman/test/246_collection_other.dts | 29 ++++++ tools/binman/test/247_mkimage_coll.dts | 27 +++++ .../test/248_compress_dtb_prepend_invalid.dts | 17 ++++ .../test/249_compress_dtb_prepend_length.dts | 19 ++++ tools/binman/test/250_compress_dtb_invalid.dts | 16 +++ tools/binman/test/251_compress_dtb_zstd.dts | 16 +++ 47 files changed, 660 insertions(+), 659 deletions(-) delete mode 100644 tools/binman/test/225_dev.key delete mode 100644 tools/binman/test/225_pre_load.dts delete mode 100644 tools/binman/test/226_pre_load_pkcs.dts delete mode 100644 tools/binman/test/227_pre_load_pss.dts delete mode 100644 tools/binman/test/228_pre_load_invalid_padding.dts delete mode 100644 tools/binman/test/229_pre_load_invalid_sha.dts create mode 100644 tools/binman/test/230_dev.key create mode 100644 tools/binman/test/230_pre_load.dts delete mode 100644 tools/binman/test/230_pre_load_invalid_algo.dts delete mode 100644 tools/binman/test/230_unique_names.dts delete mode 100644 tools/binman/test/231_pre_load_invalid_key.dts create mode 100644 tools/binman/test/231_pre_load_pkcs.dts delete mode 100644 tools/binman/test/231_unique_names_multi.dts create mode 100644 tools/binman/test/232_pre_load_pss.dts delete mode 100644 tools/binman/test/232_replace_with_bintool.dts delete mode 100644 tools/binman/test/233_fit_extract_replace.dts create mode 100644 tools/binman/test/233_pre_load_invalid_padding.dts create mode 100644 tools/binman/test/234_pre_load_invalid_sha.dts delete mode 100644 tools/binman/test/234_replace_section_simple.dts delete mode 100644 tools/binman/test/235_compress_dtb_prepend_invalid.dts delete mode 100644 tools/binman/test/235_mkimage_name.dts create mode 100644 tools/binman/test/235_pre_load_invalid_algo.dts delete mode 100644 tools/binman/test/236_compress_dtb_prepend_length.dts delete mode 100644 tools/binman/test/236_mkimage_image.dts create mode 100644 tools/binman/test/236_pre_load_invalid_key.dts delete mode 100644 tools/binman/test/237_compress_dtb_invalid.dts delete mode 100644 tools/binman/test/237_mkimage_image_no_content.dts create mode 100644 tools/binman/test/237_unique_names.dts delete mode 100644 tools/binman/test/238_compress_dtb_zstd.dts delete mode 100644 tools/binman/test/238_mkimage_image_bad.dts create mode 100644 tools/binman/test/238_unique_names_multi.dts delete mode 100644 tools/binman/test/239_collection_other.dts create mode 100644 tools/binman/test/239_replace_with_bintool.dts create mode 100644 tools/binman/test/240_fit_extract_replace.dts delete mode 100644 tools/binman/test/240_mkimage_coll.dts create mode 100644 tools/binman/test/241_replace_section_simple.dts create mode 100644 tools/binman/test/242_mkimage_name.dts create mode 100644 tools/binman/test/243_mkimage_image.dts create mode 100644 tools/binman/test/244_mkimage_image_no_content.dts create mode 100644 tools/binman/test/245_mkimage_image_bad.dts create mode 100644 tools/binman/test/246_collection_other.dts create mode 100644 tools/binman/test/247_mkimage_coll.dts create mode 100644 tools/binman/test/248_compress_dtb_prepend_invalid.dts create mode 100644 tools/binman/test/249_compress_dtb_prepend_length.dts create mode 100644 tools/binman/test/250_compress_dtb_invalid.dts create mode 100644 tools/binman/test/251_compress_dtb_zstd.dts diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 0b17740..5422940 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -5351,16 +5351,6 @@ fdt fdtmap Extract the devicetree blob from the fdtmap "Node '/binman/u-boot': Please use 'extend-size' instead of 'expand-size'", str(e.exception)) - def testMkimageMissingBlob(self): - """Test using mkimage to build an image""" - with test_util.capture_sys_output() as (stdout, stderr): - self._DoTestFile('229_mkimage_missing.dts', allow_missing=True, - allow_fake_blobs=True) - err = stderr.getvalue() - self.assertRegex( - err, - "Image '.*' has faked external blobs and is non-functional: .*") - def testFitSplitElf(self): """Test an image with an FIT with an split-elf operation""" if not elf.ELF_TOOLS: @@ -5461,24 +5451,6 @@ fdt fdtmap Extract the devicetree blob from the fdtmap "Node '/binman/fit': subnode 'images/@atf-SEQ': Failed to read ELF file: Magic number does not match", str(exc.exception)) - def testFitSplitElfBadDirective(self): - """Test a FIT split-elf invalid fit,xxx directive in an image node""" - if not elf.ELF_TOOLS: - self.skipTest('Python elftools not available') - err = self._check_bad_fit('227_fit_bad_dir.dts') - self.assertIn( - "Node '/binman/fit': subnode 'images/@atf-SEQ': Unknown directive 'fit,something'", - err) - - def testFitSplitElfBadDirectiveConfig(self): - """Test a FIT split-elf with invalid fit,xxx directive in config""" - if not elf.ELF_TOOLS: - self.skipTest('Python elftools not available') - err = self._check_bad_fit('228_fit_bad_dir_config.dts') - self.assertEqual( - "Node '/binman/fit': subnode 'configurations/@config-SEQ': Unknown directive 'fit,config'", - err) - def checkFitSplitElf(self, **kwargs): """Test an split-elf FIT with a missing ELF file @@ -5505,6 +5477,25 @@ fdt fdtmap Extract the devicetree blob from the fdtmap err = stderr.getvalue() return out, err + def testFitSplitElfBadDirective(self): + """Test a FIT split-elf invalid fit,xxx directive in an image node""" + if not elf.ELF_TOOLS: + self.skipTest('Python elftools not available') + err = self._check_bad_fit('227_fit_bad_dir.dts') + self.assertIn( + "Node '/binman/fit': subnode 'images/@atf-SEQ': Unknown directive 'fit,something'", + err) + + def testFitSplitElfBadDirectiveConfig(self): + """Test a FIT split-elf with invalid fit,xxx directive in config""" + if not elf.ELF_TOOLS: + self.skipTest('Python elftools not available') + err = self._check_bad_fit('228_fit_bad_dir_config.dts') + self.assertEqual( + "Node '/binman/fit': subnode 'configurations/@config-SEQ': Unknown directive 'fit,config'", + err) + + def testFitSplitElfMissing(self): """Test an split-elf FIT with a missing ELF file""" if not elf.ELF_TOOLS: @@ -5531,31 +5522,41 @@ fdt fdtmap Extract the devicetree blob from the fdtmap fname = tools.get_output_filename('binman-fake/missing.elf') self.assertTrue(os.path.exists(fname)) + def testMkimageMissingBlob(self): + """Test using mkimage to build an image""" + with test_util.capture_sys_output() as (stdout, stderr): + self._DoTestFile('229_mkimage_missing.dts', allow_missing=True, + allow_fake_blobs=True) + err = stderr.getvalue() + self.assertRegex( + err, + "Image '.*' has faked external blobs and is non-functional: .*") + def testPreLoad(self): """Test an image with a pre-load header""" entry_args = { 'pre-load-key-path': '.', } - data, _, _, _ = self._DoReadFileDtb('225_pre_load.dts', + data, _, _, _ = self._DoReadFileDtb('230_pre_load.dts', entry_args=entry_args) self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)]) self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)]) self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)]) - data = self._DoReadFile('225_pre_load.dts') + data = self._DoReadFile('230_pre_load.dts') self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)]) self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)]) self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)]) def testPreLoadPkcs(self): """Test an image with a pre-load header with padding pkcs""" - data = self._DoReadFile('226_pre_load_pkcs.dts') + data = self._DoReadFile('231_pre_load_pkcs.dts') self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)]) self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)]) self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)]) def testPreLoadPss(self): """Test an image with a pre-load header with padding pss""" - data = self._DoReadFile('227_pre_load_pss.dts') + data = self._DoReadFile('232_pre_load_pss.dts') self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)]) self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)]) self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)]) @@ -5563,22 +5564,22 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testPreLoadInvalidPadding(self): """Test an image with a pre-load header with an invalid padding""" with self.assertRaises(ValueError) as e: - data = self._DoReadFile('228_pre_load_invalid_padding.dts') + data = self._DoReadFile('233_pre_load_invalid_padding.dts') def testPreLoadInvalidSha(self): """Test an image with a pre-load header with an invalid hash""" with self.assertRaises(ValueError) as e: - data = self._DoReadFile('229_pre_load_invalid_sha.dts') + data = self._DoReadFile('234_pre_load_invalid_sha.dts') def testPreLoadInvalidAlgo(self): """Test an image with a pre-load header with an invalid algo""" with self.assertRaises(ValueError) as e: - data = self._DoReadFile('230_pre_load_invalid_algo.dts') + data = self._DoReadFile('235_pre_load_invalid_algo.dts') def testPreLoadInvalidKey(self): """Test an image with a pre-load header with an invalid key""" with self.assertRaises(ValueError) as e: - data = self._DoReadFile('231_pre_load_invalid_key.dts') + data = self._DoReadFile('236_pre_load_invalid_key.dts') def _CheckSafeUniqueNames(self, *images): """Check all entries of given images for unsafe unique names""" @@ -5593,7 +5594,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testSafeUniqueNames(self): """Test entry unique names are safe in single image configuration""" - data = self._DoReadFileRealDtb('230_unique_names.dts') + data = self._DoReadFileRealDtb('237_unique_names.dts') orig_image = control.images['image'] image_fname = tools.get_output_filename('image.bin') @@ -5603,7 +5604,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testSafeUniqueNamesMulti(self): """Test entry unique names are safe with multiple images""" - data = self._DoReadFileRealDtb('231_unique_names_multi.dts') + data = self._DoReadFileRealDtb('238_unique_names_multi.dts') orig_image = control.images['image'] image_fname = tools.get_output_filename('image.bin') @@ -5613,7 +5614,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testReplaceCmdWithBintool(self): """Test replacing an entry that needs a bintool to pack""" - data = self._DoReadFileRealDtb('232_replace_with_bintool.dts') + data = self._DoReadFileRealDtb('239_replace_with_bintool.dts') expected = U_BOOT_DATA + b'aa' self.assertEqual(expected, data[:len(expected)]) @@ -5632,7 +5633,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testReplaceCmdOtherWithBintool(self): """Test replacing an entry when another needs a bintool to pack""" - data = self._DoReadFileRealDtb('232_replace_with_bintool.dts') + data = self._DoReadFileRealDtb('239_replace_with_bintool.dts') expected = U_BOOT_DATA + b'aa' self.assertEqual(expected, data[:len(expected)]) @@ -5672,7 +5673,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testExtractFit(self): """Test extracting a FIT section""" - self._DoReadFileRealDtb('233_fit_extract_replace.dts') + self._DoReadFileRealDtb('240_fit_extract_replace.dts') image_fname = tools.get_output_filename('image.bin') fit_data = control.ReadEntry(image_fname, 'fit') @@ -5691,7 +5692,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testExtractFitSubentries(self): """Test extracting FIT section subentries""" - self._DoReadFileRealDtb('233_fit_extract_replace.dts') + self._DoReadFileRealDtb('240_fit_extract_replace.dts') image_fname = tools.get_output_filename('image.bin') for entry_path, expected in [ @@ -5710,7 +5711,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap new_data = b'x' * len(U_BOOT_DATA) data, expected_fdtmap, _ = self._RunReplaceCmd( 'fit/kernel/u-boot', new_data, - dts='233_fit_extract_replace.dts') + dts='240_fit_extract_replace.dts') self.assertEqual(new_data, data) path, fdtmap = state.GetFdtContents('fdtmap') @@ -5722,7 +5723,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap new_data = b'ub' * len(U_BOOT_NODTB_DATA) data, expected_fdtmap, _ = self._RunReplaceCmd( 'fit/fdt-1/u-boot-nodtb', new_data, - dts='233_fit_extract_replace.dts') + dts='240_fit_extract_replace.dts') self.assertEqual(new_data, data) # Will be repacked, so fdtmap must change @@ -5736,7 +5737,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap expected = new_data.ljust(len(U_BOOT_NODTB_DATA), b'\0') data, expected_fdtmap, _ = self._RunReplaceCmd( 'fit/fdt-1/u-boot-nodtb', new_data, - dts='233_fit_extract_replace.dts') + dts='240_fit_extract_replace.dts') self.assertEqual(expected, data) path, fdtmap = state.GetFdtContents('fdtmap') @@ -5748,14 +5749,14 @@ fdt fdtmap Extract the devicetree blob from the fdtmap new_data = b'w' * len(COMPRESS_DATA + U_BOOT_DATA) with self.assertRaises(ValueError) as exc: self._RunReplaceCmd('section', new_data, - dts='234_replace_section_simple.dts') + dts='241_replace_section_simple.dts') self.assertIn( "Node '/section': Replacing sections is not implemented yet", str(exc.exception)) def testMkimageImagename(self): """Test using mkimage with -n holding the data too""" - data = self._DoReadFile('235_mkimage_name.dts') + data = self._DoReadFile('242_mkimage_name.dts') # Check that the data appears in the file somewhere self.assertIn(U_BOOT_SPL_DATA, data) @@ -5772,7 +5773,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testMkimageImage(self): """Test using mkimage with -n holding the data too""" - data = self._DoReadFile('236_mkimage_image.dts') + data = self._DoReadFile('243_mkimage_image.dts') # Check that the data appears in the file somewhere self.assertIn(U_BOOT_SPL_DATA, data) @@ -5793,20 +5794,20 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testMkimageImageNoContent(self): """Test using mkimage with -n and no data""" with self.assertRaises(ValueError) as exc: - self._DoReadFile('237_mkimage_image_no_content.dts') + self._DoReadFile('244_mkimage_image_no_content.dts') self.assertIn('Could not complete processing of contents', str(exc.exception)) def testMkimageImageBad(self): """Test using mkimage with imagename node and data-to-imagename""" with self.assertRaises(ValueError) as exc: - self._DoReadFile('238_mkimage_image_bad.dts') + self._DoReadFile('245_mkimage_image_bad.dts') self.assertIn('Cannot use both imagename node and data-to-imagename', str(exc.exception)) def testCollectionOther(self): """Test a collection where the data comes from another section""" - data = self._DoReadFile('239_collection_other.dts') + data = self._DoReadFile('246_collection_other.dts') self.assertEqual(U_BOOT_NODTB_DATA + U_BOOT_DTB_DATA + tools.get_bytes(0xff, 2) + U_BOOT_NODTB_DATA + tools.get_bytes(0xfe, 3) + U_BOOT_DTB_DATA, @@ -5814,20 +5815,20 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testMkimageCollection(self): """Test using a collection referring to an entry in a mkimage entry""" - data = self._DoReadFile('240_mkimage_coll.dts') + data = self._DoReadFile('247_mkimage_coll.dts') expect = U_BOOT_SPL_DATA + U_BOOT_DATA self.assertEqual(expect, data[:len(expect)]) def testCompressDtbPrependInvalid(self): """Test that invalid header is detected""" with self.assertRaises(ValueError) as e: - self._DoReadFileDtb('235_compress_dtb_prepend_invalid.dts') + self._DoReadFileDtb('248_compress_dtb_prepend_invalid.dts') self.assertIn("Node '/binman/u-boot-dtb': Invalid prepend in " "'u-boot-dtb': 'invalid'", str(e.exception)) def testCompressDtbPrependLength(self): """Test that compress with length header works as expected""" - data = self._DoReadFileRealDtb('236_compress_dtb_prepend_length.dts') + data = self._DoReadFileRealDtb('249_compress_dtb_prepend_length.dts') image = control.images['image'] entries = image.GetEntries() self.assertIn('u-boot-dtb', entries) @@ -5860,7 +5861,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testInvalidCompress(self): """Test that invalid compress algorithm is detected""" with self.assertRaises(ValueError) as e: - self._DoTestFile('237_compress_dtb_invalid.dts') + self._DoTestFile('250_compress_dtb_invalid.dts') self.assertIn("Unknown algorithm 'invalid'", str(e.exception)) def testCompUtilCompressions(self): @@ -5893,7 +5894,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testCompressDtbZstd(self): """Test that zstd compress of device-tree files failed""" with self.assertRaises(ValueError) as e: - self._DoTestFile('238_compress_dtb_zstd.dts') + self._DoTestFile('251_compress_dtb_zstd.dts') self.assertIn("Node '/binman/u-boot-dtb': The zstd compression " "requires a length header", str(e.exception)) diff --git a/tools/binman/test/225_dev.key b/tools/binman/test/225_dev.key deleted file mode 100644 index b36bad2..0000000 --- a/tools/binman/test/225_dev.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDYngNWUvXYRXX/ -WEUI7k164fcpv1srXz+u+5Y3Yhouw3kPs+ffvYyHAPfjF7aUIAgezKk/4o7AvsxE -Rdih3T+0deAd/q/yuqN4Adzt6ImnsO/EqdtYl3Yh+Vck9xWhLd3SAw1++GfSmNMT -gxlcc/z6z+bIh2tJNtPtRSNNHMmvYYOkBmkfwcjbMXD+fe4vBwYjVrIize+l7Yuv -1qN2nFlq56pFi8Lj5vOvFyNhZHRvwcpWdUdkx39beNUfwrGhgewOeWngTcY75n7S -FY45TBR1G2PR90CQvyDinCi9Mm0u5s+1WASQWPblovfD6CPbHQu4GZm+FAs7yUvr -hA7VCyNxAgMBAAECggEAUbq0uaJNfc8faTtNuMPo2d9eGRNI+8FRTt0/3R+Xj2NT -TvhrGUD0P4++96Df012OkshXZ3I8uD6E5ZGQ3emTeqwq5kZM7oE64jGZwO3G2k1o -+cO4reFfwgvItHrBX3HlyrI6KljhG1Vr9mW1cOuWXK+KfMiTUylrpo86dYLSGeg3 -7ZlsOPArr4eof/A0iPryQZX6X5POf7k/e9qRFYsOkoRQO8pBL3J4rIKwBl3uBN3K -+FY40vCkd8JyTo2DNfHeIe1XYA9fG2ahjD2qMsw10TUsRRMd5yhonEcJ7VzGzy8m -MnuMDAr7CwbbLkKi4UfZUl6YDkojqerwLOrxikBqkQKBgQD6sS6asDgwiq5MtstE -4/PxMrVEsCdkrU+jjQN749qIt/41a6lbp0Pr6aUKKKGs0QbcnCtlpp7qmhvymBcW -hlqxk2wokKMChv4WLXjZS3DGcOdMglc81y2F+252bToN8vwUfm6DPp9/GKtejA0a -GP57GeHxoVO7vfDX1F/vZRogRQKBgQDdNCLWOlGWvnKjfgNZHgX+Ou6ZgTSAzy+/ -hRsZPlY5nwO5iD7YkIKvqBdOmfyjlUpHWk2uAcT9pfgzYygvyBRaoQhAYBGkHItt -slaMxnLd+09wWufoCbgJvFn+wVQxBLcA5PXB98ws0Dq8ZYuo6AOuoRivsSO4lblK -MW0guBJXPQKBgQDGjf0ukbH/aGfC5Oi8SJvWhuYhYC/jQo2YKUEAKCjXLnuOThZW -PHXEbUrFcAcVfH0l0B9jJIQrpiHKlAF9Wq6MhQoeWuhxQQAQCrXzzRemZJgd9gIo -cvlgbBNCgyJ/F9vmU3kuRDRJkv1wJhbee7tbPtXA7pkGUttl5pSRZI87zQKBgQC/ -0ZkwCox72xTQP9MpcYai6nnDta5Q0NnIC+Xu4wakmwcA2WweIlqhdnMXnyLcu/YY -n+9iqHgpuMXd0eukW62C1cexA13o4TPrYU36b5BmfKprdPlLVzo3fxTPfNjEVSFY -7jNLC9YLOlrkym3sf53Jzjr5B/RA+d0ewHOwfs6wxQKBgFSyfjx5wtdHK4fO+Z1+ -q3bxouZryM/4CiPCFuw4+aZmRHPmufuNCvfXdF+IH8dM0E9ObwKZAe/aMP/Y+Abx -Wz9Vm4CP6g7k3DU3INEygyjmIQQDKQ9lFdDnsP9ESzrPbaGxZhc4x2lo7qmeW1BR -/RuiAofleFkT4s+EhLrfE/v5 ------END PRIVATE KEY----- diff --git a/tools/binman/test/225_pre_load.dts b/tools/binman/test/225_pre_load.dts deleted file mode 100644 index c1ffe1a..0000000 --- a/tools/binman/test/225_pre_load.dts +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pre-load { - content = <&image>; - algo-name = "sha256,rsa2048"; - key-name = "tools/binman/test/225_dev.key"; - header-size = <4096>; - version = <0x11223344>; - }; - - image: blob-ext { - filename = "refcode.bin"; - }; - }; -}; diff --git a/tools/binman/test/226_pre_load_pkcs.dts b/tools/binman/test/226_pre_load_pkcs.dts deleted file mode 100644 index 3db0a37..0000000 --- a/tools/binman/test/226_pre_load_pkcs.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pre-load { - content = <&image>; - algo-name = "sha256,rsa2048"; - padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/225_dev.key"; - header-size = <4096>; - version = <0x11223344>; - }; - - image: blob-ext { - filename = "refcode.bin"; - }; - }; -}; diff --git a/tools/binman/test/227_pre_load_pss.dts b/tools/binman/test/227_pre_load_pss.dts deleted file mode 100644 index b1b01d5..0000000 --- a/tools/binman/test/227_pre_load_pss.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pre-load { - content = <&image>; - algo-name = "sha256,rsa2048"; - padding-name = "pss"; - key-name = "tools/binman/test/225_dev.key"; - header-size = <4096>; - version = <0x11223344>; - }; - - image: blob-ext { - filename = "refcode.bin"; - }; - }; -}; diff --git a/tools/binman/test/228_pre_load_invalid_padding.dts b/tools/binman/test/228_pre_load_invalid_padding.dts deleted file mode 100644 index 84fe289..0000000 --- a/tools/binman/test/228_pre_load_invalid_padding.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pre-load { - content = <&image>; - algo-name = "sha256,rsa2048"; - padding-name = "padding"; - key-name = "tools/binman/test/225_dev.key"; - header-size = <4096>; - version = <1>; - }; - - image: blob-ext { - filename = "refcode.bin"; - }; - }; -}; diff --git a/tools/binman/test/229_pre_load_invalid_sha.dts b/tools/binman/test/229_pre_load_invalid_sha.dts deleted file mode 100644 index a2b6725..0000000 --- a/tools/binman/test/229_pre_load_invalid_sha.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pre-load { - content = <&image>; - algo-name = "sha2560,rsa2048"; - padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/225_dev.key"; - header-size = <4096>; - version = <1>; - }; - - image: blob-ext { - filename = "refcode.bin"; - }; - }; -}; diff --git a/tools/binman/test/230_dev.key b/tools/binman/test/230_dev.key new file mode 100644 index 0000000..b36bad2 --- /dev/null +++ b/tools/binman/test/230_dev.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDYngNWUvXYRXX/ +WEUI7k164fcpv1srXz+u+5Y3Yhouw3kPs+ffvYyHAPfjF7aUIAgezKk/4o7AvsxE +Rdih3T+0deAd/q/yuqN4Adzt6ImnsO/EqdtYl3Yh+Vck9xWhLd3SAw1++GfSmNMT +gxlcc/z6z+bIh2tJNtPtRSNNHMmvYYOkBmkfwcjbMXD+fe4vBwYjVrIize+l7Yuv +1qN2nFlq56pFi8Lj5vOvFyNhZHRvwcpWdUdkx39beNUfwrGhgewOeWngTcY75n7S +FY45TBR1G2PR90CQvyDinCi9Mm0u5s+1WASQWPblovfD6CPbHQu4GZm+FAs7yUvr +hA7VCyNxAgMBAAECggEAUbq0uaJNfc8faTtNuMPo2d9eGRNI+8FRTt0/3R+Xj2NT +TvhrGUD0P4++96Df012OkshXZ3I8uD6E5ZGQ3emTeqwq5kZM7oE64jGZwO3G2k1o ++cO4reFfwgvItHrBX3HlyrI6KljhG1Vr9mW1cOuWXK+KfMiTUylrpo86dYLSGeg3 +7ZlsOPArr4eof/A0iPryQZX6X5POf7k/e9qRFYsOkoRQO8pBL3J4rIKwBl3uBN3K ++FY40vCkd8JyTo2DNfHeIe1XYA9fG2ahjD2qMsw10TUsRRMd5yhonEcJ7VzGzy8m +MnuMDAr7CwbbLkKi4UfZUl6YDkojqerwLOrxikBqkQKBgQD6sS6asDgwiq5MtstE +4/PxMrVEsCdkrU+jjQN749qIt/41a6lbp0Pr6aUKKKGs0QbcnCtlpp7qmhvymBcW +hlqxk2wokKMChv4WLXjZS3DGcOdMglc81y2F+252bToN8vwUfm6DPp9/GKtejA0a +GP57GeHxoVO7vfDX1F/vZRogRQKBgQDdNCLWOlGWvnKjfgNZHgX+Ou6ZgTSAzy+/ +hRsZPlY5nwO5iD7YkIKvqBdOmfyjlUpHWk2uAcT9pfgzYygvyBRaoQhAYBGkHItt +slaMxnLd+09wWufoCbgJvFn+wVQxBLcA5PXB98ws0Dq8ZYuo6AOuoRivsSO4lblK +MW0guBJXPQKBgQDGjf0ukbH/aGfC5Oi8SJvWhuYhYC/jQo2YKUEAKCjXLnuOThZW +PHXEbUrFcAcVfH0l0B9jJIQrpiHKlAF9Wq6MhQoeWuhxQQAQCrXzzRemZJgd9gIo +cvlgbBNCgyJ/F9vmU3kuRDRJkv1wJhbee7tbPtXA7pkGUttl5pSRZI87zQKBgQC/ +0ZkwCox72xTQP9MpcYai6nnDta5Q0NnIC+Xu4wakmwcA2WweIlqhdnMXnyLcu/YY +n+9iqHgpuMXd0eukW62C1cexA13o4TPrYU36b5BmfKprdPlLVzo3fxTPfNjEVSFY +7jNLC9YLOlrkym3sf53Jzjr5B/RA+d0ewHOwfs6wxQKBgFSyfjx5wtdHK4fO+Z1+ +q3bxouZryM/4CiPCFuw4+aZmRHPmufuNCvfXdF+IH8dM0E9ObwKZAe/aMP/Y+Abx +Wz9Vm4CP6g7k3DU3INEygyjmIQQDKQ9lFdDnsP9ESzrPbaGxZhc4x2lo7qmeW1BR +/RuiAofleFkT4s+EhLrfE/v5 +-----END PRIVATE KEY----- diff --git a/tools/binman/test/230_pre_load.dts b/tools/binman/test/230_pre_load.dts new file mode 100644 index 0000000..c0c2472 --- /dev/null +++ b/tools/binman/test/230_pre_load.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pre-load { + content = <&image>; + algo-name = "sha256,rsa2048"; + key-name = "tools/binman/test/230_dev.key"; + header-size = <4096>; + version = <0x11223344>; + }; + + image: blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/230_pre_load_invalid_algo.dts b/tools/binman/test/230_pre_load_invalid_algo.dts deleted file mode 100644 index 34c8d34..0000000 --- a/tools/binman/test/230_pre_load_invalid_algo.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pre-load { - content = <&image>; - algo-name = "sha256,rsa20480"; - padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/225_dev.key"; - header-size = <4096>; - version = <1>; - }; - - image: blob-ext { - filename = "refcode.bin"; - }; - }; -}; diff --git a/tools/binman/test/230_unique_names.dts b/tools/binman/test/230_unique_names.dts deleted file mode 100644 index 6780d37..0000000 --- a/tools/binman/test/230_unique_names.dts +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - allow-repack; - - u-boot { - }; - - fdtmap { - }; - - u-boot2 { - type = "u-boot"; - }; - - text { - text = "some text"; - }; - - u-boot-dtb { - }; - - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/231_pre_load_invalid_key.dts b/tools/binman/test/231_pre_load_invalid_key.dts deleted file mode 100644 index 08d5a75..0000000 --- a/tools/binman/test/231_pre_load_invalid_key.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pre-load { - content = <&image>; - algo-name = "sha256,rsa4096"; - padding-name = "pkcs-1.5"; - key-name = "tools/binman/test/225_dev.key"; - header-size = <4096>; - version = <1>; - }; - - image: blob-ext { - filename = "refcode.bin"; - }; - }; -}; diff --git a/tools/binman/test/231_pre_load_pkcs.dts b/tools/binman/test/231_pre_load_pkcs.dts new file mode 100644 index 0000000..530638c --- /dev/null +++ b/tools/binman/test/231_pre_load_pkcs.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pre-load { + content = <&image>; + algo-name = "sha256,rsa2048"; + padding-name = "pkcs-1.5"; + key-name = "tools/binman/test/230_dev.key"; + header-size = <4096>; + version = <0x11223344>; + }; + + image: blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/231_unique_names_multi.dts b/tools/binman/test/231_unique_names_multi.dts deleted file mode 100644 index db63afb..0000000 --- a/tools/binman/test/231_unique_names_multi.dts +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - multiple-images; - - image { - size = <0xc00>; - allow-repack; - - u-boot { - }; - - fdtmap { - }; - - u-boot2 { - type = "u-boot"; - }; - - text { - text = "some text"; - }; - - u-boot-dtb { - }; - - image-header { - location = "end"; - }; - }; - }; -}; diff --git a/tools/binman/test/232_pre_load_pss.dts b/tools/binman/test/232_pre_load_pss.dts new file mode 100644 index 0000000..371e0fd --- /dev/null +++ b/tools/binman/test/232_pre_load_pss.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pre-load { + content = <&image>; + algo-name = "sha256,rsa2048"; + padding-name = "pss"; + key-name = "tools/binman/test/230_dev.key"; + header-size = <4096>; + version = <0x11223344>; + }; + + image: blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/232_replace_with_bintool.dts b/tools/binman/test/232_replace_with_bintool.dts deleted file mode 100644 index d7fabd2..0000000 --- a/tools/binman/test/232_replace_with_bintool.dts +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - allow-repack; - - u-boot { - }; - - _testing { - require-bintool-for-contents; - require-bintool-for-pack; - }; - - fdtmap { - }; - - u-boot2 { - type = "u-boot"; - }; - - text { - text = "some text"; - }; - - u-boot-dtb { - }; - - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/233_fit_extract_replace.dts b/tools/binman/test/233_fit_extract_replace.dts deleted file mode 100644 index b44d05a..0000000 --- a/tools/binman/test/233_fit_extract_replace.dts +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - allow-repack; - - fill { - size = <0x1000>; - fill-byte = [77]; - }; - - fit { - description = "test-desc"; - #address-cells = <1>; - - images { - kernel { - description = "test u-boot"; - type = "kernel"; - arch = "arm64"; - os = "linux"; - compression = "none"; - load = <00000000>; - entry = <00000000>; - - u-boot { - }; - }; - - fdt-1 { - description = "test u-boot-nodtb"; - type = "flat_dt"; - arch = "arm64"; - compression = "none"; - - u-boot-nodtb { - }; - }; - - scr-1 { - description = "test blob"; - type = "script"; - arch = "arm64"; - compression = "none"; - - blob { - filename = "compress"; - }; - }; - }; - - configurations { - default = "conf-1"; - - conf-1 { - description = "Kernel with FDT blob"; - kernel = "kernel"; - fdt = "fdt-1"; - }; - }; - }; - - u-boot-dtb { - }; - - fdtmap { - }; - }; -}; diff --git a/tools/binman/test/233_pre_load_invalid_padding.dts b/tools/binman/test/233_pre_load_invalid_padding.dts new file mode 100644 index 0000000..9cb4cb5 --- /dev/null +++ b/tools/binman/test/233_pre_load_invalid_padding.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pre-load { + content = <&image>; + algo-name = "sha256,rsa2048"; + padding-name = "padding"; + key-name = "tools/binman/test/230_dev.key"; + header-size = <4096>; + version = <1>; + }; + + image: blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/234_pre_load_invalid_sha.dts b/tools/binman/test/234_pre_load_invalid_sha.dts new file mode 100644 index 0000000..8ded98d --- /dev/null +++ b/tools/binman/test/234_pre_load_invalid_sha.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pre-load { + content = <&image>; + algo-name = "sha2560,rsa2048"; + padding-name = "pkcs-1.5"; + key-name = "tools/binman/test/230_dev.key"; + header-size = <4096>; + version = <1>; + }; + + image: blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/234_replace_section_simple.dts b/tools/binman/test/234_replace_section_simple.dts deleted file mode 100644 index c9d5c32..0000000 --- a/tools/binman/test/234_replace_section_simple.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - allow-repack; - - u-boot-dtb { - }; - - section { - blob { - filename = "compress"; - }; - - u-boot { - }; - }; - - fdtmap { - }; - }; -}; diff --git a/tools/binman/test/235_compress_dtb_prepend_invalid.dts b/tools/binman/test/235_compress_dtb_prepend_invalid.dts deleted file mode 100644 index ee32670..0000000 --- a/tools/binman/test/235_compress_dtb_prepend_invalid.dts +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - u-boot-dtb { - compress = "lz4"; - prepend = "invalid"; - }; - }; -}; diff --git a/tools/binman/test/235_mkimage_name.dts b/tools/binman/test/235_mkimage_name.dts deleted file mode 100644 index fbc82f1..0000000 --- a/tools/binman/test/235_mkimage_name.dts +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - mkimage { - args = "-T script"; - data-to-imagename; - - u-boot-spl { - }; - }; - }; -}; diff --git a/tools/binman/test/235_pre_load_invalid_algo.dts b/tools/binman/test/235_pre_load_invalid_algo.dts new file mode 100644 index 0000000..145286c --- /dev/null +++ b/tools/binman/test/235_pre_load_invalid_algo.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pre-load { + content = <&image>; + algo-name = "sha256,rsa20480"; + padding-name = "pkcs-1.5"; + key-name = "tools/binman/test/230_dev.key"; + header-size = <4096>; + version = <1>; + }; + + image: blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/236_compress_dtb_prepend_length.dts b/tools/binman/test/236_compress_dtb_prepend_length.dts deleted file mode 100644 index 1570233..0000000 --- a/tools/binman/test/236_compress_dtb_prepend_length.dts +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - u-boot-dtb { - compress = "lz4"; - prepend = "length"; - }; - fdtmap { - }; - }; -}; diff --git a/tools/binman/test/236_mkimage_image.dts b/tools/binman/test/236_mkimage_image.dts deleted file mode 100644 index 6b8f4a4..0000000 --- a/tools/binman/test/236_mkimage_image.dts +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - mkimage { - args = "-T script"; - - imagename { - type = "u-boot"; - }; - - u-boot-spl { - }; - }; - }; -}; diff --git a/tools/binman/test/236_pre_load_invalid_key.dts b/tools/binman/test/236_pre_load_invalid_key.dts new file mode 100644 index 0000000..df858c3 --- /dev/null +++ b/tools/binman/test/236_pre_load_invalid_key.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pre-load { + content = <&image>; + algo-name = "sha256,rsa4096"; + padding-name = "pkcs-1.5"; + key-name = "tools/binman/test/230_dev.key"; + header-size = <4096>; + version = <1>; + }; + + image: blob-ext { + filename = "refcode.bin"; + }; + }; +}; diff --git a/tools/binman/test/237_compress_dtb_invalid.dts b/tools/binman/test/237_compress_dtb_invalid.dts deleted file mode 100644 index 2281390..0000000 --- a/tools/binman/test/237_compress_dtb_invalid.dts +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - u-boot-dtb { - compress = "invalid"; - }; - }; -}; diff --git a/tools/binman/test/237_mkimage_image_no_content.dts b/tools/binman/test/237_mkimage_image_no_content.dts deleted file mode 100644 index 7306c06..0000000 --- a/tools/binman/test/237_mkimage_image_no_content.dts +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - mkimage { - args = "-T script"; - - imagename { - type = "_testing"; - return-unknown-contents; - }; - - u-boot-spl { - }; - }; - }; -}; diff --git a/tools/binman/test/237_unique_names.dts b/tools/binman/test/237_unique_names.dts new file mode 100644 index 0000000..6780d37 --- /dev/null +++ b/tools/binman/test/237_unique_names.dts @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + allow-repack; + + u-boot { + }; + + fdtmap { + }; + + u-boot2 { + type = "u-boot"; + }; + + text { + text = "some text"; + }; + + u-boot-dtb { + }; + + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/238_compress_dtb_zstd.dts b/tools/binman/test/238_compress_dtb_zstd.dts deleted file mode 100644 index 90cf85d..0000000 --- a/tools/binman/test/238_compress_dtb_zstd.dts +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - u-boot-dtb { - compress = "zstd"; - }; - }; -}; diff --git a/tools/binman/test/238_mkimage_image_bad.dts b/tools/binman/test/238_mkimage_image_bad.dts deleted file mode 100644 index 54d2c99..0000000 --- a/tools/binman/test/238_mkimage_image_bad.dts +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - mkimage { - args = "-T script"; - data-to-imagename; - - imagename { - type = "u-boot"; - }; - - u-boot-spl { - }; - }; - }; -}; diff --git a/tools/binman/test/238_unique_names_multi.dts b/tools/binman/test/238_unique_names_multi.dts new file mode 100644 index 0000000..db63afb --- /dev/null +++ b/tools/binman/test/238_unique_names_multi.dts @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + + image { + size = <0xc00>; + allow-repack; + + u-boot { + }; + + fdtmap { + }; + + u-boot2 { + type = "u-boot"; + }; + + text { + text = "some text"; + }; + + u-boot-dtb { + }; + + image-header { + location = "end"; + }; + }; + }; +}; diff --git a/tools/binman/test/239_collection_other.dts b/tools/binman/test/239_collection_other.dts deleted file mode 100644 index 09de20e..0000000 --- a/tools/binman/test/239_collection_other.dts +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - collection { - content = <&u_boot_nodtb &dtb>; - }; - section { - fill { - size = <2>; - fill-byte = [ff]; - }; - u_boot_nodtb: u-boot-nodtb { - }; - fill2 { - type = "fill"; - size = <3>; - fill-byte = [fe]; - }; - }; - dtb: u-boot-dtb { - }; - }; -}; diff --git a/tools/binman/test/239_replace_with_bintool.dts b/tools/binman/test/239_replace_with_bintool.dts new file mode 100644 index 0000000..d7fabd2 --- /dev/null +++ b/tools/binman/test/239_replace_with_bintool.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + allow-repack; + + u-boot { + }; + + _testing { + require-bintool-for-contents; + require-bintool-for-pack; + }; + + fdtmap { + }; + + u-boot2 { + type = "u-boot"; + }; + + text { + text = "some text"; + }; + + u-boot-dtb { + }; + + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/240_fit_extract_replace.dts b/tools/binman/test/240_fit_extract_replace.dts new file mode 100644 index 0000000..b44d05a --- /dev/null +++ b/tools/binman/test/240_fit_extract_replace.dts @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + allow-repack; + + fill { + size = <0x1000>; + fill-byte = [77]; + }; + + fit { + description = "test-desc"; + #address-cells = <1>; + + images { + kernel { + description = "test u-boot"; + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "none"; + load = <00000000>; + entry = <00000000>; + + u-boot { + }; + }; + + fdt-1 { + description = "test u-boot-nodtb"; + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + + u-boot-nodtb { + }; + }; + + scr-1 { + description = "test blob"; + type = "script"; + arch = "arm64"; + compression = "none"; + + blob { + filename = "compress"; + }; + }; + }; + + configurations { + default = "conf-1"; + + conf-1 { + description = "Kernel with FDT blob"; + kernel = "kernel"; + fdt = "fdt-1"; + }; + }; + }; + + u-boot-dtb { + }; + + fdtmap { + }; + }; +}; diff --git a/tools/binman/test/240_mkimage_coll.dts b/tools/binman/test/240_mkimage_coll.dts deleted file mode 100644 index 3086011..0000000 --- a/tools/binman/test/240_mkimage_coll.dts +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - collection { - content = <&spl &u_boot>; - }; - mkimage { - args = "-T script"; - - spl: u-boot-spl { - }; - - imagename { - type = "section"; - - u_boot: u-boot { - }; - }; - }; - }; -}; diff --git a/tools/binman/test/241_replace_section_simple.dts b/tools/binman/test/241_replace_section_simple.dts new file mode 100644 index 0000000..c9d5c32 --- /dev/null +++ b/tools/binman/test/241_replace_section_simple.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + allow-repack; + + u-boot-dtb { + }; + + section { + blob { + filename = "compress"; + }; + + u-boot { + }; + }; + + fdtmap { + }; + }; +}; diff --git a/tools/binman/test/242_mkimage_name.dts b/tools/binman/test/242_mkimage_name.dts new file mode 100644 index 0000000..fbc82f1 --- /dev/null +++ b/tools/binman/test/242_mkimage_name.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + data-to-imagename; + + u-boot-spl { + }; + }; + }; +}; diff --git a/tools/binman/test/243_mkimage_image.dts b/tools/binman/test/243_mkimage_image.dts new file mode 100644 index 0000000..6b8f4a4 --- /dev/null +++ b/tools/binman/test/243_mkimage_image.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + + imagename { + type = "u-boot"; + }; + + u-boot-spl { + }; + }; + }; +}; diff --git a/tools/binman/test/244_mkimage_image_no_content.dts b/tools/binman/test/244_mkimage_image_no_content.dts new file mode 100644 index 0000000..7306c06 --- /dev/null +++ b/tools/binman/test/244_mkimage_image_no_content.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + + imagename { + type = "_testing"; + return-unknown-contents; + }; + + u-boot-spl { + }; + }; + }; +}; diff --git a/tools/binman/test/245_mkimage_image_bad.dts b/tools/binman/test/245_mkimage_image_bad.dts new file mode 100644 index 0000000..54d2c99 --- /dev/null +++ b/tools/binman/test/245_mkimage_image_bad.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + mkimage { + args = "-T script"; + data-to-imagename; + + imagename { + type = "u-boot"; + }; + + u-boot-spl { + }; + }; + }; +}; diff --git a/tools/binman/test/246_collection_other.dts b/tools/binman/test/246_collection_other.dts new file mode 100644 index 0000000..09de20e --- /dev/null +++ b/tools/binman/test/246_collection_other.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + collection { + content = <&u_boot_nodtb &dtb>; + }; + section { + fill { + size = <2>; + fill-byte = [ff]; + }; + u_boot_nodtb: u-boot-nodtb { + }; + fill2 { + type = "fill"; + size = <3>; + fill-byte = [fe]; + }; + }; + dtb: u-boot-dtb { + }; + }; +}; diff --git a/tools/binman/test/247_mkimage_coll.dts b/tools/binman/test/247_mkimage_coll.dts new file mode 100644 index 0000000..3086011 --- /dev/null +++ b/tools/binman/test/247_mkimage_coll.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + collection { + content = <&spl &u_boot>; + }; + mkimage { + args = "-T script"; + + spl: u-boot-spl { + }; + + imagename { + type = "section"; + + u_boot: u-boot { + }; + }; + }; + }; +}; diff --git a/tools/binman/test/248_compress_dtb_prepend_invalid.dts b/tools/binman/test/248_compress_dtb_prepend_invalid.dts new file mode 100644 index 0000000..ee32670 --- /dev/null +++ b/tools/binman/test/248_compress_dtb_prepend_invalid.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-dtb { + compress = "lz4"; + prepend = "invalid"; + }; + }; +}; diff --git a/tools/binman/test/249_compress_dtb_prepend_length.dts b/tools/binman/test/249_compress_dtb_prepend_length.dts new file mode 100644 index 0000000..1570233 --- /dev/null +++ b/tools/binman/test/249_compress_dtb_prepend_length.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-dtb { + compress = "lz4"; + prepend = "length"; + }; + fdtmap { + }; + }; +}; diff --git a/tools/binman/test/250_compress_dtb_invalid.dts b/tools/binman/test/250_compress_dtb_invalid.dts new file mode 100644 index 0000000..2281390 --- /dev/null +++ b/tools/binman/test/250_compress_dtb_invalid.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-dtb { + compress = "invalid"; + }; + }; +}; diff --git a/tools/binman/test/251_compress_dtb_zstd.dts b/tools/binman/test/251_compress_dtb_zstd.dts new file mode 100644 index 0000000..90cf85d --- /dev/null +++ b/tools/binman/test/251_compress_dtb_zstd.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-dtb { + compress = "zstd"; + }; + }; +}; -- cgit v1.1 From 2d74226f2c6ed5b758c97865bef7e42c9f389437 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 23 Aug 2022 10:14:05 -0700 Subject: vbe: Enable command only with BOOTSTD_FULL Avoid enabling this command by default. This saves about 1KB of code space. Signed-off-by: Simon Glass Reviewed-by: Ilias Apalodimas --- cmd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 211ebe9..8ea064b 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -333,7 +333,7 @@ config BOOTM_RTEMS config CMD_VBE bool "vbe - Verified Boot for Embedded" depends on BOOTMETH_VBE - default y + default y if BOOTSTD_FULL help Provides various subcommands related to VBE, such as listing the available methods, looking at the state and changing which method -- cgit v1.1 From c2ee5ee7b3393770dbe809ca36814083feffaf83 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Fri, 26 Aug 2022 15:15:41 +0200 Subject: Rename disto_[pxe_]getfile to distro_[pxe_]getfile Replace 'disto' with 'distro' since they are all functions about distro booting. Signed-off-by: Dario Binacchi --- boot/bootmeth_distro.c | 6 +++--- boot/bootmeth_pxe.c | 6 +++--- doc/develop/bootstd.rst | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boot/bootmeth_distro.c b/boot/bootmeth_distro.c index fea09b2..5c6c687 100644 --- a/boot/bootmeth_distro.c +++ b/boot/bootmeth_distro.c @@ -35,8 +35,8 @@ static int distro_get_state_desc(struct udevice *dev, char *buf, int maxsize) return 0; } -static int disto_getfile(struct pxe_context *ctx, const char *file_path, - char *file_addr, ulong *sizep) +static int distro_getfile(struct pxe_context *ctx, const char *file_path, + char *file_addr, ulong *sizep) { struct distro_info *info = ctx->userdata; ulong addr; @@ -113,7 +113,7 @@ static int distro_boot(struct udevice *dev, struct bootflow *bflow) addr = map_to_sysmem(bflow->buf); info.dev = dev; info.bflow = bflow; - ret = pxe_setup_ctx(&ctx, &cmdtp, disto_getfile, &info, true, + ret = pxe_setup_ctx(&ctx, &cmdtp, distro_getfile, &info, true, bflow->subdir); if (ret) return log_msg_ret("ctx", -EINVAL); diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c index f1e2b4c..e699216 100644 --- a/boot/bootmeth_pxe.c +++ b/boot/bootmeth_pxe.c @@ -23,8 +23,8 @@ #include #include -static int disto_pxe_getfile(struct pxe_context *ctx, const char *file_path, - char *file_addr, ulong *sizep) +static int distro_pxe_getfile(struct pxe_context *ctx, const char *file_path, + char *file_addr, ulong *sizep) { struct distro_info *info = ctx->userdata; ulong addr; @@ -142,7 +142,7 @@ static int distro_pxe_boot(struct udevice *dev, struct bootflow *bflow) info.dev = dev; info.bflow = bflow; info.cmdtp = &cmdtp; - ret = pxe_setup_ctx(ctx, &cmdtp, disto_pxe_getfile, &info, false, + ret = pxe_setup_ctx(ctx, &cmdtp, distro_pxe_getfile, &info, false, bflow->subdir); if (ret) return log_msg_ret("ctx", -EINVAL); diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst index f7fc725..1ccc494 100644 --- a/doc/develop/bootstd.rst +++ b/doc/develop/bootstd.rst @@ -322,7 +322,7 @@ look like this:: The `sf-bootdev` driver can implement a way to read from the SPI flash, using the offset and size provided, and return that bootflow file back to the caller. -When distro boot wants to read the kernel it calls disto_getfile() which must +When distro boot wants to read the kernel it calls distro_getfile() which must provide a way to read from the SPI flash. See `distro_boot()` at distro_boot_ for more details. -- cgit v1.1 From 53a9f9ef879fbc9ae0e6bf5330d3817ebd726e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 7 Aug 2022 21:04:22 +0200 Subject: distroboot: ubifs: Add support for specifying UBI header offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some UBI partitions may use non-standard UBI header offset. For attaching these UBI partitions it is required to pass second argument with offset to "ubi part" command. Therefore extend distroboot to allow specifying additional optional 6th argument with UBI header offset. This offset is set in new distroboot variable ${bootubioff} which may be used by distroboot script to e.g. properly pass this value to linux kernel command line for proper mounting of rootfs by kernel. This variable is set to empty string (cleared) when UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES macro. Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified UBIFS func with either 5 or 6 arguments. If not then cpp throws compile error. Signed-off-by: Pali Rohár Reviewed-by: Tom Rini --- include/config_distro_bootcmd.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index c6e9c49..5506f31 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -70,7 +70,7 @@ #ifdef CONFIG_CMD_UBIFS #define BOOTENV_SHARED_UBIFS \ "ubifs_boot=" \ - "if ubi part ${bootubipart} && " \ + "if ubi part ${bootubipart} ${bootubioff} && " \ "ubifsmount ubi0:${bootubivol}; " \ "then " \ "devtype=ubi; " \ @@ -80,12 +80,14 @@ "run scan_dev_for_boot; " \ "ubifsumount; " \ "fi\0" -#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \ +#define BOOTENV_DEV_UBIFS_BOOTUBIOFF(off) #off /* type check, throw error when called with more args */ +#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol, ...) \ "bootcmd_ubifs" #instance "=" \ "bootubipart=" #bootubipart "; " \ "bootubivol=" #bootubivol "; " \ + "bootubioff=" BOOTENV_DEV_UBIFS_BOOTUBIOFF(__VA_ARGS__) "; " \ "run ubifs_boot\0" -#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \ +#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, ...) \ #devtypel #instance " " #else #define BOOTENV_SHARED_UBIFS -- cgit v1.1 From 04a20ca5dc9f9eb8929097ff0c93cfe905bc7191 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Tue, 3 May 2022 15:13:27 +0200 Subject: common/console.c: prevent pre-console buffer contents from being added to itself I do not have any non-serial output devices, so a print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL) does nothing for me. However, I was manually inspected the pre-console buffer using md.b, and I noticed that the early part of it was repeated. The reason is that the first call of print_pre_console_buffer(), from console_init_f(), ends up invoking puts() with the contents of the buffer at that point, and puts() at that point ends up in the else branch of if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ fputs(stdout, s); } else { /* Send directly to the handler */ pre_console_puts(s); serial_puts(s); } so indeed the contents is added again. That can be somewhat confusing (both when reading the buffer manually, but also if it did actually come out on some device). So disable all use of the pre-console buffer while print_pre_console_buffer() is emitting it. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- common/console.c | 10 +++++++++- include/asm-generic/global_data.h | 12 ++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/common/console.c b/common/console.c index bde9412..e783f30 100644 --- a/common/console.c +++ b/common/console.c @@ -600,6 +600,9 @@ static void pre_console_putc(const char c) { char *buffer; + if (gd->precon_buf_idx < 0) + return; + buffer = map_sysmem(CONFIG_VAL(PRE_CON_BUF_ADDR), CONFIG_VAL(PRE_CON_BUF_SZ)); buffer[CIRC_BUF_IDX(gd->precon_buf_idx++)] = c; @@ -609,13 +612,16 @@ static void pre_console_putc(const char c) static void pre_console_puts(const char *s) { + if (gd->precon_buf_idx < 0) + return; + while (*s) pre_console_putc(*s++); } static void print_pre_console_buffer(int flushpoint) { - unsigned long in = 0, out = 0; + long in = 0, out = 0; char buf_out[CONFIG_VAL(PRE_CON_BUF_SZ) + 1]; char *buf_in; @@ -632,6 +638,7 @@ static void print_pre_console_buffer(int flushpoint) buf_out[out] = 0; + gd->precon_buf_idx = -1; switch (flushpoint) { case PRE_CONSOLE_FLUSHPOINT1_SERIAL: puts(buf_out); @@ -640,6 +647,7 @@ static void print_pre_console_buffer(int flushpoint) console_puts_select(stdout, false, buf_out); break; } + gd->precon_buf_idx = in; } #else static inline void pre_console_putc(const char c) {} diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 805a6fd..2a747d91 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -115,10 +115,14 @@ struct global_data { /** * @precon_buf_idx: pre-console buffer index * - * @precon_buf_idx indicates the current position of the buffer used to - * collect output before the console becomes available - */ - unsigned long precon_buf_idx; + * @precon_buf_idx indicates the current position of the + * buffer used to collect output before the console becomes + * available. When negative, the pre-console buffer is + * temporarily disabled (used when the pre-console buffer is + * being written out, to prevent adding its contents to + * itself). + */ + long precon_buf_idx; #endif /** * @env_addr: address of environment structure -- cgit v1.1 From cb735173e76788920fec4fdc9ee56eeb938154f9 Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Tue, 23 Aug 2022 16:18:26 +1000 Subject: gitlab-ci: Update comment about the Dockerfile It's found in the u-boot tree now. Signed-off-by: Joel Stanley --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5592862..cebd76d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ -# Grab our configured image. The source for this is found at: -# https://source.denx.de/u-boot/gitlab-ci-runner +# Grab our configured image. The source for this is found +# in the u-boot tree at tools/docker/Dockerfile image: trini/u-boot-gitlab-ci-runner:jammy-20220801-09Aug2022 # We run some tests in different order, to catch some failures quicker. -- cgit v1.1 From bf6376642fe8295f887144999713ebe644388205 Mon Sep 17 00:00:00 2001 From: "Matwey V. Kornilov" Date: Tue, 23 Aug 2022 19:05:34 +0300 Subject: board: ti: common: board_detect: Fix EEPROM read quirk There are three different kinds of EEPROM possibly present on boards. 1. 1byte address. For those we should avoid 2byte address in order not to rewrite the data. Second byte of the address can potentially be interpreted as the data to write. 2. 2byte address with defined behaviour. When we try to use 1byte address they just return "FF FF FF FF ... FF" 3. 2byte address with undefined behaviour (for instance, 24LC32AI). When we try to use 1byte address, then their internal read pointer is changed to some value. Subsequential reads may be broken. To gracefully handle both case #1 and case #3 we read all required data from EEPROM at once (about 80 bytes). So either all the data is valid or we fallback to 2byte address. Cc: Nishanth Menon Fixes: a58147c2dbbf ("board: ti: common: board_detect: Do 1byte address checks first.") Reference: https://lore.kernel.org/all/CAJs94Ebdd4foOjhGFu9Bop0v=B1US9neDLxfhgcY23ukgLzFOQ@mail.gmail.com/ Signed-off-by: Matwey V. Kornilov Acked-by: Nishanth Menon --- board/ti/common/board_detect.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index ed34991..9fa7b7b 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -86,7 +86,6 @@ __weak void gpi2c_init(void) static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, u32 header, u32 size, uint8_t *ep) { - u32 hdr_read = 0xdeadbeef; int rc; #if CONFIG_IS_ENABLED(DM_I2C) @@ -113,10 +112,10 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, * We must allow for fall through to check the data if 2 byte * addressing works */ - (void)dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4); + (void)dm_i2c_read(dev, 0, ep, size); /* Corrupted data??? */ - if (hdr_read != header) { + if (*((u32 *)ep) != header) { /* * read the eeprom header using i2c again, but use only a * 2 byte address (some newer boards need this..) @@ -125,16 +124,12 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, if (rc) return rc; - rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4); + rc = dm_i2c_read(dev, 0, ep, size); if (rc) return rc; } - if (hdr_read != header) + if (*((u32 *)ep) != header) return -1; - - rc = dm_i2c_read(dev, 0, ep, size); - if (rc) - return rc; #else u32 byte; @@ -154,26 +149,21 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, * We must allow for fall through to check the data if 2 byte * addressing works */ - (void)i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read, 4); + (void)i2c_read(dev_addr, 0x0, byte, ep, size); /* Corrupted data??? */ - if (hdr_read != header) { + if (*((u32 *)ep) != header) { /* * read the eeprom header using i2c again, but use only a * 2 byte address (some newer boards need this..) */ byte = 2; - rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read, - 4); + rc = i2c_read(dev_addr, 0x0, byte, ep, size); if (rc) return rc; } - if (hdr_read != header) + if (*((u32 *)ep) != header) return -1; - - rc = i2c_read(dev_addr, 0x0, byte, ep, size); - if (rc) - return rc; #endif return 0; } -- cgit v1.1 From a638bd349ea438256daf9c1f323402a137c55e03 Mon Sep 17 00:00:00 2001 From: Heiko Thiery Date: Wed, 24 Aug 2022 10:37:23 +0200 Subject: kbuild: add KBUILD_HOSTLDFLAGS to cmd_host-csingle When compiling executables from a single.c file, the linker is also invoked. Pass the flags like the other linker commands. cherry-pick kbuild change from Linux: 63185b46cdb3 (kbuild: use HOSTLDFLAGS for single .c executables) Signed-off-by: Heiko Thiery Reviewed-by: Simon Glass --- scripts/Makefile.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 69983a1..7624304 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -89,7 +89,7 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) # Create executable from a single .c file # host-csingle -> Executable quiet_cmd_host-csingle = HOSTCC $@ - cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \ + cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) $(host-csingle): $(obj)/%: $(src)/%.c FORCE $(call if_changed_dep,host-csingle) -- cgit v1.1 From da223d812bfe01ad745badce45a2d3b4482dc536 Mon Sep 17 00:00:00 2001 From: Roger Knecht Date: Thu, 25 Aug 2022 12:12:01 +0000 Subject: fs: fix comment typo Fix typo in include/fs.h Reviewed-by: Simon Glass Signed-off-by: Roger Knecht --- include/fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fs.h b/include/fs.h index 2195dc1..8370d88 100644 --- a/include/fs.h +++ b/include/fs.h @@ -46,7 +46,7 @@ int do_fat_fsload(struct cmd_tbl *cmdtp, int flag, int argc, int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); /* - * Tell the fs layer which block device an partition to use for future + * Tell the fs layer which block device and partition to use for future * commands. This also internally identifies the filesystem that is present * within the partition. The identification process may be limited to a * specific filesystem type by passing FS_* in the fstype parameter. -- cgit v1.1 From 6eea9408ac1e2607c231f3049953261b327d7b14 Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Thu, 25 Aug 2022 20:03:51 +0300 Subject: spl: ahci: Fix dependency for SPL_AHCI_PCI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The option SPL_SATA_SUPPORT is renamed to SPL_SATA. Fix the option name. Fixes: 73059529b20 ("ata: ahci-pci: Add new option CONFIG_SPL_AHCI_PCI") Signed-off-by: Oleksandr Suvorov Acked-by: Pali Rohár --- drivers/ata/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 7715c40..cd6060d 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -48,7 +48,7 @@ config SPL_AHCI_PCI bool "Support for PCI-based AHCI controller for SPL" depends on SPL depends on SPL_PCI - depends on SPL_SATA_SUPPORT && DM_SCSI + depends on SPL_SATA && DM_SCSI config DWC_AHCI bool "Enable Synopsys DWC AHCI driver support" -- cgit v1.1 From 1aa9a04ff687b8d55b0fb68ae2a688c8705665cc Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 26 Aug 2022 23:15:55 +0200 Subject: Revert "i2c: fix stack buffer overflow vulnerability in i2c md command" This reverts commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409. The commit is largely wrong and breaks most of i2c command functionality. The problem described in the aforementioned commit commit message is valid, however the commit itself does many more changes unrelated to fixing that one problem it describes. Those extra changes, namely the handling of i2c device address length as unsigned instead of signed integer, breaks the expectation that address length may be negative value. The negative value is used by DM to indicate that address length of device does not change. The actual bug documented in commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409 can be fixed by extra sanitization in separate patch. Signed-off-by: Marek Vasut Cc: Heiko Schocher Cc: Nicolas Iooss Cc: Simon Glass Cc: Tim Harvey Reviewed-by: Simon Glass --- cmd/i2c.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/i2c.c b/cmd/i2c.c index bd04b14..9050b2b 100644 --- a/cmd/i2c.c +++ b/cmd/i2c.c @@ -200,10 +200,10 @@ void i2c_init_board(void) * * Returns the address length. */ -static uint get_alen(char *arg, uint default_len) +static uint get_alen(char *arg, int default_len) { - uint j; - uint alen; + int j; + int alen; alen = default_len; for (j = 0; j < 8; j++) { @@ -247,7 +247,7 @@ static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc, { uint chip; uint devaddr, length; - uint alen; + int alen; u_char *memaddr; int ret; #if CONFIG_IS_ENABLED(DM_I2C) @@ -301,7 +301,7 @@ static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc, { uint chip; uint devaddr, length; - uint alen; + int alen; u_char *memaddr; int ret; #if CONFIG_IS_ENABLED(DM_I2C) @@ -469,8 +469,8 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc, { uint chip; uint addr, length; - uint alen; - uint j, nbytes, linebytes; + int alen; + int j, nbytes, linebytes; int ret; #if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; @@ -589,9 +589,9 @@ static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc, { uint chip; ulong addr; - uint alen; + int alen; uchar byte; - uint count; + int count; int ret; #if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; @@ -676,8 +676,8 @@ static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc, { uint chip; ulong addr; - uint alen; - uint count; + int alen; + int count; uchar byte; ulong crc; ulong err; @@ -985,7 +985,7 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { uint chip; - uint alen; + int alen; uint addr; uint length; u_char bytes[16]; -- cgit v1.1 From e4573fef7701afc2df22924ce0a445b923475afc Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 26 Aug 2022 23:15:56 +0200 Subject: i2c: fix stack buffer overflow vulnerability in i2c md command This reinstates fix from commit 8f8c04bf1ebb ("i2c: fix stack buffer overflow vulnerability in i2c md command") without the changes unrelated to the actual fix. Avoid the underflow by setting only nbytes and linebytes as unsigned integers. Signed-off-by: Marek Vasut Cc: Heiko Schocher Cc: Nicolas Iooss Cc: Simon Glass Cc: Tim Harvey Acked-by: Tim Harvey --- cmd/i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/i2c.c b/cmd/i2c.c index 9050b2b..e196a73 100644 --- a/cmd/i2c.c +++ b/cmd/i2c.c @@ -470,7 +470,8 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc, uint chip; uint addr, length; int alen; - int j, nbytes, linebytes; + int j; + uint nbytes, linebytes; int ret; #if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; -- cgit v1.1 From fdffe6aae2c3a09f4502edd890ebb1200ff8f486 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 26 Aug 2022 10:53:36 -0400 Subject: corenet_ds.h: Remove This was missed when removing the platform. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- include/configs/corenet_ds.h | 369 ------------------------------------------- 1 file changed, 369 deletions(-) delete mode 100644 include/configs/corenet_ds.h diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h deleted file mode 100644 index 7e65b2b..0000000 --- a/include/configs/corenet_ds.h +++ /dev/null @@ -1,369 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright 2009-2012 Freescale Semiconductor, Inc. - * Copyright 2020-2021 NXP - */ - -/* - * Corenet DS style board configuration file - */ -#ifndef __CONFIG_H -#define __CONFIG_H - -#include - -#include "../board/freescale/common/ics307_clk.h" - -#ifdef CONFIG_RAMBOOT_PBL -#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE -#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc -#endif - -#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE -/* Set 1M boot space */ -#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR (CONFIG_SYS_TEXT_BASE & 0xfff00000) -#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS \ - (0x300000000ull | CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR) -#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc -#endif - -/* High Level Configuration Options */ - -#ifndef CONFIG_RESET_VECTOR_ADDRESS -#define CONFIG_RESET_VECTOR_ADDRESS 0xeffffffc -#endif - -#define CONFIG_SYS_NUM_CPC CONFIG_SYS_NUM_DDR_CTLRS - -/* - * These can be toggled for performance analysis, otherwise use default. - */ -#define CONFIG_SYS_INIT_L2CSR0 L2CSR0_L2E -#ifdef CONFIG_DDR_ECC -#define CONFIG_MEM_INIT_VALUE 0xdeadbeef -#endif - -#define CONFIG_POST CONFIG_SYS_POST_MEMORY /* test POST memory test */ - -/* - * Config the L3 Cache as L3 SRAM - */ -#define CONFIG_SYS_INIT_L3_ADDR CONFIG_RAMBOOT_TEXT_BASE -#ifdef CONFIG_PHYS_64BIT -#define CONFIG_SYS_INIT_L3_ADDR_PHYS (0xf00000000ull | CONFIG_RAMBOOT_TEXT_BASE) -#else -#define CONFIG_SYS_INIT_L3_ADDR_PHYS CONFIG_SYS_INIT_L3_ADDR -#endif -#define CONFIG_SYS_L3_SIZE (1024 << 10) -#define CONFIG_SYS_INIT_L3_END (CONFIG_SYS_INIT_L3_ADDR + CONFIG_SYS_L3_SIZE) - -#ifdef CONFIG_PHYS_64BIT -#define CONFIG_SYS_DCSRBAR 0xf0000000 -#define CONFIG_SYS_DCSRBAR_PHYS 0xf00000000ull -#endif - -/* EEPROM */ -#define CONFIG_SYS_I2C_EEPROM_NXID -#define CONFIG_SYS_EEPROM_BUS_NUM 0 - -/* - * DDR Setup - */ -#define CONFIG_VERY_BIG_RAM -#define CONFIG_SYS_DDR_SDRAM_BASE 0x00000000 -#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE - -#define SPD_EEPROM_ADDRESS1 0x51 -#define SPD_EEPROM_ADDRESS2 0x52 -#define SPD_EEPROM_ADDRESS SPD_EEPROM_ADDRESS1 /* for p3041/p5010 */ -#define CONFIG_SYS_SDRAM_SIZE 4096 /* for fixed parameter use */ - -/* - * Local Bus Definitions - */ - -/* Set the local bus clock 1/8 of platform clock */ -#define CONFIG_SYS_LBC_LCRR LCRR_CLKDIV_8 - -#define CONFIG_SYS_FLASH_BASE 0xe0000000 /* Start of PromJet */ -#ifdef CONFIG_PHYS_64BIT -#define CONFIG_SYS_FLASH_BASE_PHYS 0xfe0000000ull -#else -#define CONFIG_SYS_FLASH_BASE_PHYS CONFIG_SYS_FLASH_BASE -#endif - -#define PIXIS_BASE 0xffdf0000 /* PIXIS registers */ -#ifdef CONFIG_PHYS_64BIT -#define PIXIS_BASE_PHYS 0xfffdf0000ull -#else -#define PIXIS_BASE_PHYS PIXIS_BASE -#endif - -#define PIXIS_LBMAP_SWITCH 7 -#define PIXIS_LBMAP_MASK 0xf0 -#define PIXIS_LBMAP_SHIFT 4 -#define PIXIS_LBMAP_ALTBANK 0x40 - -#define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */ - -/* Nand Flash */ -#ifdef CONFIG_NAND_FSL_ELBC -#define CONFIG_SYS_NAND_BASE 0xffa00000 -#ifdef CONFIG_PHYS_64BIT -#define CONFIG_SYS_NAND_BASE_PHYS 0xfffa00000ull -#else -#define CONFIG_SYS_NAND_BASE_PHYS CONFIG_SYS_NAND_BASE -#endif - -#define CONFIG_SYS_NAND_BASE_LIST {CONFIG_SYS_NAND_BASE} -#define CONFIG_SYS_MAX_NAND_DEVICE 1 - -/* NAND flash config */ -#define CONFIG_SYS_NAND_BR_PRELIM (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \ - | (2<> 1) -#define CONFIG_SYS_BMAN_CINH_BASE (CONFIG_SYS_BMAN_MEM_BASE + \ - CONFIG_SYS_BMAN_CENA_SIZE) -#define CONFIG_SYS_BMAN_CINH_SIZE (CONFIG_SYS_BMAN_MEM_SIZE >> 1) -#define CONFIG_SYS_BMAN_SWP_ISDR_REG 0xE08 -#define CONFIG_SYS_QMAN_NUM_PORTALS 10 -#define CONFIG_SYS_QMAN_MEM_BASE 0xf4200000 -#ifdef CONFIG_PHYS_64BIT -#define CONFIG_SYS_QMAN_MEM_PHYS 0xff4200000ull -#else -#define CONFIG_SYS_QMAN_MEM_PHYS CONFIG_SYS_QMAN_MEM_BASE -#endif -#define CONFIG_SYS_QMAN_MEM_SIZE 0x00200000 -#define CONFIG_SYS_QMAN_SP_CENA_SIZE 0x4000 -#define CONFIG_SYS_QMAN_SP_CINH_SIZE 0x1000 -#define CONFIG_SYS_QMAN_CENA_BASE CONFIG_SYS_QMAN_MEM_BASE -#define CONFIG_SYS_QMAN_CENA_SIZE (CONFIG_SYS_QMAN_MEM_SIZE >> 1) -#define CONFIG_SYS_QMAN_CINH_BASE (CONFIG_SYS_QMAN_MEM_BASE + \ - CONFIG_SYS_QMAN_CENA_SIZE) -#define CONFIG_SYS_QMAN_CINH_SIZE (CONFIG_SYS_QMAN_MEM_SIZE >> 1) -#define CONFIG_SYS_QMAN_SWP_ISDR_REG 0xE08 - -#define CONFIG_SYS_DPAA_FMAN -#define CONFIG_SYS_DPAA_PME - -#ifdef CONFIG_FMAN_ENET -#define CONFIG_SYS_FM1_DTSEC1_PHY_ADDR 0x1c -#define CONFIG_SYS_FM1_DTSEC2_PHY_ADDR 0x1d -#define CONFIG_SYS_FM1_DTSEC3_PHY_ADDR 0x1e -#define CONFIG_SYS_FM1_DTSEC4_PHY_ADDR 0x1f -#define CONFIG_SYS_FM1_10GEC1_PHY_ADDR 4 - -#define CONFIG_SYS_FM2_DTSEC1_PHY_ADDR 0x1c -#define CONFIG_SYS_FM2_DTSEC2_PHY_ADDR 0x1d -#define CONFIG_SYS_FM2_DTSEC3_PHY_ADDR 0x1e -#define CONFIG_SYS_FM2_DTSEC4_PHY_ADDR 0x1f -#define CONFIG_SYS_FM2_10GEC1_PHY_ADDR 0 - -#define CONFIG_SYS_TBIPA_VALUE 8 -#endif - -/* - * Environment - */ -#define CONFIG_LOADS_ECHO /* echo on for serial download */ -#define CONFIG_SYS_LOADS_BAUD_CHANGE /* allow baudrate change */ - -#ifdef CONFIG_MMC -#define CONFIG_SYS_FSL_ESDHC_ADDR CONFIG_SYS_MPC85xx_ESDHC_ADDR -#endif - -/* - * Miscellaneous configurable options - */ - -/* - * For booting Linux, the board info and command line data - * have to be in the first 64 MB of memory, since this is - * the maximum mapped by the Linux kernel during initialization. - */ -#define CONFIG_SYS_BOOTMAPSZ (64 << 20) /* Initial Memory map for Linux*/ - -/* - * Environment Configuration - */ -#define CONFIG_ROOTPATH "/opt/nfsroot" -#define CONFIG_UBOOTPATH u-boot.bin /* U-Boot image on TFTP server */ - -#ifdef CONFIG_TARGET_P4080DS -#define __USB_PHY_TYPE ulpi -#else -#define __USB_PHY_TYPE utmi -#endif - -#define CONFIG_EXTRA_ENV_SETTINGS \ - "hwconfig=fsl_ddr:ctlr_intlv=cacheline," \ - "bank_intlv=cs0_cs1;" \ - "usb1:dr_mode=host,phy_type=" __stringify(__USB_PHY_TYPE) ";"\ - "usb2:dr_mode=peripheral,phy_type=" __stringify(__USB_PHY_TYPE) "\0"\ - "netdev=eth0\0" \ - "uboot=" __stringify(CONFIG_UBOOTPATH) "\0" \ - "ubootaddr=" __stringify(CONFIG_SYS_TEXT_BASE) "\0" \ - "tftpflash=tftpboot $loadaddr $uboot && " \ - "protect off $ubootaddr +$filesize && " \ - "erase $ubootaddr +$filesize && " \ - "cp.b $loadaddr $ubootaddr $filesize && " \ - "protect on $ubootaddr +$filesize && " \ - "cmp.b $loadaddr $ubootaddr $filesize\0" \ - "consoledev=ttyS0\0" \ - "ramdiskaddr=2000000\0" \ - "ramdiskfile=p4080ds/ramdisk.uboot\0" \ - "fdtaddr=1e00000\0" \ - "fdtfile=p4080ds/p4080ds.dtb\0" \ - "bdev=sda3\0" - -#include - -#endif /* __CONFIG_H */ -- cgit v1.1 From 0cd57f29e49a99135660a65d21da8e6b3d5cb52a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 27 Aug 2022 04:14:42 +0100 Subject: bootm: fix typo imape_comp -> image_comp Change variable name 'imape_comp' to the supposedly intended name 'image_comp'. Signed-off-by: Daniel Golle Reviewed-by: Simon Glass --- boot/bootm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/boot/bootm.c b/boot/bootm.c index 86dbfbc..63c79a9 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -1006,7 +1006,7 @@ static int bootm_host_load_image(const void *fit, int req_image_type, int noffset; ulong load_end, buf_size; uint8_t image_type; - uint8_t imape_comp; + uint8_t image_comp; void *load_buf; int ret; @@ -1024,7 +1024,7 @@ static int bootm_host_load_image(const void *fit, int req_image_type, return -EINVAL; } - if (fit_image_get_comp(fit, noffset, &imape_comp)) { + if (fit_image_get_comp(fit, noffset, &image_comp)) { puts("Can't get image compression!\n"); return -EINVAL; } @@ -1032,12 +1032,12 @@ static int bootm_host_load_image(const void *fit, int req_image_type, /* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 << 20) + len * 4; load_buf = malloc(buf_size); - ret = image_decomp(imape_comp, 0, data, image_type, load_buf, + ret = image_decomp(image_comp, 0, data, image_type, load_buf, (void *)data, len, buf_size, &load_end); free(load_buf); if (ret) { - ret = handle_decomp_error(imape_comp, load_end - 0, buf_size, ret); + ret = handle_decomp_error(image_comp, load_end - 0, buf_size, ret); if (ret != BOOTM_ERR_UNIMPLEMENTED) return ret; } -- cgit v1.1 From 88de6c512758f9705a14965ab97f11b463f3fa7c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 27 Aug 2022 04:17:28 +0100 Subject: image-fit: don't set compression if it can't be read fit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used. As a result the warning message WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent. Signed-off-by: Daniel Golle Reviewed-by: Simon Glass --- boot/bootm.c | 6 ++---- boot/image-fit.c | 3 +-- cmd/ximg.c | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/boot/bootm.c b/boot/bootm.c index 63c79a9..29c067f 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const void *fit, int req_image_type, return -EINVAL; } - if (fit_image_get_comp(fit, noffset, &image_comp)) { - puts("Can't get image compression!\n"); - return -EINVAL; - } + if (fit_image_get_comp(fit, noffset, &image_comp)) + image_comp = IH_COMP_NONE; /* Allow the image to expand by a factor of 4, should be safe */ buf_size = (1 << 20) + len * 4; diff --git a/boot/image-fit.c b/boot/image-fit.c index df3e5df..21dbd05 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -477,7 +477,7 @@ void fit_print_contents(const void *fit) void fit_image_print(const void *fit, int image_noffset, const char *p) { char *desc; - uint8_t type, arch, os, comp; + uint8_t type, arch, os, comp = IH_COMP_NONE; size_t size; ulong load, entry; const void *data; @@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) data = fdt_getprop(fit, noffset, FIT_COMP_PROP, &len); if (data == NULL) { fit_get_debug(fit, noffset, FIT_COMP_PROP, len); - *comp = -1; return -1; } diff --git a/cmd/ximg.c b/cmd/ximg.c index 65ba413..f84141f 100644 --- a/cmd/ximg.c +++ b/cmd/ximg.c @@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return 1; } - if (fit_image_get_comp(fit_hdr, noffset, &comp)) { - puts("Could not find script subimage " - "compression type\n"); - return 1; - } + if (fit_image_get_comp(fit_hdr, noffset, &comp)) + comp = IH_COMP_NONE; data = (ulong)fit_data; len = (ulong)fit_len; -- cgit v1.1 From 5acfdfbd43bfc4964dade2f8b085b26dc24a9dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sat, 27 Aug 2022 14:48:10 +0200 Subject: bootm: Fix upper bound of FDT overlap checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FTD blob can be put immediately after the OS image. So use strict inequality for start address check. Fixes: fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image") Signed-off-by: Pali Rohár Reviewed-by: Simon Glass --- boot/bootm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/bootm.c b/boot/bootm.c index 29c067f..e3233fd 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -305,9 +305,9 @@ int bootm_find_images(int flag, int argc, char *const argv[], ulong start, /* check if FDT overlaps OS image */ if (images.ft_addr && (((ulong)images.ft_addr >= start && - (ulong)images.ft_addr <= start + size) || + (ulong)images.ft_addr < start + size) || ((ulong)images.ft_addr + images.ft_len >= start && - (ulong)images.ft_addr + images.ft_len <= start + size))) { + (ulong)images.ft_addr + images.ft_len < start + size))) { printf("ERROR: FDT image overlaps OS image (OS=0x%lx..0x%lx)\n", start, start + size); return 1; -- cgit v1.1 From 1a4af2d9507b54ccf91d5616d5544915f695e64d Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 29 Aug 2022 13:34:01 +0200 Subject: tools: mkimage: fix build with recent LibreSSL LibreSSL 3.5.0 and later (also shipped as part of OpenBSD 7.1 and and later) have an opaque RSA object and do provide the RSA_get0_* functions that OpenSSL provides. Fixes: 2ecc354b8e46 ("tools: mkimage: fix build with LibreSSL") Signed-off-by: Mark Kettenis Reviewed-by: Jonathan Gray --- tools/sunxi_toc0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sunxi_toc0.c b/tools/sunxi_toc0.c index 56200bd..7a8d74b 100644 --- a/tools/sunxi_toc0.c +++ b/tools/sunxi_toc0.c @@ -34,7 +34,7 @@ #define pr_warn(fmt, args...) fprintf(stderr, pr_fmt(fmt), "warning", ##args) #define pr_info(fmt, args...) fprintf(stderr, pr_fmt(fmt), "info", ##args) -#if defined(LIBRESSL_VERSION_NUMBER) +#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL #define RSA_get0_n(key) (key)->n #define RSA_get0_e(key) (key)->e #define RSA_get0_d(key) (key)->d -- cgit v1.1 From f4b540e25c5c63fd55a80c78a22b2f69ecb848f8 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Tue, 30 Aug 2022 16:32:27 -0400 Subject: arm: smh: Fix uninitialized parameters with newer GCCs Newer versions of GCC won't initialize parts of structures which don't appear to be used. This results in uninitialized semihosting parameters passed via R1. Fix this by marking the inline assembly as clobbering memory. Signed-off-by: Sean Anderson --- arch/arm/lib/semihosting.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c index dbea2b0..01d652a 100644 --- a/arch/arm/lib/semihosting.c +++ b/arch/arm/lib/semihosting.c @@ -32,12 +32,12 @@ static noinline long smh_trap(unsigned int sysnum, void *addr) { register long result asm("r0"); #if defined(CONFIG_ARM64) - asm volatile ("hlt #0xf000" : "=r" (result) : "0"(sysnum), "r"(addr)); + asm volatile ("hlt #0xf000" : "=r" (result) : "0"(sysnum), "r"(addr) : "memory"); #elif defined(CONFIG_CPU_V7M) - asm volatile ("bkpt #0xAB" : "=r" (result) : "0"(sysnum), "r"(addr)); + asm volatile ("bkpt #0xAB" : "=r" (result) : "0"(sysnum), "r"(addr) : "memory"); #else /* Note - untested placeholder */ - asm volatile ("svc #0x123456" : "=r" (result) : "0"(sysnum), "r"(addr)); + asm volatile ("svc #0x123456" : "=r" (result) : "0"(sysnum), "r"(addr) : "memory"); #endif return result; } -- cgit v1.1 From d5391bf02b9dc6a84fe33ba913caf70061909950 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 31 Aug 2022 16:37:35 +0200 Subject: efi_loader: ensure all block devices are probed Only probed block devices are available in the UEFI sub-system. Multiple block devices may be involved in the boot process. So we have to make sure that all block devices are probed. Another reason is that we store UEFI variables on the ESP which may be on any block device. On the sandbox before the patch: => efidebug devices No EFI system partition Device Device Path ================ ==================== 000000001b027c70 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b) 000055d078bc1ae0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D) 000000001b22e0b0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(020011223344,1) After the patch: => efidebug devices No EFI system partition Device Device Path ================ ==================== 000000001b027c70 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b) 000055bdac8ddae0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D) 000000001b230920 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) 000000001b233ac0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) 000000001b233b80 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)/HD(1,GPT,d0a914ee-a71c-fc1e-73f0-7e302b0e6c20,0x30,0x1) 000000001b234110 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)/HD(2,GPT,9330a0ea-8aff-f67a-294c-fa05d60896c3,0x31,0x1) 000000001b22f0e0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) 000000001b238df0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(020011223344,1) Fixes: a9bf024b2933 ("efi_loader: disk: a helper function to create efi_disk objects from udevice") Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 4 +++- lib/efi_loader/efi_disk.c | 17 +++++++++++++++++ lib/efi_loader/efi_setup.c | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index b0d6fff..9611aec 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -531,8 +531,10 @@ void efi_carve_out_dt_rsv(void *fdt); void efi_try_purge_kaslr_seed(void *fdt); /* Called by bootefi to make console interface available */ efi_status_t efi_console_register(void); -/* Called by efi_init_obj_list() to initialize efi_disks */ +/* Called by efi_init_early() to add block devices when probed */ efi_status_t efi_disk_init(void); +/* Called by efi_init_obj_list() to proble all block devices */ +efi_status_t efi_disks_register(void); /* Called by efi_init_obj_list() to install EFI_RNG_PROTOCOL */ efi_status_t efi_rng_register(void); /* Called by efi_init_obj_list() to install EFI_TCG2_PROTOCOL */ diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index f269abf..5feeb52 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -760,3 +760,20 @@ efi_status_t efi_disk_init(void) return EFI_SUCCESS; } + +/** + * efi_disks_register() - ensure all block devices are available in UEFI + * + * The function probes all block devices. As we store UEFI variables on the + * EFI system partition this function has to be called before enabling + * variable services. + */ +efi_status_t efi_disks_register(void) +{ + struct udevice *dev; + + uclass_foreach_dev_probe(UCLASS_BLK, dev) { + } + + return EFI_SUCCESS; +} diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index 751beda..45a9a1d 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -246,6 +246,14 @@ efi_status_t efi_init_obj_list(void) /* Set up console modes */ efi_setup_console_size(); + /* + * Probe block devices to find the ESP. + * efi_disks_register() must be called before efi_init_variables(). + */ + ret = efi_disks_register(); + if (ret != EFI_SUCCESS) + goto out; + /* Initialize variable services */ ret = efi_init_variables(); if (ret != EFI_SUCCESS) -- cgit v1.1 From 00cc81f4e4c3d7e28766a770a09ce888c7ff5bb5 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 30 Aug 2022 16:56:28 +0200 Subject: doc: Add gpio status output fields description Add gpio status output fields description and one output example. Signed-off-by: Patrice Chotard Reviewed-by: Simon Glass Tweak the formatting. Signed-off-by: Heinrich Schuchardt --- doc/usage/cmd/gpio.rst | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/doc/usage/cmd/gpio.rst b/doc/usage/cmd/gpio.rst index f6a5668..ee90213 100644 --- a/doc/usage/cmd/gpio.rst +++ b/doc/usage/cmd/gpio.rst @@ -45,6 +45,31 @@ gpio status Display the status of one or multiple GPIOs. By default only claimed GPIOs are displayed. +gpio status command output fields are:: + + : : [x]