Commit graph

97382 commits

Author SHA1 Message Date
Heinrich Schuchardt
590c1813a4 efi_loader: use include in ARM EFI linker script
Use the same include as arm64 for the linker script.

Adjust the 32-bit ARM PE-COFF header accordingly and harmonize it with the
64-bit ARM header.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-17 20:31:26 +01:00
Heinrich Schuchardt
216459d2cf efi_loader: correct SizeOfCode, SizeOfInitializedData
The fields SizeOfCode, SizeOfInitializedData, and SizeOfUninitializedData
are define in the PE-COFF specification [1].

* SizeOfCode must match the size of all .text sections.
* SizeOfInitializedData must match the size of all .data sections.
* SizeOfUninitializedData must match the size of all .bss sections.

We only have one .text and one .data section. SizeOfCode and
SizeOfInitializedData have to be calculated as the difference between
the end and the start of the respective section.

As we don't have any .bss sections in the generated EFI binaries.
SizeOfUninitializedData must remain 0.

[1] https://learn.microsoft.com/en-us/windows/win32/debug/pe-format

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-17 20:31:26 +01:00
Heinrich Schuchardt
6a628c1503 efi_loader: use INCLUDE in EFI linker scripts
Except for the architecture specific lines ARM and RISC-V can use the same
linker script. Move the common lines to an include.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-17 20:31:26 +01:00
Heinrich Schuchardt
6384229dc3 scripts/Makefile.lib: add -L option to LD command for EFI binaries
The linker uses the path specified with -L to search for linker scripts
and for linker script includes.

For out-of-tree builds specify the build directory with -L instead of
the absolute path of the linker script. This allows using an INCLUDE
statement.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-17 20:31:25 +01:00
Ilias Apalodimas
75fe33973c efi_loader: Fix section alignment on EFI binaries
When creating EFI binaries, the alignment of the text section isn't
correctly factored in. As a result trying to load signed EFI binaries
throws an error with:

efi_image_region_add() efi_image_region_add: new region already part of another
Image not authenticated

Running the binary through sbverify has a similar warning
sbverify ./lib/efi_loader/helloworld.efi
warning: gap in section table:
    .text   : 0x00001000 - 0x00001c00,
    .data   : 0x00002000 - 0x00002200,
gaps in the section table may result in different checksums
warning: data remaining[7680 vs 12720]: gaps between PE/COFF sections?
.....

If we include the alignment in the text section, the signed binary boots
fine, and the relevant sbverify warning goes away
sbverify ./lib/efi_loader/helloworld.efi
warning: data remaining[8704 vs 12720]: gaps between PE/COFF sections?
.....

We should look into the remaining warning at some point as well
regarding the gaps between PE/COFF sections.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-17 20:31:25 +01:00
Andy Yan
3e4eb3e259 doc: coolpi: Fix the defconfig name
The defconfig name should be: coolpi-cm5-genbook-rk3588_defconfig

Signed-off-by: Andy Yan <andyshrk@163.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-17 20:30:59 +01:00
Tom Rini
c11dc783fb Merge https://source.denx.de/u-boot/custodians/u-boot-riscv
CI: https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/24215

- RISC-V: Add "riscv,isa-extensions" and multi-letter extension parsing
  support
- RISC-V: Add default cache line size
- Board: Canaan: Add K230-CanMV support
- Board: VisionFive2: Split out target specific configuration
2025-01-17 08:27:40 -06:00
Tom Rini
ea3324b344 Merge tag 'u-boot-imx-master-20250116' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/24221

- Enable watchdog command on Capricorn board.
- Convert imx8m evk boards to BOOTSTD.
- Enable dynamic mmcdev setting on imx8m evk boards.
- Fix i.MX FDT cooling-device property corruption.
- Add OP-TEE support on Phycore i.MX8M boards.
2025-01-16 09:59:54 -06:00
Sébastien Szymanski
985268107d imx: fdt: fix cooling-device property corruption
The function disable_thermal_cpu_nodes() corrupts the cooling-device
property.
For example, booting an i.MX93 devices with only one A55 core (IMX93x1)
with the cooling-device property set to:

$ dtc -I dtb foo.dtb | grep cooling-device
cooling-device = <0x08 0xffffffff 0xffffffff 0x09 0xffffffff 0xffffffff>;

