mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
TEST
nowhere near complete. just a proof of concept to let me know i'm on the right track Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
136
include/chromebook.sh
Normal file
136
include/chromebook.sh
Normal file
@@ -0,0 +1,136 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Copyright (c) 2025 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
# Assimilate MrChromebox coreboot distro, adapting its ports
|
||||
# for use in the Libreboot build system. This will create a
|
||||
# *patch* file for Libreboot, from the current lbmk commit.
|
||||
|
||||
# These functions are used with the "./mk mrchromebox" command.
|
||||
# MrChromebox has a habit of using branches per project, each
|
||||
# branch being a given release. He does his changes on top of
|
||||
# upstream and goes from there.
|
||||
|
||||
# The coreboot build system (upstream one) already integrates
|
||||
# MrChromebox edk2 quite heavily, so Mrchromebox's own project
|
||||
# doesn't need a complicated external build system like lbmk.
|
||||
# He relies on pre-baked configs, that he provides, and uses
|
||||
# these to build the machines.
|
||||
|
||||
spdx="# SPDX-License-Identifier: GPL-3.0-or-later"
|
||||
|
||||
mr_tmprepos="" # dir to clone tmp repos in
|
||||
|
||||
# we will use the upstream edk2 repo, but create trees
|
||||
# for mrchromebox's patches. this is because i will be
|
||||
# using edk2 for other projects in the future
|
||||
# NOTE: these mirror https://github.com/tianocore/edk2.git
|
||||
mx_edk2gitconf="config/git/edk2/pkg.git"
|
||||
mx_edk2repo="https://codeberg.org/libreboot/edk2"
|
||||
mx_edk2repo_bkup="https://git.disroot.org/libreboot/edk2"
|
||||
|
||||
# Now the repos to import. Please note:
|
||||
# These won't be used directly in xbmk. They're being used
|
||||
# to pull patches and configs from, that mrchromebox uses.
|
||||
# "rev" is the rev from mrchromebox. "revbase" is the upstream
|
||||
# rev that his patches derive from.
|
||||
# so we format-patch from there to HEAD(=e.g. mr_cbrev)
|
||||
|
||||
# NOTE: upstream for our purposes: https://review.coreboot.org/coreboot
|
||||
mr_cbrepo="https://github.com/mrchromebox/coreboot"
|
||||
mr_cbbranch="MrChromebox-2503" # branch in mrchromebox
|
||||
mr_cbrev="ecd9fa6a177e00132ec214252a2b9cebbb01e25f" # relative to base
|
||||
mr_cbrevbase="38f5f7c48024d9fca4b6bbd88914423c34da709c" # 25.03 upstream base
|
||||
mr_cbtree="chromebook" # tree name in xbmk
|
||||
|
||||
# NOTE: upstream for our purposes: https://github.com/tianocore/edk2.git
|
||||
mr_edk2repo="https:/github.com/mrchromebox/edk2"
|
||||
mr_edk2branch="uefipayload_2502" # branch in mrchromebox
|
||||
mr_edk2rev="feaf6b976b7cc72a18ed364f273751c943a9e7d0" # relative to base
|
||||
mr_edk2revbase="fbe0805b2091393406952e84724188f8c1941837" # 2025.02 upstream
|
||||
mr_edk2tree="chromebook" # tree name in xbmk
|
||||
|
||||
# mxlibreboot was here
|
||||
prep_mr_import()
|
||||
{
|
||||
prep_mx_edk2conf
|
||||
|
||||
prep_mr_target
|
||||
}
|
||||
|
||||
# create config/git/edk2/pkg.cfg
|
||||
prep_mx_edk2conf()
|
||||
{
|
||||
x_ remkdir "${mx_edk2gitconf%/*}"
|
||||
|
||||
printf "%s\n\n" "$spdx" > "$mx_edk2gitconf" \
|
||||
err "Can't write SPDX to '$mx_edk2gitconf'" prep_mr_edk2conf "$@"
|
||||
|
||||
printf "rev=\"HEAD\"\n\n" >> "$mx_edk2gitconf" \
|
||||
err "Can't write HEAD to '$mx_edk2gitconf'" prep_mr_edk2conf "$@"
|
||||
|
||||
printf "url=\"%s\"\n\n" "$mx_edk2repo" >> "$mx_edk2gitconf" \
|
||||
err "Can't write repo to '$mx_edk2gitconf'" prep_mr_edk2conf "$@"
|
||||
|
||||
printf "url=\"%s\"\n\n" "$mx_edk2repo_bkup" >> "$mx_edk2gitconf" \
|
||||
err "Can't write bkup to '$mx_edk2gitconf'" prep_mr_edk2conf "$@"
|
||||
}
|
||||
|
||||
# prep config/PROJECT/TREE/ for various projects
|
||||
prep_mr_target()
|
||||
{
|
||||
mr_tmprepos="`mktemp -d || err "can't make mrtmpdir"`" || \
|
||||
err "can't make mrtmpdir" "prep_mr_coreboot" "$@"
|
||||
x_ remkdir "$mr_tmprepos"
|
||||
|
||||
prep_mr "coreboot" "$mr_cbrepo" "$mr_cbbranch" "$mr_cbrev" \
|
||||
"$mr_cbrevbase" "$mr_cbtree"
|
||||
prep_mr "edk2" "$mr_edk2repo" "$mr_edk2branch" "$mr_edk2rev" \
|
||||
"$mr_edk2revbase" "$mr_edk2tree"
|
||||
}
|
||||
|
||||
# create config/PROJECT/TREE/target.cfg
|
||||
# and config/PROJECT/TREE/patches/
|
||||
prep_mr()
|
||||
{
|
||||
mr_projectname="$1"
|
||||
mr_repo="$2"
|
||||
mr_branch="$3"
|
||||
mr_rev="$4"
|
||||
mr_revbase="$5"
|
||||
mr_tree="$6"
|
||||
|
||||
mr_tmpclone="$mr_tmprepos/$mr_projectname"
|
||||
mr_patchdir="config/$mr_projectname/$mr_tree/patches"
|
||||
|
||||
x_ git clone "$mr_repo" "$mr_tmpclone"
|
||||
x_ git -C "$mr_tmpclone" checkout "$mr_branch"
|
||||
x_ git -C "$mr_tmpclone" reset --hard "$mr_rev"
|
||||
x_ git -C "$mr_tmpclone" format-patch $mr_revbase..HEAD
|
||||
|
||||
x_ remkdir "$mr_patchdir"
|
||||
x_ mv "$mr_tmpclone"/*.patch "$mr_patchdir"
|
||||
|
||||
# if no patches were created, rmdir will succeed
|
||||
rmdir "$mr_patchdir" 1>/dev/null 2>/dev/null || :
|
||||
|
||||
x_ prep_mr_targetconf "$@"
|
||||
|
||||
x_ rm -Rf "$mr_tmpclone"
|
||||
}
|
||||
|
||||
prep_mr_targetconf()
|
||||
{
|
||||
# prep the actual tree, after the patches were done
|
||||
mr_targetconf="config/$1/$6/target.cfg"
|
||||
|
||||
printf "%s\n\n" "$spdx" > \
|
||||
err "Can't write SPDX to '$mr_targetconf'" prep_mr_targetconf "$@"
|
||||
|
||||
printf "tree=\"%s\"\n" "$6" >> "$mr_targetconf" || \
|
||||
err "Can't write tree $6 '$mr_targetconf'" prep_mr_targetconf "$@"
|
||||
printf "rev=\"%s\"\n" "$5" >> "$mr_targetconf" || \
|
||||
err "Can't write rev $5 '$mr_targetconf'" prep_mr_targetconf "$@"
|
||||
|
||||
printf "Created '%s'\n" "$mr_targetconf"
|
||||
}
|
||||
3
mk
3
mk
@@ -28,6 +28,7 @@ fi
|
||||
. "include/rom.sh"
|
||||
. "include/release.sh"
|
||||
. "include/get.sh"
|
||||
. "include/chromebook.sh"
|
||||
|
||||
main()
|
||||
{
|
||||
@@ -42,7 +43,7 @@ main()
|
||||
version)
|
||||
printf "%s\nWebsite: %s\n" "$relname" "$projectsite"
|
||||
;;
|
||||
release|download|inject)
|
||||
release|download|inject|prep_mr_import)
|
||||
$cmd "$@"
|
||||
;;
|
||||
-*)
|
||||
|
||||
Reference in New Issue
Block a user