From b840755acc24f5cebe561d5ecb3380e157de1583 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Sat, 14 Feb 2015 20:14:27 -0500 Subject: Move all build scripts into a single generic script, with helpers All build scripts were moved to resources/scripts/helpers/ --- (limited to 'resources/scripts/helpers/build') diff --git a/resources/scripts/helpers/build/clean/bucts b/resources/scripts/helpers/build/clean/bucts new file mode 100755 index 0000000..eb90734 --- /dev/null +++ b/resources/scripts/helpers/build/clean/bucts @@ -0,0 +1,35 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in bucts +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# clean bucts +# -------------------------------------------------------- + +cd bucts/ +make clean + +# done. go back to main directory. +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/clean/coreboot b/resources/scripts/helpers/build/clean/coreboot new file mode 100755 index 0000000..dd1cc0f --- /dev/null +++ b/resources/scripts/helpers/build/clean/coreboot @@ -0,0 +1,61 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in coreboot +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# clean coreboot utilities (dependencies for 'build'): +# ------------------------------------------------------- + +cd coreboot/ + +# ---------------------- +# clean coreboot itself: +# ---------------------- +make clean + +# ------------------- +# clean the utilities +# ------------------- +# clean cbfstool +cd util/cbfstool/ +make clean +# clean nvramtool +cd ../nvramtool/ +make clean +# clean cbmem +cd ../cbmem/ +make clean + +# go back to coreboot dir +cd ../../ + +# ------------------------------------- +# clean reference crossGCC for coreboot +# source archive not deleted (intended) +# ------------------------------------- +make crossgcc-clean + +# done. go back to main directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/clean/flashrom b/resources/scripts/helpers/build/clean/flashrom new file mode 100755 index 0000000..1705468 --- /dev/null +++ b/resources/scripts/helpers/build/clean/flashrom @@ -0,0 +1,39 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in flashrom +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# clean flashrom +# -------------------------------------------------------- + +cd flashrom/ + +make clean +# remove patched binaries +rm -f flashrom_lenovobios_sst +rm -f flashrom_lenovobios_macronix + +# done. go back to main directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/clean/grub b/resources/scripts/helpers/build/clean/grub new file mode 100755 index 0000000..6f3dccc --- /dev/null +++ b/resources/scripts/helpers/build/clean/grub @@ -0,0 +1,36 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in GRUB +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# clean grub +# -------------------------------------------------------- + +cd grub/ + +[[ -f Makefile ]] && make clean + +# done. go back to main directoy +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/clean/i945pwm b/resources/scripts/helpers/build/clean/i945pwm new file mode 100755 index 0000000..41334e6 --- /dev/null +++ b/resources/scripts/helpers/build/clean/i945pwm @@ -0,0 +1,33 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in i945pwm +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# clean i945-pwm utility +# -------------------------------------------------------------------- + +cd resources/utilities/i945-pwm +make clean +cd ../../../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/clean/ich9deblob b/resources/scripts/helpers/build/clean/ich9deblob new file mode 100755 index 0000000..fa5b671 --- /dev/null +++ b/resources/scripts/helpers/build/clean/ich9deblob @@ -0,0 +1,33 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in ich9deblob +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# clean ich9deblob utility +# -------------------------------------------------------------------- + +cd resources/utilities/ich9deblob/ +make clean +cd ../../../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/clean/memtest86plus b/resources/scripts/helpers/build/clean/memtest86plus new file mode 100755 index 0000000..cd01bdd --- /dev/null +++ b/resources/scripts/helpers/build/clean/memtest86plus @@ -0,0 +1,36 @@ +#!/bin/bash + +# helper script: clean the dependencies that were built in memtest86+ +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# clean memtest86+ +# -------------------------------------------------------- + +cd "memtest86+-5.01"/ + +make clean + +# done. go back to main directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/clean/rom_images b/resources/scripts/helpers/build/clean/rom_images new file mode 100755 index 0000000..40bbe19 --- /dev/null +++ b/resources/scripts/helpers/build/clean/rom_images @@ -0,0 +1,32 @@ +#!/bin/bash + +# helper script: delete the ROM images +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git + +set -u -e -v + +# Delete the ROM images +# -------------------------------------------------------- + +# delete the bin/ directory +rm -rf bin/ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/external/source b/resources/scripts/helpers/build/external/source new file mode 100755 index 0000000..833c180 --- /dev/null +++ b/resources/scripts/helpers/build/external/source @@ -0,0 +1,54 @@ +#!/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 machines with the target architecture, and compiled. +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +set -u -e -v + +# delete the old data +rm -rf tobuild +rm -f tobuild.tar.xz + +# this is where they will go +mkdir tobuild + +cp -r resources/ tobuild/ + +# flashrom +cp -r flashrom/ tobuild/ +cd tobuild/flashrom/ +rm -f flashrom_lenovobios_sst flashrom_lenovobios_macronix +make clean +cd ../../ + +# bucts +cp -r bucts tobuild/ +cd tobuild/bucts/ +make clean +cd ../../ + +# the build script will be needed +cp build tobuild/ + +# that is all. now tar it up +tar -c tobuild | xz -9e >tobuild.tar.xz + +# and delete the directory +rm -rf tobuild/ diff --git a/resources/scripts/helpers/build/module/bucts b/resources/scripts/helpers/build/module/bucts new file mode 100755 index 0000000..f29d753 --- /dev/null +++ b/resources/scripts/helpers/build/module/bucts @@ -0,0 +1,52 @@ +#!/bin/bash + +# helper script: builds bucts source code +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build BUC.TS utility (needed for flashing ROM's on X60/T60 while Lenovo BIOS is running) +# -------------------------------------------------------------------- + +cd bucts/ + +buildtype="unknown" +if (( $# != 1 )); then + buildtype="dynamic" +else + buildtype="static" +fi + +if [ "$buildtype" = "static" ]; then + patch Makefile < ../resources/bucts/patch/staticlink.diff +fi + +make clean +make + +if [ "$buildtype" = "static" ]; then + patch Makefile -R < ../resources/bucts/patch/staticlink.diff +fi + +# done. go back to main directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/module/coreboot b/resources/scripts/helpers/build/module/coreboot new file mode 100755 index 0000000..4ec2eac --- /dev/null +++ b/resources/scripts/helpers/build/module/coreboot @@ -0,0 +1,56 @@ +#!/bin/bash + +# helper script: builds the dependencies that coreboot needs before building a ROM image +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build utilities needed in coreboot directory +# -------------------------------------------------------------------- + +cd coreboot + +# ----------------------------------------- +# Build the utilities required by libreboot +# ----------------------------------------- + +# cbfstool +cd util/cbfstool/ +make +# nvramtool +cd ../nvramtool/ +make +# cbmem +cd ../cbmem/ +make + +# done. go back to coreboot dir +cd ../../ + +# ------------------------------------- +# build reference crossGCC for coreboot +# ------------------------------------- +make crossgcc-i386 + +# done. go back to main libreboot_src directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/module/flashrom b/resources/scripts/helpers/build/module/flashrom new file mode 100755 index 0000000..7cd50cc --- /dev/null +++ b/resources/scripts/helpers/build/module/flashrom @@ -0,0 +1,81 @@ +#!/bin/bash + +# helper script: builds flashrom source code +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build "flashrom" (utility for flashing/dumping ROM's) +# -------------------------------------------------------------------- + +cd flashrom/ + +make clean +if (( $# != 1 )); then + make +else + if [ "$1" = "static" ]; then + make SHARED=0 CC='gcc -static' + else + make + fi +fi + +mv flashrom flashrom_normal + +# build patched binaries for MX25L1605D and SST25VF016B flash chips +# - these patches are needed for initial installation on an X60 or T60 +# - these patches are for people who have lenovo bios running +for patchname in "lenovobios_macronix" "lenovobios_sst" +do + # first remove the existing build + rm -f flashrom_"$patchname" + + # backup the unpatched flashchips.c (it will be patched) + cp flashchips.c flashchips.c_ + # patch flashchips.c + patch flashchips.c < ../resources/flashrom/patch/"$patchname".diff + + make clean + if (( $# != 1 )); then + make + else + if [ "$1" = "static" ]; then + make SHARED=0 CC='gcc -static' + else + make + fi + fi + + # Rename the binary based on the patch name + mv flashrom flashrom_"$patchname" + + # restore unpatched flashchips.c + rm -f flashchips.c + mv flashchips.c_ flashchips.c +done + +mv flashrom_normal flashrom + +cd ../ + +# ------------------- DONE ---------------------- + diff --git a/resources/scripts/helpers/build/module/grub b/resources/scripts/helpers/build/module/grub new file mode 100755 index 0000000..1856c35 --- /dev/null +++ b/resources/scripts/helpers/build/module/grub @@ -0,0 +1,42 @@ +#!/bin/bash + +# helper script: builds GRUB source code +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build utilies needed for building GRUB payloads +# --------------------------------------------------------------------- + +cd grub/ + +# clean it first +[[ -f Makefile ]] && make clean + +# build grub +./autogen.sh +./configure --with-platform=coreboot +make + +# done. go back to main directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/module/i945pwm b/resources/scripts/helpers/build/module/i945pwm new file mode 100755 index 0000000..81cef71 --- /dev/null +++ b/resources/scripts/helpers/build/module/i945pwm @@ -0,0 +1,38 @@ +#!/bin/bash + +# helper script: builds i945-pwm source code +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build i945-pwm utility +# -------------------------------------------------------------------- + +cd resources/utilities/i945-pwm/ + +make clean +# build it +make + +# done. go back to main directory +cd ../../../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/module/ich9deblob b/resources/scripts/helpers/build/module/ich9deblob new file mode 100755 index 0000000..e77957c --- /dev/null +++ b/resources/scripts/helpers/build/module/ich9deblob @@ -0,0 +1,40 @@ +#!/bin/bash + +# helper script: builds ich9deblob source code +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build ich9deblob utility +# -------------------------------------------------------------------- + +cd resources/utilities/ich9deblob + +# clean it first +make clean + +# build ich9deblob +make + +# done. go back to main directory +cd ../../../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/module/memtest86plus b/resources/scripts/helpers/build/module/memtest86plus new file mode 100755 index 0000000..f752080 --- /dev/null +++ b/resources/scripts/helpers/build/module/memtest86plus @@ -0,0 +1,40 @@ +#!/bin/bash + +# helper script: builds memtest86+ source code +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build MemTest86+ payload (for GRUB) +# -------------------------------------------------------------------- + +cd "memtest86+-5.01"/ + +# clean it first +make clean + +# build memtest86+ +make + +# done. go back to main directory +cd ../ + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/release/archives b/resources/scripts/helpers/build/release/archives new file mode 100755 index 0000000..49a1d4d --- /dev/null +++ b/resources/scripts/helpers/build/release/archives @@ -0,0 +1,388 @@ +#!/bin/bash + +# +# helper script: generate the release archives +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the current working directory when running +# it is the root directory of the libreboot git repository clone. + +set -u -e -v + +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 + +# ### Delete old archives before continuing +# ---------------------------------------------------------------------------------------------------------------------------- + +echo "Deleting old release archives" + +rm -f libreboot_*.tar.xz +rm -f tobuild.tar.xz + +# Get manifest which will be used to copy everything +find -maxdepth 1 > releasefilelist + +# ### Prepare libreboot_src archive ready for release +# ---------------------------------------------------------------------------------------------------------------------------- + +mkdir libreboot_src + +for resource in $(cat releasefilelist) +do + if [ "$resource" != "." ] + then + cp -r $resource libreboot_src + fi +done + +cd libreboot_src/ + +# clean everything +./build clean all + +# back to main checkout directory +cd ../ + +# ### Further work in libreboot_src: delete *.git and *.svn +# ### To save space since they are not useful in the release archives +# ### Changes to these projects should be submitted upstream +# ---------------------------------------------------------------------------------------------------------------------------- + +cd libreboot_src/ + +# These instructions will also work even if .git or .svn are already deleted +# because "rm -rf" won't complain if they are missing. It is still useful on +# the release archives (non-git), for example if the user re-downloads these programmes. + +# remove .git for libreboot project itself +rm -rf .git* + +# remove .git for bucts +cd bucts/ +rm -rf .git* +cd ../ + +# coreboot: +# the instructions for coreboot remain in the download script +# they need to stay there, because otherwise "git diff" +# will show the blobs that were deleted (which means, +# that libreboot would be distributing blobs) + +# Flashrom: +cd flashrom/ +rm -rf .svn +cd ../ + +# GRUB: +cd grub/ +rm -rf .git +rm -f .gitignore +cd ../ + +cd ../ + +# ### Version information for this release +# ---------------------------------------------------------------------------------------------------------------------------- + +# create file showing the commit ID from git for this archive. +cat .git/refs/heads/master > commitid + +# ### Prepare ROM archives ready for release +# ---------------------------------------------------------------------------------------------------------------------------- + +cd bin/ +for board in $(ls) +do + # show the libreboot commit ID in the archive + cat ../commitid > "$board"/commitid + + # create lzma compressed src archive + tar -c "$board" | xz -9e >../libreboot_"$board".tar.xz + + # delete. no longer needed + rm -f "$board"/commitid +done +cd ../ + +# ### Prepare libreboot_util archive ready for release +# ---------------------------------------------------------------------------------------------------------------------------- + +mkdir libreboot_util + +# -------------- +# 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 libreboot_util/bucts/ +mkdir libreboot_util/bucts/"$arch"/ +mv bucts/bucts libreboot_util/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 libreboot_util/flashrom +cd flashrom/ +mkdir ../libreboot_util/flashrom/"$arch" +mv flashrom ../libreboot_util/flashrom/"$arch" +mv flashrom_lenovobios_sst ../libreboot_util/flashrom/"$arch" +mv flashrom_lenovobios_macronix ../libreboot_util/flashrom/"$arch" +cd ../ +rm -rf flashrom +mv flashrom_ flashrom + +# ---------------- +# cbfstool related +# ---------------- +# build cbfstool, compiled (statically linked) and include the binary +cd coreboot/util/ +cp -r cbfstool cbfstool_ +cd cbfstool/ +make clean +make SHARED=0 CC='gcc -static' +mkdir ../../../libreboot_util/cbfstool + +mkdir ../../../libreboot_util/cbfstool/"$arch" +mv cbfstool ../../../libreboot_util/cbfstool/"$arch"/ +mv rmodtool ../../../libreboot_util/cbfstool/"$arch"/ + +if [ "$arch" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir ../../../libreboot_util/cbfstool/i686 + mv cbfstool ../../../libreboot_util/cbfstool/i686/ + mv rmodtool ../../../libreboot_util/cbfstool/i686/ +fi + +# cross-compile for ARM +make clean +make SHARED=0 CC='arm-linux-gnueabi-gcc -static' +mkdir ../../../libreboot_util/cbfstool/armv7l +mv cbfstool ../../../libreboot_util/cbfstool/armv7l/ +mv rmodtool ../../../libreboot_util/cbfstool/armv7l/ + +cd ../ +rm -rf cbfstool +mv cbfstool_ cbfstool +cd ../../ + +# ---------------- +# ich9deblob related +# ---------------- +# build ich9deblob, compiled (statically linked) and include the binary +cd resources/utilities/ +cp -r ich9deblob ich9deblob_ +cd ich9deblob/ +make clean +make SHARED=0 CC='gcc -static' +mkdir ../../../libreboot_util/ich9deblob + +mkdir ../../../libreboot_util/ich9deblob/"$arch" +mv ich9deblob ../../../libreboot_util/ich9deblob/"$arch"/ +mv ich9gen ../../../libreboot_util/ich9deblob/"$arch"/ + +if [ "$arch" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir ../../../libreboot_util/ich9deblob/i686 + mv ich9deblob ../../../libreboot_util/ich9deblob/i686/ + mv ich9gen ../../../libreboot_util/ich9deblob/i686/ +fi + +# cross-compile for ARM +make clean +make SHARED=0 CC='arm-linux-gnueabi-gcc -static' +mkdir ../../../libreboot_util/ich9deblob/armv7l +mv ich9deblob ../../../libreboot_util/ich9deblob/armv7l/ +mv ich9gen ../../../libreboot_util/ich9deblob/armv7l/ + +cd ../ +rm -rf ich9deblob +mv ich9deblob_ ich9deblob +cd ../../ + +# ----------------- +# nvramtool related +# ----------------- +# build nvramtool, compiled (statically linked) and include the binary +cd coreboot/util/ +cp -r nvramtool nvramtool_ +cd nvramtool/ +make clean +make SHARED=0 CC='gcc -static' +mkdir ../../../libreboot_util/nvramtool + +mkdir ../../../libreboot_util/nvramtool/"$arch" +mv nvramtool ../../../libreboot_util/nvramtool/"$arch"/ + +if [ "$arch" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir ../../../libreboot_util/nvramtool/i686 + mv nvramtool ../../../libreboot_util/nvramtool/i686/ +fi + +cd ../ +rm -rf nvramtool +mv nvramtool_ nvramtool +cd ../../ + +# ----------------- +# cbmem related +# ----------------- +# build cbmem, compiled (statically linked) and include the binary +cd coreboot/util/ +cp -r cbmem cbmem_ +cd cbmem/ +make clean +make SHARED=0 CC='gcc -static' +mkdir ../../../libreboot_util/cbmem + +mkdir ../../../libreboot_util/cbmem/"$arch" +mv cbmem ../../../libreboot_util/cbmem/"$arch"/ + +if [ "$arch" = "x86_64" ] + then + # Now build 32-bit binaries + make clean + make SHARED=0 CC='gcc -static -m32' + mkdir ../../../libreboot_util/cbmem/i686 + mv cbmem ../../../libreboot_util/cbmem/i686/ +fi +cd ../ +rm -rf cbmem +mv cbmem_ cbmem +cd ../../ + +# --------------------- +# Include documentation +# --------------------- +cp -r docs/ libreboot_util/ + +# ------------- +# Miscellaneous +# ------------- +# include X60 cmos.layout file +mkdir libreboot_util/cmoslayouts/ +cp coreboot/src/mainboard/apple/macbook21/cmos.layout libreboot_util/cmoslayouts/macbook21cmos.layout +cp coreboot/src/mainboard/lenovo/x60/cmos.layout libreboot_util/cmoslayouts/x60cmos.layout +cp coreboot/src/mainboard/lenovo/t60/cmos.layout libreboot_util/cmoslayouts/t60cmos.layout +cp coreboot/src/mainboard/lenovo/x200/cmos.layout libreboot_util/cmoslayouts/x200cmos.layout + +# Flashing script +cp flash libreboot_util/ + +# ich9macchange script (change MAC address on X200 ROMs, using ich9gen) +cp ich9macchange libreboot_util/ + +# for changing the GRUB background +cp grub-background libreboot_util/ + +# ### Create the release tarballs +# ---------------------------------------------------------------------------------------------------------------------------- + +# Also delete the manifest +rm -f libreboot_src/releasefilelist +rm -f libreboot_util/releasefilelist +rm -f releasefilelist + +# We don't want to encourage development +# to happen on the release archives. +# Development goes in git. These scripts are +# not needed in libreboot_src, because +# the files that they download are already included +rm -rf libreboot_src/resources/scripts/helpers/build/release +rm -f libreboot_src/download +rm -rf libreboot_src/resources/scripts/helpers/download/ + +# ich9deblob: there are certain files in there +# that the user most likely does not want to share +rm -f libreboot_src/resources/utilities/ich9deblob/deblobbed_descriptor.bin +rm -f libreboot_src/resources/utilities/ich9deblob/factory.rom +rm -f libreboot_src/resources/utilities/ich9deblob/libreboot.rom +rm -f libreboot_src/resources/utilities/ich9deblob/mkdescriptor.c +rm -f libreboot_src/resources/utilities/ich9deblob/mkdescriptor.h +rm -f libreboot_src/resources/utilities/ich9deblob/mkgbe.c +rm -f libreboot_src/resources/utilities/ich9deblob/mkgbe.h +rm -f libreboot_src/resources/utilities/ich9deblob/ich9fdgbe_4m.bin +rm -f libreboot_src/resources/utilities/ich9deblob/ich9fdgbe_8m.bin +rm -f libreboot_src/mkgbe.c +rm -f libreboot_src/mkgbe.h +rm -f libreboot_src/ich9fdgbe_8m.bin +rm -f libreboot_src/ich9fdgbe_4m.bin + +# delete the "tobuild" +rm -rf libreboot_src/tobuild/ +rm -f libreboot_src/tobuild.tar.xz + +# mention the commit ID (libreboot, git) in the release archives +cat commitid > libreboot_src/commitid +cat commitid > libreboot_util/commitid + +# create lzma compressed src archive +tar -c libreboot_src | xz -9e >libreboot_src.tar.xz + +# create lzma compressed util archive +tar -c libreboot_util | xz -9e >libreboot_util.tar.xz + +# ### Delete the uncompressed release directories +# ---------------------------------------------------------------------------------------------------------------------------- + +# The uncompressed archives are no longer needed +rm -rf libreboot_src +rm -rf libreboot_util + +# For those utilities that have to be built on the target +./build external source + +# DONE. See libreboot_src.tar.xz and libreboot_util.tar.xz +# NOTE FOR FCHMMR: don't forget to add ARM binaries for flashrom +# NOTE FOR FCHMMR: don't forget to add i386 binaries for flashrom/bucts +# The tarball tobuild.tar.xz has been created with everything needed to build these utilities + +# ------------------- DONE ---------------------- diff --git a/resources/scripts/helpers/build/roms/helper b/resources/scripts/helpers/build/roms/helper new file mode 100755 index 0000000..0a4f06c --- /dev/null +++ b/resources/scripts/helpers/build/roms/helper @@ -0,0 +1,114 @@ +#!/bin/bash + +# helper script: create ROM images for a given system, with GRUB +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +if (( $# != 1 )); then + echo "Usage: ./buildrom-withgrub boardname" + echo "Example: ./buildrom-withgrub x60" + echo "You need to specify exactly 1 argument" + exit 1 +fi + +cd coreboot + +# Build ROM images with text-mode and corebootfb modes. +# --------------------------------------------------------------------------------------------------------------- + +if [ "$1" = "qemu_i440fx_piix4" ] || [ "$1" = "qemu_q35_ich9" ] +then + # assume that the default config enable framebuffer mode, duplicate and patch for text-mode + # necessary, otherwise it will ask you to enter the Y/X resolution of the framebuffer at build time + cp ../resources/libreboot/config/"$1"/config config_vesafb + sed 's/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/' < config_vesafb > config_txtmode +else + # assume that the default config enables text-mode, duplicate and patch for framebuffer mode + cp ../resources/libreboot/config/"$1"/config config_txtmode + sed 's/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/' < config_txtmode > config_vesafb +fi + +for romtype in txtmode vesafb +do + if [ "$1" = "x200_8mb" ] || [ "$1" = "x200_4mb" ] || [ "$1" = "r400_8mb" ] || [ "$1" = "r400_4mb" ] + then + if [ "$romtype" = "txtmode" ] + then + echo "Text mode graphics is currently broken on X200 and R400. Only framebuffer mode works." + continue + fi + fi + + # Build coreboot ROM image + make clean + mv config_"$romtype" .config + mv grub_"$romtype".elf grub.elf + make + mv grub.elf grub_"$romtype".elf + mv build/coreboot.rom "$1"_"$romtype".rom + # .config no longer needed + rm -f .config + + # Add the background image + if [ "$romtype" = "vesafb" ] + then + if [ "$1" = "macbook21" ] || [ "$1" = "x200_4mb" ] || [ "$1" = "x200_8mb" ] || [ "$1" = "r400_4mb" ] || [ "$1" = "r400_8mb" ] + then + ./util/cbfstool/cbfstool "$1"_"$romtype".rom add -f ../resources/grub/background/gnulove.jpg -n background.jpg -t raw + else + ./util/cbfstool/cbfstool "$1"_"$romtype".rom add -f ../resources/grub/background/background.jpg -n background.jpg -t raw + fi + fi + + # Add the correct GRUB configuration file for this image. + for keymap in $(ls ../resources/utilities/grub-assemble/keymap/original) + do + # copy the images based on the keymap + cp "$1"_"$romtype".rom "$1"_"$keymap"_"$romtype".rom + + # Insert grub config into the image + ./util/cbfstool/cbfstool "$1"_"$keymap"_"$romtype".rom add -f grub_"$keymap"_"$romtype".cfg -n grub.cfg -t raw + # Insert grub test config into the image (for the user to test modifications to before modifying the main one) + ./util/cbfstool/cbfstool "$1"_"$keymap"_"$romtype".rom add -f grub_"$keymap"_"$romtype"_test.cfg -n grubtest.cfg -t raw + done + + # This config-less ROM is no longer needed + rm -rf "$1"_"$romtype".rom +done + +# Now we clean up and prepare the bin directory containing all the images +# ---------------------------------------------------------------------------------------------------------------------------- + +# prepare directory for new ROM images +rm -rf "$1" +mkdir "$1" +# move the ROM's into the newly created directory +mv "$1"*rom "$1" + +# delete the old ROM's from ../bin +rm -rf ../bin/"$1" +# now put the new ROM's in ./bin +mv "$1" ../bin + +# go back to main source directory +cd ../ + diff --git a/resources/scripts/helpers/build/roms/withgrub b/resources/scripts/helpers/build/roms/withgrub new file mode 100755 index 0000000..9fa20e5 --- /dev/null +++ b/resources/scripts/helpers/build/roms/withgrub @@ -0,0 +1,106 @@ +#!/bin/bash + +# +# helper script: build ROM images with GRUB and put them in ./bin/ +# +# Copyright (C) 2014, 2015 Francis Rowe +# +# 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 . +# + +# This script assumes that the working directory is the root +# of libreboot_src or git + +set -u -e -v + +# Build the ROM images + +if [ ! -d "bin" ] +then + mkdir bin/ +fi + +# Put GRUB payloads and config files +# in the coreboot directory, ready for next step +cd coreboot/ +for romtype in txtmode vesafb +do + cd ../resources/utilities/grub-assemble + ./gen.sh "$romtype" + rm -f ../../../coreboot/grub_"$romtype".elf + mv grub_"$romtype".elf ../../../coreboot/ + cd ../../../coreboot + + # GRUB configuration files + for keymap in $(ls ../resources/utilities/grub-assemble/keymap/original) + do + cat ../resources/grub/config/extra/common.cfg > grub_"$keymap"_"$romtype".cfg + cat ../resources/grub/config/extra/"$romtype".cfg >> grub_"$keymap"_"$romtype".cfg + echo "keymap $keymap" >> grub_"$keymap"_"$romtype".cfg + cat ../resources/grub/config/menuentries/common.cfg >> grub_"$keymap"_"$romtype".cfg + cat ../resources/grub/config/menuentries/"$romtype".cfg >> grub_"$keymap"_"$romtype".cfg + # grubtest.cfg should be able to switch back to grub.cfg + sed 's/grubtest.cfg/grub.cfg/' < grub_"$keymap"_"$romtype".cfg > grub_"$keymap"_"$romtype"_test.cfg + done +done +cd ../ + +# Build ROM images for supported boards +for board in $(ls resources/libreboot/config/) +do + ./build roms helper $board +done + +# Needed on i945 systems for the bucts/dd trick (documented) +# This enables the ROM to be flashed over the lenovo bios firmware +for i945board in x60 t60 +do + cd bin/"$i945board"/ + for i945rom in $(ls) + do + dd if="$i945rom" of=top64k.bin bs=1 skip=$[$(stat -c %s "$i945rom") - 0x10000] count=64k + dd if=top64k.bin of="$i945rom" bs=1 seek=$[$(stat -c %s "$i945rom") - 0x20000] count=64k conv=notrunc + rm -f top64k.bin + done + cd ../../ +done + +# Build the deblobbed descriptor+gbe regions for GM45/ICH9M targets. +# Then put them in the ROM images. +cd bin/ +../resources/utilities/ich9deblob/ich9gen +for board in "x200" "r400" +do + for romsize in "4m" "8m" + do + cd "$board"_"$romsize"b/ + for rom in $(ls) + do + dd if=../ich9fdgbe_"$romsize".bin of="$rom" bs=1 count=12k conv=notrunc + done + cd ../ + done +done +rm -f ich9fdgbe_4m.bin +rm -f ich9fdgbe_8m.bin +cd ../ + +# The GRUB payloads are no longer needed +rm -f coreboot/grub_vesafb.elf +rm -f coreboot/grub_txtmode.elf +# The GRUB configs are no longer needed +rm -f coreboot/grub*cfg + +# ------------------- DONE ---------------------- + -- cgit v0.9.1