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 @@

- To build it, do that in the main directory:
- $ ./builddeps-flashrom + To build it, do the following in the main directory:
+ $ ./build module flashrom +

+ +

+ To statically compile it, do the following in the main directory:
+ $ ./build module flashrom static

@@ -577,7 +591,7 @@

-

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 # diff --git a/buildall b/resources/scripts/helpers/build/clean/bucts index 31b85c8..eb90734 100755 --- a/buildall +++ b/resources/scripts/helpers/build/clean/bucts @@ -1,8 +1,8 @@ #!/bin/bash -# buildall script: Builds (absolutely) everything. +# helper script: clean the dependencies that were built in bucts # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,19 +18,18 @@ # 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 old builds first: -# ------------------------------------------------------ -./cleandeps +# clean bucts +# -------------------------------------------------------- -# Build the dependencies needed for building ROM's: -# ------------------------------------------------------ -./builddeps +cd bucts/ +make clean -# Build the ROM's: -# ------------------------------------------------------ -./build +# done. go back to main directory. +cd ../ # ------------------- DONE ---------------------- - diff --git a/builddeps-coreboot b/resources/scripts/helpers/build/clean/coreboot index 1645feb..dd1cc0f 100755 --- a/builddeps-coreboot +++ b/resources/scripts/helpers/build/clean/coreboot @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-coreboot: builds the dependencies that coreboot needs before building a ROM image +# helper script: clean the dependencies that were built in coreboot # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,39 +18,44 @@ # along with this program. If not, see . # -# This script is used by the main "builddeps" script in libreboot src/meta archives. -# The reason it is seperated here is so that coreboot can be built separately aswell. +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git set -u -e -v -# Build utilities needed in coreboot directory -# -------------------------------------------------------------------- +# clean coreboot utilities (dependencies for 'build'): +# ------------------------------------------------------- -cd coreboot +cd coreboot/ -# ----------------------------------------- -# Build the utilities required by libreboot -# ----------------------------------------- +# ---------------------- +# clean coreboot itself: +# ---------------------- +make clean -# cbfstool +# ------------------- +# clean the utilities +# ------------------- +# clean cbfstool cd util/cbfstool/ -make -# nvramtool +make clean +# clean nvramtool cd ../nvramtool/ -make -# cbmem +make clean +# clean cbmem cd ../cbmem/ -make +make clean -# done. go back to coreboot dir +# go back to coreboot dir cd ../../ # ------------------------------------- -# build reference crossGCC for coreboot +# clean reference crossGCC for coreboot +# source archive not deleted (intended) # ------------------------------------- -make crossgcc-i386 +make crossgcc-clean -# done. go back to main libreboot_src directory +# done. go back to main directory cd ../ # ------------------- DONE ---------------------- diff --git a/builddeps-i945pwm b/resources/scripts/helpers/build/clean/flashrom index 7eb5479..1705468 100755 --- a/builddeps-i945pwm +++ b/resources/scripts/helpers/build/clean/flashrom @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-i945pwm: builds i945-pwm source code +# helper script: clean the dependencies that were built in flashrom # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,18 +18,22 @@ # 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 -# Build i945-pwm utility -# -------------------------------------------------------------------- +# clean flashrom +# -------------------------------------------------------- -cd resources/utilities/i945-pwm/ +cd flashrom/ make clean -# build it -make +# remove patched binaries +rm -f flashrom_lenovobios_sst +rm -f flashrom_lenovobios_macronix # done. go back to main directory -cd ../../../ +cd ../ # ------------------- DONE ---------------------- diff --git a/builddeps-i945pwm b/resources/scripts/helpers/build/clean/grub index 7eb5479..6f3dccc 100755 --- a/builddeps-i945pwm +++ b/resources/scripts/helpers/build/clean/grub @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-i945pwm: builds i945-pwm source code +# helper script: clean the dependencies that were built in GRUB # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,18 +18,19 @@ # 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 -# Build i945-pwm utility -# -------------------------------------------------------------------- +# clean grub +# -------------------------------------------------------- -cd resources/utilities/i945-pwm/ +cd grub/ -make clean -# build it -make +[[ -f Makefile ]] && make clean -# done. go back to main directory -cd ../../../ +# done. go back to main directoy +cd ../ # ------------------- DONE ---------------------- diff --git a/builddeps-i945pwm b/resources/scripts/helpers/build/clean/i945pwm index 7eb5479..41334e6 100755 --- a/builddeps-i945pwm +++ b/resources/scripts/helpers/build/clean/i945pwm @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-i945pwm: builds i945-pwm source code +# helper script: clean the dependencies that were built in i945pwm # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,18 +18,16 @@ # 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 -# Build i945-pwm utility +# clean i945-pwm utility # -------------------------------------------------------------------- -cd resources/utilities/i945-pwm/ - +cd resources/utilities/i945-pwm make clean -# build it -make - -# done. go back to main directory cd ../../../ # ------------------- DONE ---------------------- diff --git a/builddeps-i945pwm b/resources/scripts/helpers/build/clean/ich9deblob index 7eb5479..fa5b671 100755 --- a/builddeps-i945pwm +++ b/resources/scripts/helpers/build/clean/ich9deblob @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-i945pwm: builds i945-pwm source code +# helper script: clean the dependencies that were built in ich9deblob # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,18 +18,16 @@ # 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 -# Build i945-pwm utility +# clean ich9deblob utility # -------------------------------------------------------------------- -cd resources/utilities/i945-pwm/ - +cd resources/utilities/ich9deblob/ make clean -# build it -make - -# done. go back to main directory cd ../../../ # ------------------- DONE ---------------------- diff --git a/builddeps-i945pwm b/resources/scripts/helpers/build/clean/memtest86plus index 7eb5479..cd01bdd 100755 --- a/builddeps-i945pwm +++ b/resources/scripts/helpers/build/clean/memtest86plus @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-i945pwm: builds i945-pwm source code +# helper script: clean the dependencies that were built in memtest86+ # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,18 +18,19 @@ # 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 -# Build i945-pwm utility -# -------------------------------------------------------------------- +# clean memtest86+ +# -------------------------------------------------------- -cd resources/utilities/i945-pwm/ +cd "memtest86+-5.01"/ make clean -# build it -make # done. go back to main directory -cd ../../../ +cd ../ # ------------------- DONE ---------------------- diff --git a/builddeps-i945pwm b/resources/scripts/helpers/build/clean/rom_images index 7eb5479..40bbe19 100755 --- a/builddeps-i945pwm +++ b/resources/scripts/helpers/build/clean/rom_images @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-i945pwm: builds i945-pwm source code +# helper script: delete the ROM images # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,18 +18,15 @@ # along with this program. If not, see . # -set -u -e -v - -# Build i945-pwm utility -# -------------------------------------------------------------------- +# This script assumes that the current working directory is the root +# of libreboot_src or libreboot git -cd resources/utilities/i945-pwm/ +set -u -e -v -make clean -# build it -make +# Delete the ROM images +# -------------------------------------------------------- -# done. go back to main directory -cd ../../../ +# delete the bin/ directory +rm -rf bin/ # ------------------- DONE ---------------------- diff --git a/mkextbuild b/resources/scripts/helpers/build/external/source index 8973d6a..833c180 100755 --- a/mkextbuild +++ b/resources/scripts/helpers/build/external/source @@ -1,6 +1,6 @@ #!/bin/bash -# mkextbuild script: prepare a small source archive for those utils +# 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. # @@ -29,33 +29,26 @@ rm -f tobuild.tar.xz # this is where they will go mkdir tobuild -# for reference (build dependencies) -cp deps-trisquel tobuild/ +cp -r resources/ tobuild/ # flashrom -cp -r flashrom tobuild/ +cp -r flashrom/ tobuild/ cd tobuild/flashrom/ rm -f flashrom_lenovobios_sst flashrom_lenovobios_macronix make clean cd ../../ -mkdir tobuild/resources -mkdir tobuild/resources/flashrom -mkdir tobuild/resources/flashrom/patch -cp -r resources/flashrom/patch/* tobuild/resources/flashrom/patch/ -cp builddeps-flashrom tobuild/ # bucts cp -r bucts tobuild/ cd tobuild/bucts/ make clean cd ../../ -mkdir tobuild/resources/bucts -mkdir tobuild/resources/bucts/patch -cp -r resources/bucts/patch/* tobuild/resources/bucts/patch -cp -r builddeps-bucts tobuild/ + +# the build script will be needed +cp build tobuild/ # that is all. now tar it up -tar cfJ tobuild.tar.xz tobuild +tar -c tobuild | xz -9e >tobuild.tar.xz # and delete the directory rm -rf tobuild/ diff --git a/builddeps-bucts b/resources/scripts/helpers/build/module/bucts index d7ff8b2..f29d753 100755 --- a/builddeps-bucts +++ b/resources/scripts/helpers/build/module/bucts @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-bucts: builds bucts source code +# helper script: builds bucts source code # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,27 +18,31 @@ # along with this program. If not, see . # -# This script is used by the main "builddeps" script in libreboot src/meta archives. -# The reason it is seperated here is so that bucts can be built separately aswell. +# 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 +cd bucts/ -# clean it first -make clean - -# build bucts +buildtype="unknown" if (( $# != 1 )); then - # build it dynamically linked - make + buildtype="dynamic" else + buildtype="static" +fi + +if [ "$buildtype" = "static" ]; then patch Makefile < ../resources/bucts/patch/staticlink.diff - # build it statically linked - make +fi + +make clean +make + +if [ "$buildtype" = "static" ]; then patch Makefile -R < ../resources/bucts/patch/staticlink.diff fi diff --git a/builddeps-coreboot b/resources/scripts/helpers/build/module/coreboot index 1645feb..4ec2eac 100755 --- a/builddeps-coreboot +++ b/resources/scripts/helpers/build/module/coreboot @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-coreboot: builds the dependencies that coreboot needs before building a ROM image +# helper script: builds the dependencies that coreboot needs before building a ROM image # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,8 +18,8 @@ # along with this program. If not, see . # -# This script is used by the main "builddeps" script in libreboot src/meta archives. -# The reason it is seperated here is so that coreboot can be built separately aswell. +# This script assumes that the working directory is the root +# of libreboot_src or git set -u -e -v diff --git a/builddeps-flashrom b/resources/scripts/helpers/build/module/flashrom index 4ae96bc..7cd50cc 100755 --- a/builddeps-flashrom +++ b/resources/scripts/helpers/build/module/flashrom @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-flashrom: builds flashrom source code +# helper script: builds flashrom source code # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,7 +18,8 @@ # along with this program. If not, see . # -# To build flashrom, you will need the dependencies (see docs). +# This script assumes that the working directory is the root +# of libreboot_src or git set -u -e -v @@ -27,14 +28,15 @@ set -u -e -v cd flashrom/ -# build regular flashrom (redundant flash chip definitions removed) make clean if (( $# != 1 )); then - # build it dynamically linked make else - # build it statically linked - make SHARED=0 CC='gcc -static' + if [ "$1" = "static" ]; then + make SHARED=0 CC='gcc -static' + else + make + fi fi mv flashrom flashrom_normal @@ -45,7 +47,6 @@ mv flashrom flashrom_normal for patchname in "lenovobios_macronix" "lenovobios_sst" do # first remove the existing build - make clean rm -f flashrom_"$patchname" # backup the unpatched flashchips.c (it will be patched) @@ -53,12 +54,15 @@ do # patch flashchips.c patch flashchips.c < ../resources/flashrom/patch/"$patchname".diff + make clean if (( $# != 1 )); then - # build it dynamically linked make else - # build it statically linked - make SHARED=0 CC='gcc -static' + if [ "$1" = "static" ]; then + make SHARED=0 CC='gcc -static' + else + make + fi fi # Rename the binary based on the patch name diff --git a/builddeps-grub b/resources/scripts/helpers/build/module/grub index 3897fbb..1856c35 100755 --- a/builddeps-grub +++ b/resources/scripts/helpers/build/module/grub @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-grub: builds GRUB source code +# helper script: builds GRUB source code # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,10 +18,10 @@ # along with this program. If not, see . # -set -u -e -v +# This script assumes that the working directory is the root +# of libreboot_src or git -# This script is used by the main "builddeps" script in libreboot src/meta archives. -# The reason it is seperated here is so that grub can be built separately aswell. +set -u -e -v # Build utilies needed for building GRUB payloads # --------------------------------------------------------------------- diff --git a/builddeps-i945pwm b/resources/scripts/helpers/build/module/i945pwm index 7eb5479..81cef71 100755 --- a/builddeps-i945pwm +++ b/resources/scripts/helpers/build/module/i945pwm @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-i945pwm: builds i945-pwm source code +# helper script: builds i945-pwm source code # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,6 +18,9 @@ # 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 diff --git a/builddeps-ich9deblob b/resources/scripts/helpers/build/module/ich9deblob index dffb557..e77957c 100755 --- a/builddeps-ich9deblob +++ b/resources/scripts/helpers/build/module/ich9deblob @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-ich9deblob: builds ich9deblob source code +# helper script: builds ich9deblob source code # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,8 +18,8 @@ # along with this program. If not, see . # -# This script is used by the main "builddeps" script in libreboot src/meta archives. -# The reason it is seperated here is so that ich9deblob can be built separately aswell. +# This script assumes that the working directory is the root +# of libreboot_src or git set -u -e -v diff --git a/builddeps-memtest86 b/resources/scripts/helpers/build/module/memtest86plus index a7ae55e..f752080 100755 --- a/builddeps-memtest86 +++ b/resources/scripts/helpers/build/module/memtest86plus @@ -1,8 +1,8 @@ #!/bin/bash -# builddeps-memtest86 script: builds memtest86+ source code +# helper script: builds memtest86+ source code # -# Copyright (C) 2014 Francis Rowe +# 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 @@ -18,10 +18,10 @@ # along with this program. If not, see . # -set -u -e -v +# This script assumes that the working directory is the root +# of libreboot_src or git -# This script is used by the main "builddeps" script in libreboot src/meta archives. -# The reason it is seperated here is so that MemTest86+ can be built separately aswell. +set -u -e -v # Build MemTest86+ payload (for GRUB) # -------------------------------------------------------------------- diff --git a/build-release b/resources/scripts/helpers/build/release/archives index 9384433..49a1d4d 100755 --- a/build-release +++ b/resources/scripts/helpers/build/release/archives @@ -1,7 +1,7 @@ #!/bin/bash # -# build-release script: generates libreboot_util and libreboot_src release archives +# helper script: generate the release archives # # Copyright (C) 2014, 2015 Francis Rowe # @@ -19,6 +19,9 @@ # 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" @@ -37,9 +40,6 @@ else 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 # ---------------------------------------------------------------------------------------------------------------------------- @@ -54,8 +54,6 @@ 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) @@ -69,7 +67,7 @@ done cd libreboot_src/ # clean everything -./cleandeps +./build clean all # back to main checkout directory cd ../ @@ -112,22 +110,32 @@ 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 # ---------------------------------------------------------------------------------------------------------------------------- -echo "Preparing libreboot_util release archive" - mkdir libreboot_util # -------------- @@ -137,12 +145,12 @@ mkdir libreboot_util # 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 +./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 @@ -151,7 +159,7 @@ mv bucts_ bucts # Include it statically compiled cp -r flashrom flashrom_ # make it statically compile -./builddeps-flashrom static +./build module flashrom static mkdir libreboot_util/flashrom cd flashrom/ mkdir ../libreboot_util/flashrom/"$arch" @@ -294,26 +302,20 @@ cd ../../ # --------------------- # Include documentation # --------------------- -cp -r docs libreboot_util/ +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 +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 SCRIPTS -# Flashrom script (makes flashing easier: ./flash path/to/libreboot.rom) +# Flashing script 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/ @@ -321,9 +323,6 @@ 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 # ---------------------------------------------------------------------------------------------------------------------------- @@ -337,9 +336,9 @@ rm -f releasefilelist # 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 -rf libreboot_src/resources/scripts/helpers/build/release rm -f libreboot_src/download -rm -rf libreboot_src/resources/scripts/helpers/fetch/ +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 @@ -361,36 +360,25 @@ rm -f libreboot_src/ich9fdgbe_4m.bin 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" +# 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 -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" - +# 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 -./mkextbuild +./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 diff --git a/buildrom-withgrub b/resources/scripts/helpers/build/roms/helper index 01d131e..0a4f06c 100755 --- a/buildrom-withgrub +++ b/resources/scripts/helpers/build/roms/helper @@ -1,7 +1,6 @@ #!/bin/bash -# buildrom-withgrub script: this generically builds the ROM images. -# The ROM images built by this script will use the GRUB payload. +# helper script: create ROM images for a given system, with GRUB # # Copyright (C) 2014, 2015 Francis Rowe # @@ -19,10 +18,10 @@ # along with this program. If not, see . # -set -u -e -v +# This script assumes that the working directory is the root +# of libreboot_src or git -# DO NOT RUN THIS DIRECTLY! -# Use "build" +set -u -e -v if (( $# != 1 )); then echo "Usage: ./buildrom-withgrub boardname" 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