summaryrefslogtreecommitdiff
path: root/resources/scripts
AgeCommit message (Collapse)Author
2023-08-27move resources/scripts/ to script/Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27unified list command for all scriptsLeah Rowe
e.g. ./build boot roms list ./update blobs inject listboards ./build boot list ./build clean list also this is now possible: ./build list or maybe ./update list ^ would list directories in resources/scripts/build and resources/scripts/update respectively this script is added: resources/scripts/build/command/options call it like so, e.g. ./build command options resources/coreboot this script is now used, for list functions in other scripts. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27handle/make/config: add missing pipes for errLeah Rowe
i forgot to add these! without them, the script will always exit with an error Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27handle/config/file: rename to handle/make/configLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27handle/config: fix errant "handle src for" callLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27"handle src for" - change to handle make fileLeah Rowe
an oversight, in a previous edit Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27handle/config: add missing error handleLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27build/src/for: rename to handle/make/fileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27handle/config/file: unified distclean handlingLeah Rowe
use build/src/for -c which does the same thing, specifically: try distclean, then clean, or fail Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27build/src/for: use -j for multithreaded buildsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27build/release/src: update based on recent changesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-27scripts: put quotes around file/directory namesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-26much, much stricter, more verbose error handlingLeah Rowe
lbmk is much more likely to crash now, in error conditions, which is a boon for further auditing. also: in "fetch", remove the downloaded program if fail() was called. this would also be done for gnulib, when downloading grub, but done in such a way that gnulib goes first. where calls to err write "ERROR" in the string, they no longer say "ERROR" because the "err" function itself now does that automatically. also: listmodes/listoptions (in "lbmk") now reports an error if no scripts and/or directories are found. also: where a warning is given, but not an error, i've gone through in some places and redirected the output to stderr, not stdout as part of error checks: running anything as root, except for the "./build dependencies *" commands, is no longer permitted and lbmk will throw an error mrc downloads: debugfs output no longer redirected to /dev/null, and stderr no longer redirected to stdout. everything is verbose. certain non-error states are also more verbose. for example, patch_rom in blobs/inject will now state when injection succeeds certain actual errors(bugs) were fixed: for example, build/release/roms now correctly prepares the blobs hash files for a given target, containing only the files and checksums in the list. Previously, a printf message was included. Now, with this new code: blobutil/inject rightly verifies hashes. doing all of this in one giant patch is cleaner than 100 patches changing each file. even this is yet part of a much larger audit going on in the Libreboot project. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-24use the new coding style in scriptsLeah Rowe
there were stragglers left over from the last audit, and these stragglers still exist even after all the major re-factoring as of late the new style is: bsd-like coding style and error handling. verbose yet simple error handling. we use an "err" function in a way reminiscent of most C programs that you see in openbsd base (err.h) this style is very clean, resulting in readable code Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-23scripts: never exit 1, always call err insteadLeah Rowe
this same change has been applied, selectively, to certain return statements. the general rule is this: the return statement should only be used to direct logic within a script, where certain non-errors states are used to skip certain actions; the exit command should *never* be used to return non-zero, except by err(). in so doing, we ensure easier debugging of the build system also: strip_rom_image in build/release/roms was running "continue" when a rom file didn't exist, despite not being a while/for loop. i make it return (non-error condition) instead it's ok for a script to exit 0, where appropriate, but perhaps a function could also be written for it Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-23blobs/download: copy dl_path, don't move itLeah Rowe
moving it defeats the purpose of the caching mechanism that's in place. this should avoid unnecessary downloads Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-23unify err functions across scriptsLeah Rowe
include/err.sh this new handling also does mundane things, such as tell you what script b0rked Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-22memtest86+ v6.20Riku Viitanen
uses 32-bit variant for x86_32 arch. 64-bit for x86_64. resources/scripts/build/src/for: modified it a bit. when building e.g. "memtest86plus/build32" it correctly fetches "memtest86plus" instead. but builds memtest86plus/build32, which is inside that git repo Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-08-22also clean up the main scriptsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-21general code cleanup on lbmk shell scriptsLeah Rowe
in update/blobs/download, i saw instances where appdir was being deleted with rm -r, but the more appropriate command would rm -Rf. this is now fixed. other than that, i've mostly just simplified a bunch of if statements and consolidated some duplicated logic (e.g. if/else block for dependencies in build_dependencies() of update/blobs/download one or two functions and/or variables have been renamed, for greater clarity in the code, also removed a few messages that were redundant used printf instead of echo, in a few places, also fixed up the indentation in a few places Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-21unify build/defconfig and modify/defconfigLeah Rowe
they fundamentally perform the same action: copy the .config file and run make, but build runs make-all, while modify runs make-oldconfig or make-menuconfig merge this functionality together also: ./handle config file ^ this is the new syntax, not: ./build defconfig for for example: ./handle config file -b coreboot x200_8mb <-- build x200 rom ./handle config file -m coreboot x200_8mb <-- modify configs ./handle config file -u coreboot x200_8mb <-- make-oldconfig ./handle config file -u seabios ./handle config file -b u-boot yes, 1 script and a sloccount reduction of 52. and the audit? it continues. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-20unify dependencies scriptsLeah Rowe
the unified logic is so small that i simply added it to the main "build" script commands are identical. example: ./build dependencies debian Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-20unify build/clean into ./build release srcLeah Rowe
handle it all in the 1 script quite a few clean scripts are still present, so resources/scripts/build/clean/ still exists. 23 sloc reduction. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-20unify most module build scriptsLeah Rowe
Some of them weren't even used at all, such as the flashrom build script. the bios_extract build script existed but was never used, because we only called (from blobutil) a python script from in there, without actually compiling anything! resources/script/build/src/for Usage, e.g.: ./build src for memtest86plus It also handles fetch. This script is intended largely for those codebases that are quite simple, requiring trivial or no intervention besides running "make". 37 sloc reduction. Not a lot, but the audit continues! These optimisations add up. I started at 3300 sloc in resources/scripts and me target is 2k (2000) sloc. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-20unify grub scripts under one directoryLeah Rowe
new commands are thus, build grub payloads: ./build grub payload (formerly ./build payload grub) build grub utils: ./build grub utils (formerly ./build module grub) The scripts is build/module/ will mostly be deleted. I say mostly, because some of them are being moved instead. The deleted ones will be ones that basically just run "make" in the target directory. They will be unified, in a follow-up patch. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-20unify update/modify coreboot/u-boot/seabios scriptLeah Rowe
./update seabios configs? gone .modify coreboot configs? gone it's now all 1 script, called e.g. ./modify defconfig options -u coreboot <-- runs make oldconfig ./modify defconfig options -m seabios <-- runs make menuconfig ./modify defconfig options -u u-boot gru_bob <-- oldconfig, and only gru_bob ./modify defconfig options -u coreboot x60 x200_8mb etc. you get the idea. same behaviour as before with all the separate scripts, but now its one unified script. 184 sloc reduction in resources/scripts/ Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-19consolidate u-boot/seabios/coreboot build scriptsLeah Rowe
See file: resources/scripts/build/defconfig/for It is based on: resources/scripts/build/payload/u-boot The u-boot payload script has been deleted, as has the seabios payload script; the build/boot/roms logic has been heavily simplified too, by removing the logic for building of elf files based on defconfig. SeaBIOS, U-Boot and coreboot all use defconfig-type infrastructure for their build systems, and they are fundamentally the *same* in how to compile each codebase, at least in an lbmk context, regardless of actual (and very huge) differences in these codebases. Several hundred sources-lines of code have been eliminated by this change, drastically simplifying everything; U-Boot payload compiling also now errors out when a single build fails, instead of continuing. Also: build/boot/roms no longer re-compiles a coreboot target that was already compiled, which is the same behaviour observed for payloads. (this means you must now manually delete a target, when you wish to re-build it; the build/boot/roms logic now more or less just runs cbfstool; blobutil is handled from build/defconfig/for) ALSO: Since crossgcc is now handled by build/defconfig/for, not build/boot/roms, standalone compiling of u-boot is now possible. This has been tested. You compile it like so: ./build defconfig for u-boot or specific trees, e.g. ./build defconfig for u-boot default One other consequence of this patch is that re-building the same ROM image is now much faster, because the same builds are re-used unless deleted. This could be useful when testing grub.cfg changes, for example, if that's all you change. With things like ccache used (not yet used robustly in lbmk), this could speed things up more, depending on the codebase. This patch demonstrates the raw power of lbmk; it is a very simple and highly efficient build system, and now much more so! Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-17don't call blobutil directly from lbmkLeah Rowe
it's bloat, and was only there for backwards compatibility with the old commands, but the new commands are e.g. ./update blobs inject instead of: ./blobutil inject this results in a slight code size reduction in lbmk Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-17remove download scripts, consolidate into scriptLeah Rowe
most of them were just calling the gitclone script, so remove them. the grub script was treating gnulib as a dependency. i've now added the ability to grab 1 dependency, in the gitclone script (it should be expanded later to support multiple dependencies) the gitclone script has been renamed to "fetch". the "fetch_trees" script does more or less the same thing, but calls "fetch" and handles multiple revisions if a project needs that this is more efficient, and slightly reduces the code size of lbmk! Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-17improve user feedback in blobutilLeah Rowe
make it output messages that tell the user important information. it's only subtle but it makes a difference to some people, who need confirmation. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-16merge coreboot/u-boot download logic to one scriptLeah Rowe
they are fundamentally the same, in an lbmk context. they are downloaded in the same way, and compiled in the same way! (Kconfig infrastructure, board-specific code, the way submodules are used in git, etc) ~200 sloc reduction in resources/scripts the audit begins Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-16fix permissions on arch dependencies scriptLeah Rowe
it wasn't +x Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-14NEW BOARD: HP EliteBook 8470p (Intel GPU)Leah Rowe
Intel GPU! The AMD ones will be tested, but assume Intel-only for now. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-14NEW BOARD: Dell Precision T1650Leah Rowe
Very nice ivybridge board that supports ECC RAM. NOTE: I couldn't get onboard graphics working yet, but this was confirmed working with a graphics card (in my case nvidia quadra k420) booted in text mode on the SeaBIOS payload. The GRUB payload also works, when loaded from SeaBIOS. Therefore, this is a SeaBIOS-only board (as far as first payload is concerned), but you can pick GRUB from the menu. You could make it "GRUB-only" in practise by setting SeaBIOS boot order to only load GRUB, and disable the SeaBIOS menu. We refer to this as "SeaGRUB". I've made lbmk use biosutilities and uefiextract, to get at the SMSC SCH5545 Environmental Control (EC) firmware. This firmware is needed for fan control. This is automatically downloaded and extracted, from Dell UEFI firmware updates. As with other blobs such as Intel ME, this firmware is then scrubbed by the release build scripts. The blobutil "inject" script can be used to re-insert it. Of note: there is no fixed offset, but no other blobs to be inserted in CBFS either, so the offset when re-inserting on release ROMs should still be the same, and thus the ROM checksums should match, when running blobutil inject. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-09NEW BOARD: HP EliteBook 2170pLeah Rowe
Another ivybridge platform, added in coreboot recently. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-05blobs/download: save ME file to correct locationLeah Rowe
blobdir is incorrect, and it means that the directory will appear under blobs/, in this case. this was an oversight on my part. this behaviour did not break anything in practise, but this patch makes the behaviour more consistent with rules. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-05blobs/download: try backup if bad hash on mainLeah Rowe
At present, the logic only tries backup URLs when an actual download fails (bad internet connection or the server is down). If the main download succeeds, but it has a bad checksum, the backup download is not attempted. Since wrongly hashed files are to be assumed useless, we may aswell delete and try the next file. This will guard against the possibility of a vendor changing their file, without changing the file name (non-versioned files, for example, may be subject to such changes). Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-05blobs/download: support more formats on ME extractLeah Rowe
ME extraction didn't support unar (RAR format), for regular extraction, after downloading a vendor file. For bruteforce ME extraction, after extracting a vendor archive, unar(RAR) and inno(innoextract) was not supported. This patch fixes both issues. It should be noted that as of now, the unar method has only been tested with certain HP vendor updates, and it's currently not used on any of those. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-04add unar to dependencies scriptsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-29blobs/download: declare full user agentLeah Rowe
I messed up the string, when I first did this. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-29blobs/download: properly handle backup/main urlLeah Rowe
Immediately after the last revision, which was a hacky workaround to the problem, I realised the actual problem, and the real solution: In the switch block, check *backup* first. Then it breaks, continuing on the iteration. If it's variable for a main URL, it'll reliably go to the next check in the block, whereas if it's backup, it'll default to the first one in each case. This bug has been annoying the sh*t out of me for ages, and I've finally nailed it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-29blobs/download: don't download backup on mainLeah Rowe
The script was actually downloading the backup, at all times, for each given URL. The way we handle this is quite buggy. This patch is a workaround, a dirty hack in fact, but it will do for now, because our backup URLs are always wayback links where the original URL (matching the correct main URL in the sources file) is always present, in the URL. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-29blobs/download: set common user agent stringLeah Rowe
Make it look like a normal web browser, downloading files. Some HTTP servers might block Wget unless this is done. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-29blobs/download: simplify for loopLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-29scripts: fix indentation in switch/case blocksLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-27blobutil/ec: abort if kbc1126 ec extraction failsLeah Rowe
This was an oversight on my part. Should extraction fail, we must abort. This is in preparation for addition of future mainboards, where further tweaking is required in blobutil. This error check will warn us about it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-17Revert "build/boot/roms mkUBootRoms: initialise variables"Leah Rowe
This reverts commit 7c90a4077fa1038394e3d470268ea6e509c2d734. causes another build bug. i'm helping someone with the bug now, i think the workaround for now would be to just use bash, on this script. until i can figure something better out.
2023-07-17build/boot/roms mkUBootRoms: initialise variablesLeah Rowe
they were outside the scope, outside of the if statements. in some shells, this is ok. we use "sh" so the user could have any shell. be a bit nicer to the more asininely technically correct sh implementations out there Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-16coreboot: re-add asus kgpe-d16/kcma-d8/kfsn4-dreLeah Rowe
Libreboot 20220710 was the last release to support these boards. I plan to eventually port code differences between D8/D16 to Dasharo, for KCMA-D8 support in Dasharo, to then use in Libreboot for both KCMA-D8 and KGPE-D16, but I have no plans to update the KFSN4-DRE code, at least for now. Libreboot 20220710 used coreboot 4.11, whereas this patch makes use of coreboot 4.11_branch; the crossgcc toolchains no longer compile on modern distros, so I spent time patching those (tested in Debian Sid, will also work on Arch Linux and so on). The acpica downloads now fail, in 4.11_branch, because Intel made some changes upstream for these tarball downloads. Newer coreboot works around this by grabbing tarballs from github, itself a non-ideal solution, but I digress; this patch changes coreboot crossgcc (in 4.11_branch) to download the acpica tarball from libreboot rsync, where I've added it. This patch also re-introduces the PIKE2008 fix, where empty option ROMs for these are inserted into CBFS. This prevents SeaBIOS from loading the real option ROMs, which would cause SeaBIOS to hang. This means that SAS drives are not supported in SeaBIOS, for these boards in Libreboot. I previously said, in the Censored Libreboot c20230710 announcement, that I would *only* merge D8/D16 when I've added Dasharo support to Libreboot, and use that, but the work to make coreboot 4.11_branch compile is something I'm quite proud of and I see no reason to exclude from lbmk master branch. Honestly, there's not much different than 4.11, code-wise. I *probably* won't use 4.11_branch for the next Libreboot release, on D8/D16. By then, I might have Dasharo integrated in lbmk instead. We shall see. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-07-08build/boot/roms: fix coreboot-version in releasesLeah Rowe
This error was observed, in the coreboot build system: In file included from src/lib/version.c:4: build/build.h:10:32: error: 'libreboot' undeclared here (not in a function) 10 | #define COREBOOT_MAJOR_VERSION libreboot-20230625 | ^~~~~~~~~ src/lib/version.c:35:46: note: in expansion of macro 'COREBOOT_MAJOR_VERSION' 35 | const unsigned int coreboot_major_revision = COREBOOT_MAJOR_VERSION; | ^~~~~~~~~~~~~~~~~~~~~~ This happened on the 20230625 *release archive*, when a user tried to build for W541 MRC on an Arch Linux container. This change fixes the error. I never got the error on my end when build testing the release archives, but this will prevent the error. Fix it by only inserting libreboot version string YYYYMMDD representing the Libreboot version. (libreboot uses ISO dates as version numbers) Signed-off-by: Leah Rowe <leah@libreboot.org>