From b840755acc24f5cebe561d5ecb3380e157de1583 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Sun, 15 Feb 2015 01:14:27 +0000 Subject: Move all build scripts into a single generic script, with helpers All build scripts were moved to resources/scripts/helpers/ --- .gitignore | 1 + build | 122 +++---- build-release | 400 --------------------- buildall | 36 -- builddeps | 60 ---- builddeps-bucts | 48 --- builddeps-coreboot | 56 --- builddeps-flashrom | 77 ---- builddeps-grub | 42 --- builddeps-i945pwm | 35 -- builddeps-ich9deblob | 40 --- builddeps-memtest86 | 40 --- buildrom-withgrub | 115 ------ cleandeps | 124 ------- deps-trisquel | 100 ------ docs/git/index.html | 99 ++--- docs/gnulinux/grub_cbfs.html | 2 +- docs/grub/index.html | 4 +- docs/hcl/gm45_remove_me.html | 10 +- docs/release.html | 3 +- mkextbuild | 61 ---- .../scripts/dependencies/trisquel7dependencies | 100 ++++++ resources/scripts/helpers/build/clean/bucts | 35 ++ resources/scripts/helpers/build/clean/coreboot | 61 ++++ resources/scripts/helpers/build/clean/flashrom | 39 ++ resources/scripts/helpers/build/clean/grub | 36 ++ resources/scripts/helpers/build/clean/i945pwm | 33 ++ resources/scripts/helpers/build/clean/ich9deblob | 33 ++ .../scripts/helpers/build/clean/memtest86plus | 36 ++ resources/scripts/helpers/build/clean/rom_images | 32 ++ resources/scripts/helpers/build/external/source | 54 +++ resources/scripts/helpers/build/module/bucts | 52 +++ resources/scripts/helpers/build/module/coreboot | 56 +++ resources/scripts/helpers/build/module/flashrom | 81 +++++ resources/scripts/helpers/build/module/grub | 42 +++ resources/scripts/helpers/build/module/i945pwm | 38 ++ resources/scripts/helpers/build/module/ich9deblob | 40 +++ .../scripts/helpers/build/module/memtest86plus | 40 +++ resources/scripts/helpers/build/release/archives | 388 ++++++++++++++++++++ resources/scripts/helpers/build/roms/helper | 114 ++++++ resources/scripts/helpers/build/roms/withgrub | 106 ++++++ 41 files changed, 1529 insertions(+), 1362 deletions(-) delete mode 100755 build-release delete mode 100755 buildall delete mode 100755 builddeps delete mode 100755 builddeps-bucts delete mode 100755 builddeps-coreboot delete mode 100755 builddeps-flashrom delete mode 100755 builddeps-grub delete mode 100755 builddeps-i945pwm delete mode 100755 builddeps-ich9deblob delete mode 100755 builddeps-memtest86 delete mode 100755 buildrom-withgrub delete mode 100755 cleandeps delete mode 100755 deps-trisquel delete mode 100755 mkextbuild create mode 100755 resources/scripts/dependencies/trisquel7dependencies create mode 100755 resources/scripts/helpers/build/clean/bucts create mode 100755 resources/scripts/helpers/build/clean/coreboot create mode 100755 resources/scripts/helpers/build/clean/flashrom create mode 100755 resources/scripts/helpers/build/clean/grub create mode 100755 resources/scripts/helpers/build/clean/i945pwm create mode 100755 resources/scripts/helpers/build/clean/ich9deblob create mode 100755 resources/scripts/helpers/build/clean/memtest86plus create mode 100755 resources/scripts/helpers/build/clean/rom_images create mode 100755 resources/scripts/helpers/build/external/source create mode 100755 resources/scripts/helpers/build/module/bucts create mode 100755 resources/scripts/helpers/build/module/coreboot create mode 100755 resources/scripts/helpers/build/module/flashrom create mode 100755 resources/scripts/helpers/build/module/grub create mode 100755 resources/scripts/helpers/build/module/i945pwm create mode 100755 resources/scripts/helpers/build/module/ich9deblob create mode 100755 resources/scripts/helpers/build/module/memtest86plus create mode 100755 resources/scripts/helpers/build/release/archives create mode 100755 resources/scripts/helpers/build/roms/helper create mode 100755 resources/scripts/helpers/build/roms/withgrub diff --git a/.gitignore b/.gitignore index b6e656e9..fd00a39e 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 19aaf3c3..bca8a6b2 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/build-release b/build-release deleted file mode 100755 index 9384433f..00000000 --- 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 ---------------------- diff --git a/buildall b/buildall deleted file mode 100755 index 31b85c83..00000000 --- a/buildall +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# buildall script: Builds (absolutely) everything. -# -# 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 old builds first: -# ------------------------------------------------------ -./cleandeps - -# Build the dependencies needed for building ROM's: -# ------------------------------------------------------ -./builddeps - -# Build the ROM's: -# ------------------------------------------------------ -./build - -# ------------------- DONE ---------------------- - diff --git a/builddeps b/builddeps deleted file mode 100755 index 7c8a6d9a..00000000 --- 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/builddeps-bucts b/builddeps-bucts deleted file mode 100755 index d7ff8b26..00000000 --- a/builddeps-bucts +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# builddeps-bucts: builds bucts source code -# -# 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 . -# - -# 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. - -set -u -e -v - -# Build BUC.TS utility (needed for flashing ROM's on X60/T60 while Lenovo BIOS is running) -# -------------------------------------------------------------------- - -cd bucts - -# clean it first -make clean - -# build bucts -if (( $# != 1 )); then - # build it dynamically linked - make -else - patch Makefile < ../resources/bucts/patch/staticlink.diff - # build it statically linked - make - patch Makefile -R < ../resources/bucts/patch/staticlink.diff -fi - -# done. go back to main directory -cd ../ - -# ------------------- DONE ---------------------- diff --git a/builddeps-coreboot b/builddeps-coreboot deleted file mode 100755 index 1645feb9..00000000 --- a/builddeps-coreboot +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# builddeps-coreboot: builds the dependencies that coreboot needs before building a ROM image -# -# 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 . -# - -# 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. - -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/builddeps-flashrom b/builddeps-flashrom deleted file mode 100755 index 4ae96bc9..00000000 --- a/builddeps-flashrom +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -# builddeps-flashrom: builds flashrom source code -# -# 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 . -# - -# To build flashrom, you will need the dependencies (see docs). - -set -u -e -v - -# Build "flashrom" (utility for flashing/dumping ROM's) -# -------------------------------------------------------------------- - -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' -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 - make clean - 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 - - if (( $# != 1 )); then - # build it dynamically linked - make - else - # build it statically linked - make SHARED=0 CC='gcc -static' - 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/builddeps-grub b/builddeps-grub deleted file mode 100755 index 3897fbb5..00000000 --- a/builddeps-grub +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# builddeps-grub: builds GRUB source code -# -# 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 - -# 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. - -# 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/builddeps-i945pwm b/builddeps-i945pwm deleted file mode 100755 index 7eb54792..00000000 --- a/builddeps-i945pwm +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# builddeps-i945pwm: builds i945-pwm source code -# -# 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 i945-pwm utility -# -------------------------------------------------------------------- - -cd resources/utilities/i945-pwm/ - -make clean -# build it -make - -# done. go back to main directory -cd ../../../ - -# ------------------- DONE ---------------------- diff --git a/builddeps-ich9deblob b/builddeps-ich9deblob deleted file mode 100755 index dffb5576..00000000 --- a/builddeps-ich9deblob +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# builddeps-ich9deblob: builds ich9deblob source code -# -# 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 . -# - -# 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. - -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/builddeps-memtest86 b/builddeps-memtest86 deleted file mode 100755 index a7ae55e0..00000000 --- a/builddeps-memtest86 +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# builddeps-memtest86 script: builds memtest86+ source code -# -# 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 - -# 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. - -# 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/buildrom-withgrub b/buildrom-withgrub deleted file mode 100755 index 01d131ec..00000000 --- a/buildrom-withgrub +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash - -# buildrom-withgrub script: this generically builds the ROM images. -# The ROM images built by this script will use the GRUB payload. -# -# 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 - -# DO NOT RUN THIS DIRECTLY! -# Use "build" - -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/cleandeps b/cleandeps deleted file mode 100755 index f007c96a..00000000 --- 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/deps-trisquel b/deps-trisquel deleted file mode 100755 index 227affaa..00000000 --- a/deps-trisquel +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash - -# deps-trisquel script: installs build dependencies for Trisquel 6 and 7 -# -# 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 - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 -fi - -# Duplications are intentional. Please do not re-factor. -# -# This is so that they can moved to separate scripts. -# - -apt-get -y install wget - -# For downloading source code -# ------------------------------------------------------------ - -apt-get -y install subversion git - -# For building source code: -# ------------------------------------------------------------ - -apt-get -y install build-essential - -# for cross-compiling ARM binaries -apt-get -y install gcc-arm-linux-gnueabi - -# For cross-compiling i686 target on x86_64 host. -if [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ] - then - apt-get -y install gcc-multilib libc6-i386 libc6-dev-i386 - apt-get -y install lib32stdc++6 g++-multilib dh-autoreconf - # recommended, but not sure what for: - apt-get -y install lib32tinfo-dev texi2html -fi - -# Memtest86+ build dependencies -# ------------------------------------------------------------ - -apt-get -y install build-essential - -# i945-pwm build dependencies -# ------------------------------------------------------------ - -apt-get -y install build-essential - -# Coreboot build dependencies (also requires build-essential and git) -# ------------------------------------------------------------ - -apt-get -y install libncurses5-dev doxygen iasl gdb flex bison build-essential git - -# For cross-compiling i686 target on x86_64 host. -if [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ] - then - apt-get -y install lib32ncurses5-dev -fi - -# GRUB build dependencies (also requires build-essential, bison and flex) -# ------------------------------------------------------------ - -apt-get -y install ttf-unifont libopts25 libselinux1-dev autogen m4 autoconf help2man libopts25-dev libfont-freetype-perl automake autotools-dev build-essential bison flex libfuse-dev liblzma-dev gawk libdevmapper-dev libtool libfreetype6-dev - -# BucTS build dependencies (external script) -# ------------------------------------------------------------ - -apt-get -y install build-essential - -# Flashrom build dependencies (also requires build-essential and subversion) -# ------------------------------------------------------------ - -apt-get -y install libpci-dev pciutils zlib1g-dev libftdi-dev build-essential subversion - -# For cross-compiling i686 target on x86_64 host. -if [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ] - then - apt-get -y install lib32z1-dev -fi - -# ------------------- DONE ---------------------- - diff --git a/docs/git/index.html b/docs/git/index.html index e6682d1e..320f309f 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 73cce0cf..874ebaf4 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 e37d7d7e..e9e2c351 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 d6c36f42..eff0eac5 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 edc24e3e..ad0422a2 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/mkextbuild b/mkextbuild deleted file mode 100755 index 8973d6a1..00000000 --- a/mkextbuild +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# mkextbuild script: 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 - -# for reference (build dependencies) -cp deps-trisquel tobuild/ - -# flashrom -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/ - -# that is all. now tar it up -tar cfJ tobuild.tar.xz tobuild - -# and delete the directory -rm -rf tobuild/ diff --git a/resources/scripts/dependencies/trisquel7dependencies b/resources/scripts/dependencies/trisquel7dependencies new file mode 100755 index 00000000..5330f754 --- /dev/null +++ b/resources/scripts/dependencies/trisquel7dependencies @@ -0,0 +1,100 @@ +#!/bin/bash + +# for_trisquel7 script: installs build dependencies for Trisquel 7 +# +# 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 + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 +fi + +# Duplications are intentional. Please do not re-factor. +# +# This is so that they can moved to separate scripts. +# + +apt-get -y install wget + +# For downloading source code +# ------------------------------------------------------------ + +apt-get -y install subversion git + +# For building source code: +# ------------------------------------------------------------ + +apt-get -y install build-essential + +# for cross-compiling ARM binaries +apt-get -y install gcc-arm-linux-gnueabi + +# For cross-compiling i686 target on x86_64 host. +if [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ] + then + apt-get -y install gcc-multilib libc6-i386 libc6-dev-i386 + apt-get -y install lib32stdc++6 g++-multilib dh-autoreconf + # recommended, but not sure what for: + apt-get -y install lib32tinfo-dev texi2html +fi + +# Memtest86+ build dependencies +# ------------------------------------------------------------ + +apt-get -y install build-essential + +# i945-pwm build dependencies +# ------------------------------------------------------------ + +apt-get -y install build-essential + +# Coreboot build dependencies (also requires build-essential and git) +# ------------------------------------------------------------ + +apt-get -y install libncurses5-dev doxygen iasl gdb flex bison build-essential git + +# For cross-compiling i686 target on x86_64 host. +if [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ] + then + apt-get -y install lib32ncurses5-dev +fi + +# GRUB build dependencies (also requires build-essential, bison and flex) +# ------------------------------------------------------------ + +apt-get -y install ttf-unifont libopts25 libselinux1-dev autogen m4 autoconf help2man libopts25-dev libfont-freetype-perl automake autotools-dev build-essential bison flex libfuse-dev liblzma-dev gawk libdevmapper-dev libtool libfreetype6-dev + +# BucTS build dependencies (external script) +# ------------------------------------------------------------ + +apt-get -y install build-essential + +# Flashrom build dependencies (also requires build-essential and subversion) +# ------------------------------------------------------------ + +apt-get -y install libpci-dev pciutils zlib1g-dev libftdi-dev build-essential subversion + +# For cross-compiling i686 target on x86_64 host. +if [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ] + then + apt-get -y install lib32z1-dev +fi + +# ------------------- DONE ---------------------- + diff --git a/resources/scripts/helpers/build/clean/bucts b/resources/scripts/helpers/build/clean/bucts new file mode 100755 index 00000000..eb907344 --- /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 00000000..dd1cc0fa --- /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 00000000..17054682 --- /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 00000000..6f3dccc4 --- /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 00000000..41334e6c --- /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 00000000..fa5b6712 --- /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 00000000..cd01bdd2 --- /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 00000000..40bbe196 --- /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 00000000..833c1801 --- /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 00000000..f29d7536 --- /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 00000000..4ec2eac0 --- /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 00000000..7cd50cc0 --- /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 00000000..1856c358 --- /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 00000000..81cef713 --- /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 00000000..e77957cd --- /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 00000000..f752080c --- /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 00000000..49a1d4dc --- /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 00000000..0a4f06c6 --- /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 00000000..9fa20e50 --- /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 v1.2.3-70-g09d2