Commit Graph

420 Commits (f3baebe7e1f897cb1b821ebc0e6661e8a17619a2)

Author SHA1 Message Date
Leah Rowe 1d7a6f04c9 move handle_coreboot_utils to script/trees
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-07 17:33:14 +01:00
Leah Rowe ff16d27991 put coreboot utils in elf/, not cbutils/
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-07 17:32:38 +01:00
Leah Rowe 3748f710c9 fix build issue building coreboot utils
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-07 17:31:16 +01:00
Leah Rowe a30bfd334f trees: skip single-tree build if a build exists
this replicates the same behaviour as multi-tree builds,
checking for files inside the relevant elf/ directory

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:31:11 +01:00
Leah Rowe b682b4ddca use correct memtest86plus path in script/roms
the previous change makes memtest.bin get cached in elf/
but the path was being prefixed with src/ by script/roms

do away with the prefix

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:31:05 +01:00
Leah Rowe 4749a5a29f put memtest86plus builds in elf/memtest86plus/
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:31:00 +01:00
Leah Rowe 0e9d9b33b2 put flashprog builds in elf/flashprog/
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:30:55 +01:00
Leah Rowe 7fe0106fa0 trees: also print "DONE! check elf/dir" on single
e.g. ./update trees -b flashprog

tell the user to check elf/flashprog

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:30:51 +01:00
Leah Rowe 74759d876a trees: handle build-test on multi-tree projects
for example, now flashprog binaries could be placed
in the elf/ directory, under elf/flashprog/

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:30:40 +01:00
Leah Rowe 98e9cf6864 git.sh: use singletree() to decide submodules
now it no longer hardcodes a check for whether the
project name is coreboot. this maintains the same
behaviour but will now work for other multi-tree
projects; in practise, the other multi-tree projects
did not use .gitmodules files anyway, but some of
them used config/submodules/ in our build system.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:29:58 +01:00
Leah Rowe b3b887567a remove cbcfgsdir variable (unused)
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:28:50 +01:00
Leah Rowe cb446e7d24 move cfgsdir/datadir variables to lib.sh
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-07 17:28:16 +01:00
Leah Rowe 7d99786a1a handle build.list from config/data/, not config/
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-07 17:27:45 +01:00
Leah Rowe a61794dfca don't use build.list to detect multi-tree projects
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>
2024-06-07 17:27:40 +01:00
Leah Rowe 878056f37b move id check to lib.sh too
doesn't really matter, it's just an extra layer to ensure
reliability, but "id" is pretty standard

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-07 17:27:36 +01:00
Leah Rowe 3900642471 move root check to lib.sh (bugfix)
this avoids writing the version/versiondate files as root.

this complements the previous fix, that avoided writing those
same files when running the dependencies command.

initial setup of the build system requires root, to run the
dependencies script, but otherwise the build system prevents
running as root for everything else, so we must avoid writing
the version/versiondate files as root.

that same avoidance is necessary when checking whether running
other commands as root; ironically, this check then prevented
running the build system at all!

the bug should be fully fixed now. i found this quite by accident
the other day, when testing something else.

good thing this got fixed because the release!

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-05 11:15:44 +01:00
Leah Rowe 740b1803fa bugfix: move dependencies handling to lib.sh
do it strategically, in just the right place so that the
version and versiondate files aren't written.

otherwise, version/versiondate are written as root and
the build system becomes unusable after that, unless you
reset the file ownerships from root. hardly user-friendly.

mitigate this bug.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-05 11:15:39 +01:00
Leah Rowe 4e25e335ed bump untitled revision again
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-04 14:17:04 +01:00
Leah Rowe 44ef38b335 bump untitled revision in git config
it imports the same environmental variable fix because
i had the same buggy TMPDIR check there. i fixed that
upstream in untitled.

