Commit graph

5,436 commits

Author SHA1 Message Date
Bill XIE
f3ca3aa16b util/cbfstool/cbfs-payload-linux: Copy segments when compression fails
When compression fails (usually due to larger result), we could retry
with memcpy() as in cbfs-mkpayload.c, instead of stopping immediately.

Signed-off-by: Bill XIE <persmule@hardenedlinux.org>
Change-Id: Id8b2cffef3832c4bad49bd722c9a5133735f61b0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87934
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-07-04 13:18:17 +00:00
Martin Roth
2739c4b773 SBOM: Change makefile to get versions from build.h
Builds using SBOM were failing in the release because we don't have a
git tree to get information from. We can't assume that the coreboot
source will always be in a git tree, so it needs to be updated. This
updates build.h to contain all the data that the SBOM wants and changes
the SBOM makefile to get its information from build.h which can generate
the required data in a number of different ways.

Change-Id: I59fba349d95cb0dcff7a31d335f4acb4f11c89c7
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88236
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Alicja Michalska <ahplka19@gmail.com>
2025-07-04 13:17:38 +00:00
Zhixing Ma
a9e97268fe crossgcc: Fix acpica base url version
Due to a recent acpica version upgrade, the acpica tool is now
failing to download due to an incorrect url. This commit aims to
fix the issue by updating the iasl base url to match the upgraded
version.

Change-Id: I7eddff2d17587f5d90295928800c10068c8cf281
Signed-off-by: Zhixing Ma <zhixing.ma@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88278
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2025-07-04 00:53:28 +00:00
smadhesu
e96bf7e094 soc/qc/x1p42100: Support to generate Bootblock as multi ELF
This commit performs below to create Bootblock binary.
1. createxbl.py: Converts "bootblock.raw.elf" to MBN (v7 format).
2. create_multielf.py: Concatenates TME SEQ, TME FW, QC_SEC and
bootblock into multi ELF binary.

BUG=b:415949107

TEST=Generate image.serial.bin and verify bootup on X1P42100

Change-Id: Icc499221d8806b549f6c873a14382a28c3efb74f
Signed-off-by: Sasirekaa Madhesu <smadhesu@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88241
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Pranava Y N <pranavayn@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-07-02 03:27:49 +00:00
smadhesu
ae5810e358 util/qualcomm: Add MBN v7 format support
The QCOM X1P42100 SoC requires images loaded by PBL in MBN v7
format. This script is updated to support MBN v7 format which will
be used to generate the Bootblock binary.

Starting with the Qualcomm x1p42100 SoC, the bootblock ELF header
expects MBN version 7 instead of version 6 with the SC7280 SoC. This
patch adds the necessary adjustment to ensure compatibility with older
SoC platforms and also adds incremental support for newer SoC
generations. If Qualcomm SoCs in the future demands a more advanced
version of MBN (version > 7), additional logic will be added to the
newly added section as `self.flash_parti_ver == 8`.

BUG=b:420542130, b:404985109

TEST=Create image.serial.bin with bootblock in MBN v7 format and
ensure it boots on X1P42100. Please refer to the steps mentioned
below to create final AP FW image for QC SoC X1P42100.

Step 1: Create Bootblock MBN image using createxbl.py script where the
newly added MBN v7 support will be used.

Step 2: Call create_multielf.py to create the concatenated multi ELF
( TME SEQ + TME FW + QC_SEC + BOOTBLOCK from step 1)

Step 3: Call nqgpt.py to create final GPT image.

Change-Id: I484df537ac7d1e51ec86dcae74a74dc211710616
Signed-off-by: Sasirekaa Madhesu <smadhesu@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88240
Reviewed-by: Pranava Y N <pranavayn@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
2025-07-02 03:27:39 +00:00
Elyes Haouas
0a94fcd2db crossgcc: upgrade binutils from version 2.43 to 2.44
Change-Id: Ic78053f55c59de7af16fca0265d0d23fadfb20f6
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86254
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-07-01 15:06:54 +00:00
Elyes Haouas
ef10e93e0a tree: Replace scan-build by clang-tidy
Change-Id: I0e59a1667759723bbf8d76232e7e5375837d2e9a
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87908
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-07-01 01:12:32 +00:00
Elyes Haouas
f1aa0a175b util/crossgcc: Build compiler-rt using runtimes
compiler-rt is not a variable used by the LLVM_ENABLE_PROJECTS config,
but has a separate configuration option.

