aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-07-03buildman: Make mrproper an argument to run_commit()Simon Glass1-8/+10
Pass this in so the caller can change it independently of the member variable. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03buildman: Make mrproper an argument to _config_and_build()Simon Glass1-4/+6
Pass this in so the caller can change it independently of the member variable. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03buildman: Make mrproper an argument to _reconfigure()Simon Glass1-3/+5
Pass this in so the caller can change it independently of the member variable. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03x86: Set up some assumed sizes for binary blobsSimon Glass1-0/+5
Add assumed sizes so that Binman can check that the U-Boot binaries do not grow too large. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03binman: Make Intel ME default to position 0x1000Simon Glass1-1/+1
This cannot ever go at offset 0 since the descriptor is there. Use a better offset for the ME, as used by link and coral, for example. This matters when we start using assumed sizes for missing blobs. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03binman: Support an assumed size for missing binariesSimon Glass6-1/+74
Binman has a the useful feature of handling missing external blobs gracefully, including allowing them to be missing, deciding whether the resulting image is functional or not and faking blobs when this is necessary for particular tools (e.g. mkimage). This feature is widely used in CI. One drawback is that if U-Boot grows too large to fit along with the required blobs, then this is not discovered until someone does a 'real' build which includes the blobs. Add a 'assume-size' property to entries to allow Binman to reserve a given size for missing external blobs. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03binman: Update the entrydocs headerSimon Glass1-1/+1
Reduce the length of the underline for this header, to match the heading itself. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03binman: ti: Regenerate entry docsSimon Glass2-22/+58
Correct formatting errors in the documentation. Regenerate the entries.rst file to include this recent addition. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03binman: Regenerate nxp docsSimon Glass1-0/+22
Regenerate the entries.rst file to include this recent addition. Note that more docs are needed here, to actually describe the entry type. Note also that the entry type needs Binman tests added. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03binman: efi: Correct entry docsSimon Glass3-59/+61
Somehow the class documentation has got out of sync with the generated entries.rst file. Regenerating it causes errors, so correct these and regenerate the entries.rst file. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 809f28e7213 ("binman: capsule: Use dumped capsule header...")
2024-07-03configs: enable setvariable at runtime on sandboxIlias Apalodimas2-0/+2
We currently don't have any boards enabling CONFIG_EFI_RT_VOLATILE_STORE. We do have EFI selftests testing the feature though, so enable it in all the sandbox platforms and test the functionality properly Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-07-03sandbox: cleanup linker scripts and sectionsIlias Apalodimas3-30/+5
commit 6e2228fb052b ("Merge patch series "Clean up arm linker scripts"") was cleaning up linker scripts for armv7 and v8 in a similar fashion. Several commits in the past -- e.g commit d0b5d9da5de2 ("arm: make _end compiler-generated") was moving symbols to be compiler generated. They were defined as c variables in its own section to force the compiler emit relative a reference. However, defining those in the linker script will do the same thing since [0]. So let's remove the special sections from the linker scripts, the variable definitions from sections.c, and define them as a symbols. It's worth noting that the linker was discarding the symbols in the older binary completely since the symbol definition had an extra _. - new binary $~ aarch64-linux-gnu-readelf -sW u-boot | grep efi_runtim 246: 000000000004acbe 13 FUNC LOCAL DEFAULT 14 vbe_req_efi_runtime_rand 3198: 0000000000318690 16 OBJECT LOCAL DEFAULT 29 efi_runtime_mmio 6359: 00000000000dedff 217 FUNC LOCAL DEFAULT 14 efi_runtime_relocate 7942: 00000000003074c0 136 OBJECT GLOBAL HIDDEN 29 efi_runtime_services 8869: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_rel_stop 9159: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_stop 9410: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_start 10137: 00000000005981bd 0 NOTYPE WEAK HIDDEN 33 efi_runtime.c.de5bed54 10470: 0000000000305e20 0 NOTYPE GLOBAL DEFAULT 27 __efi_runtime_rel_start - old binary $~ aarch64-linux-gnu-readelf -sW u-boot.old | grep efi_runtim 246: 000000000004acbe 13 FUNC LOCAL DEFAULT 14 vbe_req_efi_runtime_rand 3198: 0000000000318690 16 OBJECT LOCAL DEFAULT 29 efi_runtime_mmio 6359: 00000000000dedff 221 FUNC LOCAL DEFAULT 14 efi_runtime_relocate 7942: 00000000003074c0 136 OBJECT GLOBAL HIDDEN 29 efi_runtime_services 10135: 0000000000598320 0 NOTYPE WEAK HIDDEN 33 efi_runtime.c.de5bed54 $~ bloat-o-meter u-bool.old u-boot add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-4 (3) Function old new delta efi_memory_init 343 350 +7 efi_runtime_relocate 221 217 -4 Total: Before=2009902, After=2009905, chg +0.00% [0] binutils commit 6b3b0ab89663 ("Make linker assigned symbol dynamic only for shared object") Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> # sandbox_defconfig on amd64, arm64, riscv64 Reviewed-by: Simon Glass <sjg@chromium.org> Fixes: commit aac53d3d96a2 ("sandbox: Rename EFI runtime sections") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-07-03dm: core: fix typo in SPL_DM_WARN prompt textQuentin Schulz1-1/+1
It should read "in SPL" and not "wuth SPL". Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03dm: core: migrate debug() messages to use dm_warnQuentin Schulz10-143/+149
Prior to that, seeing the debug() messages required to enable DM_DEBUG which defines DEBUG (and then _DEBUG) which in turn makes failing assert() calls reset U-Boot which isn't necessarily what is desired. Instead, let's migrate to dm_warn which is using log_debug when unset or log_warn when set. While at it, reword the DM_DEBUG symbol in Kconfig to explain what it now actually does. Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03dm: core: fix signedness in debug messagesQuentin Schulz1-5/+5
outp always point to an unsigned type in ofnode_read_u* functions but the format specifier is currently always using signed type. This is an issue since the signed type can only contain half of the unsigned type values above 0. However, this now breaks another usecase. Indeed, ofnode_read_s32_default is actually passing an s32 but it'll be printed as a u32 instead. But since the function is called u32, it makes more sense to have it print an unsigned value. This was discovered because arm,smc-id = <0x82000010>; on RK3588S is above the max signed value and therefore would return a negative signed decimal value instead of its proper unsigned one. Fixes: fa12dfa08a7b ("dm: core: support reading a single indexed u64 value") Fixes: 4bb7075c830c ("dm: core: support reading a single indexed u32 value") Fixes: 7e5196c409f1 ("dm: core: Add ofnode function to read a 64-bit int") Fixes: 9e51204527dc ("dm: core: Add operations on device tree references") Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03dm: core: fix misleading debug message when matching compatibleQuentin Schulz1-3/+2
A driver can have multiple compatible. When the id->compatible matches for that driver, the first compatible supported by the driver is currently returned, which gives the following confusing message: - found match at 'rk3588_syscon': 'rockchip,rk3588-sys-grf' matches 'rockchip,rk3588-pmugrf' Considering that the compatible passed in argument is necessarily the one that exactly matched to enter this code path, there's no need to do some elaborate logic, just print the driver name and the compatible passed in argument. Fixes: d3e773613b6d ("dm: core: Use U-Boot logging instead of pr_debug()") Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03tools: patman: fix deprecated Python ConfigParser methodsBrandon Maier1-4/+4
The method `ConfigParser.readfp()` is marked deprecated[1]. In Python 3.12 this method have been removed, so replace it with `ConfigParser.read_file()`. [1] https://docs.python.org/3.11/library/configparser.html#configparser.ConfigParser.readfp Signed-off-by: Brandon Maier <brandon.maier@collins.com> CC: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03tools: binman: fix deprecated Python ConfigParser methodsBrandon Maier1-1/+1
The method `ConfigParser.readfp()` is marked deprecated[1]. In Python 3.12 this method have been removed, so replace it with `ConfigParser.read_file()`. [1] https://docs.python.org/3.11/library/configparser.html#configparser.ConfigParser.readfp Signed-off-by: Brandon Maier <brandon.maier@collins.com> CC: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03tools: binman: fix deprecated Python unittest methodsBrandon Maier5-86/+86
The methods `unittest.assertEquals()` and `unittest.assertRegexpMatches()` are marked deprecated[1]. In Python 3.12 these aliases have been removed, so do a sed to replace them with their new names. [1] https://docs.python.org/3.11/library/unittest.html#deprecated-aliases Signed-off-by: Brandon Maier <brandon.maier@collins.com> CC: Simon Glass <sjg@chromium.org> CC: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03global_data.h: drop write-only field dm_root_fRasmus Villemoes3-7/+1
The dm_root_f field seems to be entirely write-only and hence redundant, unless 'git grep' fails to find some access generated via preprocessor token concatenation or similar. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03sandbox: enable support for the unlz4 commandJonathan Liu1-1/+3
This does not work with sandbox at present. Fix it up to use map_sysmem() to convert an address to a pointer. Signed-off-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Fix conflict and reformat to 80cols: Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03patman: Add a tag for when a patch gets added to a seriesSean Anderson5-0/+22
When a patch is added to a series after the initial version, there are no changes to note except that it is new. This is typically done to suppress the "(no changes in vN)" message. It's also nice to add a change to the cover letter so reviewers know there is an additional patch. Add a tag to automate this process a bit. There are two nits with the current approach: - It favors '-' as a bullet point, but some people may prefer '*' (or something else) - Tags (e.g. 'patman: ' in 'patman: foo bar') are not stripped. They are probably just noise in most series, but they may be useful for treewide series to distinguish 'gpio: frobnicate' from 'reset: frobnicate', so I've left them in. Suggestions for the above appreciated. Suggested-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Douglas Anderson <dianders@chromium.org>
2024-07-03patman: Add Commit-cc as an alias for Patch-ccSean Anderson5-2/+9
Most tags referring to commits (or patches) are named Commit-something. The exception is Patch-cc. Add a Commit-cc alias so we can use whichever one is convenient. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2024-07-03patman: Fix tests if add_maintainers is set to FalseSean Anderson1-1/+2
If add_maintainers is set to False in the user's ~/.patman config, it will cause the custom_get_maintainer_script to fail since that test expects maintainers to be added. Set add_maintainer to True in the .patman config to prevent this. Fixes: 8c042fb7f9f ("patman: add '--get-maintainer-script' argument") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03acpi: set creator_revision in acpi_fill_headerHeinrich Schuchardt4-6/+2
We should have a single place where we write the default value to the creator revision field. If we ever will have any table created by another tool, we can overwrite the value afterwards. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-07-03sandbox: use sane access rights for filesHeinrich Schuchardt1-3/+3
When writing an executable, allowing other users to modify it introduces a security issue. Generally we should avoid giving other users write access to our files by default. Replace chmod(777) by chmod(755) and chmod(644). Fixes: 47f5fcfb4169 ("sandbox: Add os_jump_to_image() to run another executable") Fixes: d9165153caea ("sandbox: add flags for open() call") Fixes: 5c2859cdc302 ("sandbox: Allow reading/writing of RAM buffer") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2024-07-01Merge branch 'next'Tom Rini6229-52965/+91307
2024-07-01Prepare v2024.07v2024.07Tom Rini3-13/+908
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-01configs: Resync with savedefconfigTom Rini8-32/+22
Rsync all defconfig files using moveconfig.py Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-01Merge tag 'u-boot-amlogic-20240701' of ↵Tom Rini9-56/+35
https://source.denx.de/u-boot/custodians/u-boot-amlogic into next - Switch meson dwc3/usb PHY to set_mode callback for switching USB mode
2024-06-30Revert "Merge patch series "zlib: Address CVE-2016-9841""Tom Rini7-90/+151
This series brings our zlib code more up to date. However, it drops an important performance improvement that is required on some of our supported platforms in order to boot Linux before the watchdog resets the system. Furthermore, the "post increment" version of this performance loop was not tested, so while we can fix it, it would then require re-testing all platforms. At this point in time, we will revert updating zlib (which has had a potential security issue since 2016) and fix this in the v2024.10 release. This reverts commit 4914263c9a14315390d3ccc4816cf3a94cfd156d, reversing changes made to ef8ef5f77c9a998f76a48277a883af1645b54117. Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-06-30Merge tag 'efi-2024-10-rc1' of ↵Tom Rini18-1079/+1386
https://source.denx.de/u-boot/custodians/u-boot-efi into next Pull request efi-2024-10-rc1 Documentation: Update requirements.txt to use current Python module versions Add a page describing debugging U-Boot with GDB FIT: describe data-size as a conditionally mandatory property Correct link to FIT specification in SPL code. Correct kaslrseed command long text description UEFI: Add unit test checking that don't have kaslr-seed when measuring boot Deduplicate code for measured boot. Other: Print size information in fwu command
2024-06-30doc: develop: Add a general section on gdb usageAlexander Dahl2-0/+172
Mashed up from different sources linked below, including the now gone Wiki and doc/README.arm-relocation file. Tested on a custom board with AT91 SAMA5D2 SoC and Segger J-Link Base adapter. This is only generic advice here, the usage is not board specific. Some board docs have more specific instructions on using gdb with a particular board. Link: https://www.slideshare.net/slideshow/embedded-recipes-2019-introduction-to-jtag-debugging/177511981 Link: https://boundarydevices.com/debugging-using-segger-j-link-jtag/ Link: https://web.archive.org/web/20141224200032/http://www.denx.de/wiki/view/DULG/DebuggingUBoot Link: https://web.archive.org/web/20141206064148/http://www.denx.de/wiki/view/DULG/GDBScripts1 Suggested-by: Marek Vasut <marex@denx.de> Signed-off-by: Alexander Dahl <ada@thorsis.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-30doc: fit: Make data-size a conditionally mandatory propertyBastian Germann1-3/+3
Before 9d0750064e (doc: Move external FIT docs into the main body), the FIT property data-size was not a mandatory property and still it is not expected to be set alongside the data property. Move the data-size property to the "Conditionally mandatory property" section, where it actually belongs. Signed-off-by: Bastian Germann <bage@debian.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-30tpm: allow the user to select the compiled algorithmsIlias Apalodimas4-22/+87
Simon reports that after enabling all algorithms on the TPM some boards fail since they don't have enough storage to accommodate the ~5KB growth. The choice of hash algorithms is determined by the platform and the TPM configuration. Failing to cap a PCR in a bank which the platform left active is a security vulnerability. It might allow unsealing of secrets if an attacker can replay a good set of measurements into an unused bank. If MEASURED_BOOT or EFI_TCG2_PROTOCOL is enabled our Kconfig will enable all supported hashing algorithms. We still want to allow users to add a TPM and not enable measured boot via EFI or bootm though and at the same time, control the compiled algorithms for size reasons. So let's add a function tpm2_allow_extend() which checks the TPM active PCRs banks against the one U-Boot was compiled with. We only allow extending PCRs if the algorithms selected during build match the TPM configuration. It's worth noting that this is only added for TPM2.0, since TPM1.2 is lacking a lot of code at the moment to read the available PCR banks. We unconditionally enable SHA1 when a TPM is selected, which is the only hashing algorithm v1.2 supports. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> # chromebook-link
2024-06-30tpm: Untangle tpm2_get_pcr_info()Ilias Apalodimas5-56/+86
This function was used on measured boot to retrieve the number of active PCR banks and was designed to work with the TCG protocols. Since we now have the need to retrieve the active PCRs outside the measured boot context -- e.g use the in the command line, decouple the function. Create one that will only adheres to TCG TSS2.0 [0] specification called tpm2_get_pcr_info() which can be used by the TPM2.0 APIs and a new one that is called from the measured boot context called tcg2_get_pcr_info() [0] https://trustedcomputinggroup.org/wp-content/uploads/TSS_Overview_Common_Structures_Version-0.9_Revision-03_Review_030918.pdf Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-30efi_loader: remove unneeded header filesIlias Apalodimas1-1/+0
efi_tcg2.h already includes tpm-v2.h. Remove it Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-30tpm: Move TCG functions into a separate fileIlias Apalodimas5-864/+887
The previous patch is moving the TPM TCG headers in their own file for a cleaner API. Move the functions in their own file as well. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-30tpm: Move TCG headers into a separate fileIlias Apalodimas5-131/+149
commit 97707f12fdab ("tpm: Support boot measurements") moved out code from the EFI subsystem into the TPM one to support measurements when booting with !EFI. Those were moved directly into the TPM subsystem and in the tpm-v2.c library. In hindsight, it would have been better to move it in new files since the TCG2 is governed by its own spec, it's overeall cleaner and also easier to enable certain parts of the TPM functionality. So let's start moving the headers in a new file containing the TCG specific bits. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-30efi_loader: remove unused TCG algo definitionsIlias Apalodimas1-8/+0
commit 97707f12fdab ("tpm: Support boot measurements") moved some of the EFI TCG code to the TPM subsystem. Those definitions are now in tpm-v2.h. Let's remove the stale entries Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-30cmd: correct kaslrseed descriptionHeinrich Schuchardt1-1/+1
The number of random bytes generated is hard coded as 8. The command takes no argument. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-30efi_selftest: can't have measured device-tree with kaslr-seedHeinrich Schuchardt1-0/+7
Test that we don't have a /chosen/kaslr-seed property if we measure the device-tree. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-30spl: correct link to FIT specificationHeinrich Schuchardt1-1/+1
Replace the invalid link to the FIT file format specification. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-30doc: update requirements.txtHeinrich Schuchardt1-8/+8
Update all required Python packages to current release. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-30cmd: fwu: Also print information about sizeMichal Simek1-0/+1
It is useful when structure is also used for saving vendor data covered by CRC32. Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-28Merge patch series "automatically add /chosen/kaslr-seed and deduplicate code"Tom Rini6-115/+79
Tim Harvey <tharvey@gateworks.com> says: This series will automatically add /chosen/kaslr-seed to the dt if DM_RNG is enabled during the boot process. If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to randomize the virtual address at which the kernel image is loaded, it expects entropy to be provided by the bootloader by populating /chosen/kaslr-seed with a 64-bit value from source of entropy at boot. If we have DM_RNG enabled populate this value automatically when fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT is enabled as its implementation uses a different source of entropy that is not yet implemented as DM_RNG. We also skip this if MEASURED_BOOT is enabled as in that case any modifications to the dt will cause measured boot to fail (although there are many other places the dt is altered). As this fdt node is added elsewhere create a library function and use it to deduplicate code. We will provide a parameter to overwrite the node if present. For our automatic injection, we will use the first rng device and not overwrite if already present with a non-zero value (which may have been populated by an earlier boot stage). This way if a board specific ft_board_setup() function wants to customize this behavior it can call fdt_kaslrseed with a rng device index of its choosing and set overwrite true. Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now but left in place in case boot scripts exist that rely on this command existing and returning success. An informational message is printed to alert users of this command that it is likely no longer needed. Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for randomization and completely ignores the kaslr-seed for its own randomness needs (i.e the randomization of the physical placement of the kernel). It gets weeded out from the DTB that gets handed over via efi_install_fdt() as it would also mess up the measured boot DTB TPM measurements as well.
2024-06-28test: cmd: fdt: fix chosen test for DM_RNGTim Harvey1-0/+8
Now that kaslr-seed is automatically added to the chosen node if DM_RNG is enabled, adjust the test to expect this. Take care not to expect kaslr-seed for CONFIG_MEASURED_BOOT and CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT as we do not add it for those. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Cc: Michal Simek <michal.simek@amd.com> Cc: Andy Yan <andy.yan@rock-chips.com> Cc: Akash Gajjar <gajjar04akash@gmail.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Devarsh Thakkar <devarsht@ti.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Chris Morgan <macromorgan@hotmail.com>
2024-06-28use fdt_kaslrseed function to de-duplicate codeTim Harvey3-115/+8
Use the fdt_kaslrseed function to deduplicate code doing the same thing. Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now but left in place in case boot scripts exist that rely on this command existing and returning success. An informational message is printed to alert users of this command that it is likely no longer needed. Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for randomization and completely ignores the kaslr-seed for its own randomness needs (i.e the randomization of the physical placement of the kernel). It gets weeded out from the DTB that gets handed over via efi_install_fdt() as it would also mess up the measured boot DTB TPM measurements as well. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Michal Simek <michal.simek@amd.com> Cc: Andy Yan <andy.yan@rock-chips.com> Cc: Akash Gajjar <gajjar04akash@gmail.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Devarsh Thakkar <devarsht@ti.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Chris Morgan <macromorgan@hotmail.com> Acked-by: Michal Simek <michal.simek@amd.com>
2024-06-28fdt: automatically add /chosen/kaslr-seed if DM_RNG is enabledTim Harvey1-0/+9
If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to randomize the virtual address at which the kernel image is loaded, it expects entropy to be provided by the bootloader by populating /chosen/kaslr-seed with a 64-bit value from source of entropy at boot. If we have DM_RNG enabled populate this value automatically when fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT is enabled as its implementation uses a different source of entropy that is not yet implemented as DM_RNG. We also skip this if MEASURED_BOOT is enabled as in that case any modifications to the dt will cause measured boot to fail (although there are many other places the dt is altered). Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for randomization and completely ignores the kaslr-seed for its own randomness needs (i.e the randomization of the physical placement of the kernel). It gets weeded out from the DTB that gets handed over via efi_install_fdt() as it would also mess up the measured boot DTB TPM measurements as well. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Michal Simek <michal.simek@amd.com> Cc: Andy Yan <andy.yan@rock-chips.com> Cc: Akash Gajjar <gajjar04akash@gmail.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Devarsh Thakkar <devarsht@ti.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Chris Morgan <macromorgan@hotmail.com>
2024-06-28Add fdt_kaslrseed function to add kaslr-seed to chosen nodeTim Harvey2-0/+54
If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to randomize the virtual address at which the kernel image is loaded, it expects entropy to be provided by the bootloader by populating /chosen/kaslr-seed with a 64-bit value from source of entropy at boot. Add a fdt_kaslrseed function to accommodate this allowing an existing node to be overwritten if present. For now use the first rng device but it would be good to enhance this in the future to allow some sort of selection or policy in choosing the rng device used. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Michal Simek <michal.simek@amd.com> Cc: Andy Yan <andy.yan@rock-chips.com> Cc: Akash Gajjar <gajjar04akash@gmail.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Devarsh Thakkar <devarsht@ti.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Chris Morgan <macromorgan@hotmail.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>