aboutsummaryrefslogtreecommitdiff
path: root/resources/libreboot/install
diff options
context:
space:
mode:
author4 of 7 (Leah Rowe) info@minifree.org <info@minifree.org>2017-01-21 18:14:33 +0000
committer4 of 7 (Leah Rowe) info@minifree.org <info@minifree.org>2017-01-21 18:18:20 +0000
commit4b0752e1c264c4ba2a354507ca97bb2e039dda1a (patch)
treedca24f3d11087443aa9c8b2d823ed1d5b8dad001 /resources/libreboot/install
parent3c17e8d80e5bacacddb8be37b598cd91cf543539 (diff)
downloadlibrebootfr-4b0752e1c264c4ba2a354507ca97bb2e039dda1a.tar.gz
librebootfr-4b0752e1c264c4ba2a354507ca97bb2e039dda1a.zip
re-add old build system (for x86 boards/utils)
Everything will be migrated over to the new build system after release.
Diffstat (limited to 'resources/libreboot/install')
-rwxr-xr-xresources/libreboot/install/depthcharge/cros-flash-replace96
-rw-r--r--resources/libreboot/install/depthcharge/veyron_speedy/layout.txt2
2 files changed, 98 insertions, 0 deletions
diff --git a/resources/libreboot/install/depthcharge/cros-flash-replace b/resources/libreboot/install/depthcharge/cros-flash-replace
new file mode 100755
index 00000000..4ad3fabd
--- /dev/null
+++ b/resources/libreboot/install/depthcharge/cros-flash-replace
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+# replace the requested parts in the flash image with separate parts images
+#
+# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+
+[ "x${DEBUG+set}" = 'xset' ] && set -v
+
+regex="\([0-9a-fA-F]*\):\([0-9a-fA-F]*\)[[:space:]]*\(.*\)"
+block=256
+layout="layout.txt"
+flash=$1
+
+shift 1
+
+if [ ! -f "$flash" ]
+then
+ echo "Usage: $0 [flash image] [image] ..."
+ exit 1
+fi
+
+if [ ! -f "$layout" ]
+then
+ echo "Missing layout file: $layout"
+ exit 1
+fi
+
+flashsize=$( stat $flash -c "%s" )
+
+for image in $@; do
+ range=$( grep "$image" "$layout" )
+ name=$( echo "$range" | sed "s/$regex/\3/g" )
+ file="$name.img"
+
+ if [ -z "$range" ] || [ ! -f "$file" ]
+ then
+ echo "Invalid image name: $name"
+ continue
+ fi
+
+ start=$( echo "$range" | sed "s/$regex/\1/g" )
+ start=$( printf "%d\n" "0x$start" )
+ stop=$( echo "$range" | sed "s/$regex/\2/g" )
+ stop=$( printf "%d\n" "0x$stop" )
+
+ size=$(( $stop - $start + 1 ))
+ filesize=$( stat $file -c "%s" )
+
+ if [ $size -ne $filesize ]
+ then
+ echo "Invalid file size: expected $size, read $filesize"
+ continue
+ fi
+
+ if [ $size -gt $flashsize ]
+ then
+ echo "Image size too big for flash"
+ continue
+ fi
+
+ printf "Replacing $image in $flash\n\n"
+
+ if [ $start -gt 0 ]
+ then
+ dd if=$flash of=before.img bs=$block count=$(( $start / $block ))
+ else
+ touch before.img
+ fi
+
+ if [ $(( $stop + 1 )) -lt $flashsize ]
+ then
+ dd if=$flash of=after.img skip=$(( ($stop + 1) / $block )) bs=$block count=$(( ($flashsize - $stop - 1) / $block ))
+ else
+ touch after.img
+ fi
+
+ cat before.img $file after.img > $flash
+
+ rm before.img after.img
+
+ printf "\n"
+done
diff --git a/resources/libreboot/install/depthcharge/veyron_speedy/layout.txt b/resources/libreboot/install/depthcharge/veyron_speedy/layout.txt
new file mode 100644
index 00000000..bf397b80
--- /dev/null
+++ b/resources/libreboot/install/depthcharge/veyron_speedy/layout.txt
@@ -0,0 +1,2 @@
+00000000:000fffff coreboot
+001eff00:001effff ro-frid