Dmitry Shmidt | 5d08080 | 2017-04-11 14:20:03 -0700 | [diff] [blame] | 1 | # Copyright 2011, 2016 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | |
Amit Pundir | e0b34ce | 2023-10-19 18:29:28 +0530 | [diff] [blame] | 16 | DEVICE_DIR=device/linaro/hikey960/ |
Dmitry Shmidt | 5d08080 | 2017-04-11 14:20:03 -0700 | [diff] [blame] | 17 | DEVICE=hikey960 |
| 18 | PRODUCT=hikey960 |
| 19 | |
| 20 | BUILD=eng.`whoami` |
| 21 | BUILDNAME=`ls ${ANDROID_BUILD_TOP}/${PRODUCT}-img-${BUILD}.zip 2> /dev/null` |
| 22 | if [ $? -ne 0 ]; then |
| 23 | VERSION=linaro-`date +"%Y.%m.%d"` |
| 24 | else |
| 25 | BUILDNAME=`ls ${ANDROID_BUILD_TOP}/${PRODUCT}-img-*.zip 2> /dev/null` |
| 26 | BUILD=`basename ${BUILDNAME} | cut -f3 -d'-' | cut -f1 -d'.'` |
| 27 | VERSION=$BUILD |
| 28 | fi |
| 29 | |
| 30 | # Prepare the staging directory |
| 31 | rm -rf tmp |
| 32 | mkdir -p tmp/$PRODUCT-$VERSION |
| 33 | |
| 34 | # copy over bootloader binaries |
John Stultz | ad036af | 2018-04-05 20:05:24 -0700 | [diff] [blame] | 35 | cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-bl31.bin tmp/$PRODUCT-$VERSION/ |
Vishal Bhoj | bb54636 | 2017-10-09 23:05:46 +0530 | [diff] [blame] | 36 | cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-fastboot.img tmp/$PRODUCT-$VERSION/ |
John Stultz | ad036af | 2018-04-05 20:05:24 -0700 | [diff] [blame] | 37 | cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-lpm3.img tmp/$PRODUCT-$VERSION/ |
| 38 | cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-nvme.img tmp/$PRODUCT-$VERSION/ |
Vishal Bhoj | bb54636 | 2017-10-09 23:05:46 +0530 | [diff] [blame] | 39 | cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-ptable.img tmp/$PRODUCT-$VERSION/ |
Vishal Bhoj | bb54636 | 2017-10-09 23:05:46 +0530 | [diff] [blame] | 40 | cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-sec_xloader.img tmp/$PRODUCT-$VERSION/ |
John Stultz | ad036af | 2018-04-05 20:05:24 -0700 | [diff] [blame] | 41 | cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/README tmp/$PRODUCT-$VERSION/ |
Dmitry Shmidt | 5d08080 | 2017-04-11 14:20:03 -0700 | [diff] [blame] | 42 | |
| 43 | # copy over dts.img |
| 44 | cp $ANDROID_BUILD_TOP/out/target/product/hikey960/dt.img tmp/$PRODUCT-$VERSION/ |
| 45 | |
| 46 | # copy over the update image |
| 47 | cp ${SRCPREFIX}$PRODUCT-img-$BUILD.zip tmp/$PRODUCT-$VERSION/image-$PRODUCT-$VERSION.zip |
| 48 | |
| 49 | # XXX hikey960's fastboot update currently doesn't format cache/userdata, so do it manually |
| 50 | # XXX Remove this when the bug is fixed. |
| 51 | cp $ANDROID_BUILD_TOP/out/target/product/hikey960/cache.img tmp/$PRODUCT-$VERSION/ |
| 52 | cp $ANDROID_BUILD_TOP/out/target/product/hikey960/userdata.img tmp/$PRODUCT-$VERSION/ |
| 53 | |
| 54 | |
| 55 | # Write flash-all.sh |
| 56 | cat > tmp/$PRODUCT-$VERSION/flash-all.sh << EOF |
| 57 | #!/bin/bash |
| 58 | |
| 59 | # Copyright 2012, 2016 The Android Open Source Project |
| 60 | # |
| 61 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 62 | # you may not use this file except in compliance with the License. |
| 63 | # You may obtain a copy of the License at |
| 64 | # |
| 65 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 66 | # |
| 67 | # Unless required by applicable law or agreed to in writing, software |
| 68 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 69 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 70 | # See the License for the specific language governing permissions and |
| 71 | # limitations under the License. |
| 72 | |
| 73 | |
| 74 | |
John Stultz | ad036af | 2018-04-05 20:05:24 -0700 | [diff] [blame] | 75 | fastboot flash xloader hisi-sec_xloader.img |
| 76 | fastboot flash ptable hisi-ptable.img |
| 77 | fastboot flash fastboot hisi-fastboot.img |
Guodong Xu | 6eb8215 | 2017-08-15 11:40:20 +0800 | [diff] [blame] | 78 | fastboot reboot-bootloader |
John Stultz | ad036af | 2018-04-05 20:05:24 -0700 | [diff] [blame] | 79 | fastboot flash nvme hisi-nvme.img |
| 80 | fastboot flash fw_lpm3 hisi-lpm3.img |
| 81 | fastboot flash trustfirmware hisi-bl31.bin |
Dmitry Shmidt | 5d08080 | 2017-04-11 14:20:03 -0700 | [diff] [blame] | 82 | fastboot flash dts dt.img |
| 83 | |
| 84 | # XXX fastboot update doesn't format cache and userdata |
| 85 | # XXX so flash those manually. Remove this later. |
| 86 | fastboot flash cache cache.img |
| 87 | fastboot flash userdata userdata.img |
| 88 | |
| 89 | fastboot update image-$PRODUCT-$VERSION.zip |
| 90 | EOF |
| 91 | |
| 92 | chmod a+x tmp/$PRODUCT-$VERSION/flash-all.sh |
| 93 | |
| 94 | # Create the distributable package |
| 95 | (cd tmp ; zip -r ../$PRODUCT-$VERSION-factory.zip $PRODUCT-$VERSION) |
| 96 | mv $PRODUCT-$VERSION-factory.zip $PRODUCT-$VERSION-factory-$(sha256sum < $PRODUCT-$VERSION-factory.zip | cut -b -8).zip |
| 97 | |
| 98 | # Clean up |
| 99 | rm -rf tmp |