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/
---
diff --git a/.gitignore b/.gitignore
index b6e656e..fd00a39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,4 @@
/tobuild.tar.xz
/commitid
/resources/utilities/i945-pwm/i945-pwm
+/releasefilelist
diff --git a/build b/build
index 19aaf3c..bca8a6b 100755
--- a/build
+++ b/build
@@ -1,7 +1,6 @@
#!/bin/bash
-#
-# build script: builds the ROM images with GRUB payloads and puts them in ./bin/
+# generic build script, for building libreboot (all of it)
#
# Copyright (C) 2014, 2015 Francis Rowe
#
@@ -21,86 +20,53 @@
set -u -e -v
-# Build the ROM images
-
-if [ ! -d "bin" ]
-then
- mkdir bin/
-fi
-
-# MAKE SURE THAT YOU RAN "buildall" OR "builddeps" *AT LEAST ONCE*
-# BEFORE RUNNING THIS!
-
-# 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
+build=./resources/scripts/helpers/build
+mode="unknown"
+option="unknown"
+extraoption=""
- # 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 ../
+usage="./build mode option"
+availablemodes="$(ls $build/)"
+availableoptions="unknown" # unknown until the mode is determined
-# Build ROM images for supported boards
-for board in $(ls resources/libreboot/config/)
-do
- ./buildrom-withgrub $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
+# User specified no or too few/many parameters
+if (( $# != 2 )); then
+ if (( $# != 3 )); then
+ printf "$usage\n\n"
+ printf "possible values for 'mode':\n$availablemodes\n\n"
+ printf "Example: ./build module all\n"
+ printf "Example: ./build module flashrom\n"
+ printf "Example: ./build roms withgrub\n"
+ printf "Example: ./build release archives\n"
+ printf "Example: ./build clean all\n"
+ printf "Example (extra option) ./build module bucts static\n"
+ printf "Refer to the libreboot documentation for more info\n\n"
+ exit 1
+ else
+ extraoption=$3
+ fi
+fi
+mode=$1
+option=$2
-# 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
+if [ -d "$build/$mode" ]; then
+ availableoptions="$(ls $build/$mode/)"
+ if [ "$option" = "list" ]; then
+ printf "Available options for '$mode' are:\nall\n$availableoptions\n\n"
+ elif [ -f "$build/$mode/$option" ]; then
+ $build/$mode/$option $extraoption
+ elif [ "$option" = "all" ]; then
+ for option in $availableoptions; do
+ $build/$mode/$option $extraoption
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
+ else
+ printf "Invalid option for '$mode'. Available options are:\nall\n$availableoptions\n\n"
+ exit 1
+ fi
+else
+ printf "Invalid mode. Available modes are:\n$availablemodes\n\n"
+ exit 1
+fi
# ------------------- DONE ----------------------
diff --git a/builddeps b/builddeps
deleted file mode 100755
index 7c8a6d9..0000000
--- a/builddeps
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/bash
-
-# builddeps script: builds the dependencies needed for 'build' to compile the ROM images
-#
-# Copyright (C) 2014 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
-
-# Build utilities needed in coreboot directory
-# --------------------------------------------------------------------
-
-./builddeps-coreboot
-
-# Build utilies needed for building GRUB payloads
-# ---------------------------------------------------------------------
-
-./builddeps-grub
-
-# Build MemTest86+ payload (for GRUB)
-# --------------------------------------------------------------------
-
-./builddeps-memtest86
-
-# Build BUC.TS utility (needed for flashing ROM's on X60/T60/X60T while Lenovo BIOS is running)
-# --------------------------------------------------------------------
-
-./builddeps-bucts
-
-# Build "flashrom" (utility for flashing/dumping ROM's)
-# --------------------------------------------------------------------
-
-./builddeps-flashrom
-
-# Build i945-pwm
-# --------------------------------------------------------------------
-
-./builddeps-i945pwm
-
-# Build ich9deblob utility
-# --------------------------------------------------------------------
-
-./builddeps-ich9deblob
-
-# ------------------- DONE ----------------------
-
-
diff --git a/cleandeps b/cleandeps
deleted file mode 100755
index f007c96..0000000
--- a/cleandeps
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/bash
-
-# cleandeps script: cleans everything (make clean)
-#
-# Copyright (C) 2014 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
-
-# Clean all previous builds.
-
-# 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 ../
-
-# clean grub
-# --------------------------------------------------------
-
-cd grub/
-
-[[ -f Makefile ]] && make clean
-
-# done. go back to main directoy
-cd ../
-
-# clean memtest86+
-# --------------------------------------------------------
-
-cd "memtest86+-5.01"/
-
-make clean
-
-# done. go back to main directory
-cd ..
-
-# clean bucts
-# --------------------------------------------------------
-
-cd bucts/
-make clean
-
-# done. go back to main directory.
-cd ../
-
-# 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 ../
-
-# clean i945-pwm utility
-# --------------------------------------------------------------------
-
-rm -f resources/utilities/i945-pwm/i945-pwm
-
-# clean ich9deblob utility
-# --------------------------------------------------------------------
-
-cd resources/utilities/ich9deblob/
-make clean
-cd ../../../
-
-# a few more things to do last
-# --------------------------------------------------------
-
-# remove powertop directory (included if the user is on Trisquel 6 and ran "powertop.trisquel6" script
-rm -rf powertop
-
-# delete the bin/ directory
-rm -rf bin/
-
-# ------------------- DONE ----------------------
-
diff --git a/docs/git/index.html b/docs/git/index.html
index e6682d1..320f309 100644
--- a/docs/git/index.html
+++ b/docs/git/index.html
@@ -51,15 +51,19 @@
Before doing anything, you need the dependencies first. This is true if
you want to build libreboot from source, with either libreboot_src.tar.xz or git.
- If you are using libreboot_bin.tar.xz (binary archive) then you can ignore this, because
+ If you are using libreboot_util.tar.xz (binary archive) then you can ignore this, because
ROM images and statically compiled executables for the utilities are included.
-
- - deps-trisquel script installs dependencies for Trisquel 6 (also tested in Trisquel 7).
-
+
+
+
+ For Trisquel 7, you can run the following command:
+ $ sudo ./resources/scripts/dependencies/trisquel7dependencies
+
+
- For all other GNU/Linux distributions, you may have to adapt these scripts. By all means send patches!
+ For other GNU/Linux distributions, you can adapt the Trisquel 7 script for your needs.
Back to top of page
@@ -105,7 +109,7 @@
After that, run the script:
- $ ./download everything
+ $ ./download everything
@@ -143,7 +147,7 @@
- BUC.TS utility is included in libreboot_src.tar.xz and libreboot_bin.tar.xz.
+ BUC.TS utility is included in libreboot_src.tar.xz and libreboot_util.tar.xz.
If you downloaded from git, follow #build_meta before you proceed.
@@ -162,7 +166,12 @@
To build bucts, do this in the main directory:
- $ ./builddeps-bucts
+ $ ./build module bucts
+
+
+
+ To statically compile it, do this:
+ $ ./build module bucts static
@@ -182,7 +191,7 @@
- Flashrom source code is included in libreboot_src.tar.gz and libreboot_bin.tar.gz.
+ Flashrom source code is included in libreboot_src.tar.xz and libreboot_util.tar.xz.
If you downloaded from git, follow #build_meta before you proceed.
@@ -197,8 +206,13 @@
-
How to build the ROM images!
+
How to build the ROM images
You don't need to do much, as there are scripts already written for you that can build everything automatically.
@@ -596,45 +610,50 @@
If you downloaded libreboot from git, refer to
#build_meta.
-
If running for the first time, run this:
- $ ./buildall (also performs the "./build" step below)
- Or if you only want to build dependencies (crossgcc, grub and so on):
- $ ./builddeps
-
-
If you've already run ./builddeps and/or ./buildall before, you don't need to run them again.
- Just run that from now on to build the ROM images:
- $ ./build
+
+ Build all of the components used in libreboot:
+ $ ./build module all
+
-
To un-build (clean) the build dependencies that you built before, do the following:
- This also deletes the ROM images under ./bin/:
- $ ./cleandeps
+
+ After that, build the ROM images:
+ $ ./build roms withgrub
+
-
Note: after running 'cleandeps', you will need to run 'builddeps' or 'buildall' again before you can use 'build'.
+
+ To clean (reverse) everything, do the following:
+ $ ./build clean all
+
-
After 'build' or 'buildall' has finished, you'll find the ROM images for each machine under ./bin/
+
+ The ROM images will be stored under bin/.
+
Preparing release archives (optional)
- Run that script:
- $ ./build-release
+ Do the following:
+ $ ./build release archives
- If you are building on an i686 host, this will include statically linked 32-bit binaries in the binary release archive that you created,
+ If you are building on an i686 host, this will include statically linked 32-bit binaries in
+ the binary release archive that you created,
for: nvramtool, cbfstool, bucts, flashrom, ich9deblob, cbmem.
- If you are building on an x86_64 host, this will include statically linked 32- and 64-bit binaries for cbmem, ich9deblob, cbfstool and nvramtool, while flashrom
- and bucts will be included only as 64-bit statically linked binaries. To include a statically linked flashrom and bucts for i686, you
- will need to build them on a chroot, a virtual machine or a real 32-bit system. You can find the build dependencies for these packages listed in deps-*
+ If you are building on an x86_64 host, this will include statically linked 32- and 64-bit binaries for
+ cbmem, ich9deblob, cbfstool and nvramtool, while flashrom
+ and bucts will be included only as 64-bit statically linked binaries. To include a statically
+ linked flashrom and bucts for i686, you will need to build them on a chroot, a virtual machine or a real
+ 32-bit system. You can find the build dependencies for these packages listed in deps-*
- armv7l binaries (tested on a BeagleBone Black) are also included in libreboot_bin, for:
+ armv7l binaries (tested on a BeagleBone Black) are also included in libreboot_util, for:
- cbfstool
@@ -645,25 +664,25 @@
If you are building 32-bit binaries on a live system or chroot (for flashrom/bucts), you can use the following to statically link them:
- $ ./builddeps-flashrom static
- $ ./builddeps-bucts static
+ $ ./build module flashrom static
+ $ ./build module bucts static
- The same as above applies for ARM (except, building bucts on ARM is pointless, and for flashrom
+ The same conditions as above apply for ARM (except, building bucts on ARM is pointless, and for flashrom
you only need the normal executable since the lenovobios_sst and _macronix executables are meant
to run on an X60/T60 while lenovo bios is present, working around the security restrictions).
- The script mkextbuild will generate a small source tarball called tobuild.tar.xz that
- contains everything you need (including source) with which to build flashrom/bucts on these hosts.
- The build-release script will have already executed this script for you, so the archive should
- already exist.
+ The command that you used for generating the release archives will also run the following command:
+ $ ./build external source
+ The archive tobuild.tar.xz will have been created, containing bucts, flashrom and all other required
+ resources for building them.
- You'll find that the files libreboot_bin.tar.xz and libreboot_src.tar.xz have been created.
+ You'll find that the files libreboot_util.tar.xz and libreboot_src.tar.xz have been created.
diff --git a/docs/gnulinux/grub_cbfs.html b/docs/gnulinux/grub_cbfs.html
index 73cce0c..874ebaf 100644
--- a/docs/gnulinux/grub_cbfs.html
+++ b/docs/gnulinux/grub_cbfs.html
@@ -152,7 +152,7 @@
executable.
- Alternatively if you are working with libreboot_bin, you will find binaries under ./cbfstool/
+ Alternatively if you are working with libreboot_util, you will find binaries under ./cbfstool/
diff --git a/docs/grub/index.html b/docs/grub/index.html
index e37d7d7..e9e2c35 100644
--- a/docs/grub/index.html
+++ b/docs/grub/index.html
@@ -50,7 +50,7 @@
This is a free font that is also contained in GNU/Linux distributions like Trisquel or Parabola.
$ cd libreboot_src/grub
- compile grub ('build' script has the info on how to do this)
+ compile grub (the build scripts info on how to do this)
come back out into libreboot_src/resources/grub:
$ cd ../libreboot_src/resources/grub/font
@@ -95,7 +95,7 @@
- The scripts build and buildrom-withgrub will automatically see this, and automatically build
+ The build scripts will automatically see this, and automatically build
ROM images with your custom layout (given the name) and include them under bin. Example: libreboot_frazerty.rom.
diff --git a/docs/hcl/gm45_remove_me.html b/docs/hcl/gm45_remove_me.html
index d6c36f4..eff0eac 100644
--- a/docs/hcl/gm45_remove_me.html
+++ b/docs/hcl/gm45_remove_me.html
@@ -96,8 +96,8 @@
ich9gen executables can be found under ./ich9deblob/ statically compiled in
- libreboot_bin. If you are using src or git, build ich9gen from source with:
- $ ./builddeps-ich9deblob
+ libreboot_util. If you are using src or git, build ich9gen from source with:
+ $ ./build module ich9deblob
The executable will appear under resources/utilities/ich9deblob/
@@ -138,13 +138,13 @@
If you are working with libreboot_src (or git), you can find the source under resources/utilities/ich9deblob/
- and will already be compiled if you ran ./builddeps or ./builddeps-ich9deblob from the main directory (./),
+ and will already be compiled if you ran ./build module all or ./build module ich9deblob from the main directory (./),
otherwise you can build it like so:
- $ ./builddeps-ich9deblob
+ $ ./build module ich9deblob
An executable file named ich9deblob will now appear under resources/utilities/ich9deblob/
- If you are working with libreboot_bin release archive, you can find the utility included, statically compiled
+ If you are working with libreboot_util release archive, you can find the utility included, statically compiled
(for i686 and x86_64 on GNU/Linux) under ./ich9deblob/.
diff --git a/docs/release.html b/docs/release.html
index edc24e3..ad0422a 100644
--- a/docs/release.html
+++ b/docs/release.html
@@ -36,8 +36,7 @@
You can verify the downloaded archives as follows:
- $ gpg --verify libreboot_src.tar.xz.sig
- $ gpg --verify libreboot_bin.tar.xz.sig
+ $ for signature in $(ls libreboot*.tar.xz.sig); do gpg --verify $signature; done
diff --git a/deps-trisquel b/resources/scripts/dependencies/trisquel7dependencies
index 227affa..5330f75 100755
--- a/deps-trisquel
+++ b/resources/scripts/dependencies/trisquel7dependencies
@@ -1,6 +1,6 @@
#!/bin/bash
-# deps-trisquel script: installs build dependencies for Trisquel 6 and 7
+# for_trisquel7 script: installs build dependencies for Trisquel 7
#
# Copyright (C) 2014 Francis Rowe