summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild25
-rw-r--r--config/submodule/coreboot/default/vboot/patches/0001-test-patch.patch26
-rwxr-xr-xinclude/git.sh38
-rwxr-xr-xinclude/option.sh8
-rwxr-xr-xscript/roms52
-rwxr-xr-xscript/trees3
6 files changed, 85 insertions, 67 deletions
diff --git a/build b/build
index fdb47947..b28ce954 100755
--- a/build
+++ b/build
@@ -28,7 +28,7 @@ main()
[ $# -lt 1 ] && $err "Check $projectname documentation for help."
spath="script/$1"
- [ "$1" = "dependencies" ] && x_ install_packages $@ && xbmk_exit 0
+ [ "$1" = "dependencies" ] && x_ install_packages $@ && return 0
which git 1>/dev/null 2>/dev/null || \
git_err "git not installed. please install git-scm."
@@ -50,7 +50,6 @@ main()
shift 1; "$spath" $@ || $err "excmd: ${spath} ${@}" ;;
esac
set -u -e # some commands disable them. turn them on!
- xbmk_exit 0
}
install_packages()
@@ -66,13 +65,10 @@ install_packages()
. "config/dependencies/${2}"
- x_ ${pkg_add} ${pkglist}
- [ -z "${aur_notice}" ] && return 0
- printf "You must install AUR packages: %s\n" "$aur_notice" 1>&2
+ x_ $pkg_add $pkglist && [ -n "$aur_notice" ] && \
+ printf "Please install AUR packages: %s\n" "$aur_notice" 1>&2; return 0
}
-# release archives contain .gitignore, but not .git.
-# xbmk can be run from xbmk.git, or an archive.
git_init()
{
[ -L ".git" ] && $err "Reference .git is a symlink"
@@ -125,13 +121,11 @@ build_release()
) || $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"
+ --abbrev-commit > "${srcdir}/CHANGELOG" || $err "!gitlog $srcdir"
(
cd "${srcdir%/*}" || $err "${_xm}: mktarball \"${srcdir}\""
- mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || \
- $err "$_xm: mksrc"
+ mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || $err "$_xm: mksrc"
) || $err "can't create src tarball"
[ "${mode}" = "src" ] && return 0
@@ -151,22 +145,14 @@ fetch_trees()
for x in $(items config/git); do
./update trees -f "$x" || $err "$_xm: fetch $x"
done
-
for x in config/*/build.list; do
[ -f "$x" ] && xp="${x#*/}" && xp="${xp%/*}"
[ ! -f "$x" ] || [ -L "$xp" ] || x_ rm -Rf "src/$xp/$xp"
done
-
rmgit .
rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm"
}
-xbmk_exit()
-{
- tmp_cleanup || err_ "xbmk_exit: can't rm tmpdir upon exit $1: $tmpdir"
- exit $1
-}
-
fail()
{
tmp_cleanup || printf "WARNING: can't rm tmpdir: %s\n" "$tmpdir" 1>&2
@@ -180,3 +166,4 @@ tmp_cleanup()
}
main $@
+tmp_cleanup || err_ "can't rm tmpdir upon non-zero exit: $tmpdir"
diff --git a/config/submodule/coreboot/default/vboot/patches/0001-test-patch.patch b/config/submodule/coreboot/default/vboot/patches/0001-test-patch.patch
new file mode 100644
index 00000000..66428b56
--- /dev/null
+++ b/config/submodule/coreboot/default/vboot/patches/0001-test-patch.patch
@@ -0,0 +1,26 @@
+From 68f99140dda455a4f4e9d73df6d7b0a504494e95 Mon Sep 17 00:00:00 2001
+From: Leah Rowe <info@minifree.org>
+Date: Sun, 19 May 2024 23:35:52 +0100
+Subject: [PATCH 1/1] test patch
+
+Signed-off-by: Leah Rowe <info@minifree.org>
+---
+ Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 4cb265b2..ef29489f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,6 +2,8 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
++# test
++
+ # This Makefile normally builds in a 'build' subdir, but use
+ #
+ # make BUILD=<dir>
+--
+2.39.2
+
diff --git a/include/git.sh b/include/git.sh
index bc818b19..934976eb 100755
--- a/include/git.sh
+++ b/include/git.sh
@@ -7,7 +7,8 @@ eval "$(setvars "" _target rev _xm loc url bkup_url depend tree_depend xtree)"
fetch_project_trees()
{
_target="${target}"
- [ -d "src/${project}/${project}" ] || fetch_from_upstream
+ [ ! -d "src/${project}/${project}" ] && x_ mkdir -p "src/${project}" \
+ && fetch_project_repo "${project}"
fetch_config
if [ -d "src/${project}/${tree}" ]; then
printf "download/%s %s (%s): exists\n" \
@@ -17,14 +18,6 @@ fetch_project_trees()
prepare_new_tree
}
-fetch_from_upstream()
-{
- [ -d "src/${project}/${project}" ] && return 0
-
- x_ mkdir -p "src/${project}"
- fetch_project_repo "${project}"
-}
-
fetch_config()
{
rm -f "${cfgsdir}/"*/seen || $err "fetch_config ${cfgsdir}: !rm seen"
@@ -100,6 +93,9 @@ git_prep()
if [ "$project" != "coreboot" ] || [ $# -gt 2 ]; then
[ ! -f "$tmpgit/.gitmodules" ] || git -C "$tmpgit" submodule \
update --init --checkout || $err "git_prep $_loc: !submod"
+
+ patch_submodules
+
if [ "$project" = "coreboot" ] && [ -n "$xtree" ] && \
[ "$xtree" != "$tree" ]; then
(
@@ -111,12 +107,32 @@ git_prep()
fi
fi
- [ "$xbmk_release" = "y" ] && rmgit "$tmpgit"
+ [ "$xbmk_release" = "y" ] && [ "$_loc" != "src/$project/$project" ] \
+ && rmgit "$tmpgit"
+
[ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}"
mv "$tmpgit" "$_loc" || $err "git_prep: !mv $tmpgit $_loc"
[ -n "$xtree" ] && [ ! -d "src/coreboot/$xtree" ] && \
- x_ ./update project trees -f coreboot "$xtree"; return 0
+ x_ ./update trees -f coreboot "$xtree"; return 0
+}
+
+patch_submodules()
+{
+ moddir="${PWD}/config/submodule/$project"
+ [ -n "$tree" ] && moddir="$moddir/$tree"
+ [ -d "$moddir" ] || return 0
+
+ git -C "$tmpgit" submodule status | awk '{print $2}' > \
+ "$tmpdir/modules" || $err "$moddir: cannot list submodules"
+
+ while read -r modsrcdir; do
+ modname="${modsrcdir##*/}"
+ modpatchdir="$moddir/$modname/patches"
+ [ -d "$modpatchdir" ] || continue
+
+ git_am_patches "$tmpgit/$modsrcdir" "$modpatchdir"
+ done < "$tmpdir/modules"
}
git_am_patches()
diff --git a/include/option.sh b/include/option.sh
index 45066166..bfeb9eb3 100755
--- a/include/option.sh
+++ b/include/option.sh
@@ -151,11 +151,11 @@ git_err()
$err "Git name/email not configured"
}
-mktar_release()
+mkrom_tarball()
{
- printf "%s\n" "${version}" > "${1}/version" || return 1
- printf "%s\n" "${versiondate}" > "${1}/versiondate" || return 1
- printf "%s\n" "${projectname}" > "${1}/projectname" || return 1
+ 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"
mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz"
x_ rm -Rf "$1"
diff --git a/script/roms b/script/roms
index 292193e9..b375d939 100755
--- a/script/roms
+++ b/script/roms
@@ -56,7 +56,9 @@ main()
[ "${all}" != "y" ] || boards=$(items config/coreboot) || \
$err "Cannot generate list of boards for building"
for x in ${boards}; do
- handle_coreboot_target "$x"
+ [ -d "config/coreboot/$x/config" ] && \
+ handle_coreboot_target "$x" && continue
+ printf "No configs for %s; skipping\n" "$x"
done
fi
@@ -99,7 +101,7 @@ handle_serprog()
done
fi
- [ "$xbmk_release" = "y" ] && mktar_release "bin/serprog_$1"; return 0
+ [ "$xbmk_release" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0
}
build_rp2040_rom()
@@ -148,10 +150,8 @@ handle_coreboot_target()
[ -d "bin/${board}" ] || return 0
[ "$xbmk_release" = "y" ] || targets="* bin/${board}\n${targets}"
- [ "$xbmk_release" = "y" ] || return 0
-
- targets="* bin/${relname}_$board.tar.xz\n$targets"
- mktar_release "bin/$board"
+ [ "$xbmk_release" = "y" ] && mkrom_tarball "bin/$board" && \
+ targets="* bin/${relname}_$board.tar.xz\n$targets"; return 0
}
configure_target()
@@ -179,11 +179,10 @@ configure_target()
[ "$payload_seabios_grubonly" = "y" ] && payload_seabios_withgrub="y"
# The reverse logic must not be applied. If SeaBIOS-with-GRUB works,
- # that doesn't mean GRUB-withSeaBIOS will. For example, the board
- # might have a graphics card whose vga rom coreboot doesn't execute
+ # that doesn't mean GRUB-with-SeaBIOS will, e.g. VGA ROM execution
[ "$payload_grub" != "y" ] && [ "$payload_seabios" != "y" ] && \
- [ "${payload_uboot}" != "y" ] && ! check_defconfig "$targetdir" \
- && $err "target '$board' defines no payload"
+ [ "${payload_uboot}" != "y" ] && \
+ $err "target '$board' defines no payload"
[ "$payload_uboot" != "n" ] && [ "$payload_uboot" != "y" ] && \
payload_uboot="n"
@@ -192,7 +191,6 @@ configure_target()
# Override all payload directives with cmdline args
[ -z "${_payload}" ] && return 0
- printf "setting payload to: %s\n" "${_payload}"
eval "$(setvars "n" payload_grub payload_memtest payload_seabios \
payload_seabios_withgrub payload_uboot payload_grub_withseabios \
payload_seabios_grubonly)"
@@ -235,13 +233,9 @@ build_grub_payload()
[ -f "$grubelf" ] && return 0
[ -f "src/grub/grub-mkstandalone" ] || x_ ./update trees -b grub
- ./src/grub/grub-mkstandalone \
- --grub-mkimage="src/grub/grub-mkimage" \
- -O i386-coreboot \
- -o "elf/grub/grub.elf" \
- -d "src/grub/grub-core/" \
- --fonts= --themes= --locales= \
- --modules="${grub_modules}" \
+ ./src/grub/grub-mkstandalone --grub-mkimage="src/grub/grub-mkimage" \
+ -O i386-coreboot -o "elf/grub/grub.elf" -d "src/grub/grub-core/" \
+ --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" || \
@@ -255,8 +249,7 @@ build_uboot_payload()
ubootelf="${ubdir}/u-boot.elf"
[ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot" ] && \
ubootelf="${ubdir}/u-boot"
- [ -f "${ubootelf}" ] && return 0
- $err "Can't find u-boot build for board, $board";
+ [ -f "${ubootelf}" ] || $err "$board: Can't find u-boot"; return 0
}
build_target_mainboard()
@@ -281,7 +274,6 @@ build_target_mainboard()
done
}
-# Main ROM building function. This calls all other functions below
build_roms()
{
cbcfg="${1}"
@@ -323,7 +315,7 @@ build_seabios_roms()
newrom="${romdir}/seabios_${board}_${initmode}_${displaymode}"
[ "${initmode}" = "normal" ] && newrom="${romdir}/seabios" \
&& newrom="${newrom}_${board}_${initmode}"
- x_ moverom "${t}" "${newrom}.rom"
+ x_ copyrom "${t}" "${newrom}.rom"
fi
x_ rm -f "${t}"
}
@@ -387,14 +379,14 @@ build_grub_roms()
[ "${initmode}" = "normal" ] && \
newrom="${romdir}/${payload1}_${board}_" && \
newrom="${newrom}${initmode}_${keymap}.rom"
- x_ moverom "${tmpgrubrom}" "${newrom}"
+ x_ copyrom "${tmpgrubrom}" "${newrom}"
if [ "${payload_seabios_grubonly}" = "y" ]; then
x_ "$cbfstool" "$tmpgrubrom" add \
-f "config/grub/bootorder" -n bootorder -t raw
- x_ moverom "$tmpgrubrom" "${newrom%.rom}_grubfirst.rom"
+ x_ copyrom "$tmpgrubrom" "${newrom%.rom}_grubfirst.rom"
x_ "$cbfstool" "$tmpgrubrom" add-int -i 0 \
-n etc/show-boot-menu
- x_ moverom "$tmpgrubrom" "${newrom%.rom}_grubonly.rom"
+ x_ copyrom "$tmpgrubrom" "${newrom%.rom}_grubonly.rom"
fi
x_ rm -f "${tmpgrubrom}"
done
@@ -428,7 +420,7 @@ build_uboot_roms()
tmprom=$(mkUbootRom "${cbrom}" "fallback/payload") || \
$err "build_uboot_roms $board: could not create tmprom"
newrom="${romdir}/uboot_payload_${board}_${initmode}_${displaymode}.rom"
- x_ moverom "${tmprom}" "${newrom}"
+ x_ copyrom "${tmprom}" "${newrom}"
x_ rm -f "${tmprom}"
}
@@ -451,16 +443,14 @@ mkUbootRom() {
printf "%s\n" "${tmprom}"
}
-moverom()
+copyrom()
{
printf "Creating target image: %s\n" "$2"
x_ mkdir -p "${2%/*}"
x_ cp "$1" "$2"
- [ "$xbmk_release" = "y" ] || return 0
-
- mksha512sum "${2}" "vendorhashes"
- x_ ./vendor inject -r "${2}" -b "$board" -n nuke
+ [ "$xbmk_release" = "y" ] && mksha512sum "${2}" "vendorhashes" && \
+ x_ ./vendor inject -r "${2}" -b "$board" -n nuke; return 0
}
main $@
diff --git a/script/trees b/script/trees
index 3b126e56..f2b988f1 100755
--- a/script/trees
+++ b/script/trees
@@ -230,8 +230,7 @@ check_cmake()
check_makefile "${1}" || \
$err "check_cmake ${1}: can't cmake ${cmakedir}"
[ -z "${cmakedir}" ] || check_makefile "${1}" || \
- $err "check_cmake ${1}: could not generate Makefile"
- return 0
+ $err "check_cmake ${1}: can't generate Makefile"; return 0
}
check_autoconf()