From ab08c685a94eb312ea54a58cdc9d5ea7b574ddd3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 28 Feb 2021 21:42:51 +0100 Subject: [PATCH 1/7] video: buffer overrun in TrueType console When scrolling the TrueType console a buffer overrun occurs. Fixes: a29b012037cc ("video: Add a console driver that uses TrueType fonts") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- drivers/video/console_truetype.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index fa11b3bbef..98427f4c61 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -128,38 +128,36 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct console_tt_priv *priv = dev_get_priv(dev); void *end, *line; - int pixels = priv->font_size * vid_priv->line_length; - int i, ret; + int ret; line = vid_priv->fb + row * priv->font_size * vid_priv->line_length; + end = line + priv->font_size * vid_priv->line_length; + switch (vid_priv->bpix) { #ifdef CONFIG_VIDEO_BPP8 case VIDEO_BPP8: { - uint8_t *dst = line; + u8 *dst; - for (i = 0; i < pixels; i++) - *dst++ = clr; - end = dst; + for (dst = line; dst < (u8 *)end; ++dst) + *dst = clr; break; } #endif #ifdef CONFIG_VIDEO_BPP16 case VIDEO_BPP16: { - uint16_t *dst = line; + u16 *dst = line; - for (i = 0; i < pixels; i++) - *dst++ = clr; - end = dst; + for (dst = line; dst < (u16 *)end; ++dst) + *dst = clr; break; } #endif #ifdef CONFIG_VIDEO_BPP32 case VIDEO_BPP32: { - uint32_t *dst = line; + u32 *dst = line; - for (i = 0; i < pixels; i++) - *dst++ = clr; - end = dst; + for (dst = line; dst < (u32 *)end; ++dst) + *dst = clr; break; } #endif From fa3f1f1dbdd09e916f31e7cf509cf21f7cafb468 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 24 Jul 2021 17:35:46 +0200 Subject: [PATCH 2/7] lib: disable CONFIG_SPL_HEXDUMP by default CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'. Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes. Hence CONFIG_SPL_HEXDUMP should not be enabled by default. The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes boards that don't use SPL at all. axm_defconfig imx8mm-cl-iot-gate_defconfig imx8mm_venice_defconfig imxrt1020-evk_defconfig imxrt1050-evk_defconfig kontron_sl28_defconfig kp_imx53_defconfig lx2160ardb_tfa_stmm_defconfig mt7622_rfb_defconfig octeon_ebb7304_defconfig octeon_nic23_defconfig qemu_arm64_defconfig qemu_arm_defconfig qemu-riscv32_defconfig qemu-riscv32_smode_defconfig qemu-riscv64_defconfig qemu-riscv64_smode_defconfig qemu-x86_64_defconfig qemu-x86_defconfig sandbox64_defconfig sandbox_defconfig stm32mp15_basic_defconfig stm32mp15_trusted_defconfig synquacer_developerbox_defconfig taurus_defconfig xilinx_versal_virt_defconfig The patch only keeps it enabled on sandbox_spl_defconfig Signed-off-by: Heinrich Schuchardt --- configs/sandbox_spl_defconfig | 2 ++ lib/Kconfig | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 6741cd0c52..77dd83cf6f 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -224,6 +224,8 @@ CONFIG_RSA_VERIFY_WITH_PKEY=y CONFIG_TPM=y CONFIG_LZ4=y CONFIG_ERRNO_STR=y +CONFIG_HEXDUMP=y +CONFIG_SPL_HEXDUMP=y CONFIG_UNIT_TEST=y CONFIG_SPL_UNIT_TEST=y CONFIG_UT_TIME=y diff --git a/lib/Kconfig b/lib/Kconfig index fdcf7ea405..7b445d0164 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -566,8 +566,7 @@ config HEXDUMP config SPL_HEXDUMP bool "Enable hexdump in SPL" - depends on HEXDUMP - default y + depends on SPL && HEXDUMP help This enables functions for printing dumps of binary data in SPL. From d7a974953bfa0406f6c57b39ee944067279ff151 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 28 Jul 2021 10:52:53 +0200 Subject: [PATCH 3/7] doc: riscv: flashing SiFive boards We should not use /dev/sda and /dev/sdb in our examples. Users might inadvertently mess up their workstation. Use /dev/sdX instead. Remove console output like '# ' and '> ' which makes copying hard. Set example language to bash for correct syntax-highlighting. Signed-off-by: Heinrich Schuchardt iewed-by: Bin Meng --- doc/board/sifive/unleashed.rst | 20 ++++++++++---------- doc/board/sifive/unmatched.rst | 30 +++++++++++++++--------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/board/sifive/unleashed.rst b/doc/board/sifive/unleashed.rst index 4e4c852ff3..c8a62068a7 100644 --- a/doc/board/sifive/unleashed.rst +++ b/doc/board/sifive/unleashed.rst @@ -456,21 +456,21 @@ device tree blob (hifive-unleashed-a00.dtb) Format the SD card (make sure the disk has GPT, otherwise use gdisk to switch) -.. code-block:: none +.. code-block:: bash - # sudo sgdisk --clear \ - > --set-alignment=2 \ - > --new=1:34:2081 --change-name=1:loader1 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \ - > --new=2:2082:10273 --change-name=2:loader2 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \ - > --new=3:10274: --change-name=3:rootfs --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \ - > /dev/sda + sudo sgdisk --clear \ + --set-alignment=2 \ + --new=1:34:2081 --change-name=1:loader1 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \ + --new=2:2082:10273 --change-name=2:loader2 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \ + --new=3:10274: --change-name=3:rootfs --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \ + /dev/sdX Program the SD card -.. code-block:: none +.. code-block:: bash - sudo dd if=spl/u-boot-spl.bin of=/dev/sda seek=34 - sudo dd if=u-boot.itb of=/dev/sda seek=2082 + sudo dd if=spl/u-boot-spl.bin of=/dev/sdX seek=34 + sudo dd if=u-boot.itb of=/dev/sdX seek=2082 Booting ~~~~~~~ diff --git a/doc/board/sifive/unmatched.rst b/doc/board/sifive/unmatched.rst index e65b0d3206..6b024f07f6 100644 --- a/doc/board/sifive/unmatched.rst +++ b/doc/board/sifive/unmatched.rst @@ -61,31 +61,31 @@ device tree blob (hifive-unmatched-a00.dtb) Format the SD card (make sure the disk has GPT, otherwise use gdisk to switch) -.. code-block:: none +.. code-block:: bash - # sudo sgdisk -g --clear -a 1 \ - > --new=1:34:2081 --change-name=1:spl --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \ - > --new=2:2082:10273 --change-name=2:uboot --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \ - > --new=3:16384:282623 --change-name=3:boot --typecode=3:0x0700 \ - > --new=4:286720:13918207 --change-name=4:root --typecode=4:0x8300 \ - > /dev/sdb + sudo sgdisk -g --clear -a 1 \ + --new=1:34:2081 --change-name=1:spl --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \ + --new=2:2082:10273 --change-name=2:uboot --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \ + --new=3:16384:282623 --change-name=3:boot --typecode=3:0x0700 \ + --new=4:286720:13918207 --change-name=4:root --typecode=4:0x8300 \ + /dev/sdX Copy linux Image.gz and hifive-unmatched-a00.dtb to boot partition -.. code-block:: none +.. code-block:: bash - sudo mkfs.vfat /dev/sdb3 - sudo mkfs.ext4 /dev/sdb4 + sudo mkfs.vfat /dev/sdX3 + sudo mkfs.ext4 /dev/sdX4 - sudo mount /dev/sdb3 /media/sdb3 - sudo cp Image.gz hifive-unmatched-a00.dtb /media/sdb3/ + sudo mount /dev/sdX3 /media/sdX3 + sudo cp Image.gz hifive-unmatched-a00.dtb /media/sdX3/ Program the SD card -.. code-block:: none +.. code-block:: bash - sudo dd if=spl/u-boot-spl.bin of=/dev/sda seek=34 - sudo dd if=u-boot.itb of=/dev/sda seek=2082 + sudo dd if=spl/u-boot-spl.bin of=/dev/sdX seek=34 + sudo dd if=u-boot.itb of=/dev/sdX seek=2082 Booting ------- From 5e1df33b68212f2bcafc26fc460e82687cd23927 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 1 Aug 2021 22:09:44 +0200 Subject: [PATCH 4/7] doc: add missing board/ti/index.rst Commit 8baeeecbe305 ("doc: board: Move j721e document to doc/board/ti/ directory") introduced 'make htmldocs' build errors due to a missing file board/ti/index.rst. Fixes: 8baeeecbe305 ("doc: board: Move j721e document to doc/board/ti/ directory") Signed-off-by: Heinrich Schuchardt --- doc/board/ti/index.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/board/ti/index.rst diff --git a/doc/board/ti/index.rst b/doc/board/ti/index.rst new file mode 100644 index 0000000000..c0da04b109 --- /dev/null +++ b/doc/board/ti/index.rst @@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Texas Instruments +================= + +.. toctree:: + :maxdepth: 2 + + j721e_evm From 89a5fbbea1e344fb7e43ce4c547fbdf1ae8d81de Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 1 Aug 2021 22:11:39 +0200 Subject: [PATCH 5/7] doc: handle 'make htmldocs' warnings as errors Parameter -W for sphinx-build turns build warnings into errors. This helps us to avoid bad patches passing Gitlab CI. Signed-off-by: Heinrich Schuchardt --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 683e4b5609..050d9dd239 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -6,7 +6,7 @@ subdir-y := # You can set these variables from the command line. SPHINXBUILD = sphinx-build -SPHINXOPTS = +SPHINXOPTS = -W SPHINXDIRS = . _SPHINXDIRS = $(patsubst $(srctree)/doc/%/conf.py,%,$(wildcard $(srctree)/doc/*/conf.py)) SPHINX_CONF = conf.py From c0b6f7d4b843a850eb60382e5d664ac6904e707a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 1 Aug 2021 23:29:20 +0200 Subject: [PATCH 6/7] doc: add graphviz imagemagick as build dependencies 'make htmldocs' requires graphviz and imagemagick (at least with Sphinx 3.5.4). Signed-off-by: Heinrich Schuchardt --- doc/build/gcc.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst index 8ffb4e3447..e03e0b9460 100644 --- a/doc/build/gcc.rst +++ b/doc/build/gcc.rst @@ -24,9 +24,9 @@ Depending on the build targets further packages maybe needed .. code-block:: bash sudo apt-get install bc bison build-essential coccinelle \ - device-tree-compiler dfu-util efitools flex gdisk liblz4-tool \ - libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev libssl-dev \ - lz4 lzma lzma-alone openssl python3 python3-coverage \ + device-tree-compiler dfu-util efitools flex gdisk graphviz imagemagick \ + liblz4-tool libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev \ + libssl-dev lz4 lzma lzma-alone openssl python3 python3-coverage \ python3-pycryptodome python3-pyelftools python3-pytest \ python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme python3-virtualenv \ swig From 78e6b871fdcf4bb86c6d7292a0e5d4a98e1435b6 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 2 Aug 2021 08:21:12 +0200 Subject: [PATCH 7/7] efi_loader: typo cerificate %s/cerificate/certificate/ Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 9b369430e2..08469d9cd9 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -23,7 +23,7 @@ endif ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y) EFI_CAPSULE_KEY_PATH := $(subst $\",,$(CONFIG_EFI_CAPSULE_KEY_PATH)) ifeq ("$(wildcard $(EFI_CAPSULE_KEY_PATH))","") -$(error .esl cerificate not found. Configure your CONFIG_EFI_CAPSULE_KEY_PATH) +$(error .esl certificate not found. Configure your CONFIG_EFI_CAPSULE_KEY_PATH) endif endif