diff options
Diffstat (limited to 'resources/scripts/helpers/build/release')
-rwxr-xr-x | resources/scripts/helpers/build/release/roms | 105 | ||||
-rwxr-xr-x | resources/scripts/helpers/build/release/sha512sums | 53 | ||||
-rwxr-xr-x | resources/scripts/helpers/build/release/src | 133 | ||||
-rwxr-xr-x | resources/scripts/helpers/build/release/tobuild | 109 | ||||
-rwxr-xr-x | resources/scripts/helpers/build/release/util | 250 |
5 files changed, 650 insertions, 0 deletions
diff --git a/resources/scripts/helpers/build/release/roms b/resources/scripts/helpers/build/release/roms new file mode 100755 index 00000000..4c165ea0 --- /dev/null +++ b/resources/scripts/helpers/build/release/roms @@ -0,0 +1,105 @@ +#!/bin/bash + +# +# helper script: generate the ROM image release archives +# +# Copyright (C) 2015 Leah Rowe <info@minifree.org> +# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +if [ ! -d bin/ ]; then + printf "build/release/roms: no bin/ directory exists. (you haven't built any images)\n" + exit 1 +fi + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +romdir="${versiondir}/rom" +distname="libreboot_${version}" + +printf 'Building ROM image release archives for...\n' + +cd "bin/" + +for payload in *; do + + [ ! -d "../${romdir}/${payload}/" ] && mkdir -p "../${romdir}/${payload}/" + + cd "${payload}/" + + for board in *; do + + archivename="${distname}_${payload}_${board}" + + printf '...%s' "${payload}/${board}" + + # Delete the old archive + rm -f "../../${romdir}/${payload}/${distname}_${board}.tar.xz" + + cp -R "${board}/" "${archivename}/" + + # this has to be done before generating + # the "version" file + if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${archivename}/ChangeLog" + cp "${archivename}/ChangeLog" "${archivename}/NEWS" + else + # building from release archive + cp "ChangeLog" "${archivename}/" + cp "NEWS" "${archivename}/" + fi + + if [ -f "../../RELEASE" ]; then + rm -f "${archivename}/ChangeLog" + rm -f "${archivename}/NEWS" + cp "../../RELEASE" "${archivename}/ChangeLog" + cp "../../RELEASE" "${archivename}/NEWS" + fi + + # Put the version string in the archive. + printf '%s\n' "${version}" >"${archivename}/version" + # Put the version date string in the archive + printf '%s\n' "${versiondate}" >"${archivename}/versiondate" + + # Create the compressed archive. + tar -c "${archivename}/" | xz -9e >"../../${romdir}/${payload}/${archivename}.tar.xz" + + rm -Rf "${archivename:?}/" + + printf ' OK\n' + + done + + cd "../" + +done + +cd "../" + +printf 'ROM image release archives are stored in %s/\n' "${romdir}" diff --git a/resources/scripts/helpers/build/release/sha512sums b/resources/scripts/helpers/build/release/sha512sums new file mode 100755 index 00000000..11967acb --- /dev/null +++ b/resources/scripts/helpers/build/release/sha512sums @@ -0,0 +1,53 @@ +#!/bin/bash + +# +# helper script: create sha512sum file for the current snapshot +# +# Copyright (C) 2015 Leah Rowe <info@minifree.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +sha512filename="SHA512SUMS" +sha512filepath="${versiondir}/${sha512filename}" + +if [ ! -d "${versiondir}/" ]; then + + printf "build/release/sha512sums: directory %s/ does not exist. You haven't generated any archives yet.\n" "${versiondir}" + exit 1 + +fi + +# delete the old file +rm -f "${sha512filepath}" + +# create sha512sum file +printf "Creating list of SHA512 sums in %s...\n" "${sha512filepath}" +(cd "${versiondir}/" && for file in $(find -type f); do sha512sum "${file}" >> "${sha512filename}"; done) +printf "...done.\n" + +printf "\n" diff --git a/resources/scripts/helpers/build/release/src b/resources/scripts/helpers/build/release/src new file mode 100755 index 00000000..0fde6899 --- /dev/null +++ b/resources/scripts/helpers/build/release/src @@ -0,0 +1,133 @@ +#!/bin/bash + +# +# helper script: generate the source release archive +# +# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org> +# Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +printf 'Building the source release archive\n' + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +distname="libreboot_${version}_src" +distdir="${versiondir}/${distname}" + +printf 'Deleting old source release archives\n' +rm -f "${distdir}.tar.xz" +rm -Rf "${distdir:?}/" + +mkdir -p "${distdir}/" + +printf 'Copying sources to %s/\n' "${distdir}" +for resource in *; do + if [ "${resource}" = "release" ]; then + continue + fi + cp -R "${resource}" "${distdir}/" +done + +# this has to be done before generating +# the "version" file +if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${distdir}/ChangeLog" + cp "${distdir}/ChangeLog" "${distdir}/NEWS" +else + # building from release archive + cp "ChangeLog" "${distdir}/" + cp "NEWS" "${distdir}/" +fi + +if [ -f "RELEASE" ]; then + rm -f "${distdir}/ChangeLog" + rm -f "${distdir}/NEWS" + cp "RELEASE" "${distdir}/ChangeLog" + cp "RELEASE" "${distdir}/NEWS" +fi + +# include version information +printf '%s\n' "${version}" >"${distdir}/version" +# include version date information +printf '%s\n' "${versiondate}" >"${distdir}/versiondate" + +printf 'Cleaning files in %s/\n' "${distdir}" + +# Clean old builds. +(cd "${distdir}/" && ./build clean all) +printf '\n' + +# Delete Git repositories and properties and Subversion administrative +# directories and properties. +rm -Rf "${distdir}/bucts/".git* +rm -Rf "${distdir}/flashrom/".git* +rm -Rf "${distdir}/grub/".git* +rm -Rf "${distdir}/depthcharge/".git* +rm -Rf "${distdir}/seabios/".git* + +rm -f "${distdir}"/*.vim + +# Delete useless files. +rm -Rf "${distdir}/TODO/" +rm -f "${distdir}/push" + +# Delete the deblob scripts. +# Since the source archive doesn't distribute the download scripts and already +# comes with a deblobbed coreboot, the deblobbing scripts aren't needed at all. +rm -Rf "${distdir}/resources/utilities/coreboot-libre/" + +# Download scripts not needed, because the modules already exist +# in the src release archive +rm -f "${distdir}/download" +rm -Rf "${distdir}/resources/scripts/helpers/download/" + +# Other patches aren't needed in the release, either +rm -Rf "${distdir}/resources/depthcharge/patch/" +rm -Rf "${distdir}/resources/grub/patch/" +rm -Rf "${distdir}/resources/memtest86plus/patch/" + +# ich9deblob: There are certain files in there that the user most likely does +# not want to share. +rm -f "${distdir}/resources/utilities/ich9deblob/"*.bin +rm -f "${distdir}/resources/utilities/ich9deblob/"*.rom +rm -f "${distdir}/resources/utilities/ich9deblob/mk"*.[ch] +rm -f "${distdir}/mk"*.[ch] +rm -f "${distdir}/"*.bin +rm -f "${distdir}/"*.rom + +# Remove any GRUB payload ELF executables that may exist +rm -f "${distdir}/resources/utilities/grub-assemble/grub_txtmode.elf" +rm -f "${distdir}/resources/utilities/grub-assemble/grub_vesafb.elf" + +printf 'Creating %s.tar.xz\n' "${distdir}" +(cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz") + +rm -Rf "${distdir:?}/" + +printf 'Source release archive is stored in %s/\n' "${versiondir}" diff --git a/resources/scripts/helpers/build/release/tobuild b/resources/scripts/helpers/build/release/tobuild new file mode 100755 index 00000000..bdf6ca77 --- /dev/null +++ b/resources/scripts/helpers/build/release/tobuild @@ -0,0 +1,109 @@ +#!/bin/bash + +# helper: prepare a small source archive for those utils +# that don't easily cross-compile. Then the tarball can be extracted +# on those systems with the target architecture, and compiled. +# +# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +distname="libreboot_${version}_tobuild" +distdir="${versiondir}/${distname}" + +printf "Creating source archive for flashrom and bucts\n" + +# delete the old data +rm -Rf "${distdir:?}/" +rm -f "${distdir}.tar.xz" + +# this is where they will go +mkdir -p "${distdir}/" + +# flashrom +cp -R "flashrom/" "${distdir}/" +rm -f "${distdir}/flashrom/flashrom_lenovobios_sst" +rm -f "${distdir}/flashrom/flashrom_lenovobios_macronix" +(cd "${distdir}/flashrom/" && make clean) +mkdir -p "${distdir}/resources/flashrom/" +cp -R "resources/flashrom/patch/" "${distdir}/resources/flashrom/" + +# bucts +cp -R "bucts/" "${distdir}/" +(cd "${distdir}/bucts/" && make clean) +mkdir -p "${distdir}/resources/bucts/" +cp -R "resources/bucts/patch/" "${distdir}/resources/bucts/" + +# the build script will be needed +cp build "${distdir}/" +# needed build scripts (helpers) +mkdir -p "${distdir}/resources/scripts/helpers/build/" +mkdir -p "${distdir}/resources/scripts/helpers/build/module/" +mkdir -p "${distdir}/resources/scripts/helpers/build/clean/" +cp "resources/scripts/helpers/build/clean/bucts" "${distdir}/resources/scripts/helpers/build/clean/" +cp "resources/scripts/helpers/build/clean/flashrom" "${distdir}/resources/scripts/helpers/build/clean/" +cp "resources/scripts/helpers/build/module/bucts" "${distdir}/resources/scripts/helpers/build/module/" +cp "resources/scripts/helpers/build/module/flashrom" "${distdir}/resources/scripts/helpers/build/module/" +cp "resources/scripts/misc/powertop.trisquel7" "${distdir}/" + +# this has to be done before generating +# the "version" file +if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${distdir}/ChangeLog" + cp "${distdir}/ChangeLog" "${distdir}/NEWS" +else + # building from release archive + cp "ChangeLog" "${distdir}/" + cp "NEWS" "${distdir}/" +fi + +if [ -f "RELEASE" ]; then + rm -f "${distdir}/ChangeLog" + rm -f "${distdir}/NEWS" + cp "RELEASE" "${distdir}/ChangeLog" + cp "RELEASE" "${distdir}/NEWS" +fi + +# include version information +printf '%s\n' "${version}" >"${distdir}/version" +# include version date information +printf '%s\n' "${versiondate}" >"${distdir}/versiondate" + +# that is all. now tar it up +(cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz") + +# and delete the directory +rm -Rf "${distdir:?}/" + +printf "\n" +printf "Tar archive created: %s\n" "${distdir}.tar.xz" +printf "NOTE: don't forget to add ARM binaries for flashrom.\n" +printf "NOTE: don't forget to add i386 binaries for flashrom/bucts.\n" +printf "The archive %s.tar.xz has been created with everything needed to build these utilities.\n\n" "${distname}" diff --git a/resources/scripts/helpers/build/release/util b/resources/scripts/helpers/build/release/util new file mode 100755 index 00000000..7dcfa28b --- /dev/null +++ b/resources/scripts/helpers/build/release/util @@ -0,0 +1,250 @@ +#!/bin/bash + +# +# helper script: generate the release archives +# +# Copyright (C) 2014, 2015, 2016 Leah Rowe <info@minifree.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# This script assumes that the current working directory when running +# it is the root directory of the libreboot git repository clone. + +[ "x${DEBUG+set}" = 'xset' ] && set -v +set -u -e + +arch="unknown" +if [ "$(uname -i)" = "i686" ] || [ "$(uname -m)" = "i686" ] + then + arch="i686" + echo "Running on i686. ok." + sleep 2 +elif [ "$(uname -i)" = "x86_64" ] || [ "$(uname -m)" = "x86_64" ] + then + arch="x86_64" + echo "Running on x86_64. ok." + sleep 2 +else + echo "This script must be run on an i686 or x86_64 host. x86_64 is recommended." + exit 1 +fi + +if [ -f "version" ]; then + # _src release archive is being used + version="$(cat version)" + versiondate="$(cat versiondate)" +else + # git repo is being used + version="$(git describe --tags HEAD)" + versiondate="$(git show -s --format=%ct)" +fi +versiondir="release/oldbuildsystem/${version}" +distname="libreboot_${version}_util" +distdir="${versiondir}/${distname}" + +printf "Creating utility archive (static executables)\n" + +# delete the old data +rm -Rf "${distdir:?}/" +rm -f "${distdir}.tar.xz" + +# this is where they will go +mkdir -p "${distdir}/" + +# this has to be done before generating +# the "version" file +if [ ! -f "version" ]; then + # generate ChangeLog and NEWS files + rm -f "ChangeLog" "NEWS" + git log > "${distdir}/ChangeLog" + cp "${distdir}/ChangeLog" "${distdir}/NEWS" +else + # building from release archive + cp "ChangeLog" "${distdir}/" + cp "NEWS" "${distdir}/" +fi + +if [ -f "RELEASE" ]; then + rm -f "${distdir}/ChangeLog" + rm -f "${distdir}/NEWS" + cp "RELEASE" "${distdir}/ChangeLog" + cp "RELEASE" "${distdir}/NEWS" +fi + +# include version information +printf '%s\n' "${version}" >"${distdir}/version" +# include version date information +printf '%s\n' "${versiondate}" >"${distdir}/versiondate" + +# -------------- +# BUC.TS related +# -------------- +# X60/T60: BUC.TS utility is needed to flash libreboot while Lenovo BIOS is running +# Include it statically compiled +cp -R "bucts" "bucts_/" +# make it statically compile +./build module bucts static +mkdir -p "${distdir}/bucts/${arch}/" +mv "bucts/bucts" "${distdir}/bucts/${arch}/" +rm -Rf "bucts/" +mv "bucts_/" "bucts/" + +# ---------------- +# Flashrom related +# ---------------- +# Flashrom is used to install libreboot on supported targets +# Include it statically compiled +cp -R "flashrom/" "flashrom_/" +# make it statically compile +./build module flashrom static +mkdir -p "${distdir}/flashrom/${arch}/" +mv "flashrom/flashrom" "${distdir}/flashrom/${arch}/" +mv "flashrom/flashrom_lenovobios_sst" "${distdir}/flashrom/${arch}/" +mv "flashrom/flashrom_lenovobios_macronix" "${distdir}/flashrom/${arch}/" +rm -Rf "flashrom/" +mv "flashrom_/" "flashrom/" + + # ---------------- +# cbfstool related +# ---------------- +# build cbfstool, compiled (statically linked) and include the binary + +mkdir -p "${distdir}/cbfstool/${arch}/" + +cd "crossgcc/util/" +cp -R "cbfstool" "cbfstool_/" +cd "cbfstool/" +sed -i '/.*fmd_scanner.o.*-Wno-unused-function$/ s/$/ -Wno-sign-compare/' Makefile.inc # build fix for latest flex version +make clean +make SHARED=0 CC='gcc -static' + +mv "cbfstool" "../../../${distdir}/cbfstool/${arch}/" + +if [ "${arch}" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir "../../../${distdir}/cbfstool/i686" + mv "cbfstool" "../../../${distdir}/cbfstool/i686/" +fi + +# cross-compile for ARM +make clean +make SHARED=0 CC='arm-linux-gnueabi-gcc -static' +mkdir "../../../${distdir}/cbfstool/armv7l/" +mv "cbfstool" "../../../${distdir}/cbfstool/armv7l/" + +cd ../ +rm -Rf "cbfstool/" +mv "cbfstool_/" "cbfstool/" +cd ../../ + + +# ---------------- +# ich9deblob related +# ---------------- +# build ich9deblob, compiled (statically linked) and include the binary + +mkdir -p "${distdir}/ich9deblob/${arch}" + +cd "resources/utilities/" +cp -R "ich9deblob" "ich9deblob_/" +cd "ich9deblob/" +make clean +make SHARED=0 CC='gcc -static' + +mv "ich9deblob" "../../../${distdir}/ich9deblob/${arch}/" +mv "ich9gen" "../../../${distdir}/ich9deblob/${arch}/" +mv "demefactory" "../../../${distdir}/ich9deblob/${arch}/" + +if [ "${arch}" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir "../../../${distdir}/ich9deblob/i686/" + mv "ich9deblob" "../../../${distdir}/ich9deblob/i686/" + mv "ich9gen" "../../../${distdir}/ich9deblob/i686/" + mv "demefactory" "../../../${distdir}/ich9deblob/i686/" +fi + +# cross-compile for ARM +make clean +make SHARED=0 CC='arm-linux-gnueabi-gcc -static' +mkdir "../../../${distdir}/ich9deblob/armv7l" +mv "ich9deblob" "../../../${distdir}/ich9deblob/armv7l/" +mv "ich9gen" "../../../${distdir}/ich9deblob/armv7l/" +mv "demefactory" "../../../${distdir}/ich9deblob/armv7l/" + +cd "../" +rm -Rf "ich9deblob/" +mv "ich9deblob_/" "ich9deblob/" +cd "../../" + +# ----------------- +# nvramtool related +# ----------------- +# build nvramtool, compiled (statically linked) and include the binary +cd "crossgcc/util/" +cp -R "nvramtool/" "nvramtool_/" +cd "nvramtool/" +make clean +make SHARED=0 CC='gcc -static' + +mkdir -p "../../../${distdir}/nvramtool/${arch}/" + +mv "nvramtool" "../../../${distdir}/nvramtool/${arch}/" + +if [ "${arch}" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir "../../../${distdir}/nvramtool/i686/" + mv "nvramtool" "../../../${distdir}/nvramtool/i686/" +fi + +cd "../" +rm -Rf "nvramtool/" +mv "nvramtool_/" "nvramtool/" +cd "../../" + +# ------------- +# Miscellaneous +# ------------- + +# Flashing script +cp "flash" "${distdir}/" + +# powertop script +cp "resources/scripts/misc/powertop.trisquel7" "${distdir}/" + +printf "\n\n" + +# ### Create the release tarballs +# ---------------------------------------------------------------------------------------------------------------------------- + +printf "Compressing %s/ into %s.tar.xz\n" "${distdir}" "${distdir}.tar.xz" +# create lzma compressed util archive +(cd "${versiondir}/" && tar -c "${distname}/" | xz -9e >"${distname}.tar.xz") + +printf "done\n\n" + +# ### Delete the uncompressed release directories +# ---------------------------------------------------------------------------------------------------------------------------- + +# The uncompressed archives are no longer needed +rm -Rf "${distdir:?}/" |