Change-Id: Iacd9b5f1fc1444b3dd1a785b91510f346e7a2f51
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80737
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-30 04:22:23 +00:00
Elyes Haouas
b0e0c688c8 buildgcc: Use -d to check libstdc++ include directory
Change-Id: I3d8519557d99f6cb910e721643c1b4b2eab6bb05
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88231
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:21:35 +00:00
Elyes Haouas
f2fed71533 crossgcc: Upgrade acpica from 20241212 to 20250404
Change-Id: Iddd9c6f3510e80ee3ae39d86a10cd23e77dc0a05
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87342
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:20:52 +00:00
Elyes Haouas
07a8737cbd crossgcc:Initialize OPT_LDFLAGS to avoid unset variable in IASL build
Change-Id: Ibdad41baee8bb245112160be237f1081fbfc89c8
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88233
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:20:39 +00:00
Elyes Haouas
ad9bfd4243 crossgcc: Always update HOSTCFLAGS from GMP headers if already built
Change-Id: I332cdec6d56cf09b0380dbf43575ed2d5d45461a
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88232
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:20:05 +00:00
Elyes Haouas
c3f5d7c1ee crossgcc: Upgrade MPFR from 4.2.1 to 4.2.2
Change-Id: I5e8d8daa40d05652cacd1a5e355dff10e289d9d0
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86995
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:19:39 +00:00
Elyes Haouas
a3ea1cb542 util/crossgcc: Upgrade CMake from 3.31.3 to 4.0.3
Change-Id: I46f63e0b6c41f871ccff2454b2db8b99b765d4f5
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86975
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:18:50 +00:00
Elyes Haouas
f9cde87f5a crossgcc/buildgcc: Fix GMP-6.3.0 build with GCC 15 using proper prototypes
The old test code used outdated function declarations that break with
C23 in GCC 15. Instead of forcing C17 standard:

1. Add full prototype for g() function
2. Use 'void' for empty parameters
3. Clean up messy formatting

This keeps C23 compatibility while fixing the build.

Tested with GCC 15.1.0

The -std=gnu17 workaround is no longer needed.

Change-Id: I718a5ed5c11742b1c3448abf7198c96ac78bc98a
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87995
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:18:04 +00:00
Elyes Haouas
35d6ee9223 crossgcc/buildgcc: Remove invalid option for CMake
"--parallel" is not a valid option for CMake.

Change-Id: Idba76ce6a29e5d582ce49aa91ce4013aebc6d835
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88230
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2025-06-30 04:16:31 +00:00
Martin Roth
bd36a4a465 util/lint: Remove missing dirs from checkpatch linter
The mb/adlink directory no longer exists, so remove it from the list of
checked directories.
Add a check to make sure that the directory exists before trying to lint
it in the future.

Change-Id: I59874cb7356c2e8eeb8fc216f2930b3d8ef513c7
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88237
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-29 22:34:57 +00:00
Martin Roth
a0f2e42879 util/lint: Improve final newline check
- Change .inc to .mk. This was missed when renaming the makefiles.
- Verify that dirs/files exist before checking.
- Use $FINDOPTS to control search when not in a git repo.

Change-Id: If0d80403a3e799b8103164cc075601a50c33a8d9
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88238
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-29 22:34:38 +00:00
Martin Roth
6cb9efa19a util/lint: Ignore opensil for Kconfig linter
The Kconfig linter was browsing into the openSIL tree and reporting
issues for the release because it can't use git grep there. This change
explicitly tells the Kconfig linter to ignore the openSIL submodule.

Change-Id: Ia0399225cced9f199a6d2a90bc6c2af905ff4e99
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88235
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-29 22:33:50 +00:00
Martin Roth
5228b3ef7b util/lint: Ignore binary files for cb lowercase linter
The binary files were not being correctly filtered. This tells grep to
just ignore binary files. This isn't particularly important inside the
git tree, but for releases where we can't use git grep, it becomes an
issue.

