summaryrefslogtreecommitdiff
path: root/include/lib.sh
AgeCommit message (Collapse)Author
2024-07-10remove executable permission on include/Leah Rowe
files under include/ should never be executed directly Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-07-07rom.sh: new file, to replace script/romsLeah Rowe
stub it from the trees script. the way it works now, there is less code in the build system. ./build roms this is no longer a thing ./build roms serprog this is also no longer a thing. instead, do: ./update trees -b coreboot targetnamehere ./update trees -b pico-serprog ./update trees -b stm32-vserprog the old commands still works, which causes the new commands to run coreboot roms now appear in elf/, not bin/, as before, but those images now contain payloads. NOTE: to contradict the above: ./build roms is no longer a thing, in that it's now deprecated, but backward compatibility is present for now. it will be removed in a future release. ./build roms list also still works! it will do: ./update trees -b coreboot list also: ./update trees -b grub list this is now possible too if a target "list" is provided, for multi-tree sources, the targets are shown. there is another difference: seagrub roms are now seagrub_, instead of seabios_withgrub. seabios-only roms are no longer provided, where grub is also enabled; only seagrub is used. the user can easily remove the bootorder file, if they want seabios to not try grub first. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28lib.sh: stricter check in chkvars()Leah Rowe
testing +x is all well and good, but the variable string may be empty, even if set. some of the checks in the build system are relying on the latter, so handle it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28tidy up some setvars listsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28lib.sh: keep versiondate check to 80 charactersLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28lib.sh: condense for loopLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28lib.sh: condense err_() a bitLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28lib.sh: add a return to the end of chkvars()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-28vendor.sh: unified reading of board configsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: remove unused cbdir variableLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: move git_err() to buildLeah Rowe
it's only used in the main build script, so move it there. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: condense singletree() a bitLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: add a return to the end of check_defconfigLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: condense e() a bitLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: make elf/coreboot* a dot directoryLeah Rowe
we don't want the user to flash coreboot from elf/, because those images do not contain payloads. the user must flash from bin/ ample warning is given, at build time, but the warning is written in english. therefore, some people may not understand it, because they may not even speak english. hide the coreboot elf/ directory, to mitigate this possibility. in most cases, this will probably prevent the average user from flashing those images, since they likely won't see it. the "DO NOT FLASH" warning is still included in that directory name, while creating it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: simplified TMPDIR handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-27lib.sh: condense setcfg() if/else logicLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-25lib.sh: introduce mandatory check of projectnameLeah Rowe
error out if it's not set. ditto projectsite. that way, if the files are accidentally deleted, or not added in a derivative of the build system, you'll know. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-25lib.sh: condense setvars() a bitLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-25simplified lock messageLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-25lib.sh: simplify reading of version filesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-25lib.sh: simplify use of environment variablesLeah Rowe
don't have a separate variable for them. just export them directly and use them directly. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-23lib.sh: fix error running ./build dependenciesLeah Rowe
the e() and setvars() functions need to be declared before the dependencies function. also: after calling install_packages, it was doing a return when it should have done an exit. this is all fixed now. i apologise to anyone who previously ran into trouble with this! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22use backticks on eval commands, not subshellsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22lib.sh: remove badcmd()Leah Rowe
it's bloat. telling the user to rtfm is something that we already do on irc; they will still ask how to do everything, and ignore the message from badcmd(), or they will automatically know to rtfm. i'm on a massive purge, removing bloat from lbmk as part of Libreboot Build System Audit 6. all bloat must go. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-22lib.sh: more unified config handlingLeah Rowe
replace it with logic that simply uses "." to load files directly. for this, "vcfg" is added as a variable in coreboot target.cfg files, referring to a directory in config/vendor/ containing a file named pkg.cfg, and this file then contains the same variables as the erstwhile config/vendor/sources config/git files are now directories, also containing pkg.cfg files each with the same variables as before, such as repository link and commit hash this change results in a noticeable reduction in code complexity within the build system. unified reading of config files: new function setcfg() added to lib.sh setcfg checks if a config exists. if a 2nd argument is passed, it is used as a return value for eval, otherwise a string calling err is passed. setcfg output is passed through eval, to set strings based on config; eval must be used, so that the variables are set within the same scope, otherwise they'd be set within setcfg which could lead to some whacky results. there's still a bit more more to do, but this single change results in a substantial reduction in code complexity. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-20minor code cleanup in the build systemLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-17roms: remind the user about gkb filesLeah Rowe
nowadays, we don't insert GRUB keymaps automatically, for sake of efficiency; without one, the default is US QWERTY. a user will only want one keymap in particular, so this is more efficient. in practise, they're either building from source anyway, or using the inject scripts which compile cbfstool anyway, so the user will already have cbfstool. also output this message from the inject script. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-16unify coreboot elfdir (DO_NOT_FLASH)Leah Rowe
use a common string when setting this path Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-15roms: unify all add-payload commandsLeah Rowe
add a generic function that can insert payloads with lzma compression, or raw files without compression Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-14unified checks for variable initialisationLeah Rowe
new function chkvars() does the job Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-14lib.sh: remove the items() functionLeah Rowe
it's pretty much just doing the same thing as ls -1 remove it! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09lib.sh: more useful lock messageLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09create a lock file during buildsLeah Rowe
prevent duplicate main instances of the build system from running the lock file is deleted when the parent process exits, alongside the tmpdir deletion the build system must only ever be run ot one instance at a time, per work directory Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09lib.sh: fix regressionLeah Rowe
i was being a bit too clever about some optimisations revert this change. otherwise, nothing will download or build Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09lib.sh: less confusing error in download()Leah Rowe
don't say "file missing", because it may be present! instead, say that the download failed. this covers both contexts: internet failed and thus no file present, or the file is present but checksum verification failed. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09lib.sh: hide stderr on download()Leah Rowe
on the initial check, the output is confusing because it will say "checksum verification failed" if the file doesn't already exist, but then goes to download. only say checksum failed if a download occured, and the check failed, otherwise report nothing except that the file already exists. this will not reduce the ability to debug issues later on, and it will reduce the amount of confusion for users. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09lib.sh: simplify download()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09lib.sh: fix redundancy in download()Leah Rowe
it was only downloading the main url, even when it should use the backup. fix it by actually using the for loop variable. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-09lib.sh: simplify singletree()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-08vendor.sh: move download logic to lib.shLeah Rowe
in future revisions, i will make tarballs become subfiles, to complement submodules. e.g. crossgcc tarballs in coreboot Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-08lib.sh: shorten a string in e()Leah Rowe
line exceeds 80 characters Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07lib.sh: rename variable for clarityLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-06move handle_coreboot_utils to script/treesLeah Rowe
it doesn't really make sense placed in lib.sh, because it's only called from script/trees Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-06put coreboot utils in elf/, not cbutils/Leah Rowe
one directory per util, under elf/ e.g. elf/cbfstool/ further split by tree name, e.g.: elf/cbfstool/default/ elf/cbfstool/foo/ Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-06fix build issue building coreboot utilsLeah Rowe
just run make directly. the trees script isn't really designed to directly build directories, so don't. nothing wrong with good old fashioned make -C Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-06move cbcfgsdir variable to vendor.shLeah Rowe
it's only ever used here Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-06move cfgsdir/datadir variables to lib.shLeah Rowe
it's also used from script/roms, in addition to trees move these variables to a common file used everywhere Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-06handle build.list from config/data/, not config/Leah Rowe
certain code checks for build.list, to skip it, for example in items() we already use config/data/grub to store grub config data that applied to all trees create these directories too: config/data/coreboot config/data/u-boot config/data/seabios move the respective build.list files in here, and also to config/data/grub now multi-tree projects contain, per directory, just the target.cfg file and the patches directory. this is much cleaner, because some of the logic can be simplified more Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-06don't use build.list to detect multi-tree projectsLeah Rowe
instead, check for the presence of target.cfg files not in config/project/ but config/project/tree/ the way this check is done, it merely returns 1 if config/project/*/target.cfg is detected, and returns 0 in all other cases, even if config/project/target.cfg exists that way, if the maintainer accidentally adds a target.cfg in the main directory, the given multi-tree project will not break Signed-off-by: Leah Rowe <leah@libreboot.org>