Linux shows the following error at boot:

[    1.715189] OF: /thermal-zones/cpu-thermal/cooling-maps/map0: could not find phandle 1083699869
[    1.723977] thermal_sys: Add a cooling_device property with at least one device
[    1.731285] thermal thermal_zone0: binding zone cpu-thermal with cdev thermal-devfreq-0 failed:-2

because the cooling-device property in the device tree passed to the
kernel is

$ dtc -I dtb /sys/firmware/fdt | grep cooling-device
cooling-device = <0x4097f29d 0x00 0xb05aef9d>;

The issue is because the wrong variable type is passed to the function
fdt_setprop() called in the function disable_thermal_cpu_nodes(). With
the variable type fixed, the error at boot is gone and the property is
properly set:

$ dtc -I dtb /sys/firmware/fdt | grep cooling-device
cooling-device = <0x08 0xffffffff 0xffffffff>;

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
2025-01-16 10:16:47 -03:00
Alexander Sverdlin
e06f6f4377 configs: capricorn_cxg3: Enable CMD_WDT
Capricorn boards have WDT (WDT_SIEMENS_PMIC) and U-Boot is not configured
to trigger the WDT. Enable the "wdt" command to be able to stop the WDT
from the command line.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2025-01-16 10:16:30 -03:00
Yannic Moog
99039271c0 doc: phytec: imx8mm: add OP-TEE documentation
Add instructions on how to build and package OP-TEE for the
phycore-imx8mm based boards. The build instructions are identical for
phyGATE-Tauri-L and phyBOARD-Polis.
Also fix missig '-' for TF-A build instructions.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
2025-01-16 10:16:02 -03:00
Yannic Moog
608023b1ef doc: phytec: imx8mp: add OP-TEE documentation
Add documentation for the phyBOARD-Pollux i.MX 8M Plus on OP-TEE
integration.
Also add missing '-' to TF-A build instruction while at it.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
2025-01-16 10:16:02 -03:00
Yannic Moog
142317ae07 phycore-imx8mm_defconfig: add optee load address
The phyCORE i.MX 8M Mini expects 0x56000000 address to load optee.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
2025-01-16 10:16:02 -03:00
Yannic Moog
128d09273d imx8mm-phygate-tauri-l_defconfig: add optee load address
The phyGATE-Tauri-L expects 0x56000000 address to load optee.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
2025-01-16 10:16:02 -03:00
Yannic Moog
30581197f0 phycore-imx8mp_defconfig: add optee load address
The phyBOARD-Pollux expects 0x56000000 address to load optee.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
2025-01-16 10:16:02 -03:00
Yannic Moog
015483904c arm: imx8m: add OP-TEE node
Add tee node in SoC u-boot device trees. Use a kconfig entry to specify
load and entry addresses for the op-tee image in the respective
defconfig.
Default IMX8M_OPTEE_LOAD_ADDR is supplied. To keep it simple, the same
addresses are used for each SoC as are defined in upstream tf-a
(BL32_BASE) [1].

[1] https://github.com/ARM-software/arm-trusted-firmware/tree/master/plat/imx/imx8m