Change-Id: I2852ea1e8b0f337aa5c78daa5e9dbd0c3d6768a9
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88234
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-29 22:33:23 +00:00
Elyes Haouas
58d450d2dc util/crossgcc/buildgcc: Reorganize toolchain version variables
Group the variables by toolchain (GCC vs Clang) and order them by
build sequence.

Change-Id: Ifd911b719882adf1d2e9211f6009b579f8177abe
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88227
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-29 10:03:25 +00:00
Maximilian Brune
6b7f697309 util/amdfwtool/amdfwread.c: Properly error out in relative_offset()
The addresses and their modes should now all be correct and we can
therefore treat the case where `addr` and `mode` do not match as an
actual error.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: Id12c29648c0437dd082b471689ec3649314dee1c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87298
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-28 16:23:51 +00:00
Maximilian Brune
4a99023e0f util/amdfwtool/amdfwread.c: Remove APOB_NV special case
There is no need to treat the APOB_NV binary special anymore, as
the mode and address should now always match for the APOB_NV address.
Since phoenix SOC generation this code even errors out on VBOOT
platforms, because APOB_NV address is actually a BIOS relative address.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I64d43e654e3694d7590edcba9a87c98367a7256c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87297
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-28 16:23:45 +00:00
Maximilian Brune
000ac2cc38 util/amdfwtool/amdfwtool.c: Use physical address for APOB_NV
In order to not change the actual binaries in too many ways,
commit a7eb390796 ("mb/*/*/*.fmd: Start flash at 0") kept the current
behaviour in which the address mode was set to ADDR_REL_BIOS, but the
address itself was actually a physical address. It has probably only
worked all these years, because PSP/ABL code did apparently ignore the
address mode for this specific binary for generations previous to
phoenix.

Assuming the address mode is actually ignored we might as well use the
right address mode corresponding to the address that is set. That way
tooling that is used to inspect this image is not completely confused.

This sets the ADDR_PHYSICAL address mode to all generations that have
the APOB NV quirk. It therefore only affects these generations (previous
to phoenix).

tested:
Check that the binary is identical on bilby, morphius, kahlee, onyx and
birman_plus. bilby, kahlee, onyx don't have an APOB_NV region. morphius
uses a physical address anyway and birman_plus doesn't have the
apob_nv_quirk.
Check that only the address mode is changed to ADDR_PHYSICAL (and the
checksum of the table) on guybrush, frostflow, crater, chausie.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: Ib2edfb27ba0fa316f1fbe31bc0ad8e2060a70f48
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87296
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-28 16:23:40 +00:00
Maximilian Brune
d0355cb647 util/amdfwtool: Move APOB_NV quirk to amdfwtool.c
This moves the code to amdfwtool.c, because the subsequent patch needs
it to be there in order to properly update the address_mode.

This patch should not change the binary in ANY way on any platform.

tested: Check that the binary is identical on guybrush, birman_plus,
frostflow, bilby, crater, grunt, myst, onyx_poc, morphius

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I9c64c67ff8b9656516344fdafbfd2254abfceeef
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87294
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-28 16:23:35 +00:00
Varadarajan Narayanan
0dcea61e7c cbfstool: Add multi ELF support
The current QCOM fixup function qualcomm_find_hash() assumes only one
ELF will be loaded by the primary boot loader and the bootblock is one
of the segments of that ELF.

However, the primary boot loader for QCOM X1P42100 SoC loads multiple
ELFs for QC_SEC, TME Sequencer, TME FW and bootblock. This change
updates the fixup functionality to handle bootblock being a separate
ELF.

If the bootblock offset does not fit within the first ELF, then the
fixup function understands that it is a multi ELF.

Additionally, it ensures the bootblock ELF uses MBN v7 format.

BUG=b:420542130

TEST=1. Create a image.serial.bin and ensure it boots on X1P42100
2. Used the following script to verify the hash
#! /bin/bash

image=/build/bluey/firmware/image-bluey.serial.bin
bin=/tmp/bb.bin
seg=/tmp/bb.seg
hash=/tmp/bb.hash

