2023-10-26 19:11:40 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
|
|
|
# SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
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
|
|
|
# SPDX-FileCopyrightText: 2020-2024 Leah Rowe <leah@libreboot.org>
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-06 21:54:55 +00:00
|
|
|
export LC_COLLATE=C
|
|
|
|
export LC_ALL=C
|
|
|
|
|
|
|
|
tmpdir_was_set="y"
|
2023-10-26 19:11:40 +00:00
|
|
|
cbdir="src/coreboot/default"
|
|
|
|
cbcfgsdir="config/coreboot"
|
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
|
|
|
ifdtool="cbutils/default/ifdtool"
|
2023-10-26 19:11:40 +00:00
|
|
|
cbfstool="cbutils/default/cbfstool"
|
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
|
|
|
grubcfgsdir="config/grub"
|
|
|
|
layoutdir="/boot/grub/layouts"
|
|
|
|
. "${grubcfgsdir}/modules.list"
|
|
|
|
tmpgit="${PWD}/tmp/gitclone"
|
2024-05-06 21:54:55 +00:00
|
|
|
err="err_"
|
|
|
|
|
|
|
|
err_()
|
|
|
|
{
|
|
|
|
printf "ERROR %s: %s\n" "${0}" "${1}" 1>&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
setvars()
|
|
|
|
{
|
|
|
|
_setvars=""
|
|
|
|
[ $# -lt 2 ] && $err "setvars: too few arguments"
|
|
|
|
val="${1}" && shift 1
|
|
|
|
for var in $@; do
|
|
|
|
_setvars="${var}=\"${val}\"; ${_setvars}"
|
|
|
|
done
|
|
|
|
printf "%s\n" "${_setvars% }"
|
|
|
|
}
|
2024-05-16 02:59:23 +00:00
|
|
|
eval "$(setvars "" versiondate tmpdir _nogit version board boarddir \
|
|
|
|
xbmk_release threads projectname relname)"
|
2024-05-06 21:54:55 +00:00
|
|
|
|
|
|
|
# if "y": a coreboot target won't be built if target.cfg says release="n"
|
|
|
|
# (this is used to exclude certain build targets from releases)
|
2024-05-16 02:59:23 +00:00
|
|
|
set | grep XBMK_RELEASE 1>/dev/null 2>/dev/null || xbmk_release="n" || :
|
|
|
|
[ -z "$xbmk_release" ] && xbmk_release="$XBMK_RELEASE"
|
|
|
|
[ "$xbmk_release" = "n" ] || [ "$xbmk_release" = "y" ] || xbmk_release="n"
|
|
|
|
export XBMK_RELEASE="$xbmk_release"
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-06 21:54:55 +00:00
|
|
|
set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n"
|
|
|
|
if [ "${tmpdir_was_set}" = "y" ]; then
|
2024-05-16 02:59:23 +00:00
|
|
|
[ "${TMPDIR%_*}" = "/tmp/xbmk" ] || tmpdir_was_set="n"
|
2024-05-06 21:54:55 +00:00
|
|
|
fi
|
|
|
|
if [ "${tmpdir_was_set}" = "n" ]; then
|
|
|
|
export TMPDIR="/tmp"
|
2024-05-16 02:59:23 +00:00
|
|
|
tmpdir="$(mktemp -d -t xbmk_XXXXXXXX)"
|
2024-05-06 21:54:55 +00:00
|
|
|
export TMPDIR="${tmpdir}"
|
|
|
|
else
|
|
|
|
export TMPDIR="${TMPDIR}"
|
|
|
|
tmpdir="${TMPDIR}"
|
|
|
|
fi
|
2023-10-26 19:11:40 +00:00
|
|
|
|
2024-05-16 02:59:23 +00:00
|
|
|
set | grep XBMK_THREADS 1>/dev/null 2>/dev/null && threads="$XBMK_THREADS"
|
2024-04-28 16:31:16 +00:00
|
|
|
[ -z "$threads" ] && threads=1
|
2024-03-27 07:14:47 +00:00
|
|
|
expr "X$threads" : "X-\{0,1\}[0123456789][0123456789]*$" \
|
|
|
|
1>/dev/null 2>/dev/null || threads=1 # user specified a non-integer
|
2024-05-16 02:59:23 +00:00
|
|
|
export XBMK_THREADS="$threads"
|
2024-04-28 16:31:16 +00:00
|
|
|
|
2024-05-15 02:01:25 +00:00
|
|
|
x_() {
|
|
|
|
[ $# -lt 1 ] || ${@} || $err "Unhandled non-zero exit: $@"; return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
read -r projectname < projectname || :
|
|
|
|
[ ! -f version ] || read -r version < version || :
|
|
|
|
version_="${version}"
|
|
|
|
[ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \
|
|
|
|
version="git-$(git rev-parse HEAD 2>&1)" || version="${version_}"
|
|
|
|
[ ! -f versiondate ] || read -r versiondate < versiondate || :
|
|
|
|
versiondate_="${versiondate}"
|
|
|
|
[ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \
|
|
|
|
--pretty='%ct' HEAD)" || versiondate="${versiondate_}"
|
|
|
|
for p in projectname version versiondate; do
|
|
|
|
eval "[ -n \"\$$p\" ] || $err \"$p unset\""
|
|
|
|
eval "x_ printf \"%s\\n\" \"\$$p\" > $p"
|
|
|
|
done
|
|
|
|
relname="${projectname}-${version}"
|
|
|
|
export LOCALVERSION="-${projectname}-${version%%-*}"
|
|
|
|
|
2023-10-26 19:11:40 +00:00
|
|
|
items()
|
|
|
|
{
|
|
|
|
rval=1
|
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 [ ! -d "${1}" ]; then
|
|
|
|
printf "items: directory '%s' doesn't exist" "${1}" 1>&2
|
|
|
|
return 1
|
|
|
|
fi
|
2023-10-26 19:11:40 +00:00
|
|
|
for x in "${1}/"*; do
|
|
|
|
# -e used because this is for files *or* directories
|
|
|
|
[ -e "${x}" ] || continue
|
|
|
|
[ "${x##*/}" = "build.list" ] && continue
|
|
|
|
printf "%s\n" "${x##*/}" 2>/dev/null
|
|
|
|
rval=0
|
|
|
|
done
|
|
|
|
return ${rval}
|
|
|
|
}
|
|
|
|
|
|
|
|
scan_config()
|
|
|
|
{
|
|
|
|
awkstr=" /\{.*${1}.*}{/ {flag=1;next} /\}/{flag=0} flag { print }"
|
|
|
|
confdir="${2}"
|
|
|
|
revfile="$(mktemp -t sources.XXXXXXXXXX)"
|
|
|
|
cat "${confdir}/"* > "${revfile}" || \
|
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 "scan_config ${confdir}: Cannot concatenate files"
|
2023-10-26 19:11:40 +00:00
|
|
|
while read -r line ; do
|
|
|
|
set ${line} 1>/dev/null 2>/dev/null || :
|
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 [ "${1%:}" = "depend" ]; then
|
|
|
|
depend="${depend} ${2}"
|
|
|
|
else
|
|
|
|
eval "${1%:}=\"${2}\""
|
|
|
|
fi
|
2023-10-26 19:11:40 +00:00
|
|
|
done << EOF
|
|
|
|
$(eval "awk '${awkstr}' \"${revfile}\"")
|
|
|
|
EOF
|
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
|
|
|
rm -f "$revfile" || $err "scan_config: Cannot remove tmpfile"
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
check_defconfig()
|
|
|
|
{
|
2024-05-18 18:51:40 +00:00
|
|
|
[ -d "$1" ] || $err "Target '$1' not defined."
|
2023-10-26 19:11:40 +00:00
|
|
|
for x in "${1}"/config/*; do
|
2024-05-18 18:44:44 +00:00
|
|
|
[ -f "${x}" ] && printf "%s\n" "$x" && return 1
|
2023-10-26 19:11:40 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
handle_coreboot_utils()
|
|
|
|
{
|
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 util in cbfstool ifdtool; do
|
|
|
|
x_ ./update trees ${_f} "src/coreboot/${1}/util/${util}"
|
|
|
|
[ -z "${mode}" ] && [ ! -f "cbutils/${1}/${util}" ] && \
|
|
|
|
x_ mkdir -p "cbutils/${1}" && \
|
|
|
|
x_ cp "src/coreboot/${1}/util/${util}/${util}" \
|
|
|
|
"cbutils/${1}"
|
|
|
|
[ -z "${mode}" ] || x_ rm -Rf "cbutils/${1}"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
remkdir()
|
|
|
|
{
|
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
|
|
|
rm -Rf "${1}" || $err "remkdir: !rm -Rf \"${1}\""
|
|
|
|
mkdir -p "${1}" || $err "remkdir: !mkdir -p \"${1}\""
|
2023-10-26 19:11:40 +00:00
|
|
|
}
|
2024-05-06 21:54:55 +00:00
|
|
|
|
|
|
|
git_err()
|
|
|
|
{
|
|
|
|
printf "You need to set git name/email, like so:\n%s\n\n" "$1" 1>&2
|
|
|
|
$err "Git name/email not configured"
|
|
|
|
}
|
|
|
|
|
2024-05-19 05:45:38 +00:00
|
|
|
mkrom_tarball()
|
2024-05-14 22:17:22 +00:00
|
|
|
{
|
2024-05-19 05:51:20 +00:00
|
|
|
printf "%s\n" "${version}" > "${1}/version" || $err "$1 !version"
|
|
|
|
printf "%s\n" "${versiondate}" > "${1}/versiondate" || $err "$1 !vdate"
|
|
|
|
printf "%s\n" "${projectname}" > "${1}/projectname" || $err "$1 !pname"
|
2024-05-14 23:45:01 +00:00
|
|
|
|
2024-05-15 00:23:22 +00:00
|
|
|
mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz"
|
2024-05-14 22:17:22 +00:00
|
|
|
x_ rm -Rf "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
mktarball()
|
|
|
|
{
|
|
|
|
[ "${2%/*}" = "${2}" ] || \
|
|
|
|
mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\""
|
|
|
|
printf "\nCreating archive: %s\n\n" "$2"
|
2024-05-14 23:48:08 +00:00
|
|
|
tar -c "$1" | xz -T$threads -9e > "$2" || \
|
|
|
|
$err "mktarball 2, $1"
|
2024-05-14 23:37:12 +00:00
|
|
|
mksha512sum "${2}" "${2##*/}.sha512"
|
|
|
|
}
|
|
|
|
|
|
|
|
mksha512sum()
|
|
|
|
{
|
2024-05-14 22:17:22 +00:00
|
|
|
(
|
2024-05-14 23:37:12 +00:00
|
|
|
[ "${1%/*}" != "${1}" ] && x_ cd "${1%/*}"
|
|
|
|
sha512sum ./"${1##*/}" >> "${2}" || \
|
|
|
|
$err "!sha512sum \"${1}\" > \"${2}\""
|
2024-05-14 22:17:22 +00:00
|
|
|
) || $err "failed to create tarball checksum"
|
|
|
|
}
|
git.sh: Remove .git if XBMK_RELEASE=y
The build system already deletes .git in all source
directories for each given release, but does so at
the very end; it still does, but now it is deleted
one by one per project, to save space during very
large builds (release sizes vary wildly, depending
on how many trees exist for coreboot basically).
If you're building entirely in tmpfs (as I do), this
could be a problem if you have lots of .git/ directories.
This change reduces disk usage, or in the above example,
memory usage when running the build system from tmpfs.
This complements another recent change, where ROM images
are compressed per target during release builds, rather
than all at the very end of the process. It is part of a
series of optimisations, to reduce the memory and disk
usage of the build system, and to reduce I/O wastage
in general.
This change will not be the last of such changes!
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-18 03:53:31 +00:00
|
|
|
|
|
|
|
rmgit()
|
|
|
|
{
|
|
|
|
(
|
|
|
|
cd "$1" || $err "!cd gitrepo $1"
|
|
|
|
find . -name ".git" -exec rm -Rf {} + || $err "!rm .git $1"
|
|
|
|
find . -name ".gitmodules" -exec rm -Rf {} + || $err "!rm .gitmod $1"
|
|
|
|
) || $err "Cannot remove .git/.gitmodules in $1"
|
|
|
|
}
|