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 'build-release') diff --git a/build-release b/build-release deleted file mode 100755 index 9384433..0000000 --- a/build-release +++ /dev/null @@ -1,400 +0,0 @@ -#!/bin/bash - -# -# build-release script: generates libreboot_util and libreboot_src 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 . -# - -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 - -# MAKE SURE THAT YOU RAN "buildall" OR "builddeps" *AT LEAST ONCE* -# You should also run the 'build' script before running this - -# ### 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 -# ---------------------------------------------------------------------------------------------------------------------------- - -echo "Preparing libreboot_src release archive" - -mkdir libreboot_src - -for resource in $(cat releasefilelist) -do - if [ "$resource" != "." ] - then - cp -r $resource libreboot_src - fi -done - -cd libreboot_src/ - -# clean everything -./cleandeps - -# 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 ../ - -# ### Prepare ROM archives ready for release -# ---------------------------------------------------------------------------------------------------------------------------- - -cd bin/ -for board in $(ls) -do - # create lzma compressed src archive - tar -c "$board" | xz -9e >../libreboot_"$board".tar.xz -done -cd ../ - -# ### Prepare libreboot_util archive ready for release -# ---------------------------------------------------------------------------------------------------------------------------- - -echo "Preparing libreboot_util release archive" - -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 -./builddeps-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 -./builddeps-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 -cp coreboot/src/mainboard/lenovo/x60/cmos.layout libreboot_util/x60cmos.layout -cp coreboot/src/mainboard/lenovo/t60/cmos.layout libreboot_util/t60cmos.layout -cp coreboot/src/mainboard/apple/macbook21/cmos.layout libreboot_util/macbook21cmos.layout - -# FLASHING SCRIPTS -# Flashrom script (makes flashing easier: ./flash path/to/libreboot.rom) -cp flash libreboot_util/ -# Brick-prone flashing script (for mismatching board names, when they change) -cp forceflash libreboot_util/ -# X60/T60: so that the user can use libreboot_util to overwrite lenovo bios with libreboot -cp lenovobios_firstflash libreboot_util/ -cp lenovobios_secondflash libreboot_util/ -# For initial flashing on macbook21/11 -cp macbook21_firstflash 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/ - -# remove the bin/ directory from libreboot_util -rm -rf libreboot_util/bin/ - -# ### 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 -f libreboot_src/build-release -rm -f libreboot_src/download -rm -rf libreboot_src/resources/scripts/helpers/fetch/ - -# 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 - -# delete the old commitid file -rm -f commitid -rm -f libreboot_src/commitid - -# create file showing the commit ID from git for this archive. -cat .git/refs/heads/master > commitid -# include it in the release archives -cp commitid libreboot_src/ -cp commitid libreboot_util/ - -echo "Creating compressed libreboot_src release archive" - -# create lzma compressed src archive -tar -c libreboot_src | xz -9e >libreboot_src.tar.xz - -echo "Creating compressed libreboot_util release archive" - -# create lzma compressed util archive -tar -c libreboot_util | xz -9e >libreboot_util.tar.xz - -# ### Delete the uncompressed release directories -# ---------------------------------------------------------------------------------------------------------------------------- - -echo "Deleted the uncompressed release archives" - -rm -rf libreboot_src -rm -rf libreboot_util - -# For those utilities that have to be built on the target -./mkextbuild - -# 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 ---------------------- -- cgit v0.9.1