Ed James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 1 | set -e |
| 2 | |
Matthias Kaehlcke | 512046c | 2015-03-27 13:41:10 -0700 | [diff] [blame] | 3 | target="$1" |
| 4 | |
| 5 | if [ "$target" == "optimus" ]; then |
| 6 | barebox_config="optimus_defconfig" |
Matthias Kaehlcke | 06004a0 | 2015-03-27 14:45:39 -0700 | [diff] [blame] | 7 | keystore_id="GFIBER_DRM" |
Matthias Kaehlcke | 512046c | 2015-03-27 13:41:10 -0700 | [diff] [blame] | 8 | elif [ "$target" == "spacecast" ]; then |
| 9 | barebox_config="spacecast_defconfig" |
Matthias Kaehlcke | 06004a0 | 2015-03-27 14:45:39 -0700 | [diff] [blame] | 10 | keystore_id="SPACECAST" |
Matthias Kaehlcke | 512046c | 2015-03-27 13:41:10 -0700 | [diff] [blame] | 11 | else |
| 12 | echo "Usage: $0 [optimus|spacecast]" >&2 |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
Ed James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 16 | binaries=$(pwd)/out |
| 17 | if [ -d $binaries ]; then |
| 18 | rm -rf $binaries.old |
| 19 | mv -f $binaries $binaries.old |
| 20 | fi |
| 21 | mkdir -p $binaries |
| 22 | |
| 23 | make distclean |
| 24 | make optimus_uloader_defconfig ARCH=arm |
| 25 | make -j 16 |
| 26 | cp uloader.bin $binaries/uloader_unsigned_release.bin |
| 27 | |
| 28 | make distclean |
| 29 | make optimus_mfg_defconfig ARCH=arm |
| 30 | make -j 16 |
| 31 | cp barebox.bin $binaries/barebox_unsigned_mfg.bin |
| 32 | |
| 33 | make distclean |
Matthias Kaehlcke | 512046c | 2015-03-27 13:41:10 -0700 | [diff] [blame] | 34 | make $barebox_config ARCH=arm |
Ed James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 35 | make -j 16 |
| 36 | cp barebox.bin $binaries/barebox_unsigned_release.bin |
| 37 | |
| 38 | make distclean |
Matthias Kaehlcke | 512046c | 2015-03-27 13:41:10 -0700 | [diff] [blame] | 39 | make $barebox_config ARCH=arm |
Ed James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 40 | echo CONFIG_DEVELOPER_BAREBOX=y >> .config |
| 41 | make oldconfig |
| 42 | make -j 16 |
| 43 | cp barebox.bin $binaries/barebox_unsigned_unlocked.bin |
| 44 | |
| 45 | ( |
| 46 | set -e |
| 47 | cd /google/src/files/head/depot/google3/isp/fiber/drm |
| 48 | type=uloader |
| 49 | for n in $binaries/uloader_unsigned_*.bin; do |
| 50 | signed=$(echo $n | sed -e 's/_unsigned_/_signed_/') |
Matthias Kaehlcke | 06004a0 | 2015-03-27 14:45:39 -0700 | [diff] [blame] | 51 | blaze run -- //isp/fiber/drm:code_sign_tool sign-image $n \ |
| 52 | --image_type=$type --outfile=$signed --keystore_config_id=$keystore_id |
Ed James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 53 | done |
| 54 | type=barebox |
| 55 | for n in $binaries/barebox_unsigned_*.bin; do |
| 56 | signed=$(echo $n | sed -e 's/_unsigned_/_signed_/') |
Matthias Kaehlcke | 06004a0 | 2015-03-27 14:45:39 -0700 | [diff] [blame] | 57 | blaze run -- //isp/fiber/drm:code_sign_tool sign-image $n \ |
| 58 | --image_type=$type --outfile=$signed --keystore_config_id=$keystore_id |
Ed James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 59 | done |
| 60 | |
Matthias Kaehlcke | 06004a0 | 2015-03-27 14:45:39 -0700 | [diff] [blame] | 61 | blaze --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 James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 64 | ) |
| 65 | |
| 66 | for 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 |
| 69 | done |
| 70 | |
| 71 | rm -f $binaries/gfiber_private.pem |
| 72 | |
| 73 | cat << EOF |
| 74 | ###################################################################### |
| 75 | Done |
| 76 | If all looks good and tests well, check in with the following |
Matthias Kaehlcke | 512046c | 2015-03-27 13:41:10 -0700 | [diff] [blame] | 77 | cp out/*.bin out/*.sig ../../loader-bin/mindspeed/$target/ |
| 78 | cd ../../loader-bin/mindspeed/$target/ |
Ed James | f6bffe6 | 2014-05-16 12:15:07 -0700 | [diff] [blame] | 79 | git add *.bin *.sig |
| 80 | git commit |
| 81 | git push gfiber-internal HEAD:refs/for/master |
| 82 | EOF |