Commit Graph

306 Commits (257eedca0c729ae7341733306bc87d29b8113c28)

Author SHA1 Message Date
Alper Nebi Yasak 3d5bd034c5 coreboot: Add qemu_arm64_12mb board
Add a build for QEMU AArch64 virtual machine using U-Boot as payload.
Coreboot config is based on the following defconfig:

    CONFIG_CBFS_SIZE=0x00c00000
    CONFIG_BOARD_EMULATION_QEMU_AARCH64=y
    CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x20000
    CONFIG_COREBOOT_ROMSIZE_KB_12288=y
    CONFIG_UART_PCI_ADDR=0x0

The resulting ROM can be booted with a command line like:

    qemu-system-aarch64 \
        -machine virt,secure=on,virtualization=on \
        -cpu cortex-a53 -m 1G \
        -vga none -display none -serial stdio \
        -bios bin/qemu_arm64_12mb/uboot_*.rom

However, this is little more than a proof of concept because U-Boot
upstream is missing coreboot integration on non-x86 boards, which could
have been useful for e.g. a framebuffer.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak d14731beef u-boot: Add qemu_arm64_12mb board
Add a U-Boot payload build for the QEMU AArch64 virtual machine. The
config is same as upstream "qemu-arm64" defconfig, but SYS_TEXT_BASE is
set to 0x50000000 so that it doesn't conflict with coreboot. QEMU
auto-generates and passes a device-tree file to U-Boot at runtime,
there's no compile-time canonical version, so there's no need to set
REMAKE_ELF or OF_EMBED.

It's not immediately obvious if QEMU-specific drivers are available to
support display output, but most coreboot integration is unavailable
(depends on x86) and entire video subsystem is disabled in the U-Boot
upstream defconfig.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak b5a5801f7a coreboot: qemu_x86_12mb: Enable DRIVERS_UART_8250IO
U-Boot doesn't run on this board when this SuperIO serial driver is
disabled. Enable it.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 737573cee5 u-boot: Add qemu_x86_12mb build
Add a U-Boot build for the qemu_x86_12mb board. The config is a copy of
the upstream "coreboot" defconfig, but with OF_EMBED=y.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 1c62b003ad build/roms: Support using "u-boot" ELF file as U-Boot payload
U-Boot runtime configuration is done with a device-tree file, which is
built alongside the executable in the upstream build system, and must be
available to U-Boot at runtime.

This device-tree is normally not linked into the default "u-boot" ELF
file. So far we have been handling it by re-creating a "u-boot.elf" from
the raw binary parts by setting REMAKE_ELF, and using that as the
coreboot payload. Unfortunately, that fails to build for x86 boards,
more specificly the "coreboot" boards upstream.

It's also possible (but discouraged) to set OF_EMBED to embed the
device-tree file into the U-Boot itself, in which case we could use the
"u-boot" file as the payload on the "coreboot" boards. Add support for
using the "u-boot" file as the payload if "u-boot.elf" doesn't exist.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 6cabcec51d u-boot: Add video damage tracking patch series
Add a series posted to upstream mailing lists that makes the GRUB
text-mode console faster by implementing video damage tracking [1].
Refresh the config files to include its new VIDEO_DAMAGE Kconfig.

Patch 7/7 upstream has a tiny conflict with "Improve UEFI experience"
series we already have, but it's only in the diff context. No changes
other than fixing that.

