summaryrefslogtreecommitdiff
path: root/script/update/project/release
diff options
context:
space:
mode:
Diffstat (limited to 'script/update/project/release')
-rwxr-xr-xscript/update/project/release132
1 files changed, 41 insertions, 91 deletions
diff --git a/script/update/project/release b/script/update/project/release
index 3b869f6a..0fd29e82 100755
--- a/script/update/project/release
+++ b/script/update/project/release
@@ -7,9 +7,8 @@ set -u -e
. "include/err.sh"
-eval "$(setvars "" vdir basename src_dirname srcdir _nogit _xm target romdir \
- microcode_required CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \
- CONFIG_KBC1126_FIRMWARE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW)"
+eval "$(setvars "" vdir relname src_dirname srcdir _nogit _xm target romdir \
+ microcode_required mode)"
_f="coreboot u-boot seabios flashrom grub memtest86plus uefitool"
_f="${_f} bios_extract biosutilities pico-serprog stm32-vserprog"
@@ -21,18 +20,18 @@ cbfstool="cbutils/default/cbfstool"
main()
{
vdir="release"
- while getopts d: option
- do
- case "${1}" in
- -d) vdir="${2}" ;;
+ 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
- [ -z "${vdir}" ] && err "Empty directory names not allowed"
vdir="${vdir}/${version}"
- basename="${projectname}-${version}"
- src_dirname="${basename}_src"
+ relname="${projectname}-${version}"
+ src_dirname="${relname}_src"
srcdir="${vdir}/${src_dirname}"
[ -e "${vdir}" ] && err "already exists: \"${vdir}\""
@@ -72,15 +71,18 @@ build_release()
_xm="build_release ${vdir}"
(
cd "${srcdir}" || err "${_xm}: !cd \"${srcdir}\""
-
fetch_trees
- mkrom_images
- clean_release
)
(
cd "${srcdir%/*}" || err "${_xm}: mktarball \"${srcdir}\""
mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || err "${_xm}: mksrc"
)
+ if [ "${mode}" != "src" ]; then
+ (
+ cd "${srcdir}" || err "${_xm}: 2 !cd \"${srcdir}\""
+ mkrom_images
+ )
+ fi
rm -Rf "${srcdir}" || err "${_xm}: !rm -Rf \"${srcdir}\""
}
@@ -89,16 +91,14 @@ fetch_trees()
for x in ${_f}; do
./update project trees -f "${x}" || err "${_xm}: fetch ${x}"
done
-
- x_ rm -Rf src/coreboot/coreboot src/u-boot/u-boot src/seabios/seabios
-
- # by doing this first, we build-test under the same conditions as
- # the user, when they extract and build from the src tarball. this
- # saves time on build-testing, because we build once, not twice. thus:
-
+ for x in config/*/build.list; do
+ [ -f "${x}" ] || continue
+ xp="${x#*/}"; xp="${xp%/*}"
+ [ -L "${xp}" ] || x_ rm -Rf "src/${xp}/${xp}"
+ done
rm -Rf */.git* */*/.git* */*/*/.git* */*/*/*/.git* */*/*/*/*/.git* \
- */*/*/*/*/*/.git* */*/*/*/*/*/*/.git* */*/*/*/*/*/*/*/.git* || \
- err "${_xm}: rm-dotgit"
+ */*/*/*/*/*/.git* */*/*/*/*/*/*/.git* */*/*/*/*/*/*/*/.git* \
+ .git tmp || err "${_xm}: rm-dotgit"
}
mkrom_images()
@@ -124,7 +124,7 @@ handle_rom_archive()
if [ ! -f "config/coreboot/${target}/target.cfg" ]; then
# No config, just make a tarball
- tarball="release/${version}/roms/${basename}_${target}.tar.xz"
+ tarball="release/${version}/roms/${relname}_${target}.tar.xz"
insert_copying_files "${builddir}"
mktarball "${builddir}" "${tarball}"
return 0
@@ -134,7 +134,7 @@ handle_rom_archive()
x_ mkdir -p "${romdir}"
x_ cp "${builddir}/"* "${romdir}"
- handle_vendorfiles
+ nukerom
printf "Generating release/%s/roms/%s-%s_%s.tar.xz\n" \
"${version}" "${projectname}" "${version}" "${target##*/}"
@@ -145,30 +145,12 @@ handle_rom_archive()
mkrom_tarball
}
-handle_vendorfiles()
+nukerom()
{
microcode_required="y"
. "config/coreboot/${target}/target.cfg"
if [ "${microcode_required}" != "y" ] && \
[ "${microcode_required}" != "n" ]; then microcode_required="y"; fi
-
- for x in CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN CONFIG_KBC1126_FIRMWARE \
- CONFIG_INCLUDE_SMSC_SCH5545_EC_FW; do
- eval "${x}=\"y\""
- grep "${x}=y" "config/coreboot/${target}/config/"* || \
- eval "${x}=\"n\""
- done
-
- # remove ME/MRC/EC firmware from ROM images
- if [ "${CONFIG_HAVE_ME_BIN}" = "y" ] || \
- [ "${target}" = "e6400_4mb" ] || \
- [ "${microcode_required}" = "n" ]; then
- strip_archive
- fi
-}
-
-strip_archive()
-{
if [ "${microcode_required}" = "n" ]; then
for romfile in "${romdir}"/*.rom; do
[ -f "${romfile}" ] || continue
@@ -180,16 +162,18 @@ strip_archive()
done
fi
- # Hash the rom before removing vendor files
+ # Hash the images before removing vendor files
+ # which ./update vendor inject uses for verification
x_ rm -f "${romdir}/vendorhashes"
x_ touch "${romdir}/vendorhashes"
(
x_ cd "${romdir}"
x_ sha512sum *.rom >> vendorhashes
)
+
for romfile in "${romdir}"/*.rom; do
[ -f "${romfile}" ] || continue
- strip_rom_image "${romfile}"
+ x_ ./update vendor inject -r "${romfile}" -b ${target} -n nuke
done
}
@@ -207,24 +191,6 @@ strip_ucode()
x_ mv "${romfile}" "${_newrom_b}"
}
-strip_rom_image()
-{
- [ -f "${1}" ] || return 0
- [ "${CONFIG_HAVE_ME_BIN}" != "y" ] || \
- x_ "${ifdtool}" --nuke me "${1}" -O "${1}"
- [ "${CONFIG_HAVE_MRC}" != "y" ] || \
- x_ "${cbfstool}" "${1}" remove -n mrc.bin
- [ "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" != "y" ] || \
- x_ "${cbfstool}" "${1}" remove -n sch5545_ecfw.bin
- if [ "${CONFIG_KBC1126_FIRMWARE}" = "y" ]; then
- x_ "${cbfstool}" "${1}" remove -n ecfw1.bin
- x_ "${cbfstool}" "${1}" remove -n ecfw2.bin
- fi
- # TODO: replace this board-specific hack
- [ "${target}" = "e6400_4mb" ] || return 0
- x_ "${cbfstool}" "${1}" remove -n "pci10de,06eb.rom"
-}
-
insert_copying_files()
{
x_ rm -Rf "${1}/licenses"
@@ -241,7 +207,7 @@ insert_copying_files()
mkrom_tarball()
{
- archivename="${basename}_${target##*/}"
+ archivename="${relname}_${target##*/}"
f="release/${version}/roms/${archivename}"
x_ mkdir -p "${f%/*}"
(
@@ -253,32 +219,6 @@ mkrom_tarball()
printf "Created ROM archive: ${f%/*}/${archivename}.tar.xz"
}
-clean_release()
-{
- for x in "src/coreboot/default/util/kbc1126" util/*; do
- [ ! -f "${x}/Makefile" ] && continue
- x_ make clean -C "${x}"
- done
-
- for x in ${_f}; do
- ./update project trees -c "${x}" || err "${_xm}: pclean ${x}"
- done
- ./update project trees -x coreboot || err "${_xm}: clean-crossgcc"
- ./update project trees -c "stm32-vserprog/libopencm3"
-
- # make absolutely sure crossgcc was purged. for some reason,
- # crossgcc-clean isn't always reliable on every coreboot tree
- for xgcc in "build-" "binutils-" "gcc-" "gmp-" "mpc-" "mpfr-" \
- "llvm-" "clang-tools-" "cfe-" "compiler-rt-" "acpica-" \
- "getopt" "xgcc"; do
- x_ rm -Rf src/coreboot/*/util/crossgcc/${xgcc}*
- done
-
- rm -Rf vendor mrc ec pciroms || err "${_xm}: vendor files"
- rm -Rf elf tmp cbutils src/pico-serprog/build release bin || \
- err "${_xm}: elf, tmp, cbutils, pico-serprog/build"
-}
-
insert_version_files()
{
printf "%s\n" "${version}" > "${1}/version" || return 1
@@ -288,8 +228,18 @@ insert_version_files()
mktarball()
{
+ # preserve timestamps for reproducible tarballs
+ tar_implementation=$(tar --version | head -n1) || :
+
[ "${2%/*}" = "${2}" ] || x_ mkdir -p "${2%/*}"
- x_ tar -c "${1}" | xz -T0 -9e > "${2}"
+ if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then
+ tar --sort=name --owner=root:0 --group=root:0 \
+ --mtime="UTC 2023-10-14" -c "${1}" | xz -T0 -9e > "${2}" || \
+ err "mktarball 1, ${1}"
+ else
+ # TODO: reproducible tarballs on non-GNU systems
+ tar -c "${1}" | xz -T0 -9e > "${2}" || err "mktarball 2, ${1}"
+ fi
(
[ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}"
x_ sha512sum "${2##*/}" > "${2##*/}.sha512"