Signed-off-by: Yannic Moog <y.moog@phytec.de>
2025-01-16 10:16:02 -03:00
Peng Fan
2b6601b18e gpio: adp5585: Update compatible string
i.MX93-11x11-EVK has switched to use upstream device tree, and use
"adi,adp5585". Since i.MX93-11x11-EVK is the only user of this driver,
so it is safe to drop "adp5585".

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
65bdb716d9 imx: imx93-11x11-evk: drop duplicated nodes
The upstream dts already has the lpi2c2 subnodes, so drop the duplicated
ones in u-boot dtsi.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
7050bd925f imx: imx8mq_evk: Switch to BOOTSTD
Move env to imx8mq_evk.env
Switch to support BOOTSTD with a bsp bootcmd as fallback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
838c2fffaa imx: imx8mq_evk: Enable dynamic settings to mmcdev and mmcroot
Enable dynamic settings to mmcdev and mmcroot for i.MX8MQ-EVK
Since we are here, clean up the including headers

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
c00e8e0f57 imx: imx8mq_evk: Drop DECLARE_GLOBAL_DATA_PTR
There is no gd used in the board file, so drop DECLARE_GLOBAL_DATA_PTR.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
74854d7750 imx: imx8mq_evk: Cleanup headers
Drop unused headers and sort the order.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
364ba68ed1 imx: imx8mm_evk: Switch to BOOTSTD
Move env to imx8mm_evk.env
Switch to support BOOTSTD with a bsp bootcmd as fallback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
fc7bb3decc imx: imx8mm_evk: Enable dynamic settings to mmcdev and mmcroot
Enable dynamic settings to mmcdev and mmcroot for i.MX8MM-EVK

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:42 -03:00
Peng Fan
f8ab31eae4 imx: imx8mn_evk: Switch to BOOTSTD
Move env to imx8mn_evk.env
Switch to support BOOTSTD with a bsp bootcmd as fallback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
35e43f7f75 imx: imx8mn_evk: Enable dynamic settings to mmcdev and mmcroot
Enable dynamic settings to mmcdev and mmcroot for i.MX8MN-EVK

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
07d5afc562 imx: imx8mn_evk: Drop DECLARE_GLOBAL_DATA_PTR
There is no users of global data in imx8mn_evk.c, drop it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
2b28dec8ad imx: imx8mn_evk: Cleanup headers
Drop unused headers and sort them

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
4718e8adaf imx: imx8mp_evk: Switch to BOOTSTD
Move env to imx8mp_evk.env.
Switch to support BOOTSTD with a bsp bootcmd as fallback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
d4e0105e58 imx: imx8mp_evk: Enable dynamic settings to mmcdev and mmcroot
Enable dynamic settings to mmcdev and mmcroot for i.MX8MP-EVK

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
4854b2777c imx: imx91_evk: switch to BOOTSTD
Switch to support BOOTSTD with a bsp bootcmd as fallback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
d489e27c35 imx: imx93_qsb: switch to BOOTSTD
Switch to support BOOTSTD with a bsp bootcmd as fallback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Peng Fan
a0df7f39a4 imx: imx93_evk: switch to BOOTSTD
Switch to support BOOTSTD with a bsp bootcmd as fallback.
Move the env to imx93_evk.env

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2025-01-16 10:15:41 -03:00
Junhui Liu
b3ce35900c doc: canaan: Add K230 CanMV board
Add description of compiling u-boot for K230 CanMV.

Since the vendor's u-boot-spl verifies u-boot header [1], it is
necessary to use the Python script from vendor to add the header to the
u-boot image.

[1] https://github.com/kendryte/k230_sdk/blob/v1.8/src/little/uboot/board/canaan/common/k230_board_common.h#L52

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:55:27 +08:00
Junhui Liu
9c402a54df riscv: canaan: k230_canmv: Add initial support
Add support for K230 CanMV board with serial console and usb otg
support. It can boot via vendor's u-boot-spl and boot into Linux
via tftp through the onboard RTL8152.

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:55:27 +08:00
Junhui Liu
78d9ce3e36 riscv: cpu: k230: Add support for Canaan Kendryte K230 SoC
Add Canaan K230 SoC with sysreset support, running without cache
enabled.

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:55:27 +08:00
Junhui Liu
a1135b7526 riscv: dts: canaan: Add basic device tree for K230 CanMV board
Add initial dts for K230-CanMV powered by Canaan Kendryte K230 SoC,
which has two RISC-V C908 cores, a big core with vector 1.0 extension
and a small core without vector extension.

This patch is basically comes from Linux Kernel [1] and it assumes
u-boot is running on the big core. Additionally, bootctl and reboot nodes
are added to support sysreset [2] and an clk_dummy node is added to
satisfy dependencies for usb [3].

