Commit Graph

54 Commits (a4ea2867319471d9fe7d4ee540881e0286b4d3cf)

Author SHA1 Message Date
Leah Rowe a4ea286731 Remove most of Ferass's lbmk contributions
The primary purpose of my intense auditing has
been to improve lbmk's coding style and fix bugs
but there is a secondary purpose: know precisely
who owns what, because I want to re-license as
much as possible of lbmk under *MIT*, instead of
the current GNU licensing. MIT is vastly superior,
because it grants *actual* freedom to the user,
permits *sublicensing* and it is vastly more
compatible with other GPL combinations; for
example, MIT license is compatible with GPL2-only
whereas lbmk's current mix of GPLv3-or-later and
GPLv3-only is legally incompatible with GPLv2-only.

Re-licensing under MIT will most likely result in
more contributions to Libreboot's build system in
the future, especially as it will attract a lot
more commercial interest. Contrary to the popular
arguments, copyleft is a liability to the free
software movement and results in less code being
written; in practise, permissively licensed code
gets more public contributions, including from
commercial entities, even if companies can
theoretically make something proprietary out of
it (in practise, anyone inclined can just use the
upstream and proprietary forks almost always die).

Copyleft propaganda is fundamentally flawed. See:
<https://unixsheikh.com/articles/the-problems-with-the-gpl.html>

Anyway, I've been doing a combination of:

* Seeking permission from other copyright holders,
  for re-licensing
* Deleting, or moving, other contributions; for
  example, splitting certain contributions into
  separate files so that originally modified files
  become unencumbered. This latter solution is a
  result of *code cleanup* arising from the audit.

For Ferass's contributions, I opted to seek
*permission*, and permission was denied. In full compliance
with this legal imperative, I'm acting accordingly; this
commit removes all of Ferass's changes that converted lbmk
to posix shell scripts, thus removing his copyright on the
affected files, bypassing his authority entirely. Therefore,
lbmk is largely now bash-dependent. In practise, nobody is
going to use anything other than a GNU system to build
Libreboot, because many projects that Libreboot makes use
of rely heavily on GNU; for example, coreboot's build
system makes heavy use of GNU-specific extensions in *GNU
Make*, and likely contains many bashisms. Of course,
Libreboot also compiles GNU GRUB.

I would much rather have MIT-licensed Bash scripts
than GPL-licensed posix SCL scripts.

This reverts the changes from Ferass El Hafidi,
for the following commits, with some exceptions:

* 7f5dfebf7d
* f787044642

Exception:

download/mrc not reverted, because that was
already a fork of an existing script under
coreboot's build system, and their script was
GPLv2. i cannot/will not re-license this file
(ergo,
7f5dfebf7d
change remains intact, on this file)

resources/scripts/build/boot/roms_helper, these changes
have been kept:
* 7e6691e9 - Add ARMv7 and AArch64 support
* dec2d720 - add myself in the build/roms_helper script
	(added 2021 copyright for the change below)
* b7405656 - Workaround for grub's slow boot
^ these changes will be re-factored, splitting them
  out of the file into a new file. This will be done in
  a future lbmk revision. (in some cases, it makes sense
  to keep a change but split it, allowing the main file to
  be re-licensed without the change in it)

This is part of a much larger series of
licensing audits. It's likely that lbmk will
be posix-compliant (in its shell scripts)
again some day, because I'm planning to rewrite
most of these scripts (the ones modified in this
patch), and many of them (e.g. individual download
scripts) are subject to future deletion in a planned
overhaul of the download logic for third party
projects.

In addition: these changes are being kept (no attempt
to re-license them will be made):

* cff081c6 - Fix grub's slow boot (1 year, 5 months ago) <Vitali64>
* 4c851889 - Add macbook*1 16mb configs (1 year, 6 months ago) <Vitali64>

Ferass's work that remains will be split into dedicated
files containing them, where feasible.

In the case of grub.cfg (for GNU GRUB), I don't care
because it's a script for an engine (GRUB shell) that's
under GPL anyway, so who really cares about MIT license.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-27 08:10:50 +01:00
Leah Rowe c8dfc3ccaa build/build/roms: simplify mkCoreboot() arguments 2023-05-13 03:06:55 +01:00
Leah Rowe d8a8a1c622 build/boot/roms: don't use subshells frivilously
use make -BC instead of cd
2023-05-13 02:52:42 +01:00
Leah Rowe 834be77c1d build/boot/roms: remove errant debug line
i added this in the last revision