#
# Bootblock is the final ELF of the multi ELF. Hopefully
# there is no other ELF in ${image}. Get the offset of the
# final ELF in ${image} and get it out
#

bb_offset=`od -Ad -w4 -tx4 ${image} | grep 464c457f | tail -1 | cut -f1 -d ' '`

dd if=${image} of=${bin} skip=1 bs=${bb_offset} &> /dev/null

#
# The last two segments of the bootblock ELF have the actual
# executable and the hash. 'LOAD' is the executable segment and
# the other is the hash segment. Get their offsets and convert
# to decimal.
#
offs=`readelf -lW ${bin} | tail -2 | awk '{print $1" "$2" "$5}'`
offs=(`printf "%s %u %u %s %u %u" ${offs}`)

#
# Get the executable and hash segments
#
if [ ${offs[0]} = "LOAD" ]; then
        first=${seg}
        second=${hash}
else
        first=${hash}
        second=${seg}
fi

dd if=${bin} skip=${offs[1]} bs=1 count=${offs[2]} of=${first} &> /dev/null
dd if=${bin} skip=${offs[4]} bs=1 count=${offs[5]} of=${second} &> /dev/null

#
# Find the SHA384 hash for the executable segment
#
sha=`sha384sum ${seg} | cut -f1 -d ' ' | sed 's/../& /g'`

echo ===================================================
echo Expected hash:
echo
echo ${sha} | fold -w48
echo ===================================================
echo
hexdump -C ${hash} | grep -A4 "`echo ${sha} | cut -f1-4 -d ' '`"


Change-Id: If57ba0cc9a4f08b69d7712f27c215339307e73d4
Signed-off-by: Varadarajan Narayanan <vnarayan@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88148
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-26 16:56:14 +00:00
Sasirekaa Madhesu
6a02f2d4a7 util/qualcomm: Add script to concatenate ELF images
The PBL of QCOM X1P42100 SoC loads image in multi ELF format, which is
a concatenation of TME SEQ, TME FW, QC-SEC and Bootblock binaries.
This script stitches the binaries together into multi ELF image.

Usage: create_multielf.py [-h] -f IN_FILES [-o [OUT_FILE]]
Example: python create_multielf.py -f image1,image2,image3 -o output.bin

Change-Id: I9cdbdf6b5c62663491ccd7d42ab270742760aa0b
Signed-off-by: Sasirekaa Madhesu <smadhesu@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88145
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
2025-06-26 14:30:49 +00:00
Maximilian Brune
47f1b798e4 util/amdfwtool/amdfwtool.c: Remove APOB_NV src address check
The current approach has two problems:
- Just because the source address is 0 does not mean it is no
  specifically set. A bunch of mainboards specify their APOB_NV base
  address at 0 in their FMAP files.
- There is no AMD SOC that has support for this binary, but doesn't give
  AMDFWTOOL the base address. It would also not work considering that
  AMD common/block/apob code gets the region from the FMAP.

Therefore just remove the check since no mainboard will ever enter the
else branch.

tested: binary identical for at least 1 mainboard on each SOC
generation.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: Ic85d6b25c95ab12dbcc72d17158591891dd04e97
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87292
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-24 04:23:59 +00:00
Elyes Haouas
89e4fff2d3 crossgcc/buildgcc: introduce RISCV_ISA_SPEC for RISC-V ISA specification
Add RISCV_ISA_SPEC variable and replace hardcoded “20191213”.

Change-Id: I35c01a01998066dcafbd262cebd2f0c544983fa2
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87433
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2025-06-19 01:55:23 +00:00
Kapil Porwal
b369756680 util/qualcomm: Add script to extract a segment from ELF
Create a new script to extract
- ELF header
- Program header table (PHT)
- A given segment number
- Hash table segment with type as NULL and p_flags as 0x02000000
from an ELF.

Usage:

```
elf_segment_extractor.py [--eh] [--pht] [--segment <index>] [--hashtable]  <elf_file> <output_file>
```

BUG=b:419213272
TEST=Extract first segment alongwith ELF header and PHT.
TEST=Extract a segment with an index number.
TEST=Extract the last segment if index is 'N'.
TEST=Extract hash table segment alongwith ELF header and PHT.

