2023-10-26 19:11:40 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2024-05-26 00:54:36 +00: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 19:11:40 +00:00
|
|
|
|
|
|
|
set -u -e
|
|
|
|
|
2024-05-26 11:10:27 +00:00
|
|
|
. "include/lib.sh"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
|
|
|
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"
|
|
|
|
grub_background="background1280x800.png"
|
|
|
|
grubelf="elf/grub/grub.elf"
|
|
|
|
cfgsdir="config/coreboot"
|
2024-05-26 00:54:36 +00:00
|
|
|
picosrc="src/pico-serprog"
|
|
|
|
picosdk="src/pico-sdk"
|
|
|
|
stm32src="src/stm32-vserprog"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
|
|
|
# Disable all payloads by default.
|
|
|
|
# target.cfg files have to specifically enable [a] payload(s)
|
2024-05-26 00:54:36 +00:00
|
|
|
pv="payload_uboot payload_grub_withseabios payload_seabios payload_memtest t"
|
|
|
|
pv="$pv payload_seabios_withgrub payload_seabios_grubonly payload_grub mt86bin"
|
2024-04-24 04:27:27 +00:00
|
|
|
v="romdir cbrom initmode displaymode cbcfg targetdir tree keymaps release"
|
2024-05-26 00:54:36 +00:00
|
|
|
v="$v grub_timeout ubdir board grub_scan_disk uboot_config"
|
|
|
|
eval "$(setvars "n" $pv serprog)"
|
|
|
|
eval "$(setvars "" $v boards _displaymode _payload _keyboard all targets \
|
2024-05-11 17:53:12 +00:00
|
|
|
serprog_boards_dir)"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
while [ $# -gt 0 ]; do
|
2024-05-26 00:54:36 +00:00
|
|
|
case "$1" in
|
|
|
|
list) x_ items config/coreboot; return 0 ;;
|
|
|
|
serprog) serprog="y"; shift 1; break ;;
|
|
|
|
-d) _displaymode="$2" ;;
|
|
|
|
-p) _payload="$2" ;;
|
|
|
|
-k) _keyboard="$2" ;;
|
2023-10-26 19:11:40 +00:00
|
|
|
*)
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$1" = "all" ] && all="y"
|
|
|
|
boards="$1 $boards"
|
2023-10-26 19:11:40 +00:00
|
|
|
shift && continue ;;
|
|
|
|
esac
|
|
|
|
shift 2
|
|
|
|
done
|
|
|
|
|
2024-05-09 12:52:49 +00:00
|
|
|
if [ "$serprog" = "y" ]; then
|
2024-05-26 00:54:36 +00:00
|
|
|
handle_serprog $@; return 0
|
2024-05-09 12:52:49 +00:00
|
|
|
else
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$all" != "y" ] || boards="$(items config/coreboot)" || \
|
2024-05-09 12:52:49 +00:00
|
|
|
$err "Cannot generate list of boards for building"
|
2024-05-26 00:54:36 +00:00
|
|
|
for x in $boards; do
|
2024-05-19 21:43:52 +00:00
|
|
|
[ -d "config/coreboot/$x/config" ] && \
|
2024-05-26 00:54:36 +00:00
|
|
|
handle_coreboot_target "$x"; continue
|
2024-05-09 12:52:49 +00:00
|
|
|
done
|
|
|
|
fi
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
x="directories"
|
2024-05-26 08:25:12 +00:00
|
|
|
[ "$xbmk_release" = "y" ] && x="archives"
|
2024-05-14 22:17:22 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
[ -z "$targets" ] && $err "No ROM images were compiled"
|
2024-05-26 08:22:39 +00:00
|
|
|
printf "\nROM images available in these %s:\n" "$x"
|
2024-05-26 00:54:36 +00:00
|
|
|
eval "printf \"$targets\""
|
2024-05-26 08:22:39 +00:00
|
|
|
printf "^^ ROM images available in these %s.\n\n" "$x"
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
printf "DO NOT flash images from elf/ - please use bin/ instead.\n"
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
2024-05-09 12:52:49 +00:00
|
|
|
handle_serprog()
|
|
|
|
{
|
2024-05-15 03:30:42 +00:00
|
|
|
[ -z "${1+x}" ] && $err "bad command. Check $projectname docs."
|
|
|
|
[ "$1" != "rp2040" ] && [ "$1" != "stm32" ] && $err "bad command"
|
2024-05-26 00:54:36 +00: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 12:52:49 +00:00
|
|
|
fi
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ mkdir -p "bin/serprog_$1"
|
2024-05-09 12:52:49 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
if [ $# -gt 1 ] && [ "$2" = "list" ]; then
|
|
|
|
list_serprog_boards "$serprog_boards_dir"
|
2024-05-14 22:17:22 +00:00
|
|
|
return 0
|
2024-05-09 12:52:49 +00:00
|
|
|
elif [ $# -gt 1 ]; then
|
2024-05-26 00:54:36 +00:00
|
|
|
build_${1}_rom "$2"
|
2024-05-09 12:52:49 +00:00
|
|
|
else
|
2024-05-26 00:54:36 +00:00
|
|
|
list_serprog_boards "$serprog_boards_dir" | \
|
2024-05-09 12:52:49 +00:00
|
|
|
while read -r board; do
|
2024-05-26 00:54:36 +00:00
|
|
|
build_${1}_rom "$board"
|
2024-05-09 12:52:49 +00:00
|
|
|
done
|
|
|
|
fi
|
2024-05-14 22:17:22 +00:00
|
|
|
|
2024-05-19 05:45:38 +00:00
|
|
|
[ "$xbmk_release" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0
|
2024-05-09 12:52:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_rp2040_rom()
|
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
board="$1"
|
|
|
|
printf "Building pico-serprog for %s\n" "$board"
|
|
|
|
x_ cmake -DPICO_BOARD="$board" -DPICO_SDK_PATH="$picosdk" \
|
|
|
|
-B "$picosrc/build" "$picosrc"
|
|
|
|
x_ cmake --build "$picosrc/build"
|
|
|
|
x_ mv "$picosrc/build/pico_serprog.uf2" \
|
|
|
|
"bin/serprog_rp2040/serprog_$board.uf2"
|
2024-05-09 12:52:49 +00:00
|
|
|
printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "$board"
|
|
|
|
}
|
|
|
|
|
|
|
|
build_stm32_rom()
|
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
board="$1"
|
|
|
|
printf "Building stm32-vserprog for %s\n" "$board"
|
|
|
|
x_ make -C "$stm32src" libopencm3-just-make BOARD=$board
|
|
|
|
x_ make -C "$stm32src" BOARD=$board
|
|
|
|
x_ mv "$stm32src/stm32-vserprog.hex" \
|
|
|
|
"bin/serprog_stm32/serprog_$board.hex"
|
2024-05-09 12:52:49 +00:00
|
|
|
printf "output to bin/serprog_stm32/serprog_%s.hex\n" "$board"
|
|
|
|
}
|
|
|
|
|
|
|
|
list_serprog_boards()
|
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
basename -a -s .h "$1/"*.h || $err "$1: can't list boards"
|
2024-05-09 12:52:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
handle_coreboot_target()
|
2024-05-05 04:09:23 +00:00
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
eval "$(setvars "n" $pv) $(setvars "" $v)"
|
2024-05-05 04:09:23 +00:00
|
|
|
grub_background="background1280x800.png"
|
2024-05-05 04:28:06 +00:00
|
|
|
board="$1"
|
2024-05-05 04:09:23 +00:00
|
|
|
|
|
|
|
configure_target
|
2024-05-11 17:53:12 +00:00
|
|
|
[ "$board" = "$tree" ] && return 0
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$xbmk_release" = "y" ] && [ "$release" = "n" ] && return 0
|
2024-05-05 04:09:23 +00:00
|
|
|
|
|
|
|
build_payloads
|
|
|
|
build_target_mainboard
|
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
[ -d "bin/$board" ] || return 0
|
|
|
|
[ "$xbmk_release" = "y" ] || targets="* bin/$board\n$targets"
|
2024-05-19 05:45:38 +00:00
|
|
|
[ "$xbmk_release" = "y" ] && mkrom_tarball "bin/$board" && \
|
2024-05-26 00:54:36 +00:00
|
|
|
targets="* bin/${relname}_$board.tar.xz\n$targets"; return 0
|
2024-05-05 04:09:23 +00: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 11:37:25 +00:00
|
|
|
configure_target()
|
2023-10-26 19:11:40 +00:00
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
targetdir="$cfgsdir/$board"
|
|
|
|
[ -f "$targetdir/target.cfg" ] || $err "$board: target.cfg missing"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
|
|
|
# Override the above defaults using target.cfg
|
2024-05-26 00:54:36 +00:00
|
|
|
. "$targetdir/target.cfg"
|
2023-10-26 19:11:40 +00: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 19:16:49 +00:00
|
|
|
[ -z "$grub_scan_disk" ] && grub_scan_disk="nvme ahci ata"
|
|
|
|
_ata=""
|
|
|
|
_ahci=""
|
|
|
|
_nvme=""
|
|
|
|
_grub_scan_disk=""
|
|
|
|
for _disk in $grub_scan_disk; do
|
|
|
|
[ "$_disk" != "nvme" ] && [ "$_disk" != "ahci" ] && \
|
|
|
|
[ "$_disk" != "ata" ] && _grub_scan_disk="nvme ahci ata" \
|
|
|
|
&& break
|
2024-05-28 00:23:43 +00:00
|
|
|
|
|
|
|
[ -n "$_ata" ] && [ "$_disk" = "ata" ] && continue
|
|
|
|
[ -n "$_ahci" ] && [ "$_disk" = "ahci" ] && continue
|
|
|
|
[ -n "$_nvme" ] && [ "$_disk" = "nvme" ] && continue
|
|
|
|
|
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 19:16:49 +00:00
|
|
|
eval "_$_disk=\"$_disk\""
|
|
|
|
_grub_scan_disk="$_grub_scan_disk $_disk"
|
|
|
|
done
|
|
|
|
[ -z "$_grub_scan_disk" ] && _grub_scan_disk="nvme ahci ata"
|
|
|
|
grub_scan_disk="${_grub_scan_disk# }"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
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 01:19:39 +00:00
|
|
|
[ -z "$tree" ] && $err "$board: tree not defined"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$payload_memtest" != "y" ] && payload_memtest="n"
|
2024-05-21 22:32:18 +00:00
|
|
|
[ "$(uname -m)" = "x86_64" ] || payload_memtest="n"
|
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$payload_grub_withseabios" = "y" ] && payload_grub="y"
|
|
|
|
[ "$payload_grub_withseabios" = "y" ] && \
|
2023-10-26 19:11:40 +00:00
|
|
|
eval "$(setvars "y" 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 11:37:25 +00:00
|
|
|
[ "$payload_seabios_withgrub" = "y" ] && payload_seabios="y"
|
|
|
|
[ "$payload_seabios_grubonly" = "y" ] && payload_seabios="y"
|
|
|
|
[ "$payload_seabios_grubonly" = "y" ] && payload_seabios_withgrub="y"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
|
|
|
# The reverse logic must not be applied. If SeaBIOS-with-GRUB works,
|
2024-05-19 05:30:32 +00: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 11:37:25 +00:00
|
|
|
[ "$payload_grub" != "y" ] && [ "$payload_seabios" != "y" ] && \
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$payload_uboot" != "y" ] && $err "'$board' defines no payload"
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
[ "$payload_uboot" != "n" ] && [ "$payload_uboot" != "y" ] && \
|
2023-10-26 19:11:40 +00:00
|
|
|
payload_uboot="n"
|
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 11:37:25 +00:00
|
|
|
[ "$payload_uboot" = "y" ] && [ -z "$uboot_config" ] && \
|
2023-10-26 19:11:40 +00:00
|
|
|
uboot_config="default"
|
|
|
|
|
|
|
|
# Override all payload directives with cmdline args
|
2024-05-26 00:54:36 +00:00
|
|
|
[ -z "$_payload" ] && return 0
|
2023-10-26 19:11:40 +00:00
|
|
|
eval "$(setvars "n" payload_grub payload_memtest payload_seabios \
|
2023-11-01 05:18:08 +00:00
|
|
|
payload_seabios_withgrub payload_uboot payload_grub_withseabios \
|
|
|
|
payload_seabios_grubonly)"
|
2024-05-26 00:54:36 +00:00
|
|
|
eval "payload_$_payload=y"
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
build_payloads()
|
2023-10-26 19:11:40 +00:00
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
romdir="bin/$board"
|
|
|
|
cbdir="src/coreboot/$board"
|
|
|
|
[ "$board" = "$tree" ] || cbdir="src/coreboot/$tree"
|
|
|
|
cbfstool="cbutils/$tree/cbfstool"
|
|
|
|
cbrom="$cbdir/build/coreboot.rom"
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
[ -f "$cbfstool" ] || x_ ./update trees -b coreboot utils $tree
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
mt86bin="memtest86plus/build64/memtest.bin"
|
|
|
|
[ "$payload_memtest" != "y" ] || [ -f "src/$mt86bin" ] || \
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
[ "$payload_seabios" = "y" ] && x_ ./update trees -b seabios
|
|
|
|
if [ "$payload_grub" = "y" ] || [ "$payload_seabios_withgrub" = "y" ] \
|
|
|
|
|| [ "$payload_seabios_grubonly" = "y" ]; then build_grub_payload
|
|
|
|
fi
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$payload_uboot" = "y" ] && build_uboot_payload; return 0
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
build_grub_payload()
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
x_ mkdir -p elf/grub
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
for keymapfile in config/grub/keymap/*.gkb; do
|
2024-05-26 00:54:36 +00:00
|
|
|
[ -f "$keymapfile" ] && keymaps="$keymaps $keymapfile"
|
2023-10-26 19:11:40 +00:00
|
|
|
done
|
GRUB: insert only 1 keymap per board, in cbfs
There is no need to add multiple keymap files, because
GRUB can load keymaps from CBFS. The current build logic
is designed to avoid building multiple GRUB binaries,
which are expensive computationally because each one
would then have to be compressed for each board.
This patch provides the best of both worlds: less space
used in flash like in the old lbmk design (1 keymap per
board), but retaining the current build speeds and therefore
not re-introducing the slowness of lbmk's previous GRUB
build logic.
The grub.cfg file has been modified, accordingly. It now
only loads a keymap.gkb file from CBFS, by default. It does
this, only if that file exists; if not, GRUB already defaults
to US Qwerty layout anyway.
ALSO: compress all keymap gkb files with xz -6
GRUB automatically decompresses files when accessed.
This results in about 2KB of flash space saved in CBFS.
Here is real-world data, showing the increased flash space:
< fallback/payload 0x3eb80 simple elf 548821 none
< keymap.cfg 0xc4bc0 raw 16 none
< (empty) 0xc4c00 null 11633316 none
---
> fallback/payload 0x3eb80 simple elf 546787 none
> keymap.gkb 0xc43c0 raw 344 none
> (empty) 0xc4540 null 11635044 none
This was taken by diffing the cbfstool "print" output,
both before and after. The *after* result is with this change.
11633316. In this example, 1728 bytes have been saved. Therefore,
with compression taken into account, this patch saves about 1.7KB
of space in CBFS.
This change means that lbmk can now scale to support hundreds
of keymaps, without increasing the amount of flash space used,
in each given image. Since the keymap files are compressed in
lbmk.git, in advance, we spend no additional time on compression
at build time. The resulting change in build speed in negligible.
Adding your own keymap.gkb file was already possible, for changing
the keymap in libreboot images, if you didn't want to change the
memdisk (and thus re-compile grub.elf). Now, this is the default
behaviour, and the only way to do it. It's much more efficient.
The original keymap files can be restored, by running unxz.
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-17 23:54:53 +00:00
|
|
|
[ -z "$_keyboard" ] || [ -f "$grubcfgsdir/keymap/$_keyboard.gkb" ] || \
|
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 01:19:39 +00:00
|
|
|
$err "build_grub_payload: $_keyboard layout not defined"
|
2024-05-26 00:54:36 +00:00
|
|
|
[ -n "$_keyboard" ] && keymaps="$grubcfgsdir/keymap/$_keyboard.gkb"
|
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 11:37:25 +00:00
|
|
|
[ -f "$grubelf" ] && return 0
|
|
|
|
[ -f "src/grub/grub-mkstandalone" ] || x_ ./update trees -b grub
|
|
|
|
|
2024-05-19 05:30:32 +00:00
|
|
|
./src/grub/grub-mkstandalone --grub-mkimage="src/grub/grub-mkimage" \
|
|
|
|
-O i386-coreboot -o "elf/grub/grub.elf" -d "src/grub/grub-core/" \
|
2024-05-26 00:54:36 +00:00
|
|
|
--fonts= --themes= --locales= --modules="$grub_modules" \
|
|
|
|
--install-modules="$grub_install_modules" \
|
|
|
|
"/boot/grub/grub.cfg=$grubcfgsdir/config/grub_memdisk.cfg" \
|
|
|
|
"/boot/grub/grub_default.cfg=$grubcfgsdir/config/grub.cfg" || \
|
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 01:19:39 +00:00
|
|
|
$err "could not generate grub.elf"
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
build_uboot_payload()
|
2023-10-26 19:11:40 +00:00
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ ./update trees -b u-boot $board
|
|
|
|
ubdir="elf/u-boot/$board/$uboot_config"
|
|
|
|
ubootelf="$ubdir/u-boot.elf"
|
|
|
|
[ ! -f "$ubootelf" ] && [ -f "$ubdir/u-boot" ] && \
|
|
|
|
ubootelf="$ubdir/u-boot"
|
|
|
|
[ -f "$ubootelf" ] || $err "$board: Can't find u-boot"; return 0
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
build_target_mainboard()
|
2023-10-26 19:11:40 +00:00
|
|
|
{
|
2024-05-26 00:54:36 +00: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 11:37:25 +00:00
|
|
|
|
2023-10-26 19:11:40 +00:00
|
|
|
for x in "normal" "vgarom" "libgfxinit"; do
|
2024-05-26 00:54:36 +00:00
|
|
|
initmode="$x"
|
2023-10-26 19:11:40 +00:00
|
|
|
hmode="vesafb"
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$initmode" = "vgarom" ] || hmode="corebootfb"
|
|
|
|
modes="$hmode txtmode"
|
|
|
|
[ -z "$_displaymode" ] || modes="$_displaymode"
|
|
|
|
for y in $modes; do
|
|
|
|
displaymode="$y"
|
|
|
|
[ "$initmode" = "normal" ] && \
|
2023-10-26 19:11:40 +00:00
|
|
|
[ "$displaymode" != "txtmode" ] && continue
|
2024-05-26 00:54:36 +00:00
|
|
|
cbcfg="$targetdir/config/${initmode}_$displaymode"
|
|
|
|
[ "$initmode" = "normal" ] && cbcfg="${cbcfg%_*}"
|
|
|
|
build_roms "$cbcfg"; x_ rm -f "$cbrom"
|
2023-10-26 19:11:40 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
build_roms()
|
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
cbcfg="$1"
|
|
|
|
e "$cbcfg" f not && return 0
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ ./update trees -b coreboot $board
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
_cbrom="elf/coreboot_nopayload_DO_NOT_FLASH"
|
2024-05-26 00:54:36 +00:00
|
|
|
_cbrom="$_cbrom/$board/${initmode}_$displaymode"
|
|
|
|
[ "$initmode" = "normal" ] && _cbrom="${_cbrom%"_$displaymode"}"
|
|
|
|
_cbrom="$_cbrom/coreboot.rom"
|
2023-10-26 19:11:40 +00:00
|
|
|
cbrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ cp "$_cbrom" "$cbrom"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$payload_memtest" != "y" ] || x_ "$cbfstool" "$cbrom" add-payload \
|
|
|
|
-f "src/$mt86bin" -n img/memtest -c lzma
|
|
|
|
[ "$payload_seabios" = "y" ] && build_seabios_roms
|
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 11:37:25 +00:00
|
|
|
[ "$payload_grub" != "y" ] || x_ build_grub_roms "$cbrom" "grub"
|
2024-05-26 00:54:36 +00:00
|
|
|
[ "$payload_uboot" = "y" ] || return 0
|
|
|
|
x_ cp "$_cbrom" "$cbrom"
|
2023-10-26 19:11:40 +00:00
|
|
|
build_uboot_roms
|
|
|
|
}
|
|
|
|
|
|
|
|
build_seabios_roms()
|
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
if [ "$payload_seabios_withgrub" = "y" ]; then
|
|
|
|
t="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
|
|
|
x_ cp "$cbrom" "$t"
|
|
|
|
x_ build_grub_roms "$t" "seabios_withgrub"
|
2023-10-26 19:11:40 +00:00
|
|
|
else
|
2024-05-26 00:54:36 +00: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 01:19:39 +00:00
|
|
|
$err "build_seabios_roms: cannot build tmprom"
|
2024-05-26 00:54:36 +00:00
|
|
|
newrom="$romdir/seabios_${board}_${initmode}_$displaymode"
|
|
|
|
[ "$initmode" = "normal" ] && newrom="$romdir/seabios" \
|
|
|
|
&& newrom="${newrom}_${board}_$initmode"
|
|
|
|
x_ cprom "$t" "$newrom.rom"
|
2023-10-26 19:11:40 +00:00
|
|
|
fi
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ rm -f "$t"
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Make separate ROM images with GRUB payload, for each supported keymap
|
|
|
|
build_grub_roms()
|
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
tmprom="$1"
|
|
|
|
payload1="$2" # allow values: grub, seabios, seabios_withgrub
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
if [ "$payload1" = "grub" ] && [ "$payload_grub_withseabios" = "y" ]
|
|
|
|
then
|
2024-05-26 00:54:36 +00:00
|
|
|
_tmpmvrom="$(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 01:19:39 +00: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 11:37:25 +00:00
|
|
|
x_ mv "$_tmpmvrom" "$tmprom"
|
|
|
|
elif [ "$payload1" != "grub" ] && [ "$payload_seabios_withgrub" = "y" ]
|
|
|
|
then
|
|
|
|
grub_cbfs="img/grub2"
|
2024-05-26 00:54:36 +00:00
|
|
|
_tmpmvrom="$(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 01:19:39 +00: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 11:37:25 +00:00
|
|
|
x_ mv "$_tmpmvrom" "$tmprom"
|
|
|
|
fi
|
2023-10-26 19:11:40 +00:00
|
|
|
|
|
|
|
# we only need insert grub.elf once, for each coreboot config:
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ "$cbfstool" "$tmprom" add-payload -f "$grubelf" \
|
|
|
|
-n "$grub_cbfs" -c lzma
|
2023-10-26 19:11:40 +00:00
|
|
|
|
|
|
|
# we only need insert background.png once, for each coreboot config:
|
2024-05-26 00:54:36 +00:00
|
|
|
if [ "$displaymode" = "vesafb" ] || \
|
|
|
|
[ "$displaymode" = "corebootfb" ]; then
|
|
|
|
backgroundfile="config/grub/background/$grub_background"
|
|
|
|
"$cbfstool" "$tmprom" add -f "$backgroundfile" -n \
|
|
|
|
background.png -t raw || $err "!bg, $backgroundfile"
|
2023-10-26 19:11:40 +00:00
|
|
|
fi
|
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
tmpcfg="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
|
|
|
printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" > "$tmpcfg" || \
|
|
|
|
$err "set grub_scandisk, $grub_scan_disk, $tmpcfg"
|
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 19:16:49 +00:00
|
|
|
x_ "$cbfstool" "$tmprom" add -f "$tmpcfg" -n scan.cfg -t raw
|
2024-05-26 00:54:36 +00:00
|
|
|
printf "set timeout=%s\n" "$grub_timeout" > "$tmpcfg" || \
|
|
|
|
$err "set timeout, $grub_timeout, $tmpcfg"
|
|
|
|
[ -z "$grub_timeout" ] || x_ "$cbfstool" "$tmprom" add \
|
|
|
|
-f "$tmpcfg" -n timeout.cfg -t raw
|
|
|
|
x_ rm -f "$tmpcfg"
|
|
|
|
|
|
|
|
for keymapfile in $keymaps; do
|
|
|
|
[ -f "$keymapfile" ] || continue
|
2023-10-26 19:11:40 +00:00
|
|
|
keymap="${keymapfile##*/}"
|
|
|
|
keymap="${keymap%.gkb}"
|
GRUB: insert only 1 keymap per board, in cbfs
There is no need to add multiple keymap files, because
GRUB can load keymaps from CBFS. The current build logic
is designed to avoid building multiple GRUB binaries,
which are expensive computationally because each one
would then have to be compressed for each board.
This patch provides the best of both worlds: less space
used in flash like in the old lbmk design (1 keymap per
board), but retaining the current build speeds and therefore
not re-introducing the slowness of lbmk's previous GRUB
build logic.
The grub.cfg file has been modified, accordingly. It now
only loads a keymap.gkb file from CBFS, by default. It does
this, only if that file exists; if not, GRUB already defaults
to US Qwerty layout anyway.
ALSO: compress all keymap gkb files with xz -6
GRUB automatically decompresses files when accessed.
This results in about 2KB of flash space saved in CBFS.
Here is real-world data, showing the increased flash space:
< fallback/payload 0x3eb80 simple elf 548821 none
< keymap.cfg 0xc4bc0 raw 16 none
< (empty) 0xc4c00 null 11633316 none
---
> fallback/payload 0x3eb80 simple elf 546787 none
> keymap.gkb 0xc43c0 raw 344 none
> (empty) 0xc4540 null 11635044 none
This was taken by diffing the cbfstool "print" output,
both before and after. The *after* result is with this change.
11633316. In this example, 1728 bytes have been saved. Therefore,
with compression taken into account, this patch saves about 1.7KB
of space in CBFS.
This change means that lbmk can now scale to support hundreds
of keymaps, without increasing the amount of flash space used,
in each given image. Since the keymap files are compressed in
lbmk.git, in advance, we spend no additional time on compression
at build time. The resulting change in build speed in negligible.
Adding your own keymap.gkb file was already possible, for changing
the keymap in libreboot images, if you didn't want to change the
memdisk (and thus re-compile grub.elf). Now, this is the default
behaviour, and the only way to do it. It's much more efficient.
The original keymap files can be restored, by running unxz.
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-17 23:54:53 +00:00
|
|
|
|
|
|
|
tmpgrubrom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ cp "$tmprom" "$tmpgrubrom"
|
GRUB: insert only 1 keymap per board, in cbfs
There is no need to add multiple keymap files, because
GRUB can load keymaps from CBFS. The current build logic
is designed to avoid building multiple GRUB binaries,
which are expensive computationally because each one
would then have to be compressed for each board.
This patch provides the best of both worlds: less space
used in flash like in the old lbmk design (1 keymap per
board), but retaining the current build speeds and therefore
not re-introducing the slowness of lbmk's previous GRUB
build logic.
The grub.cfg file has been modified, accordingly. It now
only loads a keymap.gkb file from CBFS, by default. It does
this, only if that file exists; if not, GRUB already defaults
to US Qwerty layout anyway.
ALSO: compress all keymap gkb files with xz -6
GRUB automatically decompresses files when accessed.
This results in about 2KB of flash space saved in CBFS.
Here is real-world data, showing the increased flash space:
< fallback/payload 0x3eb80 simple elf 548821 none
< keymap.cfg 0xc4bc0 raw 16 none
< (empty) 0xc4c00 null 11633316 none
---
> fallback/payload 0x3eb80 simple elf 546787 none
> keymap.gkb 0xc43c0 raw 344 none
> (empty) 0xc4540 null 11635044 none
This was taken by diffing the cbfstool "print" output,
both before and after. The *after* result is with this change.
11633316. In this example, 1728 bytes have been saved. Therefore,
with compression taken into account, this patch saves about 1.7KB
of space in CBFS.
This change means that lbmk can now scale to support hundreds
of keymaps, without increasing the amount of flash space used,
in each given image. Since the keymap files are compressed in
lbmk.git, in advance, we spend no additional time on compression
at build time. The resulting change in build speed in negligible.
Adding your own keymap.gkb file was already possible, for changing
the keymap in libreboot images, if you didn't want to change the
memdisk (and thus re-compile grub.elf). Now, this is the default
behaviour, and the only way to do it. It's much more efficient.
The original keymap files can be restored, by running unxz.
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-17 23:54:53 +00:00
|
|
|
x_ "$cbfstool" "$tmpgrubrom" add -f "$keymapfile" \
|
|
|
|
-n keymap.gkb -t raw
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
newrom="$romdir/${payload1}_${board}_${initmode}_"
|
|
|
|
newrom="$newrom${displaymode}_$keymap.rom"
|
|
|
|
[ "$initmode" = "normal" ] && newrom="$romdir/${payload1}_" \
|
|
|
|
&& newrom="$newrom${board}_${initmode}_$keymap.rom"
|
|
|
|
x_ cprom "$tmpgrubrom" "$newrom"
|
2024-05-27 14:05:33 +00:00
|
|
|
if [ "$payload_seabios_withgrub" = "y" ] && \
|
|
|
|
[ "$payload1" != "grub" ]; then
|
2024-04-28 19:21:35 +00:00
|
|
|
x_ "$cbfstool" "$tmpgrubrom" add \
|
|
|
|
-f "config/grub/bootorder" -n bootorder -t raw
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ cprom "$tmpgrubrom" "${newrom%.rom}_grubfirst.rom"
|
2024-05-27 13:42:16 +00:00
|
|
|
if [ "$payload_seabios_grubonly" = "y" ]; then
|
|
|
|
x_ "$cbfstool" "$tmpgrubrom" add-int -i 0 \
|
|
|
|
-n etc/show-boot-menu
|
|
|
|
x_ cprom "$tmpgrubrom" \
|
|
|
|
"${newrom%.rom}_grubonly.rom"
|
|
|
|
fi
|
2024-04-28 18:56:25 +00:00
|
|
|
fi
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ rm -f "$tmpgrubrom"
|
2023-10-26 19:11:40 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# make a rom in /tmp/ and then print the path of that ROM
|
|
|
|
mkSeabiosRom() {
|
2024-05-26 00:54:36 +00:00
|
|
|
_cbrom="$1" # rom to insert seabios in. will not be touched
|
2023-10-26 19:11:40 +00:00
|
|
|
# (a tmpfile will be made instead)
|
2024-05-26 00:54:36 +00:00
|
|
|
_seabios_cbfs_path="$2" # e.g. fallback/payload
|
|
|
|
_seabioself="elf/seabios/default/$initmode/bios.bin.elf"
|
|
|
|
tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ cp "$_cbrom" "$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 11:37:25 +00:00
|
|
|
x_ "$cbfstool" "$tmprom" add-payload -f "$_seabioself" \
|
2024-05-26 00:54:36 +00:00
|
|
|
-n "$_seabios_cbfs_path" -c lzma
|
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 11:37:25 +00: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-05-26 00:54:36 +00:00
|
|
|
[ "$initmode" != "libgfxinit" ] || x_ "$cbfstool" "$tmprom" add -f \
|
|
|
|
"$seavgabiosrom" -n vgaroms/seavgabios.bin -t raw
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
printf "%s\n" "$tmprom"
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_uboot_roms()
|
|
|
|
{
|
2024-05-26 00:54:36 +00:00
|
|
|
tmprom="$(mkUbootRom "$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 01:19:39 +00:00
|
|
|
$err "build_uboot_roms $board: could not create tmprom"
|
2024-05-26 00:54:36 +00:00
|
|
|
newrom="$romdir/uboot_payload_${board}_${initmode}_$displaymode.rom"
|
|
|
|
x_ cprom "$tmprom" "$newrom"
|
|
|
|
x_ rm -f "$tmprom"
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# make a rom in /tmp/ and then print the path of that ROM
|
|
|
|
mkUbootRom() {
|
2024-05-26 00:54:36 +00:00
|
|
|
_cbrom="$1"
|
|
|
|
_uboot_cbfs_path="$2"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
_ubdir="elf/u-boot/$board/$uboot_config"
|
|
|
|
_ubootelf="$_ubdir/u-boot.elf"
|
|
|
|
[ -f "$_ubootelf" ] || _ubootelf="$_ubdir/u-boot"
|
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 01:19:39 +00:00
|
|
|
[ -f "$_ubootelf" ] || $err "mkUbootRom: $board: cant find u-boot"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
tmprom="$(mktemp -t coreboot_rom.XXXXXXXXXX)"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
x_ cp "$_cbrom" "$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 11:37:25 +00:00
|
|
|
x_ "$cbfstool" "$tmprom" add-payload -f "$_ubootelf" \
|
2024-05-26 00:54:36 +00:00
|
|
|
-n "$_uboot_cbfs_path" -c lzma
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
printf "%s\n" "$tmprom"
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
2024-05-26 00:54:36 +00:00
|
|
|
cprom()
|
2023-10-26 19:11:40 +00: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 11:37:25 +00:00
|
|
|
printf "Creating target image: %s\n" "$2"
|
|
|
|
|
|
|
|
x_ mkdir -p "${2%/*}"
|
|
|
|
x_ cp "$1" "$2"
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main $@
|