mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-18 10:46:44 +00:00
Preserve custom CBFS files on flashrom updates
This commit is contained in:
parent
48ca75a482
commit
1cbae3cc12
@ -8,8 +8,7 @@ if [ -z "$CBFS_PCR" ]; then
|
||||
fi
|
||||
|
||||
# Load individual files
|
||||
cbfsfiles=`cbfs -t 50 -l 2>/dev/null | grep "^heads/initrd/"` \
|
||||
|| die "cbfs list files failed"
|
||||
cbfsfiles=`cbfs -t 50 -l 2>/dev/null | grep "^heads/initrd/"`
|
||||
|
||||
for cbfsname in `echo $cbfsfiles`; do
|
||||
filename=${cbfsname:12}
|
||||
|
@ -1,13 +1,24 @@
|
||||
#!/bin/sh
|
||||
. /etc/functions
|
||||
|
||||
if [ "$1" = "-c" ]; then
|
||||
CLEAN=1
|
||||
ROM="$2"
|
||||
else
|
||||
CLEAN=0
|
||||
ROM="$1"
|
||||
if [ -z "$1" ]; then
|
||||
die "Usage: $0 /media/kgpe-d16.rom"
|
||||
fi
|
||||
|
||||
if [ ! -e "$ROM" ]; then
|
||||
die "Usage: $0 [-c] /media/kgpe-d16.rom"
|
||||
fi
|
||||
|
||||
cp "$ROM" /tmp/kgpe-d16.rom
|
||||
sha256sum /tmp/kgpe-d16.rom
|
||||
if [ "$CLEAN" -eq 0 ]; then
|
||||
preserve_rom /tmp/kgpe-d16.rom \
|
||||
|| die "$ROM: Config preservation failed"
|
||||
fi
|
||||
|
||||
flashrom \
|
||||
--force \
|
||||
|
@ -1,13 +1,24 @@
|
||||
#!/bin/sh
|
||||
. /etc/functions
|
||||
|
||||
if [ "$1" = "-c" ]; then
|
||||
CLEAN=1
|
||||
ROM="$2"
|
||||
else
|
||||
CLEAN=0
|
||||
ROM="$1"
|
||||
if [ -z "$1" ]; then
|
||||
die "Usage: $0 /media/x230.rom"
|
||||
fi
|
||||
|
||||
if [ ! -e "$ROM" ]; then
|
||||
die "Usage: $0 [-c] /media/x230.rom"
|
||||
fi
|
||||
|
||||
cp "$ROM" /tmp/x230.rom
|
||||
sha256sum /tmp/x230.rom
|
||||
if [ "$CLEAN" -eq 0 ]; then
|
||||
preserve_rom /tmp/x230.rom \
|
||||
|| die "$ROM: Config preservation failed"
|
||||
fi
|
||||
|
||||
flashrom \
|
||||
--force \
|
||||
|
@ -198,3 +198,19 @@ check_config() {
|
||||
cp $1/kexec*.txt /tmp/kexec \
|
||||
|| die "Failed to copy kexec boot params to tmp"
|
||||
}
|
||||
|
||||
preserve_rom() {
|
||||
new_rom="$1"
|
||||
old_files=`cbfs -t 50 -l 2>/dev/null | grep "^heads/"`
|
||||
|
||||
for old_file in `echo $old_files`; do
|
||||
new_file=`cbfs -o $1 -l | grep -x $old_file`
|
||||
if [ -z "$new_file" ]; then
|
||||
echo "+++ Adding $old_file to $1"
|
||||
cbfs -t 50 -r $old_file >/tmp/rom.$$ \
|
||||
|| die "Failed to read cbfs file from ROM"
|
||||
cbfs -o $1 -a $old_file -f /tmp/rom.$$ \
|
||||
|| die "Failed to write cbfs file to new ROM file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user