e.g.
elf_segment_extractor.py --eh --pht --segment 0 cpucp.elf cpucp_meta
elf_segment_extractor.py --segment 0 cpucp.elf cpucp_meta
elf_segment_extractor.py --segment N cpucp.elf cpucp_meta
elf_segment_extractor.py --eh --pht --hashtable cpucp.elf cpucp_meta

Change-Id: I1ea58d0ca17ad66463ffe7345a27e91dc0d22d2f
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87888
Reviewed-by: Pranava Y N <pranavayn@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-17 03:57:49 +00:00
Jon Murphy
712dfb3761 Revert "util/cbmem: Consolidate CBMEM and coreboot table access"
This reverts commit c24a12db86.

Reason for revert: can't assume uint64_t or uintptr_t is a long. use proper printf modifiers instead.

```
cbmem.c:417:28: error: format specifies type 'unsigned long' but the argument
      has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
  417 |                 debug("Found at %#lx\n", address + i);
      |                                 ~~~~     ^~~~~~~~~~~
      |                                 %#llx
cbmem.c:50:40: note: expanded from macro 'debug'
   50 | #define debug(x...) if(verbose) printf(x)
      |                                        ^
cbmem.c:1321:21: error: format specifies type 'unsigned long' but the argument
      has type 'uintptr_t' (aka 'unsigned int') [-Werror,-Wformat]
 1321 |                         printf("%08lx:", start_address + i);
      |                                 ~~~~~    ^~~~~~~~~~~~~~~~~
      |                                 %08x
2 errors generated.
make: *** [<builtin>: cbmem.o] Error 1
```

Signed-off-by: Jon Murphy <jpmurphy@google.com>
Change-Id: I6e074b0c6c8247f85cd69d64c0e8584c5826e35a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88016
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Jakub "Kuba" Czapiga <czapiga@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-09 19:16:53 +00:00
Angel Pons
73cc8a413a treewide: Work around GCC 15 Werror=unterminated-string-initialization
GCC 15 added a new `unterminated-string-initialization` warning. Even
though crossgcc is still using GCC 14, some Linux distributions (e.g.
Arch Linux) already started shipping GCC 15. Given that coreboot uses
`-Werror` (warnings are errors), this new warning causes build errors
for things built using the host toolchain, such as utilities. In this
case, cbfstool is affected, which prevents building coreboot images.

The nonstring attribute is used to tell the compiler whether or not a
string is intentionally not null terminated. Since the attribute is
only included in GCC 15 for multidimensional character arrays (and even
later for clang) we need to check the GCC version before using the
attribute.

On GCC version prior to GCC 15 the nonstring attribute will not be used,
but that is not a problem since the unterminated-string-initialization
warning only exists since GCC 15. So you can still build on all GCC
versions as before. This way it also works if your host toolchain is GCC
15 (which builds commonlib code for cbfstool) and your coreboot cross
toolchain is GCC 14 (which builds commonlib code for coreboot).
Clang is a diffent matter. According to the documentation, the nonstring
attribute only exists in version 21 which is not yet released by LLVM.

TEST=Build qemu/Q35 successfully

Change-Id: I919d71cb2811e91869ba1ff493a0719ddcc86c36
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87825
Reviewed-by: Benjamin Doron <benjamin.doron00@gmail.com>
Reviewed-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-09 07:19:09 +00:00
Yidi Lin
c4eb645a0b update_submodules: Fix submodule path handling
There are two regressions introduced by CB:87823.

1. If the specified repo path has a tailing slash, `submodule` becames a
   empty variable due to `${submodule##*/}`, e.g.,

   `./util/scripts/update_submodules -R 3rdparty/arm-trusted-firmware/`

2. CB:87823 uses `git submodule status | cut -d ' ' -f 3` to retrieve
   all submodule paths. The script gets the wrong path if the format is
   wrong, e.g.,

-26c572974bcf7255930b0e9a51da3144ed0104b5 3rdparty/amd_blobs
 57ac3f74b34a3303f03deee264a1f2247c68008d 3rdparty/arm-trusted-firmware (v2.12.0-908-g57ac3f74b)
