blob: 702ddbe28252ec08814a43e11b1ffe4ab651051e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#!/bin/sh
#
# Usage: fb.sh [--prep] [--wait]
#
# No arguments does what is needed to get us into fastboot and
# send the kernel on fastboot
#
# --prep just gets us into fastboot and terminates
# --wait Don't reset, --prep is running in the background
B=32
if [ ! -z "$BITS" ] ; then
B=$BITS
fi
# only used for modules
O=panda
STAGING=staging
LIBMODS=$O/$STAGING/lib/modules
KVER=`ls -1 $LIBMODS`
if [ $B -eq 32 ] ; then
ARCH=arm
FILE=zImage-dtb
#IR=initramfs
IR=
#CMDLINE="console=ttyMSM0 root=/dev/mmcblk0p27 rw rootwait loglevel=4 rdinit=/bin/bash"
CMDLINE="console=ttyMSM0 root=/dev/mmcblk0p27 rw rootwait loglevel=4"
else
ARCH=arm64
FILE=Image.gz-dtb
fi
DTR=./tools/dtr-control/dtr-control
DEV=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AK003YV5-if00-port0
if [ ! -f $DEV ]; then
DEV=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AK*-if00-port0
fi
echo $ARCH
#CMDLINE="console=ttyMSM0 rdinit=/bin/bash"
#CMDLINE="console=ttyMSM0 rdinit=/bin/bash"
#CMDLINE="console=ttyHSL0,115200,n8 loglevel=4 rdinit=/bin/bash"
#CMDLINE="keep_bootcon console=ttyHSL0,115200,n8 earlyprintk=1 earlycon=ttyHSL0,115200,n8 rdinit=/bin/bash"
STATE=0
while [ $STATE -ne 3 ] ; do
if [ ! -z "`sudo fastboot devices`" ] ; then
echo "Step 4 / 4: Fastboot ready"
STATE=3
continue;
fi
if [ ! -z "`sudo adb devices | cut -f2 | grep "^dev"`" ] ; then
if [ "$1" == "--wait" ] ; then
if [ ! -z "$O" ] ; then
echo "Step 2 / 4: Updating /lib/modules"
# adb push dies on symlinks, remove
rm -f $LIBMODS/$KVER/build $LIBMODS/$KVER/source
# make /data writeable, then /data/lib writeable
# and creat /data/lib/modules as root
echo -e "system-mksh\nchmod 777 /data\nexit\nsumksh\nchmod 777 /data/lib\nmkdir /data/lib/modules\nexit\nexit\n" | sudo adb shell
# send the modules
sudo adb push panda/staging/lib/modules /data/lib/modules
fi
echo "Step 3 / 4: Restarting into fastboot"
sudo adb reboot-bootloader
STATE=2
else
exit 0
fi
fi
if [ $STATE -eq 0 ] ; then
if [ "$1" != "--wait" ] ; then
echo "Step 1 / 4: Resetting via stock"
$DTR $DEV
fi
STATE=1
continue;
fi
sleep 1s
done
if [ "$1" = "--prep" ] ; then
exit 0
fi
if [ -f panda/arch/$ARCH/boot/$FILE ]; then
sudo fastboot boot \
panda/arch/$ARCH/boot/$FILE $IR \
-p "msm8916" \
-c "$CMDLINE"
fi
|