summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/build/coreboot/grub17
-rwxr-xr-xscript/build/coreboot/utils4
-rwxr-xr-xscript/build/fw/coreboot12
-rwxr-xr-xscript/build/fw/serprog8
-rwxr-xr-xscript/update/blobs/inject18
-rwxr-xr-xscript/update/project/build21
-rwxr-xr-xscript/update/project/repo8
-rwxr-xr-xscript/update/project/trees23
-rwxr-xr-xscript/update/release/roms2
-rwxr-xr-xscript/update/release/src81
10 files changed, 94 insertions, 100 deletions
diff --git a/script/build/coreboot/grub b/script/build/coreboot/grub
index 7f448e24..49b8b416 100755
--- a/script/build/coreboot/grub
+++ b/script/build/coreboot/grub
@@ -5,11 +5,12 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
+. "include/err.sh"
+
elfdir="elf/grub"
grubcfgsdir="config/grub"
layoutdir="/boot/grub/layouts"
-. "include/err.sh"
. "${grubcfgsdir}/modules.list"
main()
@@ -21,16 +22,16 @@ main()
handle_dependencies()
{
- [ -d "grub/" ] || x_ ./update project repo grub
- [ -f "grub/grub-mkstandalone" ] || build_grub_utils
- [ -d "${elfdir}" ] || x_ mkdir -p "${elfdir}"
+ [ -d "src/grub" ] || x_ ./update project repo grub
+ [ -f "src/grub/grub-mkstandalone" ] || build_grub_utils
+ x_ mkdir -p "${elfdir}"
x_ rm -f "${elfdir}/"*
}
build_grub_utils()
{
(
- x_ cd grub/
+ x_ cd "src/grub"
[ ! -d Makefile ] || x_ make distclean
x_ ./bootstrap --gnulib-srcdir=gnulib/ --no-git
x_ ./autogen.sh
@@ -52,11 +53,11 @@ build_keymap_configs()
build_grub_payload()
{
- grub/grub-mkstandalone \
- --grub-mkimage="grub/grub-mkimage" \
+ ./src/grub/grub-mkstandalone \
+ --grub-mkimage="src/grub/grub-mkimage" \
-O i386-coreboot \
-o "${elfdir}/grub.elf" \
- -d grub/grub-core/ \
+ -d "src/grub/grub-core/" \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \
diff --git a/script/build/coreboot/utils b/script/build/coreboot/utils
index e3d471ad..65c565bb 100755
--- a/script/build/coreboot/utils
+++ b/script/build/coreboot/utils
@@ -29,13 +29,13 @@ build_for_mainboard() {
}
buildutils() {
- [ -d "coreboot/${1}/" ] || \
+ [ -d "src/coreboot/${1}/" ] || \
x_ ./update project trees coreboot ${1}
for util in cbfstool ifdtool; do
[ -f "cbutils/${1}/${util}" ] && continue
[ -d "cbutils/${1}" ] || x_ mkdir -p "cbutils/${1}"
- utildir="coreboot/${1}/util/${util}"
+ utildir="src/coreboot/${1}/util/${util}"
x_ make distclean -C "${utildir}"
x_ make -j$(nproc) -C "${utildir}"
x_ cp "${utildir}/${util}" "cbutils/${1}"
diff --git a/script/build/fw/coreboot b/script/build/fw/coreboot
index 15430255..d7f67ad5 100755
--- a/script/build/fw/coreboot
+++ b/script/build/fw/coreboot
@@ -23,7 +23,7 @@ kmapdir="config/grub/keymap"
# Disable all payloads by default.
# target.cfg files have to specifically enable [a] payload(s)
pv="payload_grub payload_grub_withseabios payload_seabios payload_memtest"
-pv="${pv} payload_seabios_withgrub payload_uboot"
+pv="${pv} payload_seabios_withgrub payload_uboot memtest_bin"
v="romdir cbdir cbfstool cbrom initmode displaymode cbcfg targetdir tree arch"
v="${v} grub_timeout ubdir blobs_required board grub_scan_disk uboot_config"
eval "$(setvars "n" ${pv})"
@@ -122,8 +122,8 @@ check_target()
prepare_target()
{
romdir="bin/${board}"
- cbdir="coreboot/${board}"
- [ "${board}" = "${tree}" ] || cbdir="coreboot/${tree}"
+ cbdir="src/coreboot/${board}"
+ [ "${board}" = "${tree}" ] || cbdir="src/coreboot/${tree}"
cbfstool="cbutils/${tree}/cbfstool"
cbrom="${cbdir}/build/coreboot.rom"
@@ -132,8 +132,8 @@ prepare_target()
build_dependency_seabios
memtest_bin="memtest86plus/build${arch#*_}/memtest.bin"
- [ "${payload_memtest}" != "y" ] || [ -f "${memtest_bin}" ] || \
- x_ ./update project build -b ${memtest_bin%/*}
+ [ "${payload_memtest}" != "y" ] || [ -f "src/${memtest_bin}" ] || \
+ x_ ./update project build -b memtest86plus
x_ rm -f "${romdir}/"*
@@ -226,7 +226,7 @@ build_roms()
[ "${payload_memtest}" != "y" ] || \
x_ "${cbfstool}" "${cbrom}" add-payload \
- -f "${memtest_bin}" -n img/memtest -c lzma
+ -f "src/${memtest_bin}" -n img/memtest -c lzma
[ "${payload_seabios}" = "y" ] && \
build_seabios_roms
[ "${payload_grub}" != "y" ] || \
diff --git a/script/build/fw/serprog b/script/build/fw/serprog
index 0966af77..bb6952e2 100755
--- a/script/build/fw/serprog
+++ b/script/build/fw/serprog
@@ -7,10 +7,12 @@ set -u -e
. "include/err.sh"
-pico_src_dir=util-fw/rp2040/pico-serprog
-pico_sdk_dir=util-fw/rp2040/pico-sdk
+eval "$(setvars "" platform pico_sdk_dir pico_src_dir stm32_src_dir \
+ boards_dir)"
-stm32_src_dir=util-fw/stm32-vserprog
+pico_src_dir=src/pico-serprog
+pico_sdk_dir=src/pico-sdk
+stm32_src_dir=src/stm32-vserprog
usage="usage: ./build firmware serprog <rp2040|stm32> [board]"
diff --git a/script/update/blobs/inject b/script/update/blobs/inject
index 96ee0002..d778fe78 100755
--- a/script/update/blobs/inject
+++ b/script/update/blobs/inject
@@ -34,7 +34,6 @@ main()
printf "Friendly reminder (this is *not* an error message):\n"
printf "Please always ensure that the files were inserted correctly.\n"
- printf "Read: https://libreboot.org/docs/install/ivy_has_common.html\n"
}
check_board()
@@ -187,8 +186,7 @@ inject_blob_intel_mrc()
printf "adding mrc\n"
- # mrc.bin must be inserted at a specific offset. the only
- # libreboot platform that needs it, at present, is haswell
+ # mrc.bin must be inserted at a specific offset
# in cbfstool, -b values above 0x80000000 are interpreted as
# top-aligned x86 memory locations. this is converted into an
@@ -197,7 +195,7 @@ inject_blob_intel_mrc()
# coreboot's own build system hardcodes the mrc.bin offset
# because there is only one correct location in memory, but
- # it would be useful for lbmk if it could be easily scanned
+ # it would be useful for us if it could be easily scanned
# from Kconfig, with the option to change it where in practise
# it is not changed
@@ -217,7 +215,7 @@ inject_blob_intel_me()
[ -z ${CONFIG_ME_BIN_PATH} ] && \
err "inject_blob_intel_me: CONFIG_ME_BIN_PATH not set"
- _me_location=${CONFIG_ME_BIN_PATH#../../}
+ _me_location=${CONFIG_ME_BIN_PATH##*../}
[ ! -f "${_me_location}" ] && \
err "inject_blob_intel_me: per CONFIG_ME_BIN_PATH: file missing"
@@ -228,9 +226,9 @@ inject_blob_hp_kbc1126_ec()
{
rom="${1}"
- _ec1_location="${CONFIG_KBC1126_FW1#../../}"
+ _ec1_location="${CONFIG_KBC1126_FW1##*../}"
_ec1_offset="${CONFIG_KBC1126_FW1_OFFSET}"
- _ec2_location="${CONFIG_KBC1126_FW2#../../}"
+ _ec2_location="${CONFIG_KBC1126_FW2##*../}"
_ec2_offset="${CONFIG_KBC1126_FW2_OFFSET}"
printf "adding hp kbc1126 ec firmware\n"
@@ -253,7 +251,7 @@ inject_blob_dell_e6400_vgarom_nvidia()
{
rom="${1}"
- _vga_location="${CONFIG_VGA_BIOS_FILE#../../}"
+ _vga_location="${CONFIG_VGA_BIOS_FILE##*../}"
_vga_dir="${_vga_location%/*}"
_vga_filename="${_vga_location##*/}"
@@ -271,7 +269,7 @@ inject_blob_dell_e6400_vgarom_nvidia()
inject_blob_smsc_sch5545_ec()
{
rom="${1}"
- _sch5545ec_location="${CONFIG_SMSC_SCH5545_EC_FW_FILE#../../}"
+ _sch5545ec_location="${CONFIG_SMSC_SCH5545_EC_FW_FILE##*../}"
[ -f "${_sch5545ec_location}" ] || \
err "inject_blob_smsc_sch5545_ec: SCH5545 fw missing"
@@ -286,7 +284,7 @@ modify_gbe()
err "modify_gbe: ${board}: CONFIG_GBE_BIN_PATH not set"
rom="${1}"
- _gbe_location=${CONFIG_GBE_BIN_PATH#../../}
+ _gbe_location=${CONFIG_GBE_BIN_PATH##*../}
[ -f "${_gbe_location}" ] || \
err "modify_gbe: CONFIG_GBE_BIN_PATH points to missing file"
[ -f "${nvmutil}" ] || \
diff --git a/script/update/project/build b/script/update/project/build
index 2c6eff97..69c11105 100755
--- a/script/update/project/build
+++ b/script/update/project/build
@@ -33,7 +33,7 @@ main()
-x) mode="crossgcc-clean" ;;
*) err "Invalid option" ;;
esac
- shift; project="${OPTARG}"; shift
+ shift; project="${OPTARG#src/}"; shift
done
[ -z ${_f} ] && err "flag not specified (-m, -u, -b, -c or -x)"
[ -z ${project} ] && err "project name not specified"
@@ -48,15 +48,13 @@ main()
build_projects()
{
[ $# -gt 0 ] && x_ ./update project build ${_f} ${@}
- codedir="${project}"
+ codedir="src/${project}"
- [ -d "${codedir}" ] || x_ ./update project repo "${codedir%/*}"
- [ -d "${codedir}" ] || \
- err "build_targets: ${codedir%/*} not downloaded"
+ [ -d "${codedir}" ] || x_ ./update project repo "${project}"
if [ "${project}" = "uefitool" ]; then
(
- x_ cd uefitool
+ x_ cd src/uefitool
cmake UEFIExtract/ || [ -f Makefile ] || \
err "build_targets: !cmake UEFIExtract/"
)
@@ -138,7 +136,7 @@ handle_src_tree()
[ -z ${arch} ] && \
err "handle_src_tree: ${target_dir}: undefined cpu type"
- codedir="${project}/${tree}"
+ codedir="src/${project}/${tree}"
if [ ! -d "${codedir}" ]; then
if [ "${mode}" = "distclean" ] || \
[ "${mode}" = "crossgcc-clean" ]; then
@@ -171,13 +169,14 @@ check_cross_compiler()
[ "${crossgcc_ada}" != "y" ] && \
export BUILD_LANGUAGES=c
- cbdir="coreboot/${tree}"
+ cbdir="src/coreboot/${tree}"
[ "${project}" != "coreboot" ] && \
- cbdir="coreboot/default" # not u-boot (e.g. linux will use it)
+ cbdir="src/coreboot/default" # not u-boot (e.g. linux)
[ "${project}" = "u-boot" ] && \
- cbdir="coreboot/cros" # u-boot only used on coreboot/cros
+ cbdir="src/coreboot/cros" # u-boot only used on coreboot/cros
+
# only true if not building coreboot:
- ctarget="${cbdir#coreboot/}"
+ ctarget="${cbdir#src/coreboot/}"
[ -d "${cbdir}" ] || \
x_ ./update project trees coreboot ${ctarget}
diff --git a/script/update/project/repo b/script/update/project/repo
index 71c3940c..df522edc 100755
--- a/script/update/project/repo
+++ b/script/update/project/repo
@@ -16,7 +16,7 @@ main()
[ $# -gt 0 ] || fail "no argument given"
[ -z "${1+x}" ] && fail 'main(): name not set'
- name=${1}
+ name=${1#src/}
scan_config "${name}" "config/git" "fail"
verify_config
@@ -40,6 +40,9 @@ clone_project()
xx_ rm -Rf "${tmp_dir}"
xx_ mkdir -p "${tmp_dir%/*}"
+ loc="${loc#src/}"
+ loc="src/${loc}"
+
git clone ${url} "${tmp_dir}" || git clone ${bkup_url} "${tmp_dir}" || \
fail "clone_project: could not download ${name}"
git_reset_rev "${tmp_dir}" "${rev}" "fail" || \
@@ -47,8 +50,7 @@ clone_project()
git_am_patches "${tmp_dir}" "${PWD}/config/${name}/patches" "fail" || \
fail "clone_project ${loc}/: cannot apply patches"
- [ ! -d "${loc}" ] || \
- xx_ rm -Rf "${loc}"
+ xx_ rm -Rf "${loc}"
[ "${loc}" = "${loc%/*}" ] || xx_ mkdir -p ${loc%/*}
xx_ mv "${tmp_dir}" "${loc}"
}
diff --git a/script/update/project/trees b/script/update/project/trees
index 29004760..4b25d5b9 100755
--- a/script/update/project/trees
+++ b/script/update/project/trees
@@ -15,13 +15,13 @@ eval "$(setvars "" _target tree rev project cfgsdir _xm)"
main()
{
- printf "Downloading %s and applying patches\n" ${project}
-
[ -z "${1}" ] && err "project name not specified"
- project="${1}" && shift 1
+ project="${1#src/}" && shift 1
configure_targets $@
+ printf "Downloading %s and applying patches\n" ${project}
+
for x in ${targets}; do
x_ rm -f "${cfgsdir}/"*/seen
download_for_target "${x}"
@@ -45,8 +45,9 @@ download_for_target()
_target="${1}"
fetch_config
- [ -d "${project}/${tree}" ] && printf "download/%s %s (%s): exists\n" \
- "${project}" "${tree}" "${_target}" 1>&2 && return 0
+ [ -d "src/${project}/${tree}" ] && \
+ printf "download/%s %s (%s): exists\n" \
+ "${project}" "${tree}" "${_target}" 1>&2 && return 0
fetch_from_upstream
prepare_new_tree
@@ -83,9 +84,9 @@ check_config_for_target()
fetch_from_upstream()
{
- [ -d "${project}" ] || x_ mkdir -p "${project}"
- [ -d "${project}/${project}" ] && return 0
+ [ -d "src/${project}/${project}" ] && return 0
+ x_ mkdir -p "src/${project}"
x_ ./update project repo "${project}"
}
@@ -93,14 +94,14 @@ prepare_new_tree()
{
printf "Creating %s tree %s (%s)\n" "${project}" "${tree}" "${_target}"
- x_ cp -R "${project}/${project}" "${project}/${tree}"
- x_ git_reset_rev "${project}/${tree}" "${rev}" "err"
+ x_ cp -R "src/${project}/${project}" "src/${project}/${tree}"
+ x_ git_reset_rev "src/${project}/${tree}" "${rev}" "err"
(
- x_ cd "${project}/${tree}"
+ x_ cd "src/${project}/${tree}"
git submodule update --init --checkout || \
err "prepare_new_tree ${project}/${tree}: can't update git modules"
)
- git_am_patches "${PWD}/${project}/${tree}" \
+ git_am_patches "${PWD}/src/${project}/${tree}" \
"${PWD}/${cfgsdir}/${tree}/patches" "err"
}
diff --git a/script/update/release/roms b/script/update/release/roms
index 3cf5d93e..e4d5db4f 100755
--- a/script/update/release/roms
+++ b/script/update/release/roms
@@ -104,7 +104,7 @@ make_archive()
strip_archive()
{
romdir=${1}
- [ -d "coreboot/${tree}" ] || \
+ [ -d "src/coreboot/${tree}" ] || \
x_ ./update project trees coreboot ${tree}
x_ ./build coreboot utils ${tree}
diff --git a/script/update/release/src b/script/update/release/src
index 3a966015..689a23ab 100755
--- a/script/update/release/src
+++ b/script/update/release/src
@@ -14,9 +14,9 @@ simple_fetch_list="flashrom grub memtest86plus me_cleaner uefitool"
simple_fetch_list="${simple_fetch_list} bios_extract biosutilities"
download_only_list="pico-serprog stm32-vserprog"
-dirlist="config util script include util-fw"
-linklist="build update handle" # symlinks in main directory, to script: lbmk
-filelist="lbmk README.md COPYING version versiondate projectname"
+dirlist="config util script include"
+linklist="update" # symlinks in main directory, to script: lbmk
+filelist="build README.md COPYING version versiondate projectname .gitignore"
version="version-unknown"
versiondate="version-date-unknown"
@@ -44,54 +44,39 @@ create_release_directory()
dirname="${projectname}-${version}_src"
srcdir="${reldir}/${dirname}"
- [ -d "release/" ] || x_ mkdir -p release/
- [ -d "${reldir}/" ] || x_ mkdir -p "${reldir}/"
- [ ! -d "${srcdir}/" ] || x_ rm -Rf "${srcdir}/"
- [ ! -f "${srcdir}.tar.xz" ] || \
- x_ rm -f "${srcdir}.tar.xz/"
-
- x_ mkdir -p "${srcdir}/"
- x_ printf "%s" "${version}" > "${srcdir}"/version
+ xx_ mkdir -p "${reldir}"
+ xx_ rm -Rf "${srcdir}" "${srcdir}.tar.xz"
+ xx_ mkdir -p "${srcdir}"
}
download_modules()
{
for modname in ${trees_fetch_list}; do
- [ -d "${modname}" ] || x_ ./update project trees ${modname}
+ [ -d "src/${modname}" ] || xx_ ./update project trees ${modname}
done
for modname in ${simple_fetch_list} ${download_only_list}; do
- [ -d "${modname}/" ] || x_ ./update project repo ${modname}
+ [ -d "src/${modname}/" ] || xx_ ./update project repo ${modname}
done
}
copy_files()
{
+ xx_ cp -R "src" "${srcdir}/src"
for dir in ${trees_fetch_list}; do
- [ -d "${dir}" ] || continue
- for subdir in "${dir}"/*; do
- [ -d "${subdir}" ] || continue
- [ "${subdir##*/}" = "${dir}" ] && continue
- x_ mkdir -p "${srcdir}/${dir}"
- [ ! -d "${srcdir}/${dir}/${subdir##*/}" ] || \
- x_ rm -Rf "${srcdir}/${dir}/${subdir##*/}"
- x_ cp -R "${subdir}" "${srcdir}/${dir}/${subdir##*/}"
- done
+ xx_ rm -Rf "${srcdir}/src/${dir}/${dir}"
done
- for dir in ${simple_fetch_list} ${dirlist}; do
- x_ cp -R "${dir}/" "${srcdir}/"
+ for dir in ${dirlist}; do
+ xx_ cp -R "${dir}/" "${srcdir}/"
done
for i in ${filelist}; do
- if [ ! -f "${i}" ]; then
- x_ rm -Rf "${srcdir}"
- err "copy_files: file '${i}' does not exist"
- fi
- x_ cp "${i}" "${srcdir}/"
+ [ -f "${i}" ] || fail "copy_files: '${i}' does not exist"
+ xx_ cp "${i}" "${srcdir}/"
done
(
- x_ cd "${srcdir}/"
+ xx_ cd "${srcdir}/"
for i in ${linklist}; do
- x_ ln -s lbmk "${i}"
+ xx_ ln -s build "${i}"
done
)
}
@@ -99,30 +84,36 @@ copy_files()
purge_files()
{
(
- x_ cd "${srcdir}/"
- [ ! -d "coreboot/default/util/kbc1126" ] || \
- x_ ./update project build -c "coreboot/default/util/kbc1126"
- x_ ./update project build -x coreboot
+ xx_ cd "${srcdir}"
+ [ ! -d "src/coreboot/default/util/kbc1126" ] || \
+ xx_ ./update project build -c "src/coreboot/default/util/kbc1126"
+ xx_ ./update project build -x coreboot
for p in u-boot seabios coreboot; do
- x_ ./update project build -c "${p}"
+ xx_ ./update project build -c "${p}"
done
- x_ ./update project build -c bios_extract flashrom grub uefitool \
- util-fw/stm32-vserprog util-fw/stm32-vserprog/libopencm3 \
- memtest86plus/build32 memtest86plus/build64 util/*
+ xx_ ./update project build -c bios_extract flashrom grub uefitool \
+ stm32-vserprog stm32-vserprog/libopencm3 util/* memtest86plus
- x_ rm -Rf .git* */.git* */*/.git* */*/*/.git* */*/*/*/.git* \
- */*/*/*/*/.git* */*/*/*/*/*/.git* */*/*/*/*/*/*/.git*
- x_ rm -Rf cbutils elf util-fw/rp2040/pico-serprog/build
+ xx_ rm -Rf .git */.git* */*/.git* */*/*/.git* */*/*/*/.git* \
+ */*/*/*/*/.git* */*/*/*/*/*/.git* */*/*/*/*/*/*/.git* \
+ */*/*/*/*/*/*/*/.git*
+ xx_ rm -Rf cbutils elf src/pico-serprog/build
)
}
create_release_archive()
{
(
- x_ cd "${reldir}/"
- x_ tar -c "${dirname}/" | xz -T0 -9e >"${dirname}.tar.xz"
- x_ rm -Rf "${dirname}/"
+ xx_ cd "${reldir}/"
+ xx_ tar -c "${dirname}/" | xz -T0 -9e >"${dirname}.tar.xz"
+ xx_ rm -Rf "${dirname}/"
)
}
+fail()
+{
+ [ -z ${srcdir} ] || rm -Rf "${srcdir}" 1>/dev/null 2>/dev/null || :
+ fail "${1}"
+}
+
main $@