Compare commits

...

7 Commits

Author SHA1 Message Date
Leah Rowe 5c888669c6 disable x301 for next release (for now)
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 02:14:12 +01:00
Leah Rowe 91c90d763f print two line breaks before confirming release
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 02:13:59 +01:00
Leah Rowe d423421995 remove all status checks. only handle release.
the release variable is all we need, turning a target on
or off for a given release.

the status checks were prone to bugs, and unnecessary; it
also broke certain benchmark scripts.

it's better to keep the cbmk logic simpler. board status
will be moved to the documentation instead.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 02:07:22 +01:00
Leah Rowe 4826364afb git.sh: remove errant comment
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 01:57:46 +01:00
Leah Rowe 541430016f move script/*/* to script/
there are only two scripts under script/ now, and there
probably won't be many more. cbmk's design has simplified
to such a degree that the two-level directory structure is
no longer necessary.

the existing command structure has not changed. for example:

./build roms list
./update trees -f coreboot default

these will still work, but the symlinks to "build" are now
strictly for backwards compatibility; they may be removed
at a later date, but i'll keep the current design for now.

this also leads to a quirk, for example:

./build roms all
./update roms all

these now do the exact same thing, whereas "./update roms all"
would have previously been an invalid command.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 01:57:12 +01:00
Leah Rowe 9084ab15ab build: print usage for special commands
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 01:55:37 +01:00
Leah Rowe f12c2f284f merge script/update/release into build
the main script isn't that big, and since the main
purpose of cbmk is geared toward the releases, it
makes sense to reduce the number of scripts by
merging into the main one

the way this works, "./update release" still works
afterward

so, the way cbmk is used shall remain unchanged

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-05-13 01:54:56 +01:00
70 changed files with 227 additions and 378 deletions

224
build
View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2014,2015,2020,2021,2023 Leah Rowe <leah@libreboot.org>
# SPDX-FileCopyrightText: 2014,2015,2020-2024 Leah Rowe <leah@libreboot.org>
# SPDX-FileCopyrightText: 2015 Patrick "P. J." McDermott <pj@pehjota.net>
# SPDX-FileCopyrightText: 2015, 2016 Klemens Nanni <contact@autoboot.org>
# SPDX-FileCopyrightText: 2022, Caleb La Grange <thonkpeasant@protonmail.com>
@ -14,12 +14,12 @@ fi
. "include/option.sh"
eval "$(setvars "" option aur_notice)"
eval "$(setvars "" script_path aur_notice vdir relname src_dirname srcdir \
_xm target romdir mode)"
err="fail"
linkpath="${0}"
linkname="${linkpath##*/}"
buildpath="./script/${linkname}"
main()
{
@ -42,10 +42,11 @@ initcmd()
case "${1}" in
help) usage ${0} ;;
list) items "${buildpath}" ;;
list) items "script" ;;
version) mkversion ;;
release) shift 1; mkrelease $@ ;;
*)
option="${1}"
script_path="script/${1}"
return 0 ;;
esac
cbmk_exit 0
@ -88,9 +89,8 @@ git_init()
excmd()
{
cbmkcmd="${buildpath}/${option}"
[ -f "${cbmkcmd}" ] || $err "Invalid command. Run: ${linkpath} help"
shift 1; "$cbmkcmd" $@ || $err "excmd: ${cbmkcmd} ${@}"
[ -f "${script_path}" ] || $err "Bad command. Run: ${linkpath} help"
shift 1; "$script_path" $@ || $err "excmd: ${script_path} ${@}"
}
usage()
@ -102,7 +102,12 @@ usage()
USAGE: ${progname} <OPTION>
possible values for 'OPTION':
$(items "${buildpath}")
$(items "script")
Special commands (consult $projectname documentation):
./update release
./build dependencies distroname
(replace distroname with a filename from config/dependencies/)
To know what ${projectname} version you're on, type:
${progname} version
@ -111,6 +116,207 @@ usage()
EOF
}
mkrelease()
{
export CBMK_RELEASE="y"
vdir="release"
while getopts d:m: option; do
[ -z "${OPTARG}" ] && $err "Empty argument not allowed"
case "${option}" in
d) vdir="${OPTARG}" ;;
m) mode="${OPTARG}" ;;
*) $err "Invalid option" ;;
esac
done
check_project
vdir="${vdir}/${version}"
relname="${projectname}-${version}"
[ "${mode}" = "u-boot" ] && relname="u-boot-for-${relname}"
src_dirname="${relname}_src"
srcdir="${vdir}/${src_dirname}"
[ -e "${vdir}" ] && $err "already exists: \"${vdir}\""
mkvdir
build_release
printf "\n\nDONE! Check release files under %s\n" "${vdir}"
}
mkvdir()
{
mkdir -p "${vdir}" || $err "mkvdir: !mkdir -p \"${vdir}\""
git clone . "${srcdir}" || $err "mkdir: !gitclone \"${srcdir}\""
insert_version_files "$srcdir" || $err "mkvdir $srcdir: versionfile"
}
build_release()
{
_xm="build_release ${vdir}"
(
cd "${srcdir}" || $err "${_xm}: !cd \"${srcdir}\""
fetch_trees
[ "${mode}" = "u-boot" ] || x_ mv src/docs docs
) || $err "can't create release files"
git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \
--abbrev-commit > "${srcdir}/CHANGELOG" || \
$err "build_release $srcdir: couldn't generate changelog"
(
if [ "${mode}" = "u-boot" ]; then
cd "${srcdir}/src/" || $err "${_xm}: mktarball \"${srcdir}\""
mktarball u-boot "../../${srcdir##*/}.tar.xz" || \
$err "$_xm: mksrc"
# make a src archive containing only u-boot
else
cd "${srcdir%/*}" || $err "${_xm}: mktarball \"${srcdir}\""
mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || \
$err "$_xm: mksrc"
fi
) || $err "can't create src tarball"
[ "${mode}" = "src" ] && return 0
[ "${mode}" = "u-boot" ] && return 0
(
cd "${srcdir}" || $err "${_xm}: 2 !cd \"${srcdir}\""
mkrom_images
) || $err "can't build rom images"
rm -Rf "${srcdir}" || $err "!rm -Rf ${srcdir}"
}
fetch_trees()
{
for x in config/git/*; do
[ "${mode}" = "u-boot" ] && break
[ ! -f "${x}" ] || ./update trees -f "${x#config/git/}" || \
$err "${_xm}: fetch ${x#config/git/}"
done
[ "${mode}" = "u-boot" ] && x_ ./update trees -f u-boot
for x in config/*/build.list; do
[ -f "${x}" ] || continue
xp="${x#*/}"; xp="${xp%/*}"
[ -L "${xp}" ] || rm -Rf "src/${xp}/${xp}" || \
$err "!rm -Rf \"src/${xp}/${xp}\""
done
find . -name ".git" -exec rm -Rf {} + || $err "$_xm: rm .git"
find . -name ".gitmodules" -exec rm -Rf {} + || $err "$_xm: rm .gitmod"
x_ rm -Rf tmp .git
}
mkrom_images()
{
./build roms all || $err "${_xm}: roms-all"
./build roms serprog rp2040 || $err "${_xm}: rp2040"
./build roms serprog stm32 || $err "${_xm}: stm32"
for rombuild in bin/*; do
[ -d "${rombuild}" ] || continue
handle_rom_archive "${rombuild}"
done
mv "release/${version}/roms/" ../roms || $err "${_xm}: copy roms/"
}
handle_rom_archive()
{
builddir="${1}"
romdir="tmp/romdir"
rm -Rf "${romdir}" || $err "!rm romdir, handle_rom_archive"
target="${builddir##*/}"
if [ ! -f "config/coreboot/${target}/target.cfg" ]; then
# No config, just make a tarball
tarball="release/${version}/roms/${relname}_${target}.tar.xz"
insert_copying_files "${builddir}" || \
$err "!insert copy, handle, ${builddir}"
mktarball "${builddir}" "${tarball}"
return 0
fi
romdir="${romdir}/bin/${target}"
mkdir -p "${romdir}" || $err "!mkdir -p romdir, handle_rom_archive"
cp "$builddir/"* "$romdir" || $err "!cp romdir, handle_rom_archive"
printf "Generating release/%s/roms/%s-%s_%s.tar.xz\n" \
"${version}" "${projectname}" "${version}" "${target##*/}"
insert_version_files "${romdir}" || \
$err "mkrom_tarball ${romdir}: versionfile"
insert_copying_files "$romdir" || $err "!insert copy, handle 2, $romdir"
mkrom_tarball
}
insert_copying_files()
{
remkdir "${1}/licenses"
l="${1}/licenses"
# copy licenses to rom image archive, for completion
cp "src/grub/COPYING" "${l}/COPYING.grub" || return 1
cp "src/coreboot/default/COPYING" "${l}/COPYING.coreboot" || return 1
cp -R "src/coreboot/default/LICENSES" "${l}/LICENSES.coreboot" || \
return 1
cp "src/seabios/default/COPYING" "${l}/COPYING.coreboot" || return 1
cp "src/seabios/default/COPYING.LESSER" "$l/COPYING.LESSER.seabios" \
|| return 1
cp -R "src/u-boot/default/Licenses" "${l}/COPYING.u-boot" || return 1
printf "Multiple licenses. Check corresponding %s source archive\n" \
"${projectname}" > "${1}/COPYING" || return 1
rm -f src/u-boot/*/test/lib/strlcat.c || return 1
}
mkrom_tarball()
{
archivename="${relname}_${target##*/}"
f="release/${version}/roms/${archivename}"
mkdir -p "${f%/*}" || $err "mkrom_tarball: !mkdir -p ${f%/*}"
(
cd "${romdir%"/bin/$target"}" || $err "!cd ${romdir%"/bin/$target"}"
mktarball "bin/${target}" "${archivename}.tar.xz"
) || $err "can't create rom tarball"
mv "${romdir%"/bin/${target}"}/${archivename}.tar.xz"* "${f%/*}" || \
$err "mktar ${f%/*}/${romdir%"/bin/$target"}/$archivename.tar.xz"
printf "Created ROM archive: %s" "${f%/*}/${archivename}.tar.xz"
}
insert_version_files()
{
printf "%s\n" "${version}" > "${1}/version" || return 1
printf "%s\n" "${versiondate}" > "${1}/versiondate" || return 1
printf "%s\n" "${projectname}" > "${1}/projectname" || return 1
}
mktarball()
{
# preserve timestamps for reproducible tarballs
tar_implementation=$(tar --version | head -n1) || :
[ "${2%/*}" = "${2}" ] || \
mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\""
printf "\nCreating archive: %s\n\n" "$2"
if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then
tar --sort=name --owner=root:0 --group=root:0 \
--mtime="UTC 2024-05-04" -c "$1" | xz -T$threads -9e \
> "$2" || $err "mktarball 1, ${1}"
else
# TODO: reproducible tarballs on non-GNU systems
tar -c "$1" | xz -T$threads -9e > "$2" || \
$err "mktarball 2, $1"
fi
(
[ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}"
sha512sum "${2##*/}" > "${2##*/}.sha512" || \
$err "!sha512sum \"${2##*/}\" > \"${2##*/}.sha512\""
) || $err "failed to create tarball checksum"
}
mkversion()
{
printf "revision: %s %s\n" "$projectname" "$version"

View File

@ -4,5 +4,4 @@ payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
payload_memtest="y"
status="untested"
release="n"

View File

@ -1 +0,0 @@
this board has never been stable, and has not been tested in Libreboot 20240504 so no ROM images included for it in that release

View File

@ -3,5 +3,4 @@ xarch="i386-elf"
payload_seabios="y"
payload_seabios_withgrub="y"
payload_memtest="y"
status="untested"
release="n"

View File

@ -1 +0,0 @@
this board has never been stable, and has not been tested in Libreboot 20240504 so no ROM images included for it in that release

View File

@ -4,5 +4,4 @@ payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
payload_memtest="n"
status="untested"
release="n"

View File

@ -1 +0,0 @@
this board has never been stable, and has not been tested in Libreboot 20240504 so no ROM images included for it in that release

View File

@ -4,5 +4,4 @@ payload_grub="n"
payload_grub_withseabios="n"
payload_seabios="y"
payload_memtest="n"
status="untested"
release="n"

View File

@ -1 +0,0 @@
this board has never been stable, and has not been tested in Libreboot 20240504 so no ROM images included for it in that release

View File

@ -7,4 +7,3 @@ payload_memtest="y"
payload_seabios_withgrub="y"
payload_seabios_grubonly="y"
grub_scan_disk="ahci"
status="stable" # broken s3

View File

@ -1 +0,0 @@
Battery indicator not working yet. May shut down instead of throttle on high CPU temperature; use the intel_pstate driver to cap speeds, and monitor performance via CPU stress test and lm-sensors/xsensors utility, before using the machine regularly.

View File

@ -3,4 +3,3 @@ xarch="i386-elf"
payload_seabios="y"
payload_memtest="y"
grub_timeout=10
status="stable"

View File

@ -3,5 +3,4 @@ xarch="i386-elf"
payload_seabios="y"
payload_memtest="y"
grub_timeout=10
status="stable"
release="n"

View File

@ -4,4 +4,3 @@ payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ata"
grub_timeout=10
status="stable"

View File

@ -1,4 +1,3 @@
tree="default"
xarch="aarch64-elf arm-eabi"
payload_uboot="y"
status="stable"

View File

@ -1 +0,0 @@
Incomplete UEFI implementation but should boot most distros fine. Debian Bookworm installed and the first 1GB or so of the partition got corrupted. Leave the first 2GB or so unpartitioned, when installing any distro.

View File

@ -1,4 +1,3 @@
tree="default"
xarch="aarch64-elf arm-eabi"
payload_uboot="y"
status="stable"

View File

@ -1 +0,0 @@
Incomplete UEFI implementation but should boot most distros fine. Debian Bookworm installed and the first 1GB or so of the partition got corrupted. Leave the first 2GB or so unpartitioned, when installing any distro.

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
xlang="c"
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
xlang="c"
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -6,4 +6,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
xlang="c"
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -6,4 +6,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
xlang="c"
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -4,4 +4,3 @@ payload_seabios="y"
payload_memtest="y"
xlang="c"
grub_timeout=10
status="stable"

View File

@ -5,4 +5,3 @@ payload_seabios_withgrub="y"
payload_memtest="y"
xlang="c"
grub_timeout=10
status="stable"

View File

@ -5,4 +5,3 @@ payload_seabios_withgrub="y"
payload_memtest="y"
xlang="c"
grub_timeout=10
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -5,4 +5,3 @@ payload_seabios_withgrub="y"
payload_memtest="y"
xlang="c"
grub_timeout=10
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -6,4 +6,3 @@ payload_seabios_withgrub="y"
payload_memtest="y"
xlang="c"
grub_timeout=10
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -6,4 +6,3 @@ payload_seabios_withgrub="y"
payload_memtest="y"
xlang="c"
grub_timeout=10
status="unstable"

View File

@ -1 +0,0 @@
raminit has always been unreliable on this board; ymmv

View File

@ -4,4 +4,3 @@ payload_grub="y"
payload_grub_withseabios="y"
payload_seabios="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -4,4 +4,3 @@ payload_grub="y"
payload_grub_withseabios="y"
payload_seabios="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -1,4 +1,3 @@
tree="default"
xarch="aarch64-elf arm-eabi"
payload_uboot="y"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="both"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
grub_scan_disk="ahci"
grub_background="background1024x768.png"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
grub_scan_disk="ahci"
grub_background="background1024x768.png"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"

View File

@ -5,4 +5,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"
release="n"

View File

@ -5,4 +5,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"
release="n"

View File

@ -5,4 +5,4 @@ payload_grub_withseabios="y"
payload_seabios="y"
payload_memtest="y"
grub_scan_disk="ahci"
status="stable"
release="n"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
grub_scan_disk="ahci"
grub_background="background1024x768.png"
status="stable"

View File

@ -5,4 +5,3 @@ payload_grub_withseabios="y"
payload_seabios="y"
grub_scan_disk="ahci"
grub_background="background1024x768.png"
status="stable"

View File

@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2020,2021,2023,2024 Leah Rowe <leah@libreboot.org>
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# This file is only used by update/project/trees
eval "$(setvars "" _target rev _xm loc url bkup_url depend tree_depend xtree)"
fetch_project_trees()

View File

@ -33,8 +33,8 @@ setvars()
done
printf "%s\n" "${_setvars% }"
}
eval "$(setvars "" _nogit _dest board boarddir cbmk_release cbmk_status threads \
version versiondate projectname)"
eval "$(setvars "" versiondate tmpdir _nogit version _dest board boarddir \
cbmk_release threads projectname)"
# 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)
@ -43,13 +43,6 @@ set | grep CBMK_RELEASE 1>/dev/null 2>/dev/null || cbmk_release="n" || :
[ "$cbmk_release" = "n" ] || [ "$cbmk_release" = "y" ] || cbmk_release="n"
export CBMK_RELEASE="$cbmk_release"
# if set to n via export, status checks will be skipped during
# all builds, and all targets will be built regardless of status.
# this replicates the old behaviour of cbmk, prior to the checks.
set | grep CBMK_STATUS 1>/dev/null 2>/dev/null && cbmk_status="$CBMK_STATUS"
[ "$cbmk_status" = "y" ] || [ "$cbmk_status" = "n" ] || cbmk_status="y"
export CBMK_STATUS="$cbmk_status"
set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n"
if [ "${tmpdir_was_set}" = "y" ]; then
[ "${TMPDIR%_*}" = "/tmp/cbmk" ] || tmpdir_was_set="n"