+5b7492979fc139efdfdc7f97ae53a2349798f160 3rdparty/cmocka (cmocka-1.1.5-263-g5b74929)

   The script gets the empty path for 3rdparty/amd_blobs and get
   cmocka-1.1.5-263-g5b74929 for 3rdparty/cmocka.

This patch fixes 1 by removing the tailing slash for the input directory
and fixes 2 by the below command.
   `git submodule foreach 'echo ${sm_path}'|grep -v Entering`

Note that `smp_path` is an environment variable[1] set by
`git submodule` when travelling the submodule directory.

[1]: https://git-scm.com/docs/git-submodule

Change-Id: I0016f3a867e2b4594788d71a790ff9a938121da5
Signed-off-by: Yidi Lin <yidilin@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87972
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-06 13:26:30 +00:00
Felix Singer
f2310ab35e update_submodules: Prefix commit title with relative path
It's common for coreboot commits to prefix the commit title with a
topic, which is often the path to the files or directories. So adjust
this commit title accordingly.

Change-Id: Ice267719a08b289b0d996fd20c993d616c812d00
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87824
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-06-06 13:13:17 +00:00
Maximilian Brune
471df8ca5e util/crossgcc/buildgcc: Fix GMP build on GCC 15
Currently building GMP with GCC 15 causes this error:
"configure: error: could not find a working compiler, see config.log
for details"

GCC 15 by default uses std=gnu23 but that causes the build of GMP to
fail. So hardcode it to always build GMP using std=gnu17.

Once GMP is fixed in their next release, we can remove this again.

source:
https://gmplib.org/list-archives/gmp-bugs/2024-November/005550.html

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I7813ff18e8e486bece503652af69de1db93958b2
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87650
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-06-05 22:53:36 +00:00
Jakub Czapiga
c24a12db86 util/cbmem: Consolidate CBMEM and coreboot table access
Provide common functions for accessing CBMEM and coreboot table entries
instead of mapping them manually in each function. New functions return
a copy of requested region as a heap-allocated buffer thus avoiding a
need for aligned memory access.
Remove global variables wherever possible to make code easier to read
and to isolate responsibilities of functions.
Use CBMEM entries instead of coreboot table records directly, but
provide fallback for old systems in case the correcponding CBMEM entry
does not exist.

BUG=b:391874512
TEST=cbmem -l; cbmem -x; cbmem -r 434f4e53; cbmem -t; cbmem -a 1200

Change-Id: I89b371e27ab3840cfbbd44880c32383b77f65e5c
Signed-off-by: Jakub Czapiga <czapiga@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87417
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2025-06-05 13:44:27 +00:00
Benjamin Doron
0251e98e9e util/amdfwtool: Do not attempt to continue processing --help
If the `--help` argument is passed, print the usage and immediately
return. This avoids printing errors about 'invalid config,' which
users don't specify when getting the usage information, and potentially
printing the usage a second time before exiting.

Change-Id: I18bf154ff5177fa0e0aa6a41f0d71980fed7ce55
Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87869
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
Reviewed-by: Alicja Michalska <ahplka19@gmail.com>
2025-06-04 17:33:46 +00:00
Felix Singer
7cbbf786cc update_submodules: Use relative paths to submodules
There doesn't seem to be much reason to use absolute paths to the
submodules, other than that it's not needed to change to the original
directory.

In preparation for CB:87824, make use of relative paths and change to
the original directory at the start of each iteration.

Change-Id: Ic74b589d933e6acd882fb9a09461bf7c01952a6f
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87823
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-05-27 15:09:51 +00:00
Felix Singer
d27e8ef460 update_submodules: Add an empty log line between each iteration
For better readability of the log output, add an empty line between each
iteration of the submodules.

