blob: 73a391d2cee12758af6c1e8337368c0dd819b188 [file] [log] [blame]
Dmitry Shmidt5d080802017-04-11 14:20:03 -07001# 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 Pundire0b34ce2023-10-19 18:29:28 +053016DEVICE_DIR=device/linaro/hikey960/
Dmitry Shmidt5d080802017-04-11 14:20:03 -070017DEVICE=hikey960
18PRODUCT=hikey960
19
20BUILD=eng.`whoami`
21BUILDNAME=`ls ${ANDROID_BUILD_TOP}/${PRODUCT}-img-${BUILD}.zip 2> /dev/null`
22if [ $? -ne 0 ]; then
23 VERSION=linaro-`date +"%Y.%m.%d"`
24else
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
28fi
29
30# Prepare the staging directory
31rm -rf tmp
32mkdir -p tmp/$PRODUCT-$VERSION
33
34# copy over bootloader binaries
John Stultzad036af2018-04-05 20:05:24 -070035cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-bl31.bin tmp/$PRODUCT-$VERSION/
Vishal Bhojbb546362017-10-09 23:05:46 +053036cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-fastboot.img tmp/$PRODUCT-$VERSION/
John Stultzad036af2018-04-05 20:05:24 -070037cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-lpm3.img tmp/$PRODUCT-$VERSION/
38cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-nvme.img tmp/$PRODUCT-$VERSION/
Vishal Bhojbb546362017-10-09 23:05:46 +053039cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-ptable.img tmp/$PRODUCT-$VERSION/
Vishal Bhojbb546362017-10-09 23:05:46 +053040cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/hisi-sec_xloader.img tmp/$PRODUCT-$VERSION/
John Stultzad036af2018-04-05 20:05:24 -070041cp $ANDROID_BUILD_TOP/$DEVICE_DIR/installer/hikey960/README tmp/$PRODUCT-$VERSION/
Dmitry Shmidt5d080802017-04-11 14:20:03 -070042
43# copy over dts.img
44cp $ANDROID_BUILD_TOP/out/target/product/hikey960/dt.img tmp/$PRODUCT-$VERSION/
45
46# copy over the update image
47cp ${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.
51cp $ANDROID_BUILD_TOP/out/target/product/hikey960/cache.img tmp/$PRODUCT-$VERSION/
52cp $ANDROID_BUILD_TOP/out/target/product/hikey960/userdata.img tmp/$PRODUCT-$VERSION/
53
54
55# Write flash-all.sh
56cat > 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 Stultzad036af2018-04-05 20:05:24 -070075fastboot flash xloader hisi-sec_xloader.img
76fastboot flash ptable hisi-ptable.img
77fastboot flash fastboot hisi-fastboot.img
Guodong Xu6eb82152017-08-15 11:40:20 +080078fastboot reboot-bootloader
John Stultzad036af2018-04-05 20:05:24 -070079fastboot flash nvme hisi-nvme.img
80fastboot flash fw_lpm3 hisi-lpm3.img
81fastboot flash trustfirmware hisi-bl31.bin
Dmitry Shmidt5d080802017-04-11 14:20:03 -070082fastboot flash dts dt.img
83
84# XXX fastboot update doesn't format cache and userdata
85# XXX so flash those manually. Remove this later.
86fastboot flash cache cache.img
87fastboot flash userdata userdata.img
88
89fastboot update image-$PRODUCT-$VERSION.zip
90EOF
91
92chmod 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)
96mv $PRODUCT-$VERSION-factory.zip $PRODUCT-$VERSION-factory-$(sha256sum < $PRODUCT-$VERSION-factory.zip | cut -b -8).zip
97
98# Clean up
99rm -rf tmp