View File

@ -24,31 +24,23 @@ stm32_src_dir="src/stm32-vserprog"
pv="payload_grub payload_grub_withseabios payload_seabios payload_memtest t"
pv="${pv} payload_seabios_withgrub payload_seabios_grubonly payload_uboot memtest_bin"
v="romdir cbrom initmode displaymode cbcfg targetdir tree keymaps release"
v="${v} grub_timeout ubdir board grub_scan_disk uboot_config status"
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 \
skipped listboards list_type serprog_boards_dir)"
serprog_boards_dir)"
main()
{
check_project
while [ $# -gt 0 ]; do
if [ "$listboards" = "y" ]; then
list_type="$list_type $1"
list_type="${list_type# }"
shift 1; continue
fi
case ${1} in
help)
usage
exit 0 ;;
list)
boards=$(items config/coreboot) || \
$err "Cannot generate list of boards for list"
listboards="y"
shift 1; continue ;;
x_ items config/coreboot
return 0 ;;
serprog)
serprog="y"
shift 1; break ;;
@ -74,14 +66,6 @@ main()
done
fi
[ "$listboards" = "y" ] && return 0
if [ -n "$skipped" ]; then
printf "\nThese targets were skipped:\n"
eval "printf \"${skipped}\""
printf "^^ These targets were skipped.\n\n"
fi
[ -z "${targets}" ] && $err "No ROM images were compiled"
printf "\nROM images available in these directories:\n"
eval "printf \"${targets}\""
@ -155,18 +139,11 @@ handle_coreboot_target()
eval "$(setvars "n" ${pv}) $(setvars "" ${v})"
grub_background="background1280x800.png"
board="$1"
status="unknown"
configure_target
[ "$board" = "$tree" ] && \
return 0
print_target_name && return 0
# exclude certain targets from the release
if skip_board; then
printf "Skip target %s(%s)\n" "$board" "$status"
skipped="* $board($status)\n$skipped"
[ "$board" = "$tree" ] && return 0
if [ "$cbmk_release" = "y" ] && [ "$release" = "n" ]; then
printf "Target '%s' disabled for release.\n" "$board"
return 0
fi
@ -225,57 +202,6 @@ configure_target()
eval "payload_${_payload}=y"
}
print_target_name()
{
[ "$listboards" = "y" ] || return 1
[ -z "$list_type" ] && printf "%s\n" "$board"
for _list_type in $list_type; do
if [ "${_list_type#_}" = "$_list_type" ]; then
[ "$status" != "$_list_type" ] && \
continue
printf "%s\n" "$board"
break
elif [ "$status" != "${_list_type#_}" ]; then
printf "%s\n" "$board"
break
fi
done
}
skip_board()
{
if [ "$listboards" != "y" ] && [ "$status" != "stable" ]; then
printf "\n\n\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
printf "\t__WARNING: %s has status '%s'__\n" \
"$board" "$status"
printf "\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"
fi
if [ -f "$targetdir/warn.txt" ] && [ "$listboards" != "y" ]; then
printf "Regarding target '%s' (status '%s'):\n\n" \
"$board" "$status"
cat -u "$targetdir/warn.txt" || \
$err "!cat $targetdir/warn.txt"
fi
[ "$cbmk_release" = "y" ] && [ "$release" = "n" ] && return 0
[ "$cbmk_release" = "y" ] && [ "$status" != "broken" ] && return 1
[ "$cbmk_status" = "y" ] || return 1
[ "$status" = "stable" ] && return 1
printf "\nTo disable this dialog when building, do:\n"
printf "export CBMK_STATUS=n\n\n"
while true; do
printf "Board %s has status '%s'. Skip? [y/n] " \
"$board" "$status"
read -r skip
[ "$skip" = "y" ] && return 0
[ "$skip" = "n" ] && return 1; continue
done
}
build_payloads()
{
romdir="bin/${board}"

View File

@ -1,213 +0,0 @@
#!/usr/bin/env sh
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2020-2024 Leah Rowe <leah@libreboot.org>
set -u -e
. "include/option.sh"
eval "$(setvars "" vdir relname src_dirname srcdir _xm target romdir mode)"
export CBMK_RELEASE="y"
export CBMK_STATUS="n"
main()
{
vdir="release"
while getopts d:m: option; do
[ -z "${OPTARG}" ] && $err "Empty argument not allowed"
case "${option}" in
d) vdir="${OPTARG}" ;;
m) mode="${OPTARG}" ;;
*) $err "Invalid option" ;;
esac
done
check_project
vdir="${vdir}/${version}"
relname="${projectname}-${version}"
[ "${mode}" = "u-boot" ] && relname="u-boot-for-${relname}"
src_dirname="${relname}_src"
srcdir="${vdir}/${src_dirname}"
[ -e "${vdir}" ] && $err "already exists: \"${vdir}\""
mkvdir
build_release
printf "DONE! Check release files under %s\n" "${vdir}"
}
mkvdir()
{
mkdir -p "${vdir}" || $err "mkvdir: !mkdir -p \"${vdir}\""
git clone . "${srcdir}" || $err "mkdir: !gitclone \"${srcdir}\""
insert_version_files "$srcdir" || $err "mkvdir $srcdir: versionfile"
}
build_release()
{
_xm="build_release ${vdir}"
(
cd "${srcdir}" || $err "${_xm}: !cd \"${srcdir}\""
fetch_trees
[ "${mode}" = "u-boot" ] || x_ mv src/docs docs
) || $err "can't create release files"
git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \
--abbrev-commit > "${srcdir}/CHANGELOG" || \
$err "build_release $srcdir: couldn't generate changelog"
(
if [ "${mode}" = "u-boot" ]; then
cd "${srcdir}/src/" || $err "${_xm}: mktarball \"${srcdir}\""
mktarball u-boot "../../${srcdir##*/}.tar.xz" || \
$err "$_xm: mksrc"
# make a src archive containing only u-boot
else
cd "${srcdir%/*}" || $err "${_xm}: mktarball \"${srcdir}\""
mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || \
$err "$_xm: mksrc"
fi
) || $err "can't create src tarball"
[ "${mode}" = "src" ] && return 0
[ "${mode}" = "u-boot" ] && return 0
(
cd "${srcdir}" || $err "${_xm}: 2 !cd \"${srcdir}\""
mkrom_images
) || $err "can't build rom images"
rm -Rf "${srcdir}" || $err "!rm -Rf ${srcdir}"
}
fetch_trees()
{
for x in config/git/*; do
[ "${mode}" = "u-boot" ] && break
[ ! -f "${x}" ] || ./update trees -f "${x#config/git/}" || \
$err "${_xm}: fetch ${x#config/git/}"
done
[ "${mode}" = "u-boot" ] && x_ ./update trees -f u-boot
for x in config/*/build.list; do
[ -f "${x}" ] || continue
xp="${x#*/}"; xp="${xp%/*}"
[ -L "${xp}" ] || rm -Rf "src/${xp}/${xp}" || \
$err "!rm -Rf \"src/${xp}/${xp}\""
done
find . -name ".git" -exec rm -Rf {} + || $err "$_xm: rm .git"
find . -name ".gitmodules" -exec rm -Rf {} + || $err "$_xm: rm .gitmod"
x_ rm -Rf tmp .git
}
mkrom_images()
{
./build roms all || $err "${_xm}: roms-all"
./build roms serprog rp2040 || $err "${_xm}: rp2040"
./build roms serprog stm32 || $err "${_xm}: stm32"
for rombuild in bin/*; do
[ -d "${rombuild}" ] || continue
handle_rom_archive "${rombuild}"
done
mv "release/${version}/roms/" ../roms || $err "${_xm}: copy roms/"
}
handle_rom_archive()
{
builddir="${1}"
romdir="tmp/romdir"
rm -Rf "${romdir}" || $err "!rm romdir, handle_rom_archive"
target="${builddir##*/}"
if [ ! -f "config/coreboot/${target}/target.cfg" ]; then
# No config, just make a tarball
tarball="release/${version}/roms/${relname}_${target}.tar.xz"
insert_copying_files "${builddir}" || \
$err "!insert copy, handle, ${builddir}"
mktarball "${builddir}" "${tarball}"
return 0
fi
romdir="${romdir}/bin/${target}"
mkdir -p "${romdir}" || $err "!mkdir -p romdir, handle_rom_archive"
cp "$builddir/"* "$romdir" || $err "!cp romdir, handle_rom_archive"
printf "Generating release/%s/roms/%s-%s_%s.tar.xz\n" \
"${version}" "${projectname}" "${version}" "${target##*/}"
insert_version_files "${romdir}" || \
$err "mkrom_tarball ${romdir}: versionfile"
insert_copying_files "$romdir" || $err "!insert copy, handle 2, $romdir"
mkrom_tarball
}
insert_copying_files()
{
remkdir "${1}/licenses"
l="${1}/licenses"
# copy licenses to rom image archive, for completion
cp "src/grub/COPYING" "${l}/COPYING.grub" || return 1
cp "src/coreboot/default/COPYING" "${l}/COPYING.coreboot" || return 1
cp -R "src/coreboot/default/LICENSES" "${l}/LICENSES.coreboot" || \
return 1
cp "src/seabios/default/COPYING" "${l}/COPYING.coreboot" || return 1
cp "src/seabios/default/COPYING.LESSER" "$l/COPYING.LESSER.seabios" \
|| return 1
cp -R "src/u-boot/default/Licenses" "${l}/COPYING.u-boot" || return 1
printf "Multiple licenses. Check corresponding %s source archive\n" \
"${projectname}" > "${1}/COPYING" || return 1
rm -f src/u-boot/*/test/lib/strlcat.c || return 1
}
mkrom_tarball()
{
archivename="${relname}_${target##*/}"
f="release/${version}/roms/${archivename}"
mkdir -p "${f%/*}" || $err "mkrom_tarball: !mkdir -p ${f%/*}"
(
cd "${romdir%"/bin/$target"}" || $err "!cd ${romdir%"/bin/$target"}"
mktarball "bin/${target}" "${archivename}.tar.xz"
) || $err "can't create rom tarball"
mv "${romdir%"/bin/${target}"}/${archivename}.tar.xz"* "${f%/*}" || \
$err "mktar ${f%/*}/${romdir%"/bin/$target"}/$archivename.tar.xz"
printf "Created ROM archive: %s" "${f%/*}/${archivename}.tar.xz"
}
insert_version_files()
{
printf "%s\n" "${version}" > "${1}/version" || return 1
printf "%s\n" "${versiondate}" > "${1}/versiondate" || return 1
printf "%s\n" "${projectname}" > "${1}/projectname" || return 1
}
mktarball()
{
# preserve timestamps for reproducible tarballs
tar_implementation=$(tar --version | head -n1) || :
[ "${2%/*}" = "${2}" ] || \
mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\""
printf "\nCreating archive: %s\n\n" "$2"
if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then
tar --sort=name --owner=root:0 --group=root:0 \
--mtime="UTC 2024-05-10" -c "$1" | xz -T$threads -9e \
> "$2" || $err "mktarball 1, ${1}"
else
# TODO: reproducible tarballs on non-GNU systems
tar -c "$1" | xz -T$threads -9e > "$2" || \
$err "mktarball 2, $1"
fi
(
[ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}"
sha512sum "${2##*/}" > "${2##*/}.sha512" || \
$err "!sha512sum \"${2##*/}\" > \"${2##*/}.sha512\""
) || $err "failed to create tarball checksum"
}
main $@