summaryrefslogtreecommitdiffstats
path: root/builddeps-flashrom
diff options
context:
space:
mode:
Diffstat (limited to 'builddeps-flashrom')
-rwxr-xr-xbuilddeps-flashrom71
1 files changed, 25 insertions, 46 deletions
diff --git a/builddeps-flashrom b/builddeps-flashrom
index b54f1d7..250c393 100755
--- a/builddeps-flashrom
+++ b/builddeps-flashrom
@@ -18,66 +18,45 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# This script is used by the main "builddeps" script in libreboot src/meta archives.
-# The reason it is seperated here is so that flashrom can be built separately aswell.
-
-# To build flashrom, you will need the dependencies in "builddeb".
-# Run it, or adapt it if you do not use an "apt-get" distro.
+# To build flashrom, you will need the dependencies (se docs).
set -u -e -v
# Build "flashrom" (utility for flashing/dumping ROM's)
# --------------------------------------------------------------------
-cd flashrom
+cd flashrom/
# clean it first
make clean
-# remove modified binaries aswell
-rm -f flashrom_lenovobios_sst
-rm -f flashrom_lenovobios_macronix
-# patch flashchips.c to remove the useless Macronix entries (for X60/T60)
-# makes flashrom work without having to use "-c" switch
+# default flashchips.c
mv flashchips.c flashchips.c_
-cp ../resources/flashrom/patch/flashchips.c .
-# build flashrom
-if (( $# != 1 )); then
- make
-else
- make SHARED=0 CC='gcc -static'
-fi
-# restore default flashchips.c
-rm -f flashchips.c
-
-# backup those files
-mv flashrom flashrom_
-
-# build patched version for MX25L1605D flash chip on Lenovo BIOS X60/T60
-cp ../resources/flashrom/patch/flashchips.c_lenovobios_macronix flashchips.c
-if (( $# != 1 )); then
- make
-else
- make SHARED=0 CC='gcc -static'
-fi
-mv flashrom flashrom_lenovobios_macronix
-rm -f flashchips.c
-
-# build patched version for SST25VF016B flash chip on Lenovo BIOS X60/T60
-cp ../resources/flashrom/patch/flashchips.c_lenovobios_sst flashchips.c
-if (( $# != 1 )); then
- make
-else
- make SHARED=0 CC='gcc -static'
-fi
-mv flashrom flashrom_lenovobios_sst
-rm -f flashchips.c
-# restore default binary/source
+# build patched binary for libreboot X60/T60 (MX25L1605D chip)
+# - this patch removes redundant definitions from flashchips.c
+# - this patch removes the need to use the -c parameter in flashrom
+# 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 "_normal" "_lenovobios_macronix" "_lenovobios_sst"
+do
+ rm -f flashchips.c"$patchname"
+ cp ../resources/flashrom/patch/flashchips.c"$patchname" flashchips.c
+ rm -f flashrom"$patchname"
+ if (( $# != 1 )); then
+ make
+ else
+ make SHARED=0 CC='gcc -static'
+ fi
+ mv flashrom flashrom"$patchname"
+ rm -f flashchips.c
+done
+mv flashrom_normal flashrom
+
+# default flashchips.c
mv flashchips.c_ flashchips.c
-mv flashrom_ flashrom
-# done. go back to main directory
cd ../
# ------------------- DONE ----------------------