Currently, u-boot is booted by the vendor's u-boot-spl. To meet the
requirements [4][5] of vendor's u-boot-spl for u-boot, a binman node with
mkimage child node is added here, which will compress u-boot.bin with
gzip and generate an image named "uboot" in the file u-boot-gz.img.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/log/?h=k230-basic
[2] https://github.com/kendryte/k230_sdk/blob/v1.8/src/big/rt-smart/kernel/bsp/maix3/board/interdrv/sysctl/sysctl_boot/sysctl_boot.c#L67
[3] https://lore.kernel.org/linux-riscv/tencent_AD84B436C2F31108B66B4739D6E306C5E80A@qq.com/
[4] https://github.com/kendryte/k230_sdk/blob/v1.8/src/little/uboot/board/canaan/common/k230_img.c#L306
[5] https://github.com/kendryte/k230_sdk/blob/v1.8/src/little/uboot/board/canaan/common/k230_img.c#L125

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:55:27 +08:00
Junhui Liu
892b31a1fb usb: dwc2: Add support for Canaan K230
Canaan Kendryte K230 SoC instantiates a dwc2 v4.30a core. This patch
adds the compatible for it.

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:55:27 +08:00
Yu-Chien Peter Lin
6be961a758 Kconfig: Add a default cache line size for RISC-V
The RISC-V ISA profile RVA23U64 requires extension Zic64b (Cache blocks
must be 64 bytes in size, naturally aligned in the address space).

Some RISC-V platforms do not define the d-cache line size through SYS_CACHE_SHIFT_n.
Set a default value of 64 bytes for such cases.

Signed-off-by: Yu-Chien Peter Lin <peter.lin@sifive.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:34:30 +08:00
Mayuresh Chitale
4492c8db60 riscv: Fallback to riscv,isa
Update the cpu probing to fallback to "riscv,isa" property if
"riscv,isa-extensions" is not available and modify the riscv CMO code
to use the block size that was probed during cpu setup.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:34:18 +08:00
Mayuresh Chitale
ab15e20ea9 riscv: Enhance extension probing
Enhance the existing extension probing mechanism by adding support for
more extensions and probing using the "riscv,isa" property. This patch
is ported from the latest upstream linux.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:34:18 +08:00
E Shattow
9c4d760637 riscv: dts: starfive: split out visionfive2 target specific configuration
Split out StarFive VisionFive2 multi-board target specific configuration
into starfive-visionfive2-binman.dtsi in preparation for removal of
jh7110-u-boot and jh7110-common-u-boot in part or whole as sent upstream.

Signed-off-by: E Shattow <e@freeshell.de>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-01-16 15:34:05 +08:00
Tom Rini
178f6ecb21 Merge patch series "bootstd: Support recording images"
Simon Glass <sjg@chromium.org> says:

This series provides a way to keep track of the images used in bootstd,
including the type of each image.

At present this is sort-of handled by struct bootflow but in quite an
ad-hoc way. The structure has become quite large and is hard to query.
Future work will be able to reduce its size.

Ultimately the 'bootflow info' command may change to also show images as
a list, but that is left for later, as this series is already fairly
long. So for now, just introduce the concept and adjust bootstd to use
it, with a simple command to list the images.

This series includes various alist enhancements, to make use of this new
data structure a little easier.

[trini: Drop patch 18 and 19 for now due to size considerations]

Link: https://lore.kernel.org/r/20241115231926.211999-1-sjg@chromium.org
2025-01-15 19:27:14 -06:00
Simon Glass
a3d0fadca6 bootstd: Export bootdev_get_from_blk()
Export this function so it can be used from other files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:43 -06:00
Simon Glass
d9055f5e4f bootstd: Add a simple command to list images
Add a new 'bootstd images' command, which lists the images which have
been loaded.

Update some existing tests to use it. Provide some documentation about
images in general and this command in particular.

Use a more realistic kernel command-line to make the test easier to
follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:42 -06:00
Simon Glass
59a9a14537 bootstd: Update cros bootmeth to record images
Record images loaded by this bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:42 -06:00
Simon Glass
ff4c9a4b6f Update bootmeth_alloc_other() to record images
Update this function to add the image to the list.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:42 -06:00
Simon Glass
985f9f7039 boot: Update pxe bootmeth to record images
Record images loaded by this bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:42 -06:00
Simon Glass
3ed218e2ff boot: Update extlinux pxe_getfile_func() to include type
Add a file-type parameter to this function and update all users. Add a
proper comment to the function which we are here.

This will allow tracking of the file types loaded by the extlinux
bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:42 -06:00
Simon Glass
ea7f88f313 bootmeth_efi: Check the filename-allocation in the network path
If the filename cannot be set we should give up. Add the missing error
check.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:42 -06:00