import the new untitled revision.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-04 14:06:57 +01:00
Leah Rowe 7b9431e336 lib.sh bugfix: check environmental variables right
A user had TMUX_TMPDIR set, which broke the TMPDIR check

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-04 13:58:11 +01:00
Leah Rowe 2478252f67 lib.sh: more friendly output from e()
already of saying "found", say "already exists"

this means the output of these commands more user
friendly and intuitive:

./update trees -b grub default
./update trees -b coreboot i945

this is just an example. when an ELF file already
exists, the build is skipped even if src isn't downloaded.

this design is intentional, because it means that you can
use previous builds if you want to save time on another.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:56 +01:00
Leah Rowe d21fd016ac badcmd: don't print "no context given"
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:51 +01:00
Leah Rowe 663de3bab4 badcmd: link directly to the maintenance manual
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:45 +01:00
Leah Rowe 1d866d17d8 better help text on invalid commands
adding help again is a bad idea. code should never
document itself; that's what documentation is for.

so, make the code do a better job telling the user
where to find documentation.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:39 +01:00
Leah Rowe 1204bc3c96 build: print the project website address on help
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:32 +01:00
Leah Rowe ca0e9354f6 add projectsite file: point to canoeboot.org
this will be used in subsequent revisions

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-03 11:09:12 +01:00
Leah Rowe eb4ac3c334 make GRUB multi-tree and re-add xhci patches
The xHCI patches were removed because they caused issues
on Sandybridge-based Dell Latitude laptops. See:
https://codeberg.org/libreboot/lbmk/issues/216

The issue was not reported elsewhere, but we still don't
need xHCI support in Canoeboot's GRUB because none of the
available coreboot targets have xHCI support. However, we
may want it in the future and it helps to keep Canoeboot
in sync with Libreboot (this patch is adapted from lbmk).

Each given coreboot target can say which GRUB tree to use
by setting this in target.cfg:

grubtree="xhci"

In the above example, the "xhci" tree would be used. Some
generic GRUB config has been moved to config/data/grub/
and config/grub/ now looks like config/coreboot/ - also,
the grub.cfg file (named "payload" in each tree) is copied
to the GRUB source tree as ".config", then added to GRUB's
memdisk in the same way, as grub.cfg.

Several other design changes had to be made because of this:

* grub.cfg in memdisk no longer automatically jumps to one
  in CBFS, but now shows a menuentry for it if available

* Certain commands in script/trees are disabled for GRUB,
  such as *config make commands.

* gnulib is now defined in config/submodule/grub/, instead
  of config/git/grub - and this mitigates an existing bug
  where downloading gnulib first would make grub no longer
  possible to download in lbmk.

There is another reason for merging this design change from
lbmk, and that reasoning also applies to lbmk. Specifically:

This change will enable per-board GRUB optimisation in the
future. For example, we hardcode what partitions and LVMs
GRUB scans because * is slow on ICH7-based machines, due
to GRUB's design. On other machines, * is reasonably fast,
for automatically enumerating the list of devices for boot.

Use of * (and other wildcards) could enable our GRUB payload
to automatically boot more distros, with minimal fuss. This
can be done at a later date, in subsequent revisions.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:41:46 +01:00
Leah Rowe 347a104ae6 u-boot on qemu: remove currently unused x86 target
it doesn't build, at present, but isn't used by any
coreboot targets, so the build issue does not come up
during release builds, but i did find it laying around
during my audits.

x86 qemu is on todo for libreboot, on all x86 boards,
but the current config is broken, so: remove it.

it's very much a requirement that anything in lbmk should
work.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:29:11 +01:00
Leah Rowe 23e66c113d grub.cfg: scan /boot/grub.cfg last
very unlikely to exist. in fact, should i remove it?

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:29:05 +01:00
Leah Rowe 6151316b91 grub.cfg: scan grub2/ last
it's very unlikely that someone would use this
directory name nowadays, and i had half a mind
to remove it altogether

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:28:59 +01:00
Leah Rowe 36b3be95cf grub.cfg: search a reduced list of devs/partitions
in practise, the machines we support don't have
the option of including so many disks; 8 seems like
the most reasonable default. additionally, it's
unreasonable to expect *20 partitions*

