blob: 71425bfeadb4a2d158a21168d87a8a1054eb95c4 [file] [log] [blame]
Ed Jamesf6bffe62014-05-16 12:15:07 -07001set -e
2
Matthias Kaehlcke512046c2015-03-27 13:41:10 -07003target="$1"
4
5if [ "$target" == "optimus" ]; then
6 barebox_config="optimus_defconfig"
Matthias Kaehlcke06004a02015-03-27 14:45:39 -07007 keystore_id="GFIBER_DRM"
Matthias Kaehlcke512046c2015-03-27 13:41:10 -07008elif [ "$target" == "spacecast" ]; then
9 barebox_config="spacecast_defconfig"
Matthias Kaehlcke06004a02015-03-27 14:45:39 -070010 keystore_id="SPACECAST"
Matthias Kaehlcke512046c2015-03-27 13:41:10 -070011else
12 echo "Usage: $0 [optimus|spacecast]" >&2
13 exit 1
14fi
15
Ed Jamesf6bffe62014-05-16 12:15:07 -070016binaries=$(pwd)/out
17if [ -d $binaries ]; then
18 rm -rf $binaries.old
19 mv -f $binaries $binaries.old
20fi
21mkdir -p $binaries
22
23make distclean
24make optimus_uloader_defconfig ARCH=arm
25make -j 16
26cp uloader.bin $binaries/uloader_unsigned_release.bin
27
28make distclean
29make optimus_mfg_defconfig ARCH=arm
30make -j 16
31cp barebox.bin $binaries/barebox_unsigned_mfg.bin
32
33make distclean
Matthias Kaehlcke512046c2015-03-27 13:41:10 -070034make $barebox_config ARCH=arm
Ed Jamesf6bffe62014-05-16 12:15:07 -070035make -j 16
36cp barebox.bin $binaries/barebox_unsigned_release.bin
37
38make distclean
Matthias Kaehlcke512046c2015-03-27 13:41:10 -070039make $barebox_config ARCH=arm
Ed Jamesf6bffe62014-05-16 12:15:07 -070040echo CONFIG_DEVELOPER_BAREBOX=y >> .config
41make oldconfig
42make -j 16
43cp barebox.bin $binaries/barebox_unsigned_unlocked.bin
44
45(
46set -e
47cd /google/src/files/head/depot/google3/isp/fiber/drm
48type=uloader
49for n in $binaries/uloader_unsigned_*.bin; do
50 signed=$(echo $n | sed -e 's/_unsigned_/_signed_/')
Matthias Kaehlcke06004a02015-03-27 14:45:39 -070051 blaze run -- //isp/fiber/drm:code_sign_tool sign-image $n \
52 --image_type=$type --outfile=$signed --keystore_config_id=$keystore_id
Ed Jamesf6bffe62014-05-16 12:15:07 -070053done
54type=barebox
55for n in $binaries/barebox_unsigned_*.bin; do
56 signed=$(echo $n | sed -e 's/_unsigned_/_signed_/')
Matthias Kaehlcke06004a02015-03-27 14:45:39 -070057 blaze run -- //isp/fiber/drm:code_sign_tool sign-image $n \
58 --image_type=$type --outfile=$signed --keystore_config_id=$keystore_id
Ed Jamesf6bffe62014-05-16 12:15:07 -070059done
60
Matthias Kaehlcke06004a02015-03-27 14:45:39 -070061blaze --batch run //isp/fiber/drm:drm_keystore_client -- \
62 --key_type signing_private_key --output $binaries/gfiber_private.pem \
63 --keystore_config_id=$keystore_id
Ed Jamesf6bffe62014-05-16 12:15:07 -070064)
65
66for n in $binaries/*.bin; do
67 sig=$(echo $n | sed -e 's/.bin$/.sig/')
68 openssl dgst -sign $binaries/gfiber_private.pem -sha512 -binary -keyform PEM $n > $sig
69done
70
71rm -f $binaries/gfiber_private.pem
72
73cat << EOF
74######################################################################
75Done
76If all looks good and tests well, check in with the following
Matthias Kaehlcke512046c2015-03-27 13:41:10 -070077cp out/*.bin out/*.sig ../../loader-bin/mindspeed/$target/
78cd ../../loader-bin/mindspeed/$target/
Ed Jamesf6bffe62014-05-16 12:15:07 -070079git add *.bin *.sig
80git commit
81git push gfiber-internal HEAD:refs/for/master
82EOF