2023-10-26 21:11:40 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2024-05-26 02:54:36 +02:00
|
|
|
# Copyright (c) 2014-2016,2020-2021,2023-2024 Leah Rowe <leah@libreboot.org>
|
|
|
|
# Copyright (c) 2021-2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
|
|
|
# Copyright (c) 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
|
|
|
# Copyright (c) 2023 Riku Viitanen <riku.viitanen@protonmail.com>
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
set -u -e
|
|
|
|
|
2024-05-26 13:10:27 +02:00
|
|
|
. "include/lib.sh"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"
|
|
|
|
cfgsdir="config/coreboot"
|
2024-05-26 02:54:36 +02:00
|
|
|
picosrc="src/pico-serprog"
|
|
|
|
picosdk="src/pico-sdk"
|
|
|
|
stm32src="src/stm32-vserprog"
|
2024-06-16 02:11:46 +02:00
|
|
|
tmpcfg="$tmpdir/tmpcfg"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
# Disable all payloads by default.
|
|
|
|
# target.cfg files have to specifically enable [a] payload(s)
|
2024-05-26 02:54:36 +02:00
|
|
|
pv="payload_uboot payload_grub_withseabios payload_seabios payload_memtest t"
|
|
|
|
pv="$pv payload_seabios_withgrub payload_seabios_grubonly payload_grub mt86bin"
|
2024-06-16 00:58:27 +02:00
|
|
|
v="romdir cbrom initmode displaymode cbcfg targetdir tree release ubootelf"
|
2024-06-16 02:05:28 +02:00
|
|
|
v="$v grub_timeout board grub_scan_disk uboot_config grubtree grubelf tmpmv"
|
2024-06-14 10:11:07 +02:00
|
|
|
eval "$(setvars "n" $pv)"
|
2024-06-14 18:34:30 +02:00
|
|
|
eval "$(setvars "" $v boards targets serprog_boards_dir)"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
while [ $# -gt 0 ]; do
|
2024-06-14 15:19:44 +02:00
|
|
|
[ "$1" = "list" ] && eval "x_ ls -1 config/coreboot; return 0"
|
2024-06-16 01:40:44 +02:00
|
|
|
[ "$1" = "serprog" ] && shift && eval "mkserprog $@; return 0"
|
2024-06-14 15:19:44 +02:00
|
|
|
[ "$1" = "all" ] && shift && continue
|
|
|
|
boards="$1 $boards"; shift 1
|
2023-10-26 21:11:40 +02:00
|
|
|
done
|
|
|
|
|
2024-06-14 14:19:25 +02:00
|
|
|
[ -n "$boards" ] || boards="$(ls -1 config/coreboot)" || \
|
2024-06-14 10:11:07 +02:00
|
|
|
$err "Cannot generate list of boards for building"
|
|
|
|
for x in $boards; do
|
2024-06-14 17:34:05 +02:00
|
|
|
[ -d "config/coreboot/$x/config" ] && configure_target "$x" \
|
|
|
|
&& build_payloads && build_board && [ -d "bin/$board" ] \
|
|
|
|
&& targets="$targets, $x"; continue
|
2024-06-14 10:11:07 +02:00
|
|
|
done
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-05-26 02:54:36 +02:00
|
|
|
[ -z "$targets" ] && $err "No ROM images were compiled"
|
2024-06-14 17:34:05 +02:00
|
|
|
printf "Check these ROM directories in bin/: %s\n" "${targets#, }"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
printf "DO NOT flash images from elf/ - please use bin/ instead.\n"
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
2024-06-14 15:19:44 +02:00
|
|
|
mkserprog()
|
2024-05-09 14:52:49 +02:00
|
|
|
{
|
2024-06-03 01:17:36 +02:00
|
|
|
[ -z "${1+x}" ] && badcmd
|
2024-05-15 05:30:42 +02:00
|
|
|
[ "$1" != "rp2040" ] && [ "$1" != "stm32" ] && $err "bad command"
|
2024-05-26 02:54:36 +02:00
|
|
|
if [ "$1" = "rp2040" ]; then
|
|
|
|
serprog_boards_dir="$picosdk/src/boards/include/boards"
|
|
|
|
[ -d "$picosrc" ] || x_ ./update trees -f "pico-serprog"
|
|
|
|
elif [ "$1" = "stm32" ]; then
|
|
|
|
serprog_boards_dir="$stm32src/boards"
|
|
|
|
[ -d "$stm32src" ] || x_ ./update trees -f "stm32-vserprog"
|
2024-05-09 14:52:49 +02:00
|
|
|
fi
|
2024-05-26 02:54:36 +02:00
|
|
|
x_ mkdir -p "bin/serprog_$1"
|
2024-05-09 14:52:49 +02:00
|
|
|
|
2024-06-16 01:53:21 +02:00
|
|
|
if [ $# -gt 1 ]; then
|
|
|
|
[ "$2" = "list" ] && serlist "$serprog_boards_dir" && return 0
|
|
|
|
[ "$2" = "list" ] || build_${1}_rom "$2"
|
2024-05-09 14:52:49 +02:00
|
|
|
else
|
2024-06-16 01:53:21 +02:00
|
|
|
serlist "$serprog_boards_dir" | \
|
2024-05-09 14:52:49 +02:00
|
|
|
while read -r board; do
|
2024-05-26 02:54:36 +02:00
|
|
|
build_${1}_rom "$board"
|
2024-05-09 14:52:49 +02:00
|
|
|
done
|
|
|
|
fi
|
2024-05-15 00:17:22 +02:00
|
|
|
|
2024-05-19 07:45:38 +02:00
|
|
|
[ "$xbmk_release" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0
|
2024-05-09 14:52:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
build_rp2040_rom()
|
|
|
|
{
|
2024-06-16 01:48:36 +02:00
|
|
|
x_ cmake -DPICO_BOARD="$1" -DPICO_SDK_PATH="$picosdk" \
|
2024-05-26 02:54:36 +02:00
|
|
|
-B "$picosrc/build" "$picosrc"
|
|
|
|
x_ cmake --build "$picosrc/build"
|
|
|
|
x_ mv "$picosrc/build/pico_serprog.uf2" \
|
2024-06-16 01:48:36 +02:00
|
|
|
"bin/serprog_rp2040/serprog_$1.uf2"
|
|
|
|
printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "$1"
|
2024-05-09 14:52:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
build_stm32_rom()
|
|
|
|
{
|
2024-06-16 01:48:36 +02:00
|
|
|
x_ make -C "$stm32src" libopencm3-just-make BOARD=$1
|
|
|
|
x_ make -C "$stm32src" BOARD=$1
|
2024-05-26 02:54:36 +02:00
|
|
|
x_ mv "$stm32src/stm32-vserprog.hex" \
|
2024-06-16 01:48:36 +02:00
|
|
|
"bin/serprog_stm32/serprog_$1.hex"
|
|
|
|
printf "output to bin/serprog_stm32/serprog_%s.hex\n" "$1"
|
2024-05-09 14:52:49 +02:00
|
|
|
}
|
|
|
|
|
2024-06-16 01:53:21 +02:00
|
|
|
serlist()
|
2024-05-09 14:52:49 +02:00
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
basename -a -s .h "$1/"*.h || $err "$1: can't list boards"
|
2024-05-09 14:52:49 +02:00
|
|
|
}
|
|
|
|
|
2024-06-14 17:34:05 +02:00
|
|
|
configure_target()
|
2024-05-05 06:09:23 +02:00
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
eval "$(setvars "n" $pv) $(setvars "" $v)"
|
2024-05-05 06:28:06 +02:00
|
|
|
board="$1"
|
2024-05-05 06:09:23 +02:00
|
|
|
|
2024-05-26 02:54:36 +02:00
|
|
|
targetdir="$cfgsdir/$board"
|
|
|
|
[ -f "$targetdir/target.cfg" ] || $err "$board: target.cfg missing"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
# Override the above defaults using target.cfg
|
2024-05-26 02:54:36 +02:00
|
|
|
. "$targetdir/target.cfg"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
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 21:16:49 +02:00
|
|
|
[ -z "$grub_scan_disk" ] && grub_scan_disk="nvme ahci ata"
|
2024-06-09 19:48:58 +02:00
|
|
|
|
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 00:01:30 +02:00
|
|
|
[ -n "$grubtree" ] || grubtree="default"
|
|
|
|
grubelf="elf/grub/$grubtree/payload/grub.elf"
|
|
|
|
|
safer, simpler error handling in cbmk
in shell scripts, a function named the same as a program included in
the $PATH will override that program. for example, you could make a
function called ls() and this would override the standand "ls".
in cbmk, a part of it was first trying to run the "fail" command,
deferring to "err", because some scripts call fail() which does
some minor cleanup before calling err.
in most cases, fail() is not defined, and it's possible that the user
could have a program called "fail" in their $PATH, the behaviour of
which we could not determine, and it could have disastrous effects.
cbmk error handling has been re-engineered in such a way that the
err function is defined in a variable, which defaults to err_ which
calls err_, so defined under include/err.sh.
in functions that require cleanup prior to error handling, a fail()
function is still defined, and err is overridden, thus:
err="fail"
this change has made xx_() obsolete, so now only x_ is used. the x_
function is a wrapper that can be used to run a command and exit with
non-zero status (from cbmk) if the command fails. the xx_ command
did the same thing, but called fail() which would have called err();
now everything is $err
example:
rm -f "$filename" || err "could not delete file"
this would now be:
rm -f "$filename" || $err "could not delete file"
overriding of err= must be done *after* including err.sh. for
example:
err="fail"
. "include/err.sh"
^ this is wrong. instead, one must do:
. "include/err.sh"
err="fail"
this is because err is set as a global variable under err.sh
the new error handling is much cleaner, and safer. it also reduces
the chance of mistakes such as: calling err when you meant to
call fail. this is because the standard way is now to call $err,
so you set err="fail" at the top of the script and all is well.
Signed-off-by: Leah Rowe <info@minifree.org>
2024-03-27 02:19:39 +01:00
|
|
|
[ -z "$tree" ] && $err "$board: tree not defined"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-05-26 02:54:36 +02:00
|
|
|
[ "$payload_memtest" != "y" ] && payload_memtest="n"
|
2024-05-22 00:32:18 +02:00
|
|
|
[ "$(uname -m)" = "x86_64" ] || payload_memtest="n"
|
|
|
|
|
2024-06-16 00:38:19 +02:00
|
|
|
[ "$payload_grub_withseabios" = "y" ] && eval "$(setvars "y" \
|
|
|
|
payload_grub payload_seabios payload_seabios_withgrub)"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
[ "$payload_seabios_withgrub" = "y" ] && payload_seabios="y"
|
2024-06-16 00:42:45 +02:00
|
|
|
[ "$payload_seabios_grubonly" = "y" ] && \
|
|
|
|
eval "$(setvars "y" payload_seabios payload_seabios_withgrub)"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
# The reverse logic must not be applied. If SeaBIOS-with-GRUB works,
|
2024-05-19 07:30:32 +02:00
|
|
|
# that doesn't mean GRUB-with-SeaBIOS will, e.g. VGA ROM execution
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
[ "$payload_grub" != "y" ] && [ "$payload_seabios" != "y" ] && \
|
2024-05-26 02:54:36 +02:00
|
|
|
[ "$payload_uboot" != "y" ] && $err "'$board' defines no payload"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
[ "$payload_uboot" != "n" ] && [ "$payload_uboot" != "y" ] && \
|
2023-10-26 21:11:40 +02:00
|
|
|
payload_uboot="n"
|
2024-06-16 13:42:57 +02:00
|
|
|
[ -n "$uboot_config" ] || uboot_config="default"
|
2024-06-14 17:26:49 +02:00
|
|
|
|
|
|
|
[ "$xbmk_release" = "y" ] && [ "$release" = "n" ] && return 1
|
|
|
|
[ "$board" = "$tree" ] && return 1; return 0
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
build_payloads()
|
2023-10-26 21:11:40 +02:00
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
romdir="bin/$board"
|
|
|
|
cbdir="src/coreboot/$board"
|
|
|
|
[ "$board" = "$tree" ] || cbdir="src/coreboot/$tree"
|
2024-06-06 22:45:53 +02:00
|
|
|
cbfstool="elf/cbfstool/$tree/cbfstool"
|
2024-05-26 02:54:36 +02:00
|
|
|
cbrom="$cbdir/build/coreboot.rom"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
[ -f "$cbfstool" ] || x_ ./update trees -b coreboot utils $tree
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-06-06 10:05:16 +02:00
|
|
|
mt86bin="elf/memtest86plus/memtest.bin"
|
2024-06-06 10:11:39 +02:00
|
|
|
[ "$payload_memtest" != "y" ] || [ -f "$mt86bin" ] || \
|
2023-10-26 21:11:40 +02:00
|
|
|
x_ ./update trees -b memtest86plus
|
|
|
|
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
[ "$payload_seabios" = "y" ] && x_ ./update trees -b seabios
|
|
|
|
if [ "$payload_grub" = "y" ] || [ "$payload_seabios_withgrub" = "y" ] \
|
2024-06-14 18:34:30 +02:00
|
|
|
|| [ "$payload_seabios_grubonly" = "y" ]; then
|
|
|
|
[ -f "$grubelf" ] || x_ ./update trees -b grub $grubtree
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
fi
|
2024-05-26 02:54:36 +02:00
|
|
|
[ "$payload_uboot" = "y" ] && build_uboot_payload; return 0
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
build_uboot_payload()
|
2023-10-26 21:11:40 +02:00
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
x_ ./update trees -b u-boot $board
|
|
|
|
ubdir="elf/u-boot/$board/$uboot_config"
|
2024-06-16 00:58:27 +02:00
|
|
|
ubootelf="$ubdir/u-boot.elf" && [ ! -f "$ubootelf" ] && \
|
|
|
|
ubootelf="$ubdir/u-boot"
|
2024-05-26 02:54:36 +02:00
|
|
|
[ -f "$ubootelf" ] || $err "$board: Can't find u-boot"; return 0
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
2024-06-14 17:34:05 +02:00
|
|
|
build_board()
|
2023-10-26 21:11:40 +02:00
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
x_ rm -Rf "$romdir"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
|
2023-10-26 21:11:40 +02:00
|
|
|
for x in "normal" "vgarom" "libgfxinit"; do
|
2024-05-26 02:54:36 +02:00
|
|
|
initmode="$x"
|
2023-10-26 21:11:40 +02:00
|
|
|
hmode="vesafb"
|
2024-05-26 02:54:36 +02:00
|
|
|
[ "$initmode" = "vgarom" ] || hmode="corebootfb"
|
|
|
|
modes="$hmode txtmode"
|
|
|
|
for y in $modes; do
|
|
|
|
displaymode="$y"
|
|
|
|
[ "$initmode" = "normal" ] && \
|
2023-10-26 21:11:40 +02:00
|
|
|
[ "$displaymode" != "txtmode" ] && continue
|
2024-05-26 02:54:36 +02:00
|
|
|
cbcfg="$targetdir/config/${initmode}_$displaymode"
|
|
|
|
[ "$initmode" = "normal" ] && cbcfg="${cbcfg%_*}"
|
2024-06-16 13:46:03 +02:00
|
|
|
e "$cbcfg" f not || build_roms; x_ rm -f "$cbrom"
|
2023-10-26 21:11:40 +02:00
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
build_roms()
|
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
x_ ./update trees -b coreboot $board
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-06-16 18:46:58 +02:00
|
|
|
_cbrom="$cbelfdir/$board/${initmode}_$displaymode"
|
2024-05-26 02:54:36 +02:00
|
|
|
[ "$initmode" = "normal" ] && _cbrom="${_cbrom%"_$displaymode"}"
|
|
|
|
_cbrom="$_cbrom/coreboot.rom"
|
2023-10-26 21:11:40 +02:00
|
|
|
cbrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
2024-05-26 02:54:36 +02:00
|
|
|
x_ cp "$_cbrom" "$cbrom"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-06-15 21:22:19 +02:00
|
|
|
[ "$payload_memtest" != "y" ] || cbfs "$cbrom" "$mt86bin" img/memtest
|
2024-05-26 02:54:36 +02:00
|
|
|
[ "$payload_seabios" = "y" ] && build_seabios_roms
|
2024-06-16 00:31:26 +02:00
|
|
|
[ "$payload_grub" != "y" ] || build_grub_roms "$cbrom" "grub"
|
2024-05-26 02:54:36 +02:00
|
|
|
[ "$payload_uboot" = "y" ] || return 0
|
|
|
|
x_ cp "$_cbrom" "$cbrom"
|
2023-10-26 21:11:40 +02:00
|
|
|
build_uboot_roms
|
|
|
|
}
|
|
|
|
|
|
|
|
build_seabios_roms()
|
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
if [ "$payload_seabios_withgrub" = "y" ]; then
|
|
|
|
t="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
|
|
|
x_ cp "$cbrom" "$t"
|
2024-06-16 00:31:26 +02:00
|
|
|
build_grub_roms "$t" "seabios_withgrub"
|
2023-10-26 21:11:40 +02:00
|
|
|
else
|
2024-05-26 02:54:36 +02:00
|
|
|
t="$(mkSeabiosRom "$cbrom" "fallback/payload")" || \
|
safer, simpler error handling in cbmk
in shell scripts, a function named the same as a program included in
the $PATH will override that program. for example, you could make a
function called ls() and this would override the standand "ls".
in cbmk, a part of it was first trying to run the "fail" command,
deferring to "err", because some scripts call fail() which does
some minor cleanup before calling err.
in most cases, fail() is not defined, and it's possible that the user
could have a program called "fail" in their $PATH, the behaviour of
which we could not determine, and it could have disastrous effects.
cbmk error handling has been re-engineered in such a way that the
err function is defined in a variable, which defaults to err_ which
calls err_, so defined under include/err.sh.
in functions that require cleanup prior to error handling, a fail()
function is still defined, and err is overridden, thus:
err="fail"
this change has made xx_() obsolete, so now only x_ is used. the x_
function is a wrapper that can be used to run a command and exit with
non-zero status (from cbmk) if the command fails. the xx_ command
did the same thing, but called fail() which would have called err();
now everything is $err
example:
rm -f "$filename" || err "could not delete file"
this would now be:
rm -f "$filename" || $err "could not delete file"
overriding of err= must be done *after* including err.sh. for
example:
err="fail"
. "include/err.sh"
^ this is wrong. instead, one must do:
. "include/err.sh"
err="fail"
this is because err is set as a global variable under err.sh
the new error handling is much cleaner, and safer. it also reduces
the chance of mistakes such as: calling err when you meant to
call fail. this is because the standard way is now to call $err,
so you set err="fail" at the top of the script and all is well.
Signed-off-by: Leah Rowe <info@minifree.org>
2024-03-27 02:19:39 +01:00
|
|
|
$err "build_seabios_roms: cannot build tmprom"
|
2024-05-26 02:54:36 +02:00
|
|
|
newrom="$romdir/seabios_${board}_${initmode}_$displaymode"
|
|
|
|
[ "$initmode" = "normal" ] && newrom="$romdir/seabios" \
|
|
|
|
&& newrom="${newrom}_${board}_$initmode"
|
2024-06-16 18:49:44 +02:00
|
|
|
x_ cprom cp "$t" "$newrom.rom"
|
2023-10-26 21:11:40 +02:00
|
|
|
fi
|
2024-05-26 02:54:36 +02:00
|
|
|
x_ rm -f "$t"
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
2024-06-14 18:34:30 +02:00
|
|
|
# Make separate ROM images with GRUB payload
|
2023-10-26 21:11:40 +02:00
|
|
|
build_grub_roms()
|
|
|
|
{
|
2024-05-26 02:54:36 +02:00
|
|
|
tmprom="$1"
|
|
|
|
payload1="$2" # allow values: grub, seabios, seabios_withgrub
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
grub_cbfs="fallback/payload"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
if [ "$payload1" = "grub" ] && [ "$payload_grub_withseabios" = "y" ]
|
|
|
|
then
|
2024-06-16 02:05:28 +02:00
|
|
|
tmpmv="$(mkSeabiosRom "$tmprom" "seabios.elf")" || \
|
safer, simpler error handling in cbmk
in shell scripts, a function named the same as a program included in
the $PATH will override that program. for example, you could make a
function called ls() and this would override the standand "ls".
in cbmk, a part of it was first trying to run the "fail" command,
deferring to "err", because some scripts call fail() which does
some minor cleanup before calling err.
in most cases, fail() is not defined, and it's possible that the user
could have a program called "fail" in their $PATH, the behaviour of
which we could not determine, and it could have disastrous effects.
cbmk error handling has been re-engineered in such a way that the
err function is defined in a variable, which defaults to err_ which
calls err_, so defined under include/err.sh.
in functions that require cleanup prior to error handling, a fail()
function is still defined, and err is overridden, thus:
err="fail"
this change has made xx_() obsolete, so now only x_ is used. the x_
function is a wrapper that can be used to run a command and exit with
non-zero status (from cbmk) if the command fails. the xx_ command
did the same thing, but called fail() which would have called err();
now everything is $err
example:
rm -f "$filename" || err "could not delete file"
this would now be:
rm -f "$filename" || $err "could not delete file"
overriding of err= must be done *after* including err.sh. for
example:
err="fail"
. "include/err.sh"
^ this is wrong. instead, one must do:
. "include/err.sh"
err="fail"
this is because err is set as a global variable under err.sh
the new error handling is much cleaner, and safer. it also reduces
the chance of mistakes such as: calling err when you meant to
call fail. this is because the standard way is now to call $err,
so you set err="fail" at the top of the script and all is well.
Signed-off-by: Leah Rowe <info@minifree.org>
2024-03-27 02:19:39 +01:00
|
|
|
$err "build_grub_roms 1 $board: can't build tmprom"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
elif [ "$payload1" != "grub" ] && [ "$payload_seabios_withgrub" = "y" ]
|
|
|
|
then
|
|
|
|
grub_cbfs="img/grub2"
|
2024-06-16 02:05:28 +02:00
|
|
|
tmpmv="$(mkSeabiosRom "$tmprom" fallback/payload)" || \
|
safer, simpler error handling in cbmk
in shell scripts, a function named the same as a program included in
the $PATH will override that program. for example, you could make a
function called ls() and this would override the standand "ls".
in cbmk, a part of it was first trying to run the "fail" command,
deferring to "err", because some scripts call fail() which does
some minor cleanup before calling err.
in most cases, fail() is not defined, and it's possible that the user
could have a program called "fail" in their $PATH, the behaviour of
which we could not determine, and it could have disastrous effects.
cbmk error handling has been re-engineered in such a way that the
err function is defined in a variable, which defaults to err_ which
calls err_, so defined under include/err.sh.
in functions that require cleanup prior to error handling, a fail()
function is still defined, and err is overridden, thus:
err="fail"
this change has made xx_() obsolete, so now only x_ is used. the x_
function is a wrapper that can be used to run a command and exit with
non-zero status (from cbmk) if the command fails. the xx_ command
did the same thing, but called fail() which would have called err();
now everything is $err
example:
rm -f "$filename" || err "could not delete file"
this would now be:
rm -f "$filename" || $err "could not delete file"
overriding of err= must be done *after* including err.sh. for
example:
err="fail"
. "include/err.sh"
^ this is wrong. instead, one must do:
. "include/err.sh"
err="fail"
this is because err is set as a global variable under err.sh
the new error handling is much cleaner, and safer. it also reduces
the chance of mistakes such as: calling err when you meant to
call fail. this is because the standard way is now to call $err,
so you set err="fail" at the top of the script and all is well.
Signed-off-by: Leah Rowe <info@minifree.org>
2024-03-27 02:19:39 +01:00
|
|
|
$err "build_grub_roms 2 $board: can't build tmprom"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
fi
|
2024-06-16 02:05:28 +02:00
|
|
|
[ -n "$tmpmv" ] && [ -f "$tmpmv" ] && x_ mv "$tmpmv" "$tmprom"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
|
|
|
# we only need insert grub.elf once, for each coreboot config:
|
2024-06-15 21:22:19 +02:00
|
|
|
cbfs "$tmprom" "$grubelf" "$grub_cbfs"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-05-26 02:54:36 +02:00
|
|
|
printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" > "$tmpcfg" || \
|
2024-06-14 15:01:42 +02:00
|
|
|
$err "set grub_scan_disk, $grub_scan_disk, $tmpcfg"
|
2024-06-15 21:22:19 +02:00
|
|
|
cbfs "$tmprom" "$tmpcfg" scan.cfg raw
|
2024-06-16 02:11:46 +02:00
|
|
|
|
|
|
|
printf "set timeout=%s\n" "$grub_timeout" > "$tmpcfg" || $err "!time"
|
2024-06-15 21:22:19 +02:00
|
|
|
[ -z "$grub_timeout" ] || cbfs "$tmprom" "$tmpcfg" timeout.cfg raw
|
2024-05-26 02:54:36 +02:00
|
|
|
|
2024-06-14 18:34:30 +02:00
|
|
|
newrom="$romdir/${payload1}_${board}_${initmode}_$displaymode.rom"
|
|
|
|
[ "$initmode" = "normal" ] && newrom="$romdir/${payload1}_" \
|
|
|
|
&& newrom="$newrom${board}_$initmode.rom"
|
2024-06-16 18:49:44 +02:00
|
|
|
x_ cprom cp "$tmprom" "$newrom"
|
2024-06-14 18:34:30 +02:00
|
|
|
if [ "$payload_seabios_withgrub" = "y" ] && \
|
|
|
|
[ "$payload1" != "grub" ]; then
|
2024-06-15 21:22:19 +02:00
|
|
|
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
|
2024-06-16 18:49:44 +02:00
|
|
|
x_ cprom cp "$tmprom" "${newrom%.rom}_grubfirst.rom"
|
2024-06-14 18:34:30 +02:00
|
|
|
if [ "$payload_seabios_grubonly" = "y" ]; then
|
|
|
|
x_ "$cbfstool" "$tmprom" add-int -i 0 \
|
|
|
|
-n etc/show-boot-menu
|
2024-06-16 18:49:44 +02:00
|
|
|
x_ cprom cp "$tmprom" "${newrom%.rom}_grubonly.rom"
|
2024-04-28 20:56:25 +02:00
|
|
|
fi
|
2024-06-14 18:34:30 +02:00
|
|
|
fi
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# make a rom in /tmp/ and then print the path of that ROM
|
|
|
|
mkSeabiosRom() {
|
2024-06-16 13:54:07 +02:00
|
|
|
tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)" # 1=cbrom, 2=cbfs path
|
2024-05-26 02:54:36 +02:00
|
|
|
_seabioself="elf/seabios/default/$initmode/bios.bin.elf"
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-06-16 13:54:07 +02:00
|
|
|
x_ cp "$1" "$tmprom"
|
|
|
|
cbfs "$tmprom" "$_seabioself" "$2"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
|
|
|
|
|
|
|
|
z="2"; [ "$initmode" = "vgarom" ] && z="0"
|
|
|
|
x_ "$cbfstool" "$tmprom" add-int -i $z -n etc/pci-optionrom-exec
|
|
|
|
x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum
|
2024-06-15 21:22:19 +02:00
|
|
|
[ "$initmode" != "libgfxinit" ] || cbfs "$tmprom" "$seavgabiosrom" \
|
|
|
|
vgaroms/seavgabios.bin raw
|
2023-10-26 21:11:40 +02:00
|
|
|
|
2024-05-26 02:54:36 +02:00
|
|
|
printf "%s\n" "$tmprom"
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
build_uboot_roms()
|
|
|
|
{
|
2024-06-16 18:42:34 +02:00
|
|
|
tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
2024-05-26 02:54:36 +02:00
|
|
|
newrom="$romdir/uboot_payload_${board}_${initmode}_$displaymode.rom"
|
2024-06-16 18:42:34 +02:00
|
|
|
x_ cp "$cbrom" "$tmprom"
|
|
|
|
cbfs "$tmprom" "$ubootelf" "fallback/payload"
|
2024-06-16 18:50:42 +02:00
|
|
|
x_ cprom mv "$tmprom" "$newrom"
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
2024-05-26 02:54:36 +02:00
|
|
|
cprom()
|
2023-10-26 21:11:40 +02:00
|
|
|
{
|
2024-06-16 18:49:44 +02:00
|
|
|
printf "Creating target image: %s\n" "$3"
|
rebase cbmk 9429287 per lbmk c4d90087..f5b04fa5
cbmk 9429287 is the present canoeboot revision, on this day,
two commits after canoeboot 20231107
the cbmk revision was based on lbmk c4d90087, but lbmk
has developed a lot since, right up to f5b04fa5. lbmk
c4d90087 was four commits after libreboot 20231106
this patch brings cbmk up to date, versus lbmk f5b04fa5,
which is 135 commits after libreboot 20231106 (not 4)
therefore, the next canoeboot release shall import lbmk
changes made *after* lbmk revision f5b04fa5. good day!
In English (the above is for my reference, next time
I make a new canoeboot release):
This imports all of the numerous improvements from
Libreboot, sans the non-FSDG-compliant changes. You
can find a full list of such changes in the audit4 page:
https://libreboot.org/news/audit4.html
A full canoeboot-ised changelog will be available in
the next canoeboot release, with these and subsequent
changes. Most notable here is the update to the new
GRUB 2.12 release (instead of 2.12-rc1), and the
improvements Riku made to pico-serprog. And the build
system improvements from lbmk, such as improved, more
generic cmake and autoconf handling.
Canoeboot-specific changes: I also tweaked the deblob
logic, to make it less error-prone. The new design
changes imported into cbmk (based on latest lbmk) somewhat
broke the deblob logic; it was constantly reminding the
user that blobs.list was missing for coreboot,
at config/coreboot/blobs.list - coreboot is a multi-tree
project in both cbmk and lbmk, and the deblob logic was
tuned for single/multi, but was treating coreboot as both.
for simplicity, i removed the check for whether blobs.list
is present. this means that the operator must ensure that
these files are present, in any given revision, where they
are required on a given set of projects (and the files are
all present, in this update to cbmk)
Also of note: the grub.cfg improvements are included in this
cbmk update. The improved grub.cfg can find grub/syslinux
configs by default, not just grub anymore, also finds extlinux,
and will also find them on EFI System Partition - in addition,
UEFI-based install media is also more robust; although cbmk
doesn't provide UEFI configurations on x86, our GRUB palyoad
does still need to work with distro install media, and many
of them now use UEFI-based GRUB configurations in their
installation media, which just happen to work with our GRUB
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-02 12:37:25 +01:00
|
|
|
|
2024-06-16 18:49:44 +02:00
|
|
|
x_ mkdir -p "${3%/*}"
|
|
|
|
x_ $1 "$2" "$3"
|
2023-10-26 21:11:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main $@
|