this hardcoding is done to avoid using *, which is
slow in grub on some machines (the grub kernel always
re-enumerates the devices during every operation,
without caching any of it)

yet, the hardcoding is also slow; balance it a bit
better by searching fewer permutations, but not so few
that it would likely break a lot of setups

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:28:53 +01:00
Leah Rowe 71a17efc06 grub.cfg: scan grub.cfg from ESP
we already supported syslinux but not grub

support grub by scanning for the most common paths,
based on the most popular distros

we don't hardcode this with * because it slows down
the boot, and in practise many distros still use the
same grub.cfg location as in BIOS systems (the EFI
one is often just a link to the BIOS one)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:28:46 +01:00
Leah Rowe 8bc7e3a539 grub.cfg: split up try_user_config
in the next revision, i will add ESP paths

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:28:39 +01:00
Leah Rowe cb4bacc9d9 grub.cfg: don't search for *_grub.cfg
this is a relic from the old days when we didn't
automated the grub.cfg logic as much. these days,
the grub.cfg logic is able to boot almost all distros
without any manual intervention or override.

removing these entries will speed up the boot in general

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:28:13 +01:00
Leah Rowe ea7e6e1659 grub.cfg: remove unnecessary path for isolinux
the path "/boot/EFI" is unnecessary because the ESP
is always a FAT32 partition, so we don't need to
scan it as a subdirectory within a subdirectory.

the ESP is always mounted as its own partition,
FAT32, and EFI/ is always at the root of it

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:27:14 +01:00
Leah Rowe 1beca3b781 grub.cfg: don't scan EFI on btrfs subvols
the esp is always a fat32 partition so this makes no sensgrub.cfg: don't scan EFI on btrfs subvols

the esp is always a fat32 partition so this makes no sense

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-06-02 22:27:05 +01:00
Luke T. Shumaker 0662519cca Fix building vboot on i686 2024-06-02 22:26:42 +01:00
Leah Rowe 224dce632b git.sh: do not remove .submodules
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-30 07:52:27 +01:00
Leah Rowe a36504aa31 delete u-boot test/lib/strlcat.c using nuke()
we don't need to do it in the release function

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-30 07:38:32 +01:00
Leah Rowe cdce8ba70b make nuke function more generic
i'm merging it into lbmk after this commit. in lbmk, it
will be used for deleting certain files such as u-boot's
strlcat.c. it will not be used in libreboot for deblobbing;
that's what canoeboot is for (deblobbed coreboot distro).

Signed-off-by: Leah Rowe <info@minifree.org>
2024-05-30 07:24:13 +01:00
Leah Rowe 2c1f6f5e7a do not allow dashes in coreboot target names
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-29 10:27:22 +01:00
Leah Rowe 7dc5d35929 roms: allow user override of grub_scan_disk
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-29 10:26:03 +01:00
Leah Rowe bcb65846d3 grub.cfg: actually support setting boot order
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-29 10:25:58 +01:00
Leah Rowe 2887b77ae4 trees: use CPUS=x on regular coreboot make
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-29 10:25:50 +01:00
Leah Rowe a056583762 update gitignore
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-29 10:25:40 +01:00
Leah Rowe 1ac4f7409e roms: fix bad eval when comparing options
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-28 01:24:17 +01:00
Leah Rowe 724dbfe0ce grub.cfg: add spdx header
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-27 23:36:33 +01:00
Leah Rowe 66f5faac73 re-configure grub_scan_disk on various targets
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27 23:36:10 +01:00
Leah Rowe bb92776943 remove grub_scan_disk in all target.cfg files
A subsequest revision will set them again as needed,
per coreboot target.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-27 23:35:18 +01:00
Leah Rowe 935447b035 grub.cfg: use grub_scan_disk to set boot order
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-27 23:33:09 +01:00