Change-Id: I626b609e9833bffde0f7a5eb101877c6cd83a173
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87822
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-05-26 18:40:09 +00:00
Yu-Ping Wu
da45a88dd3 util/abuild: Fix checking of missing_arches
The commit f66c7c1037 ("util/abuild: Update echo to printf for
consistency") accidentally added whitespaces to the missing_arches
variable, causing the [[ -n "${missing_arches}" ]] check to fail.

The commit c81b08c4ba ("util/abuild: Fix building ChromeOS boards")
intended to fix it, but did it the wrong way.

Now, really fix the problem from the Makefile snippet that is causing
the whitespace issue.

Change-Id: I5e417e851840bad000492bf737fc8e25063fe0c4
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87809
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-05-23 19:54:29 +00:00
Yu-Ping Wu
c81b08c4ba util/abuild: Fix building ChromeOS boards
The commit 49ae935b37 ("util/abuild: Change [...] to [[...]] for
consistency") [1] accidentally replaced "\>" with ">" in a grep pattern,
causing all boards to be considered not supporting ChromeOS.

The commit f66c7c1037 ("util/abuild: Update echo to printf for
consistency") [2] replaced

 @echo $(foreach arch,$(REQUIRED_ARCHES),\
   $(if $(filter $(arch),$(SUBARCH_SUPPORTED)),,$(arch)))

with

 @printf "%s\n" "$(foreach arch,$(REQUIRED_ARCHES),\
   $(if $(filter $(arch),$(SUBARCH_SUPPORTED)),,$(arch)))"

and caused an additional whitespace character to be printed when all
required archs are supported. The result of the `missing_arches` shell
variable would be " ", and hence the `[[ -n "$missing_arches" ]]` check
would be wrong. Fix this by using `-z`.

[1] CB:87367
[2] CB:87368

Change-Id: Ib77566e70ac8b3717f3b29433ce9ae0a1fc69cce
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87708
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub "Kuba" Czapiga <czapiga@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
2025-05-16 07:18:52 +00:00
Martin Roth
24757047e5 util/abuild: Fix merge error
In CB:87370 (util/abuild: Use ${} around variable names),
commit id: a2baaec067, some lines were unintentionally reordered.

This led to abuild not working as intended.

Change-Id: I0aced8dde475f7338e4670c11a9cd1ec4502d743
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87681
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-05-15 00:06:47 +00:00
Keith Hui
e6dc71fe9f util/superiotool: Dump one more NCT6779D register
Nuvoton NCT6779D has an undocumented GPIOE# functionality similar
to that found in NCT6791D. Its latched status can be read from
LDN B register 0xfb. Add it to the roster of dumped registers to
help development.

Change-Id: Id050b8efde855dec8099f1ac35307f7d372ae499
Signed-off-by: Keith Hui <buurin@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87364
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-05-13 14:51:45 +00:00
Martin Roth
64fe6fd94a util/abuild: fix TODO and update targets variable to an array
Use an array instead of a variable as suggested by the TODO, so we can
remove the shellcheck disable and fix the warning.

Change-Id: I5e872ebe350f339b932a711fe7f6a68743f002ed
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87379
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-05-12 13:25:03 +00:00
Martin Roth
902288db22 util/abuild: Update version and date string
Increment the version number for the current changes.

Change-Id: Iec94067e34292df3b85744a820ace4aa198a6322
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87378
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-05-12 13:24:55 +00:00
Martin Roth
8504c796fc util/abuild: Remove obsolete FIXME
Change-Id: I51ca0acc18d052f464debaec96154ed07f639355
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87377
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-05-12 13:24:50 +00:00
Martin Roth
a8e1113e3b util/abuild: Check functions directly instead of with $?
Change-Id: I5d28e8f9533602a2ffbacd858c7380af08b56788
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87376
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-05-12 13:24:43 +00:00
Martin Roth
b128abcdad util/abuild: Add quotes around variables
Change-Id: I8822c8a5004b9b37cd3a7c4a981b52e8fbeba0e1
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87375
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-05-12 13:24:36 +00:00
Martin Roth
52b932df3b util/abuild: Group printfs to timestamps file together
This fixes the abuild warning/suggestion.

Change-Id: I3a28811becfde69c3e539406bde5938445f16c29
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87374
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-05-12 13:24:28 +00:00
Martin Roth
ad19c94d87 util/abuild: Fix shellcheck warnings about local vars
This fixes the shellcheck warnings about declaring and using local
variables at the same time.

Change-Id: Ia16911c9ea0a1b32c3480a93ca0e53a409e80d22
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87373
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-05-12 13:24:21 +00:00