it was put there to debug something that
i fixed before pushing
2023-05-13 02:36:09 +01:00
Leah Rowe 39c143989c build/boot/roms: simplify build_rom_images() 2023-05-13 02:32:44 +01:00
Leah Rowe 65dfdd56da build/boot/roms: use fast dd command for ich9m ifd
bs 12k and count 1, rather than bs 1 and count 12k
2023-05-13 01:38:59 +01:00
Leah Rowe 6a4ce66f6e build/boot/roms: don't run ich9gen twice 2023-05-13 01:34:29 +01:00
Leah Rowe 1e9ed989d3 build/boot/roms: simplify moverom() 2023-05-13 01:27:00 +01:00
Leah Rowe 5811e53e82 build/boot/roms: remove unused legacy code
this cuttype is no longer used

lbmk creates truncated me setups now, on ifd platforms
2023-05-13 01:07:53 +01:00
Leah Rowe 3bd82b7679 build/boot/roms: reduced code indentation 2023-05-13 00:13:54 +01:00
Leah Rowe 9eee0fb483 build/boot/roms: split main() to topdown functions
the logic can now more or less be read chronologically
2023-05-12 23:09:39 +01:00
Leah Rowe bceb5f2eb4 build/roms_helper: move logic into main()
logic will be split from main into smaller
functions, in follow-up commits
2023-05-12 16:55:45 +01:00
Leah Rowe 6290f999e2 build/boot/roms_helper: further cleanup
consolidated some for loops

removed errant code
2023-05-10 20:23:18 +01:00
Leah Rowe 5f44556f47 build/roms: general code style cleanup 2023-05-10 05:09:10 +01:00
Leah Rowe d521fca7ef build/roms: fix faulty keymap list expansion 2023-05-10 04:40:48 +01:00
Leah Rowe 67a607b88c build/boot/roms*: RFC 2646 compliance
No more than 80 characters per line.
2023-05-10 02:48:34 +01:00
Leah Rowe 3f1ee01507 seabios: do normal config, disable oprom in vgarom
previously, "normal" initmode relied on the vgarom-based
seabios config, which enables option roms, but then lbmk
would insert pci-optionrom-exec 0 for vgarom, and 2 for normal

in libreboot, coreboot roms with "vgarom" in the filename do
pci option rom execution from coreboot, and "normal" roms
do execution from seabios(where seabios is the only payload
provided on normal setups)

this is because payloads like grub can also be used, on vgarom
setups, where coreboot must handle oprom execution
2023-05-09 20:40:12 +01:00
Leah Rowe dac9ea86d3 build/boot/roms: fail when build cbutils fails 2023-02-19 23:16:01 +00:00
Ferass 'Vitali64' EL HAFIDI f787044642 Do not rely on bashisms and behaviour undefined by the POSIX specification.
By making lbmk fully POSIX-compliant, it will be easier to port lbmk to
other systems implementing POSIX such as Alpine Linux and FreeBSD.

Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
2022-12-27 15:50:41 +00:00
Leah Rowe 31111c645f build/boot roms: add exits for failing commands 2022-12-11 06:25:09 +00: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 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
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
Alexei Sorokin ec082429ab scripts: avoid relying on spaces from sha1sum output 2022-11-29 20:26:35 +00:00
Leah Rowe e1bbdadc95 build/roms: remove seabios_grubfirst logic
the intended use-case scenario was one in which vga rom initialisation
would be used, on desktop configurations, but without coreboot itself
handling vga rom initialisation, instead leaving that task to seabios

it was assumed that grub, when running on the bare metal with
build option "--with-platform=coreboot" would be able to display
like this, but it is not so when tested

in such setups (add-on gpu with grub payload), it is necessary to
extract the video bios and insert it into the coreboot rom, having
coreboot handle such execution. this is beyond the scope of lbmk,
in context of automated building, because we cannot reliably predict
things such as PCI IDs

do away with this build option entirely, for it does not serve the
intended purpose. it will be necessary to run PC GRUB instead (build
option --with-platform=i386-pc). PC GRUB can still read from CBFS,
and you could provide it as a floppy image file inside CBFS for
SeaBIOS to execute. in this setup, GRUB would function as originally
intended by the seabios_withgrub option; such a configuration is
referred to as "SeaGRUB" by the libreboot project, and experimentation
was done with it in the past, to no avail

it's better to keep things simple, in the libreboot project. simpler
for users, that is
2022-11-22 22:45:18 +00:00
Leah Rowe 24a866baea remove kfsn4-dre, kcma-d8 and kgpe-d16
buggy, buggy, buggy, buggy, buggy, buggy, buggy

full of bugs, these boards never worked properly. i got ripped
off with these.

now i'm ripping off the band aid

