From 839ef680cd8f25650d8fb59a3e6fe6bf3f84786b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 16 May 2024 03:56:52 +0100 Subject: lbmk: allow easier sync with cbmk an equivalent change has been made in cbmk. certain lbmk-specific variable names have been made generic, with certain functions and other variables moved around. i maintain sync between libreboot and canoeboot, where both projects can have the same behaviours, and most of the merge conflicts have to do with variable names containing "LBMK", "lbmk", "cbmk" or "CBMK", or indeed "canoeboot" and "libreboot" LBMK/lbmk/CBMK/cbmk variables between canoeboot and libreboot now contain the string XBMK/xbmk it should now be *much* easier to merge build system changes between lbmk and cbmk. Signed-off-by: Leah Rowe --- build | 18 +++++++++--------- include/option.sh | 28 ++++++++++------------------ include/vendor.sh | 14 +++++++++++--- script/roms | 14 +++++++------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/build b/build index 61836eb5..b6311846 100755 --- a/build +++ b/build @@ -8,7 +8,7 @@ set -u -e if [ "./${0##*/}" != "${0}" ] || [ ! -f "build" ] || [ -L "build" ]; then - printf "You must run this in the lbmk work directory.\n" 1>&2 + printf "You must run this in the proper work directory.\n" 1>&2 exit 1 fi @@ -27,7 +27,7 @@ main() x_ id -u 1>/dev/null 2>/dev/null [ $# -lt 1 ] && $err "Check $projectname documentation for help." - [ "$1" = "dependencies" ] && x_ install_packages $@ && lbmk_exit 0 + [ "$1" = "dependencies" ] && x_ install_packages $@ && xbmk_exit 0 which git 1>/dev/null 2>/dev/null || \ git_err "git not installed. please install git-scm." @@ -39,7 +39,7 @@ main() for cmd in initcmd git_init excmd; do eval "${cmd} \$@" done - lbmk_exit 0 + xbmk_exit 0 } initcmd() @@ -56,7 +56,7 @@ initcmd() return 0 ;; esac set -u -e # some commands disable them. turn them on! - lbmk_exit 0 + xbmk_exit 0 } install_packages() @@ -78,7 +78,7 @@ install_packages() } # release archives contain .gitignore, but not .git. -# lbmk can be run from lbmk.git, or an archive. +# xbmk can be run from xbmk.git, or an archive. git_init() { [ -L ".git" ] && $err "Reference .git is a symlink" @@ -88,7 +88,7 @@ git_init() git init || $err "${PWD}: cannot initialise Git repository" git add -A . || $err "${PWD}: cannot add files to Git repository" git commit -m "${projectname} ${version}" --date "${cdate}" \ - --author="lbmk " || \ + --author="xbmk " || \ $err "$PWD: can't commit ${projectname}/${version}, date $cdate" git tag -a "${version}" -m "${projectname} ${version}" || \ $err "${PWD}: cannot git-tag ${projectname}/${version}" @@ -102,7 +102,7 @@ excmd() mkrelease() { - export LBMK_RELEASE="y" + export XBMK_RELEASE="y" vdir="release" while getopts d:m: option; do @@ -174,9 +174,9 @@ fetch_trees() rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm" } -lbmk_exit() +xbmk_exit() { - tmp_cleanup || err_ "lbmk_exit: can't rm tmpdir upon exit $1: $tmpdir" + tmp_cleanup || err_ "xbmk_exit: can't rm tmpdir upon exit $1: $tmpdir" exit $1 } diff --git a/include/option.sh b/include/option.sh index 26867772..b2e94a6a 100755 --- a/include/option.sh +++ b/include/option.sh @@ -7,8 +7,6 @@ export LC_COLLATE=C export LC_ALL=C tmpdir_was_set="y" -vendir="vendorfiles" -appdir="${vendir}/app" cbdir="src/coreboot/default" cbcfgsdir="config/coreboot" ifdtool="cbutils/default/ifdtool" @@ -35,40 +33,34 @@ setvars() done printf "%s\n" "${_setvars% }" } -eval "$(setvars "" CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \ - CONFIG_ME_BIN_PATH CONFIG_KBC1126_FIRMWARE CONFIG_KBC1126_FW1 versiondate \ - CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW2_OFFSET \ - CONFIG_VGA_BIOS_FILE CONFIG_VGA_BIOS_ID CONFIG_GBE_BIN_PATH tmpdir _nogit \ - CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_SMSC_SCH5545_EC_FW_FILE version \ - CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE _dest board boarddir lbmk_release \ - CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE threads projectname \ - relname)" +eval "$(setvars "" versiondate tmpdir _nogit version board boarddir \ + xbmk_release threads projectname relname)" # 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) -set | grep LBMK_RELEASE 1>/dev/null 2>/dev/null || lbmk_release="n" || : -[ -z "$lbmk_release" ] && lbmk_release="$LBMK_RELEASE" -[ "$lbmk_release" = "n" ] || [ "$lbmk_release" = "y" ] || lbmk_release="n" -export LBMK_RELEASE="$lbmk_release" +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" set | grep TMPDIR 1>/dev/null 2>/dev/null || tmpdir_was_set="n" if [ "${tmpdir_was_set}" = "y" ]; then - [ "${TMPDIR%_*}" = "/tmp/lbmk" ] || tmpdir_was_set="n" + [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || tmpdir_was_set="n" fi if [ "${tmpdir_was_set}" = "n" ]; then export TMPDIR="/tmp" - tmpdir="$(mktemp -d -t lbmk_XXXXXXXX)" + tmpdir="$(mktemp -d -t xbmk_XXXXXXXX)" export TMPDIR="${tmpdir}" else export TMPDIR="${TMPDIR}" tmpdir="${TMPDIR}" fi -set | grep LBMK_THREADS 1>/dev/null 2>/dev/null && threads="$LBMK_THREADS" +set | grep XBMK_THREADS 1>/dev/null 2>/dev/null && threads="$XBMK_THREADS" [ -z "$threads" ] && threads=1 expr "X$threads" : "X-\{0,1\}[0123456789][0123456789]*$" \ 1>/dev/null 2>/dev/null || threads=1 # user specified a non-integer -export LBMK_THREADS="$threads" +export XBMK_THREADS="$threads" x_() { [ $# -lt 1 ] || ${@} || $err "Unhandled non-zero exit: $@"; return 0 diff --git a/include/vendor.sh b/include/vendor.sh index 1904de8e..3fdb7225 100755 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -11,12 +11,20 @@ me7updateparser="${PWD}/util/me7_update_parser/me7_update_parser.py" pfs_extract="${PWD}/src/biosutilities/Dell_PFS_Extract.py" uefiextract="${PWD}/src/uefitool/uefiextract" nvmutil="util/nvmutil/nvm" +vendir="vendorfiles" +appdir="${vendir}/app" -eval "$(setvars "" _b _dl EC_url EC_url_bkup EC_hash DL_hash DL_url DL_url_bkup \ +eval "$(setvars "" _b EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe \ E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ E6400_VGA_romname SCH5545EC_DL_url SCH5545EC_DL_url_bkup SCH5545EC_DL_hash \ - tree mecleaner kbc1126_ec_dump MRC_refcode_cbtree MRC_refcode_gbe new_mac \ - cbfstoolref release nukemode modifygbe rom archive)" + mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl CONFIG_HAVE_MRC \ + CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_ME_BIN archive EC_url modifygbe \ + CONFIG_ME_BIN_PATH CONFIG_KBC1126_FIRMWARE CONFIG_KBC1126_FW1 _dest tree \ + CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW2_OFFSET rom \ + CONFIG_VGA_BIOS_FILE CONFIG_VGA_BIOS_ID CONFIG_GBE_BIN_PATH release DL_url \ + CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_SMSC_SCH5545_EC_FW_FILE nukemode \ + CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_HAVE_REFCODE_BLOB cbfstoolref \ + CONFIG_REFCODE_BLOB_FILE)" vendor_download() { diff --git a/script/roms b/script/roms index ac3d28ef..7c181c36 100755 --- a/script/roms +++ b/script/roms @@ -61,14 +61,14 @@ main() fi bstr="directories" - [ "$lbmk_release" = "y" ] && bstr="tarballs" + [ "$xbmk_release" = "y" ] && bstr="tarballs" [ -z "${targets}" ] && $err "No ROM images were compiled" printf "\nROM images available in these %s:\n" "$bstr" eval "printf \"${targets}\"" printf "^^ ROM images available in these %s.\n\n" "$bstr" - [ "$lbmk_release" = "y" ] && \ + [ "$xbmk_release" = "y" ] && \ printf "Always run the inject command on release images!\n" printf "DO NOT flash images from elf/ - please use bin/ instead.\n" } @@ -99,7 +99,7 @@ handle_serprog() done fi - [ "$lbmk_release" = "y" ] && mktar_release "bin/serprog_$1"; return 0 + [ "$xbmk_release" = "y" ] && mktar_release "bin/serprog_$1"; return 0 } build_rp2040_rom() @@ -144,7 +144,7 @@ handle_coreboot_target() configure_target [ "$board" = "$tree" ] && return 0 - if [ "$lbmk_release" = "y" ] && [ "$release" = "n" ]; then + if [ "$xbmk_release" = "y" ] && [ "$release" = "n" ]; then printf "Target '%s' disabled for release.\n" "$board" return 0 fi @@ -153,8 +153,8 @@ handle_coreboot_target() build_target_mainboard [ -d "bin/${board}" ] || return 0 - [ "$lbmk_release" = "y" ] || targets="* bin/${board}\n${targets}" - [ "$lbmk_release" = "y" ] || 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" @@ -466,7 +466,7 @@ moverom() x_ mkdir -p "${2%/*}" x_ cp "$1" "$2" - [ "$lbmk_release" = "y" ] || return 0 + [ "$xbmk_release" = "y" ] || return 0 mksha512sum "${2}" "vendorhashes" x_ ./vendor inject -r "${2}" -b "$board" -n nuke -- cgit v1.2.1