summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-05-30git.sh: do not remove .submodulesLeah Rowe
the reason for it is because sometimes the coreboot build system auto-downloads submodules which we don't want. however, we now pass UPDATED_SUBMODULES=1 in make, which disables this behaviour in coreboot's build system. therefore, remove this unnecessary logic. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-30delete u-boot test/lib/strlcat.c using nuke()Leah Rowe
we don't need to do it in the release function Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-30import nuke() from cbmk cdce8ba70bLeah Rowe
cbmk revision: cdce8ba70b863ea3fe0ad7a4d7b27d0c5ca30421 as of date 30 May 2024 Canoeboot provides deblobbing, fully, on all sources, so as to provide a GNU FSDG compliant coreboot distro. Libreboot used to do this but now uses a more pragmatic Binary Blob Reduction Policy, allowing better hardware support in general. See: https://libreboot.org/news/policy.html Well! We sometimes still need to delete files in Libreboot, but for other reasons. For example, the poorly licensed strlcat.c file that we delete from U-Boot, in both projects. I currently hardcode such deletions in lbmk. After this revision, I will start using "nuke.list" files as in cbmk. Simply patching the sources to exclude such files, in this context, is not OK because then we are still including them but as diffs. This is why the nuke() function exists. Import Canoeboot's nuke technology. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-29coreboot t440p/w541: enable nvme in grub_scan_diskLeah Rowe
these laptops do not officially have nvme slots on them, but there is an ngff wifi slot which is PCI-E x1, and you can use a special adapter on it to run nvme ssds. total throughput is retarded by the x1 PCI-E configuration, but it's still faster than a sata ssd (nvmes are x4 PCI-E). support it in grub_scan_disk on the off chance that some users may make use of this. it should work just fine. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-29./vendor download: skip if blob path is /dev/nullLeah Rowe
We use a path of /dev/null pointing to a ROM for Fam15h AMD boards, to add fake PIKE2008 images. This is to mitigate a hang in SeaBIOS, but now with recent changes, this causes the command below to download coreboot, when it should just exit saying no vendor files needed. Prevent accidentally wasted bandwidth. The command was: ./vendor download kcma_d8_rdimm_16mb This now correctly does the following: $ ./vendor download kcma_d8_rdimm_16mb Vendor files not needed for: kcma_d8_rdimm_16mb The joys of programming a build system in sh! Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-29do not allow dashes in coreboot target namesLeah Rowe
Command: ./vendor download kcma-d8-rdimm_16mb Output was: include/lib.sh: line 115: kcma-d8-rdimm=config/vendor: No such file or directory That will have to be audited later on, but the recent more stringent error checking in vendor.sh triggered this previously untriggered error message. The error was in fact already occuring before, silently. Anyway, mitigate by renaming all coreboot targets so that they do not contain hyphens in the name. This should avoid triggering errors in that eval command, on line 115 in lib.sh Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-29./vendor download: more fine-tuned error controlLeah Rowe
By default, the build system does set -u -e Some errors are unavoidable and have to be handled, so we have to set +u +e (turn off error handling in sh), when downloading vendor files, but only certain parts of vendor.sh trigger errors (which cause an exit). Replace the current bazooka approach with a more fine grained approach, turning error handling back on again when it is safe to do so. In the parts of the code where it is disabled, the code is written very, very carefully, with errors still handled manually, but more careful auditing is required. This change has been tested and makes the command much safer to run. In security (or any bug auditing), it is the principle of least privilege that holds true. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-29vendor.sh: don't error on main targetsLeah Rowe
e.g. coreboot/default contains no config directory, so the old logic would be trying to do: . which is obviously invalid now for example: $ ./vendor download default Vendor files not needed for: default and it will exit with zero status the only thing that should ever return non-zero status is when you define a target that does not exist, config or no. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-28roms: allow user override of grub_scan_diskLeah Rowe
this effectively lets you change the boot order. example: ./build roms -s "nvme ata" t1650_12mb the above example would set: grub_scan_disk="nvme ata" another example: ./build roms -s nvme t1650_12mb this would set: grub_scan_disk="nvme" this overrides what's set in target.cfg for the given target. useful for quick reconfiguration if building from source Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-28grub.cfg: actually support setting boot orderLeah Rowe
replace variables ahcidev/atadev/nvmedev with a single one named bootdev the for loop goes through grub_scan_disk, so now it is effectively a bootorder configuration Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-28trees: use CPUS=x on regular coreboot makeLeah Rowe
i already do this on crossgcc, but overlooked it on regular builds where i just use -j, but coreboot's build system makes use of the CPUS= option in make use XBMK_THREADS for this Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-28update gitignoreLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-28roms: fix bad eval when comparing optionsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27grub.cfg: add spdx headerLeah Rowe
it has always been gpl 3 or later, but it helps to have the license declaration within the file there's a copying file anyway. put spdx in the config Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27re-configure grub_scan_disk on various targetsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27remove grub_scan_disk in all target.cfg filesLeah Rowe
A subsequest revision will set them again as needed, per coreboot target. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27grub.cfg: use grub_scan_disk to set boot orderLeah Rowe
Previously, grub_scan_disk could set ata, ahci or "both", which would make both be tried (ahci first). This worked when we only dealt with ata and ahci devices, but now we support nvme devices so the logic is inherently flawed. Instead, use grub_scan_disk to store the boot order, e.g.: grub_scan_disk="ahci nvme ata" grub_scan_disk="nvme ata" In the first example, it would make GRUB scan ahci first, then nvme and then ata. In the secontd example, it would make GRUB scan nvme first, and then ata. If "both" is set, or anything other than ahci/ata/nvme, grub_scan_disk is now changed to "nvme ahci ata". Actual grub_scan_disk entries in target.cfg files will now be modified, to match each machine. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27GRUB: remove XHCI patches for now (will re-add)Leah Rowe
Fixes this bug: https://codeberg.org/libreboot/lbmk/issues/216 Well, fix is the wrong word. We want xHCI ideally. Mate is working on it as I write this. I've also: * Disabled CONFIG_FINALIZE_USB_ROUTE_XHCI on Haswell boards (coreboot) * Disabled the GRUB payload on HP 820 G2 for now We will need to re-add the xHCI patches once fixed. If Mate/we can't fix it, I'll contact Patrick Rudolph who originally wrote the xHCI patches. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27minor correctionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27roms: make grubfirst if seabios_withgrub=yLeah Rowe
rather than if seabios_grubonly=y if grubonly=y, still make the grubonly rom this complements the previous commit Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27coreboot: only run GRUB as a secondary payloadLeah Rowe
See: https://codeberg.org/libreboot/lbmk/issues/216 Almost all users will be OK running GRUB, but a minority of users have experienced a fatal error pertaining to grub_free() or grub_realloc() (as my investigation of GRUB sources reveal when grepping the error reported in the link above). We don't yet know what the bug is, only that the error occurs, leading to an effective brick if the user has GRUB as their primary payload. So far, it has only been reported on some Intel SandyBridge-based Dell Latitudes in Libreboot, but we can't be too sure. The user reported that memtest86+ passes just fine, and SeaBIOS works; BIOS GRUB also works, which means that the bug is likely only in an area of GRUB that runs specifically on the coreboot payload, so it's probably a driver in GRUB when running on the metal rather than BIOS/UEFI. The build system supports a configuration whereby SeaBIOS is the primary payload, but GRUB is available in the SeaBIOS boot select menu, and an additional configuration is available where GRUB is what SeaBIOS executes first (while still providing boot select); both of these are now the *only* configurations available, on all x86 targets except QEMU. The QEMU target is fine because if the bug occurs there, you can just close QEMU and try a different image. Even after this bug is later identified and fixed, the GRUB source code is vastly over-engineered and there are likely many more such bugs. SeaBIOS is a reliable payload; the code is small and robust. Remember always: Code equals bugs Therefore, this configuration change is likely going to be permanent. This will apply in the next release. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-26flashprog: bump to 5b4fdd1 from 2 May 2024Leah Rowe
I've rebased the workaround-mx patch as follows. See: commit 9a11cbf21a5078bcdb8db7584c44a9ee17020db4 Author: Nico Huber <nico.h@gmx.de> Date: Fri Jan 13 01:19:07 2023 +0100 Let the flash context directly point to the used master This change, now upstream in flashprog, made me have to do this in the patch. I changed this: flash->mst->spi.command(flash, sizeof(cmd), sizeof(buf), cmd, buf); to this: flash->mst.spi->command(flash, sizeof(cmd), sizeof(buf), cmd, buf); It should work fine. This update imports the following upstream patches from flashprog: * 5b4fdd1 z60_flashprog.rules: Add udev rule for CH347 * 72c9e40 meson: Check for CPU families with known raw mem access * 3458220 platform/meson: Port pciutils/pci.h workaround to Meson * f279762 platform/meson: Check for libi386 on NetBSD * 14da5f7 README: Convert to Markdown * 8ddea57 README: Document branching and release policy * 2522456 util/list_yet_unsupported_chips.sh: Fix path * cbf9c11 spi: Don't cross 16MiB boundaries with long writes * 823a704 dediprog: Skip warning on first attempt to read device string * e8463c8 dediprog: Revise prefix check for given programmer id * 38af1a1 dediprog: Revise id matching * 4661e7c amd_spi100: Use flashprog_read_chunked() for progress reporting * cdcfda2 read_memmapped: Use flashprog_read_chunked() for progress reporting * 7679b5c spi25: Replace spi_read_chunked() with more abstract version * ca1c7fd spi25: Normalize parameters of spi_nbyte_read() * e36e3dc dediprog: Use default_spi_write_256 * 522a86d linux_spi: Use default_spi_read()/_write_256() * 806509b cli_classic: Turn progress reporting into a progress bar * 842d678 libflashrom: Return progress state to the library user * aa714dd flashprog.c: Let select_erase_functions() return byte count * 2eed4cf serprog: Add SPI Mode and CS Mode commands * 821a085 dediprog: Implement id reading for SF600 and later * 274e655 dediprog: Read device string early * 0057822 dediprog: Add protocol detection for SF700 & SF600Plus-G2 * fb176d2 dediprog: Use more general 4BA write mode for newer protocols * 0ab5c3d dediprog: Split device type and version parsing * bdef5c2 dediprog: Use unsigned conversions to parse device string * 5262e29 dediprog: Try to request 32B device string (instead of 16B) * e76e21f dediprog: Get rid of some unnecessary hex constants * 5a09d1e udelay: Lower the sleep vs delay threshold * 03ad4a4 linux_mtd: Provide no-op delay implementation * 211c6ec serprog: Refine flushing before synchronization * 383b7fe serprog: Test synchronicity before trying to synchronize * d7318ea serprog: Move synchronicity test into separate function * 9a11cbf Let the flash context directly point to the used master * aabb3e0 writeprotect: Hook wp functions into the chip driver * 89569d6 memory_mapped: Reduce `decode_sizes` to a single `max_rom_decode` * 929d2e1 internal: Pass programmer context down into chipset enables * 7c717c3 internal: Pass programmer context down into board enables * e3a2688 Pass programmer context to programmer->init() * 2b66ad9 Start implementing struct flashprog_programmer * 4517e92 memory_bus: Drop stale `size == 0` workaround and FIXME * b197402 memory_bus: Split register mapping into own function * 0e76d99 memory_bus: Move (un)map_flash_region into par master * 9eec407 Perform default mapping only for respective chips * 56b53dd wbsio_spi: Request memory mapping locally * 5596190 it87spi: Request memory mapping locally * 46449b4 spi25: Drop stale `bus == SPI` guards * ab6b18f spi25: Move 4BA preparations into spi_prepare_4ba() hook * 901fb95 Add prepare/finish_access() hooks for chip drivers * a96aaa3 dediprog: Support long writes of 16MiB and more * 1338936 Consider 4BA support when filtering erase functions * 8d36db6 flashprog.8: Fix up serprog example * d2ac303 flashprog.8: document new serprog cs parameter * d1b9153 chipset_enable.c: Add Genoa to mendocino entry Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-26rename include/option.sh to include/lib.shLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-26roms: rename bstr variableLeah Rowe
i forgot to do this in the recent cleanup. it is now initialised as a variable named "x" Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-26general code cleanup in the build systemLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25build: simplify git_init()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25build: do root check before git checkLeah Rowe
otherwise, git could be initialised as root. running as root is not allowed. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25build: simplify git checksLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25option.sh: fix bad check for version/versiondateLeah Rowe
i was checking whether it's a directory, whereas i should have been checking whether it's a file. this is a workaround put in place in case someone downloaded a tarball from codeberg which is pre-generated per commit. in this situation, the version and versiondate files do not exist, but the design of the build system requires that they do exist. the existing check is correct except for this bug, so fix the bug. check that they are files, not directories Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25trees: reset makeargs per target/projectLeah Rowe
it wasn't being reset before. when coreboot is being built, i add to makeargs every time. if multiple targets are being built, the make command would end up looking something like: make -C src/coreboot/default UPDATED_SUBMODULES=1 \ UPDATED_SUBMODULES=1 (the parameter would be printed twice) of course, this doesn't check whether that parameter is added already in target.cfg for a given target, but that's ok because i won't add that one in target.cfg i baked it into the code, only when handling coreboot, because that was easier than either putting it in makeargs for every coreboot target.cfg, or again modifying the code to handle that; the current solution is the cleanest. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25trees: also use UPDATED_SUBMODULES=1 on crossgccLeah Rowe
i overlooked this in the previous revision Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25trees: add UPDATED_SUBMODULES to coreboot makeLeah Rowe
we do not want submodules to be downloaded after the fact. we only handle this on ./update trees -f coreboot Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-25trees: write -C on the make command first not lastLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-24config: add backup coreboot submodule repositoriesLeah Rowe
this is using the same functionality that was added a few commits ago, to override the use of "git submodule update" each coreboot submodule has two repositories defined, with the second one kicking in if the mail one fails upon cloning. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-24coreboot/default: remove chromeec from module.listLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-24git.sh: break if a submodule clone succeedsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-24coreboot: only download the necessary submodulesLeah Rowe
whitelist what modules are downloaded, by adding module.list files in the corresponding directories under config/submodule/, per each coreboot tree. this is making use of functionality added in the previous commit. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-24git.sh: allow finer control of git submodulesLeah Rowe
in each submodule configuration directory, a module.cfg file can now be provided. in it, the user can specify two repository links (main and backup) and a revision, like so: subrepo="repo link goes here" subrepo_bkup="backup repo link goes here" subrev="git revision id goes here" additionally: in the *main* project directory for the submodules, a module.list file can be provided. example entries: 3rdparty/vboot 3rdparty/libgfxinit if the module.list file is provided, only those submodules will be downloaded. this can be combined with the module.cfg files, if you wish, but it's optional. you can mix and match. example locations: multi-tree project: config/submodule/coreboot/default/module.list config/submodule/coreboot/default/vboot/module.cfg single-tree project: config/submodule/flashprog/module.list config/submodule/flashprog/foo/module.cfg *no* configuration files have been provided, in this commit, which means that the current behaviour is maintained. follow-up commits will absolutely configure the submodules. this is being done to reduce the number of modules downloaded, because we don't use most of the coreboot submodules that are downloaded, thus wasting bandwidth and the releases are also much bigger than necessary. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-24build: hide git-init outputLeah Rowe
following on from the previous commit, if you run something like "./build roms list" when running for the first time from a codeberg tarball, the output of the git commands will be included in the output hide this output Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-24option.sh: generate version file if .git not foundLeah Rowe
a user was getting error "version unset" when using the tarball generated from codeberg. it's recommended to use the git repository properly, or a release archive. mitigate this so that the build succeeds anyway. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-23update/trees: remove unused variableLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: move repo copying to a new functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: move link_crossgcc to end of fileLeah Rowe
link_crossgcc is called after git_am_patches, so put it after ward Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: move xgcc linking to a new functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: skip submodules if .gitmodules missingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: merge patch_submodules in prep_submodulesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: split submodule handling to new functionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: remove errant line breakLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: remove another meaningless checkLeah Rowe
again, the directory in question is simply used in a for loop using asterisk (git_am_patches) and the for loop simply won't iterate if either the directory doesn't exist or it contains no items. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-22git.sh: shorter variable namesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>