use dasharo if you want d16 stuff. i'm done with it.
2022-11-19 03:51:59 +00:00
Leah Rowe 7af9953463 pragmatic system distribution guideline compliance
osboot is now part of libreboot, and will soon shut down.
libreboot now conforms to osboot policy.
2022-11-14 00:51:12 +00:00
Alper Nebi Yasak 6d6bd5eee0 build/roms: Rebuild cbutils module before starting coreboot build
In recent coreboot versions, running distclean started to erase the
cbfstool binary we built earlier in the util/cbfstool dir via the
cbutils build script call. The coreboot build puts it in a different
directory, and the roms build script can't find it when trying to add
payloads to the roms. This doesn't make the script fail (because set -e
is stupid like that), and the build appears to succeed if you don't look
close enough to see the "cbfsutil not found" error.

Build the coreboot utils we want at the places we want them after
calling distclean, so that we can actually use cbfsutil and avoid
silently-broken roms with newer coreboot versions.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-08-28 13:09:52 +03:00
Alper Nebi Yasak 61ede99832 build/roms: Support using U-Boot as a coreboot payload
This enables embedding U-Boot into the coreboot roms as the payload. For
now, the ELF file generated by enabling CONFIG_REMAKE_ELF is used, which
includes the U-Boot binary and the board-specific device-tree file. It
might be better to use the FIT payload support for U-Boot, but that was
reportedly broken and is not tested yet.

Coreboot boards can specify payload_uboot="y" in their board.cfg to
enable building a rom with U-Boot as the payload, which is built from
the U-Boot board with the same name. Boards can further specify a
uboot_config option, to choose which board-specific config file U-Boot
should be built with.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-08-28 13:09:52 +03:00
Alper Nebi Yasak a69855f7e4 build/roms: Build 32-bit crossgcc for AArch64 as well
The 32-bit ARM cross compiler toolchain is used to build parts of
arm-trusted-firmware needed by AArch64 boards, compile the toolchain for
those boards as well.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-08-28 13:09:52 +03:00
Alper Nebi Yasak 769f18f2f6 build/roms: Fix building for ARMv7 and AArch64 boards
The code that compiles coreboot crossgcc changes the working directory
to the coreboot directory, and the following code cannot find the lbmk
scripts that it needs to run. Compile ARMv7 and AArch64 cross compilers
in a subshell like in the x86 case so the rest of the script can work.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-08-28 13:09:52 +03:00
Leah Rowe 2701555582 build/boot/roms: fix wrong variable name 2021-12-29 07:37:11 +00:00
Leah Rowe 6b4b49cf8f build/boot/roms: substitute grub_scan_disk according to board.cfg 2021-12-29 07:10:56 +00:00
Vitali64 7e6691e999 Add ARMv7 and AArch64 support 2021-12-11 13:38:43 +00:00
Vitali64 dec2d7206e add myself in the build/roms_helper script 2021-12-09 06:46:18 +00:00
Leah Rowe 4b64e34fc2 build/roms: warn if grub_scan_disk is not set at all 2021-11-30 18:44:08 +00:00
Leah Rowe c7944c0e01 build/roms: warn when grub_scan_disk is set incorrectly 2021-11-30 18:40:27 +00:00
Leah Rowe c87b6f6369 build/boot/roms: don't error out if grub_scan_disk is invalid
just set it to the default, instead
2021-11-30 18:35:52 +00:00
Leah Rowe 9a0677eafd fix incorrect logic on recent grub optimization patch
or was used, instead of and
2021-11-30 18:31:19 +00:00
Vitali64 b74056563f Workaround for grub's slow boot 2021-11-28 17:16:18 +00:00
Leah Rowe eed25bd220 update coreboot and nuke tianocore
tianocore is a liability for the libreboot project. it's a bloated mess, and
unreliable, broken on many boards, and basically impossible to audit.

i don't trust tianocore, so i'm removing it.
2021-11-22 10:03:50 +00:00
Leah Rowe bc7243f1e1 build/boot/roms: fix wrong filename for pike2008 option roms 2021-11-18 17:02:36 +00:00
Leah Rowe 68d3c9372a Revert "nuke memtest86+"
This reverts commit 84a1bc502b.
2021-11-01 02:51:10 +00:00
Leah Rowe 84a1bc502b nuke memtest86+ 2021-10-31 20:52:01 +00:00
Leah Rowe 62fa042a17 re-add grub backgrounds and update grub. mitigate missing characters
mitigate missing characters in unifont for border/arrow characters. this saves
space because now it is no longer necessary to add a custom font

the background added has the libreboot logo on it, and it's 10kb in size unlike
the old gnulove background that was hundreds of KB
2021-10-31 07:13:46 +00:00
Leah Rowe 49198fe3d1 Disable PIKE2008 option ROM loading on KGPE-D16/KCMA-D8
These option ROMs are known to cause a system hang. If you insert an empty
option ROM into CBFS, it disables any option ROM loading for those devices
when using SeaBIOS.
2021-10-30 21:22:27 +01:00