Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2012-10-02 16:31:43 (GMT)
committer Daniel Drake <dsd@laptop.org>2012-10-02 16:31:43 (GMT)
commitab3d3f992d8271fb6608e815f28611a0ab088343 (patch)
tree2e2c5b902383849f20a1608382cbe97f147b2b6a
parentc7425d50162106b2de997d71ec3b8bba65c03a15 (diff)
Generate firmware zip files with model-suffixed names (#12129)
The XO-4 at the present time requires model-suffixes zip file names e.g. runos4.zip. This also seems to make sense in the general case, and is implemented here as being fully backwards-compatible with firmware that don't support it.
-rw-r--r--modules/base/kspost.50.zip_bootfiles.nochroot.inc40
-rw-r--r--modules/signing/preimage.10.extract.sh11
-rw-r--r--modules/signing/preimage.40.sign-firmware.sh8
-rw-r--r--modules/signing/preimage.40.sign-os.sh4
-rw-r--r--modules/signing/preimage.50.addsignedcontent.sh8
5 files changed, 54 insertions, 17 deletions
diff --git a/modules/base/kspost.50.zip_bootfiles.nochroot.inc b/modules/base/kspost.50.zip_bootfiles.nochroot.inc
index e5d4cc8..31cd84b 100644
--- a/modules/base/kspost.50.zip_bootfiles.nochroot.inc
+++ b/modules/base/kspost.50.zip_bootfiles.nochroot.inc
@@ -1,12 +1,16 @@
+. $OOB__shlib
+
# Put the unsigned kernel/initramfs in zip files and remove the originals
# This avoids duplication for signed builds (where these zips will be signed
# later), where otherwise we would be shipped both signed and unsigned kernels
# and losing some disk space.
+suffix=$(read_laptop_model_number)
+
# Create zip files
create_unsigned_zip() {
local infile=$1
- local tgt=$2
+ local tgt=${2}${suffix}
cd $INSTALL_ROOT/boot
[ -e $1 ] || return
@@ -40,7 +44,33 @@ remove_original() {
#remove_original initrd.img
# symlink actXX to runXX (or the other way) if any of them are missing
-[ -e $INSTALL_ROOT/boot/actos.zip ] || ln -s runos.zip $INSTALL_ROOT/boot/actos.zip
-[ -e $INSTALL_ROOT/boot/actrd.zip ] || ln -s runrd.zip $INSTALL_ROOT/boot/actrd.zip
-[ -e $INSTALL_ROOT/boot/runos.zip ] || ln -s actos.zip $INSTALL_ROOT/boot/runos.zip
-[ -e $INSTALL_ROOT/boot/runrd.zip ] || ln -s actrd.zip $INSTALL_ROOT/boot/runrd.zip
+create_missing() {
+ local dest=${1}${suffix}.zip
+ local source=${2}${suffix}.zip
+
+ [ -e $INSTALL_ROOT/boot/$dest ] && return 0
+ ln -s $source $INSTALL_ROOT/boot/$dest
+}
+create_missing actos runos
+create_missing actrd runrd
+create_missing runos actos
+create_missing runrd actrd
+
+
+create_compat() {
+ local compat=${1}.zip
+ local dest=${1}${suffix}.zip
+
+ [ -e $INSTALL_ROOT/boot/${dest} ] || return 0
+ ln -s $dest $INSTALL_ROOT/boot/$compat
+}
+
+# Some old, released firmware versions for XO-1 and XO-1.5 don't support the
+# new "versioned" zip file naming scheme. Create symlinks to the old names
+# for backwards compatibility.
+if [ "$suffix" -lt 3 ]; then
+ create_compat actos
+ create_compat actrd
+ create_compat runos
+ create_compat runrd
+fi
diff --git a/modules/signing/preimage.10.extract.sh b/modules/signing/preimage.10.extract.sh
index 489f8b4..01f3753 100644
--- a/modules/signing/preimage.10.extract.sh
+++ b/modules/signing/preimage.10.extract.sh
@@ -4,6 +4,8 @@
# this must be run before the base module creates versioned fs layout
. $OOB__shlib
+shopt -s nullglob
+
enabled=$(read_config signing extract)
[[ "$enabled" == "1" ]] || exit 0
@@ -17,10 +19,11 @@ echo "Extracting content for signing..."
copy_out_file() {
local name=$1
- local path="$fsmount"/boot/${1}.zip
- [ -f "$path"] || return
- cp $path $tgt
- found=1
+ for path in "$fsmount"/boot/${name}*.zip; do
+ [ -f "$path" ] || continue
+ cp $path $tgt
+ found=1
+ done
}
copy_out bootfw
diff --git a/modules/signing/preimage.40.sign-firmware.sh b/modules/signing/preimage.40.sign-firmware.sh
index 1f8093e..8789558 100644
--- a/modules/signing/preimage.40.sign-firmware.sh
+++ b/modules/signing/preimage.40.sign-firmware.sh
@@ -8,13 +8,14 @@ wkey=$(read_config signing wkey)
bios_crypto=$(read_config signing bios_crypto_path)
[ -n "$bios_crypto" -a -d "$bios_crypto" ] || exit 0
-[ -e $fsmount/boot/bootfw.zip ] || exit 0
+bootfw=$(find $fsmount/boot -type f -name 'bootfw*.zip' -print -quit)
+[ -n "$bootfw" ] || exit 0
echo "Signing firmware..."
fwtmp=$intermediatesdir/fw-for-signing
mkdir -p $fwtmp
-unzip -d $fwtmp $fsmount/boot/bootfw.zip
+unzip -d $fwtmp $bootfw
mv $fwtmp/data.img $intermediatesdir/fw.rom
outzip=$intermediatesdir/bootfw.zip
@@ -22,5 +23,4 @@ rm -f $outzip
pushd $bios_crypto/build
./sign-fw.sh $wkey $intermediatesdir/fw.rom $outzip
popd
-mv $outzip $fsmount/boot/
-
+mv $outzip $bootfw
diff --git a/modules/signing/preimage.40.sign-os.sh b/modules/signing/preimage.40.sign-os.sh
index 6756eb6..0adba39 100644
--- a/modules/signing/preimage.40.sign-os.sh
+++ b/modules/signing/preimage.40.sign-os.sh
@@ -9,8 +9,8 @@ bios_crypto=$(read_config signing bios_crypto_path)
[ -n "$bios_crypto" -a -d "$bios_crypto" ] || exit 0
sign_os() {
- local path="$fsmount"/boot/$1.zip
- [ -f "$path" ] || return
+ local path=$(find ${fsmount}/boot -type f -name "${1}*.zip" -print -quit)
+ [ -z "$path" ] && return
pushd $bios_crypto/build
unzip "$path"
diff --git a/modules/signing/preimage.50.addsignedcontent.sh b/modules/signing/preimage.50.addsignedcontent.sh
index 3ad5f19..f3106c2 100644
--- a/modules/signing/preimage.50.addsignedcontent.sh
+++ b/modules/signing/preimage.50.addsignedcontent.sh
@@ -2,6 +2,7 @@
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.
. $OOB__shlib
+shopt -s nullglob
content=$(read_config signing add_signed_content)
[ -n "$content" ] || exit 0
@@ -11,8 +12,11 @@ signdir=$intermediatesdir/signed-content
rm -rf $signdir
mkdir -p $signdir
unzip $content -d $signdir
-for sfile in bootfw.zip runos.zip runrd.zip actos.zip actrd.zip; do
- [ -e $signdir/$sfile ] && cp --remove-destination $signdir/$sfile $fsmount/boot/$sfile
+
+pushd $signdir
+for sfile in bootfw*.zip runos*.zip runrd*.zip actos*.zip actrd*.zip; do
+ cp --remove-destination $sfile $fsmount/boot/$sfile
done
+popd
rm -rf $signdir