[1] https://lore.kernel.org/u-boot/20220609225921.62462-1-agraf@csgraf.de/

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 38328b9394 u-boot: Set default revision to v2022.10
Set revision to the commit hash of the v2022.10 release, and run "make
olddefconfig" for all boards to refresh the configs.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak c798975de6 u-boot: Use a common tree
Merge all boards into a common "default" tree, currently for v2022.07.
This ends up applying the "Improve UEFI experience on DM_VIDEO" series
to everything, so refresh the configs for the new options.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 5b6bf2a826 build/roms: Don't rebuild crossgcc if it was already built
The roms_helper script skips building crossgcc-i386 if its target
directory exists. Skip it for other architectures as well.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak bee5054077 build/roms: Make coreboot crossgcc usable for payloads and modules
Add the coreboot-built cross-architecture toolchains to the PATH so that
modules and payloads can use them. When building for a foreign-arch
board, also export CROSS_COMPILE pointing to the appropriate prefix.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak a586356164 build/roms: Build 32-bit crossgcc for AArch64 as well
This re-applies commit a69855f7e4 ("Build 32-bit crossgcc for AArch64
as well") which was inexplicably reverted along with unrelated changes.
Mention in a comment that building crossgcc-arm is necessary for
AArch64.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 9fb4ecec62 build/roms: Don't build Memtest86+ when not specified by cmdline
When overriding which payloads will be built with the -p command line
argument, the roms_helper script builds the Memtest86+ payload before
checking if it should be disabled. Move the build command after the
command line override.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 4e3097b5e7 build/roms: Disable U-Boot when not in payloads specified by cmdline
When overriding which payloads will be built with the -p command line
argument, the roms_helper script doesn't disable the U-Boot payload.
Disable it in this case.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-10 14:19:00 +03:00
Alper Nebi Yasak 584210bd1f download/u-boot: Change to download target before running extra.sh
The U-Boot download script does its work from the repository root
instead going into the newly created dirs, unlike the coreboot
counterpart. It should run the board-specific extra.sh files with the
downloaded paths as their working directory. Do so by a subshell.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-09 16:50:29 +03:00
Alper Nebi Yasak 2b761f2f8a download/u-boot: Re-add usage text for no-argument form
The no-argument form of the U-Boot download script prepare trees for all
boards when run with no arguments, like the corresponding script for
coreboot. The usage text for this case was removed without any changes
to the corresponding code, assume it was by mistake and add it back.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-09 16:50:29 +03:00
Alper Nebi Yasak 71cf7f9db1 download/u-boot: Remove support for deleting git folders
Removing the git dirs was part of deblobbing, which Libreboot no longer
cares about. The variable that triggers it is no more. Remove the dead
code.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-12-09 16:50:29 +03:00
Leah Rowe b495aa0987 util/nvmutil: consistent parentheses on comparison 2022-12-08 21:34:19 +00:00
Leah Rowe 17fa25e5af util/nvmutil file reads: skip reading if errno!=0
*This condition will probably never be met, but it is theoretically
possible that the code could still fail at this point. Catch all errors,
and exit, ruthlessly.
2022-12-08 21:29:36 +00:00
Leah Rowe 27876c6421 util/nvmutil: return error when fstat() is -1
Another oversight in my error handling.
2022-12-08 21:20:53 +00:00
Leah Rowe 960af2d6e8 util/nvmutil: rhex(): fail if errno not zero
The code was only checking whether all of the bytes were read,
but there are other errors that can be caught via errno.

Enforce strict errno handling, when generating random
numbers for command `setmac`.
2022-12-07 22:30:55 +00:00
Leah Rowe 3d01cf28d6 util/nvmutil: minor code formatting cleanup 2022-12-05 03:26:18 +00:00
Leah Rowe a7ea70c77a build/release/roms: delete ME/MRC firmware in ROMs 2022-12-05 02:21:28 +00:00
Leah Rowe 0c33438063 build/boot/roms: remove errant code 2022-12-05 00:40:58 +00:00
Leah Rowe 33bbb36dc4 remove errant detail from comment 2022-12-05 00:19:21 +00:00
Leah Rowe 5586947499 delete build/release/u-boot-libre
this is a hangover from pre-osboot-merge libreboot. the idea
was to distribute fsdg uboot archives

lbmk has uboot support, and releases will simply
include uboot in the main src archive like with everything else
2022-12-05 00:14:53 +00:00
Leah Rowe 137b5434d7 remove logic for avoiding nonredistributable blobs
the --nuke option in ifdtool will be used instead, to nuke
the ME regions in specific rom sets (and cbfstool will be
used to delete mrc.bin files from rom sets)

the new method being implemented is heavier on disk io, but
simplifies lbmk, and disk io could still be optimised in
the following ways:

* when copying roms from boards with ME in them, use
  ifdtool --nuke to get filename.rom.new, and *move* (not copy)
  filename.rom.new to the new destination (for use with tar)

* possibly modify ifdtool to make efficient use of mmap for
  disk i/o; it currently loads entire roms into an allocated
  buffer in memory
2022-12-05 00:10:07 +00:00
Leah Rowe 7679c8e0f0 coreboot/default: add --nuke flag to ifdtool
e.g.

./ifdtool --nuke me coreboot.rom

this will be used by rom release build scripts, to scrub
stuff like intel me from the rom
2022-12-04 23:47:29 +00:00
Leah Rowe a5e4416a14 util/nvmutil: remove errant line break 2022-12-03 12:43:13 +00:00
Leah Rowe c100dd1f81 util/nvmutil: missing paretheses on if statement 2022-12-03 12:30:13 +00:00
Leah Rowe 036d710776 util/nvmutil: don't initialise rbuf unless needed
previously, it was always initialised, but now it's only
initialised if '?' is used on a mac address character in
command `setmac`

this is done by simply moving mac address character
randomisation to a separate function
2022-12-03 12:28:20 +00:00
Leah Rowe 851892b464 util/nvmutil: rename variable in hextonum 2022-12-03 12:17:16 +00:00
Leah Rowe 0bf3f1ed61 util/nvmutil: don't reallocate memory in hextonum 2022-12-03 12:11:15 +00:00
Leah Rowe e5a46b464d util/nvmutil: dont report bad size if /dev/urandom 2022-12-03 12:00:25 +00:00
Leah Rowe ededa5ddda util/nvmutil: rename variables in hextonum 2022-12-03 11:58:07 +00:00
Leah Rowe e2e321fc20 util/nvmutil: use BUFSIZ for rmac size in hextonum
I will be using this function elsewhere, and in general
I want this to be usable for lots of programs.
2022-12-03 11:55:38 +00:00
Leah Rowe a6d0112d86 util/nvtutil: fix out of bounds error
the error would have never been triggered, because it never
went over 11, but if this code were to be copied elsewhere,
it would be problematic
2022-12-03 11:49:52 +00:00
Leah Rowe 04ced693e8 update the README 2022-12-02 21:38:10 +00:00
Leah Rowe 85937f3f4c util/nvmutil: reset errno on cmd_swap
If one of the checksums was valid, but the other was not,
errno would be set to E_CANCELED, but then the buffer would
be modified anyway; this is acceptable behaviour, and errno
would later be reset writing the GBE file, which is done
only on the condition that the buffer was modified, but
it's also a good idea to reset it here just in case.

This is not a bugfix, and no behavioural changes will be
observed by the user, but this may *prevent* a bug in the
future, so let's pre-fix that bug now.
2022-12-01 13:16:05 +00:00
Alexei Sorokin ec082429ab scripts: avoid relying on spaces from sha1sum output 2022-11-29 20:26:35 +00:00
Leah Rowe 7c5334ca0e Merge branch 'hide-mei' of XRevan86/lbmk into master 2022-11-29 19:45:24 +00:00
Alexei Sorokin 69eaca2c6d coreboot: hide MEI on neutered-ME targets 2022-11-29 13:57:54 +03:00
Leah Rowe cf0522203d Merge branch 'master' of Arsen/lbmk into master 2022-11-29 01:24:30 +00:00
Leah Rowe 0c5dfddd64 Merge branch 'x230edp' of XRevan86/lbmk into master 2022-11-29 00:11:00 +00:00
Arsen Arsenović a40ba4ad11
t430_12mb: Add, based on x230_12mb
These boards are near-identical, this appears to suffice.
2022-11-28 22:38:20 +01:00
Alexei Sorokin a33e842908 coreboot: add x230edp_12mb, remove x230fhd_12mb
New x230edp_12mb target uses the
https://review.coreboot.org/c/coreboot/+/28950 patchset to add an
X230_EDP target to the default coreboot branch.
Consequently the "fhd" coreboot branch is no longer needed and has
been safely removed.
2022-11-28 23:33:58 +03:00
Leah Rowe e8eee6dd8a util/nvmutil: mild refactoring 2022-11-27 09:43:47 +00:00
Leah Rowe 342e5abe5e util/nvmutil: improved errno handling in main 2022-11-27 09:36:18 +00:00
Leah Rowe d7465efbb0 util/nvmutil: put hextonum in its own function 2022-11-27 09:29:37 +00:00
Leah Rowe 9e5ff5e4e6 util/nvmutil: move ENOTDIR check to function 2022-11-27 09:01:57 +00:00
Leah Rowe ff88cb1ac3 util/nvmutil: further improved errno handling 2022-11-27 00:48:37 +00:00