libreboot
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libreboot] [Patch V2][ 2/2] coreboot-libre: make it path independant.


From: Denis 'GNUtoo' Carikli
Subject: [Libreboot] [Patch V2][ 2/2] coreboot-libre: make it path independant.
Date: Thu, 19 Nov 2015 21:11:34 +0100

This way it can be used on any coreboot directory.
The script is expected to run inside coreboot's top directory.

It was also cleaned up while doing it:
* Converted to use less commands
* Clarified comments and prints

The respective documentation was also updated.

Signed-off-by: Denis 'GNUtoo' Carikli <address@hidden>
---
Since V1: Added documentation and updated .gitignore
---
 .gitignore                                   |  1 -
 docs/src/maintain/index.texi                 | 10 ++++---
 resources/utilities/coreboot-libre/deblob    |  4 ---
 resources/utilities/coreboot-libre/findblobs | 41 +++++++++++-----------------
 4 files changed, 22 insertions(+), 34 deletions(-)

diff --git a/.gitignore b/.gitignore
index 42c9c46..9dfb21a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,7 +21,6 @@
 /resources/utilities/ich9deblob/obj/*/*.o
 /resources/utilities/ich9deblob/mkdescriptor*.[ch]
 /resources/utilities/ich9deblob/mkgbe*.[ch]
-/resources/utilities/coreboot-libre/tocheck
 /resources/utilities/grub-assemble/grub_*.elf
 /mkgbe.[ch]
 /*.bin
diff --git a/docs/src/maintain/index.texi b/docs/src/maintain/index.texi
index a6a9f5a..55b495c 100644
--- a/docs/src/maintain/index.texi
+++ b/docs/src/maintain/index.texi
@@ -124,11 +124,11 @@ Check all coreboot file names/paths in @emph{deblob}; if 
any of them no longer e
 
 Check all coreboot file names/paths in @emph{nonblobs}; if any of them no 
longer exist at that name/path in the coreboot tree that you downloaded, delete 
the reference in @emph{nonblobs}.
 
-Now, back in the main root directory of libreboot (git repository), run the 
deblob script. This is to prevent the @emph{findblobs} scripts from finding the 
blobs that are already deleted when running the @emph{deblob} script. Like 
so:@* $ @strong{./resources/utilities/coreboot-libre/deblob}
+Then run the deblob script. This is to prevent the @emph{findblobs} scripts 
from finding the blobs that are already deleted when running the @emph{deblob} 
script. Like so:@* $ @strong{../resources/utilities/coreboot-libre/deblob}
 
-Now search for new blobs:@* $ @strong{cd 
resources/utilities/coreboot-libre/address@hidden $ @strong{./address@hidden 
WARNING: this will take a @strong{*long*} time. Be patient! What this will do 
is look through the coreboot source directory, looking for blobs. It will not 
find the blobs that you deleted before (because they no longer exist), and it 
will ignore any files listed in @emph{nonblobs}.
+Now search for new blobs:$ 
@strong{../resources/utilities/coreboot-libre/address@hidden WARNING: this will 
take a @strong{*very long*} time. Be patient! What this will do is look through 
the coreboot source directory, looking for blobs. It will not find the blobs 
that you deleted before (because they no longer exist), and it will ignore any 
files listed in @emph{nonblobs}.
 
-Once the @emph{findblobs} script has finished, check the file @emph{tocheck} 
(from the root, this will be 
@emph{resources/utilities/coreboot-libre/tocheck}). These are the files 
detected as blobs; some might be blobs, some not. The @emph{findblobs} script 
doesn't know how to determine between blobs and non-blobs, it only finds 
suspicious patterns. Distinguishing between blobs and non-blobs must be 
performed by you, the human being.
+Once the @emph{findblobs} script has finished, check the file @emph{tocheck} 
in the current directory. These are the files detected as blobs; some might be 
blobs, some not. The @emph{findblobs} script doesn't know how to determine 
between blobs and non-blobs, it only finds suspicious patterns. Distinguishing 
between blobs and non-blobs must be performed by you, the human being.
 
 @itemize
 @item
@@ -137,7 +137,9 @@ Files in @emph{tocheck} that you identify as blobs, should 
be added appropriatel
 Files in @emph{tocheck} that you identify as non-blobs, should be added 
appropriately to @emph{resources/utilities/coreboot-libre/nonblobs} - also, if 
you feel it necessary, add an explanation of it in 
@emph{resources/utilities/coreboot-libre/nonblobs_notes}
 @end itemize
 
-Now come back to the main libreboot root directory (root of the git clone). If 
you are still in resources/utilities/coreboot-libre/ for instance, you would do 
something like:@* $ @strong{cd ../../../}
+Now come back to the main libreboot root directory (root of the git clone). If 
you are still in coreboot/ for instance, you would do something like:@* $ 
@strong{cd ../}
+
+Before deleting coreboot directory, double check that you merged all the 
@emph{tocheck} content in @emph{resources/utilities/coreboot-libre/deblob} and 
@emph{resources/utilities/coreboot-libre/nonblobs}, in doubt save the 
@emph{tocheck} file somewhere safe, outside libreboot directory.
 
 Now delete the coreboot directory:@* $ @strong{rm -Rf coreboot/}
 
diff --git a/resources/utilities/coreboot-libre/deblob 
b/resources/utilities/coreboot-libre/deblob
index 882bab0..d526a05 100755
--- a/resources/utilities/coreboot-libre/deblob
+++ b/resources/utilities/coreboot-libre/deblob
@@ -26,8 +26,6 @@ set -u -e
 
 printf "Deleting blobs in coreboot\n"
 
-cd "coreboot/"
-
 # ---------------------
 # AMD: CPU microcode updates
 # ---------------------
@@ -148,5 +146,3 @@ rm -f \
 "3rdparty/vboot/tests/futility/data/zinger.unsigned"
 
 printf "\n\n"
-
-cd "../"
diff --git a/resources/utilities/coreboot-libre/findblobs 
b/resources/utilities/coreboot-libre/findblobs
index 4fcda2a..b43535d 100755
--- a/resources/utilities/coreboot-libre/findblobs
+++ b/resources/utilities/coreboot-libre/findblobs
@@ -1,8 +1,9 @@
-#!/bin/bash
+#!/bin/sh
 
 #  find blobs in coreboot
 #
-#      Copyright (C) 2014, 2015 Francis Rowe <address@hidden>
+#    Copyright (C) 2014, 2015 Francis Rowe <address@hidden>
+#    Copyright (C) 2015 Denis 'GNUtoo' Carikli <address@hidden>
 #
 #    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
@@ -21,38 +22,28 @@
 [ "x${DEBUG+set}" = 'xset' ] && set -v
 set -e -u
 
-# This is used when updating the version of
-# coreboot that libreboot uses, to know what
-# new blobs have landed in coreboot
+# This script is used to semi-automatically find blobs in coreboot.
+# It is typically when updating libreboot to use new versions of coreboot:
+# The goal is to detect new blobs added in coreboot to remove them in 
libreboot.
 
-# full deblob scripts based on linux-libre
-# will replace this script later on. For now, 
-# this will have to do.
+# The full deblob scripts are based on linux-libre's.
+# Later on it might be replaced by more scripts targetting coreboot more
+# specifically.
 
 printf "Searching for blobs in coreboot\n"
-cp "deblob-check" "../../../coreboot"
-cd "../../../coreboot/"
+install "$(dirname $0)/deblob-check" "$(pwd)"
+install "$(dirname $0)/nonblobs"     "$(pwd)"
+echo -n "" > tocheck
 
-chmod +x "deblob-check"
-find -type f | xargs ./deblob-check > "blobs"
-rm -f "deblob-check"
-
-rm -f "tocheck"
-touch "tocheck"
+find -type f -not -path '\.git/*' | xargs ./deblob-check > "blobs"
 
 for file in $(cat blobs)
 do
-       if ! grep -Fxq "${file}" 
"../resources/utilities/coreboot-libre/nonblobs"
+       if ! grep -Fxq "${file}" "nonblobs"
        then
                 printf "%s\n" "${file}" >> tocheck
        fi
 done
-rm -f "blobs"
-
-rm -f "../resources/utilities/coreboot-libre/tocheck"
-mv "tocheck" "../resources/utilities/coreboot-libre/"
-
-cd "../resources/utilities/coreboot-libre/"
 
-printf "Done! open resources/utilities/coreboot-libre/tocheck in an editor\n"
-printf "This will contain the names of the files that you must decide whether 
they are blobs or not\n\n"
+printf "Done! Now open %s/tocheck in an editor:\n" "$(pwd)"
+printf "You will then need to manually check each file content to verify if 
each one contains a blob.\n\n"
-- 
2.6.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]