-
Notifications
You must be signed in to change notification settings - Fork 5
/
ezyflash.sh
555 lines (476 loc) · 19.1 KB
/
ezyflash.sh
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
##
## Abaco Systems - GVC1000 flashing wizard (Unofficial)
##
## This script is an interactive installer for the GVC1000 and Jetson TX2 Evaluation
## boards. It is provided for refferance only and comes with absolutly no warrenty
## or support.
##
## Please use the production SDK for official L4T developemnt and support.
##
#!/bin/bash
# Uncomment the line below for the runtime libraries for production system
export TEGRA_KERNEL_OUT=build
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
LC_ALL="C.UTF-8"
SELF=$0
SECONDS=0
TIMEOUT=30
DATE=$(date "+%s")
CORES=$(nproc --all)
BOARD=jetson-tx2
RELEASE="unknown";
UBUNTU_RELEASE_VERSION=16.04.02
ABACO_TITLE="Easy Tegra TX2 System Setup"
OS="Ubuntu Base 16.04.2"
UBUNTU_BASE=" - Ubuntu Base 16.04.2"
PREPARE="Preparing Filesystem..."
CONFIGURE="Configuring Filesystem..."
PROGRESS_HEIGHT=7
ROOT=$PWD
KERNEL=kernel/kernel-4.4
KERNEL_PATH=kernel/kernel-4.4/build/arch/arm64/boot
KERNEL_IMAGE=kernel/kernel-4.4/build/arch/arm64/boot/Image
HOSTNAME=tx2
select_release()
{
REL=$1
case $REL in
R27_1)
RELEASE="R27.1";
NVIDIA_PATH=developer2.download.nvidia.com/embedded/L4T/r27_Release_v1.0
SAMPLE_FS_PACKAGE=Tegra_Linux_Sample-Root-Filesystem_R27.1.0_aarch64.tbz2
L4T_RELEASE_PACKAGE=Tegra186_Linux_R27.1.0_aarch64.tbz2
L4T_SOURCES=r27.1.0_sources.tbz2
L4T_COMPILER=gcc-4.8.5-aarch64.tgz
L4T_DOCS=Tegra_Linux_Driver_Package_Documents_R27.1.tar
KERNEL_SOURCES_DIR=""
KERNEL_SOURCES=kernel_src.tbz2
;;
R28_1)
# http://developer2.download.nvidia.com/embedded/L4T/r28_Release_v1.0/BSP/source_release.tbz2
RELEASE="R28.1";
NVIDIA_PATH=developer2.download.nvidia.com/embedded/L4T/r28_Release_v1.0
SAMPLE_FS_PACKAGE=Tegra_Linux_Sample-Root-Filesystem_R28.1.0_aarch64.tbz2
L4T_RELEASE_PACKAGE=Tegra186_Linux_R28.1.0_aarch64.tbz2
L4T_SOURCES=source_release.tbz2
L4T_COMPILER=gcc-4.8.5-aarch64.tgz
L4T_DOCS=NVIDIA_Tegra_Linux_Driver_Package.tar
KERNEL_SOURCES_DIR=sources
KERNEL_SOURCES=kernel_src-tx2.tbz2
;;
esac
# Common downloads
SAMPLE_BASE_FS_PACKAGE=ubuntu-base-16.04.2-base-arm64.tar.gz
PACKLUNCH_FILENAME="packlunch-${RELEASE}.cfg"
}
cleanup() {
rm -f /tmp/menu.sh* > /dev/null
rm -f /tmp/build.txt > /dev/null
rm -f /tmp/file.txt > /dev/null
}
abort() {
dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "Abort" \
--msgbox "Board not flashed please run this script again!!!" 6 60
cleanup
clear
}
check_connected() {
lsusb | grep -i nvidia &> /dev/null
NVIDIA_READY=$?
if ((${NVIDIA_READY} > 0)); then
NVIDIA_READY="\Z1WARNING: Could not find nVidia device on USB. Please run 'lsusb' and make sure your device is connected to the host before continuing.\Z0\n"
else
NVIDIA_READY="\Z2Found nVidia device on USB ready to flash.\Z0\n"
fi
dialog --colors --backtitle "${ABACO_TITLE}" \
--msgbox "Target check:\n\n${NVIDIA_READY}\n" 9 60
}
clean() {
cd ${ROOT}/Linux_for_Tegra/rootfs &> /dev/null
chroot . /bin/bash -c "apt-get clean &> /dev/null"
chroot . /bin/bash -c "rm -rf /var/lib/apt/lists/*"
chroot . /bin/bash -c "rm -f /usr/bin/qemu-aarch64-static"
cd - &> /dev/null
}
flash_filesystem() {
cd $ROOT/Linux_for_Tegra &> /dev/null
FLASH_OK=false;
while [ $FLASH_OK = false ]; do
lsusb | grep -i nvidia &> /dev/null
NVIDIA_READY=$?
if [ ${NVIDIA_READY} -gt 0 ]; then
NVIDIA_READY="\Z1CAUTION: Could not find nVidia device on USB. Please run 'lsusb' and make sure your device is connected to the host before continuing.\Z0\n"
else
NVIDIA_READY="\Z2NOTE: Found nVidia device on USB ready to flash.\Z0\n"
fi
dialog --colors --backtitle "${ABACO_TITLE}" \
--help-button --help-label "Re-check" --yesno "Are you ready to flash the filesystem?\n\n${NVIDIA_READY}\n" 9 60
response=$?
case $response in
0) clean; # Last thing we do is clean the filesystem
sudo ./flash.sh $1 ${BOARD} mmcblk0p1 2> /dev/null | dialog --colors --backtitle "${ABACO_TITLE} - \Z1Please wait for flashing to complete\Z0" --exit-label 'Exit when flash completes' --programbox "Flashing target..." 25 85 2> /dev/null; FLASH_OK=true;;
1) abort; clear; exit -1;;
255) echo "[ESC] key pressed.";;
esac
done
exit
cd - &> /dev/null
}
check_for_kernel_update() {
cd ${ROOT}/Linux_for_Tegra &> /dev/null
if [ -f ../$KERNEL_PATH/Image ]; then
d=$(stat -c%y ../$KERNEL_PATH/Image | cut -d'.' -f1)
dialog --colors --backtitle "${ABACO_TITLE}${VERSION}" \
--yesno "Rebuilt kernel image detected, would copy this into the filesystem?\n\n KERNEL BUILT : \Z6$d\Zn" 9 60
response=$?
case $response in
0) cp $ROOT/$KERNEL_PATH/Image ./kernel/Image &> /dev/null
cp $ROOT/$KERNEL_PATH/zImage ./kernel/zImage &> /dev/null
cp $ROOT/$KERNEL/$TEGRA_KERNEL_OUT/modules/kernel_supplements.tbz2 ./kernel/kernel_supplements.tbz2 &> /dev/null
cp $ROOT/$KERNEL/$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/* ./kernel/dtb &> /dev/null
;;
esac
fi
cd - &> /dev/null
}
ask_open_shell() {
cd ${ROOT}$1 &> /dev/null
dialog --defaultno --colors --backtitle "${ABACO_TITLE}${VERSION}" \
--yesno "Do you want to open a filesystem terminal?\n\nNOTE: This can be usefull for manually configuring your filesystem prior to flashing. $2\Zn\n" 10 60
response=$?
case $response in
0) cd $ROOT/Linux_for_Tegra/rootfs;gnome-terminal -e "bash -c \"printf 'Abaco QEMU shell for $OS\nPlease make any modifications then type exit to finish:\n\n';LANG=en_US.UTF-8 chroot . /bin/bash\"" &> /dev/null
cd .. &> /dev/null
dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "QEMU filesystem shell open..." --msgbox "Press OK when you have finished modifying the filesystem." 5 70
;;
esac
cd - &> /dev/null
}
#
# https://developer.nvidia.com/embedded/linux-tegra (Stable)
#
setup_l4t () {
OS="Ubuntu 16.04 LTS (L4T ${RELEASE})"
USER=nvidia
PASSWORD=nvidia
VERSION=" - $OS"
cmd="dialog --backtitle \"${ABACO_TITLE}\" \
--title \"Select your filesystem\" \
--no-cancel \
--menu \"You can use the UP/DOWN arrow keys, the first letter of the choice as a hot key.\" 16 65 6 \
cmdline \"Minimal command line (with networking)\" \
xfce4 \"Xfce4 Desktop Environment (with networking)\" \
lxde \"Lxde Desktop Environment (with networking)\" \
nvidia \"L4T R28.1 Full Unity Desktop\" \
${FLASH_QUICK} ${FLASH_QUICK_MENU} \
Exit \"Exit to the shell\" 2> \"${INPUT}\""
eval $cmd
menuitem=$(cat ${INPUT})
# make decsion
case $menuitem in
cmdline) DOWNLOAD_PATH=github.com/Abaco-Systems/tx2-sample-filesystems/releases/download/R28_1;
DOWNLOAD_FS=Tegra_Linux_Sample-Root-Filesystem_Debootstrap_cmdline_aarch64.tbz2;
VERSION=" - Github Debootstrap command line Ubuntu (xenial)"
USER=abaco;PASSWORD=abaco;
;;
xfce4) DOWNLOAD_PATH=github.com/Abaco-Systems/tx2-sample-filesystems/releases/download/R28_1;
DOWNLOAD_FS=Tegra_Linux_Sample-Root-Filesystem_Debootstrap_xfce4_aarch64.tbz2;
VERSION=" - Github Debootstrap Xfce4 line Ubuntu (xenial)"
USER=abaco;PASSWORD=abaco;
;;
lxde) DOWNLOAD_PATH=github.com/Abaco-Systems/tx2-sample-filesystems/releases/download/R28_1;
DOWNLOAD_FS=Tegra_Linux_Sample-Root-Filesystem_Debootstrap_lxde_aarch64.tbz2;
VERSION=" - Github Debootstrap Lxdes line Ubuntu (xenial)"
USER=abaco;PASSWORD=abaco;
;;
nvidia) DOWNLOAD_PATH=${NVIDIA_PATH}/BSP;DOWNLOAD_FS=${SAMPLE_FS_PACKAGE};;
Exit) abort;exit;;
esac
if [ -d "Linux_for_Tegra" ]; then
echo '15' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${PREPARE}" --gauge 'Removing old Files.' ${PROGRESS_HEIGHT} 75 0
rm -rf Linux_for_Tegra/ &> /dev/null
fi
echo '20' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${PREPARE}" --gauge "Downloading filesystem ${DOWNLOAD_FS}" ${PROGRESS_HEIGHT} 75 0
wget -nc -q http://${DOWNLOAD_PATH}/${DOWNLOAD_FS}
DOWNLOAD_FS=${ROOT}/${DOWNLOAD_FS}
echo '40' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${PREPARE}" --gauge "Downloading drivers ${L4T_RELEASE_PACKAGE}" ${PROGRESS_HEIGHT} 75 0
wget -nc -q http://${NVIDIA_PATH}/BSP/${L4T_RELEASE_PACKAGE}
echo '60' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${PREPARE}" --gauge "Expanding ${L4T_RELEASE_PACKAGE}" ${PROGRESS_HEIGHT} 75 0
tar xf ./${L4T_RELEASE_PACKAGE}
cd $ROOT/Linux_for_Tegra/rootfs &> /dev/null
TMP=${DOWNLOAD_FS##*/}
echo '80' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${PREPARE}" --gauge "Expanding ${TMP}" ${PROGRESS_HEIGHT} 75 0
tar xpf ${DOWNLOAD_FS}
cd .. &> /dev/null
echo '90' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${CONFIGURE}" --gauge 'Applying binaries...' ${PROGRESS_HEIGHT} 75
./apply_binaries.sh > /dev/null
echo '95' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${CONFIGURE}" --gauge 'Setting up QEMU emulator...' ${PROGRESS_HEIGHT} 75
cp /usr/bin/qemu-aarch64-static ./rootfs/usr/bin/. &> /dev/null
# If the kernel has been rebuilt offer to copy the Image in
check_for_kernel_update
cd $ROOT/Linux_for_Tegra/rootfs &> /dev/null
echo '10' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${CONFIGURE}" --gauge 'Enabling other sources...' ${PROGRESS_HEIGHT} 70
chroot . /bin/bash -c "sed -i 's/# deb http/deb http/g' /etc/apt/sources.list"
echo '20' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${CONFIGURE}" --gauge 'Updating apt-get...' ${PROGRESS_HEIGHT} 70
chroot . /bin/bash -c "apt-get update > /dev/null"
# Offer to open a QEMU chroot shell for manual probing of filesystem
ask_open_shell /Linux_for_Tegra/rootfs
# Now flash the target
flash_filesystem
dialog --backtitle "${ABACO_TITLE}${VERSION}" \
--colors \
--title "Target system should be rebooting now..." \
--msgbox "\n
Filesystem setup complete you can now login using:\n
username:\Zb\Z0${USER}\Zn\n
password:\Zb\Z0${PASSWORD}\Zn\n\n
\n\n" 12 70
clear
}
check_setup() {
if [ "$EUID" -ne 0 ]
then
printf "Please run from root shell or from user as show below:\n sudo bash -c \"./ezyflash.sh\"\n\n"
exit -1
fi
# Check that we can run the menu system
if which dialog > /dev/null
then
# Found so do nothing
echo "Ok lets continue" &> /dev/null
else
read -p "Install dialog command (y/n)?" choice
case "$choice" in
y|Y ) apt-get -qqy install dialog;;
n|N ) echo "Command required quitting..."; exit;;
* ) echo "invalid";;
esac
fi
}
#
# Download and rebuild the kernel source
#
rebuild_kernel() {
export CROSS_COMPILE=$ROOT/install/bin/aarch64-unknown-linux-gnu-
export ARCH=arm64
CONFIG=tegra18_defconfig
VERSION=" - Kernel-4.4"
BUILD="Configuring host build system"
# Get the kernel source for our board
echo '10' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge 'Removing old sources...' ${PROGRESS_HEIGHT} 70
rm -rf install
rm -rf kernel
rm -rf sources
rm -rf nvl4t_docs
rm -rf build
rm -rf hardware
echo '15' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge "Getting kernel sources $L4T_SOURCES..." ${PROGRESS_HEIGHT} 70
wget -nc -q http://${NVIDIA_PATH}/BSP/${L4T_SOURCES}
echo '30' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge 'Getting toolchain...' ${PROGRESS_HEIGHT} 70
wget -nc -q http://${NVIDIA_PATH}/BSP/${L4T_COMPILER}
echo '50' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge 'Getting documentation...' ${PROGRESS_HEIGHT} 70
wget -nc -q http://${NVIDIA_PATH}/Docs/${L4T_DOCS}
echo '60' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge 'Unpacking sources archive...' ${PROGRESS_HEIGHT} 70
case $REL in
R27_1)
tar xjf ${L4T_SOURCES} ${KERNEL_SOURCES}
;;
R28_1)
tar xjf ${L4T_SOURCES} ${KERNEL_SOURCES_DIR}/${KERNEL_SOURCES}
;;
esac
echo '70' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge 'Unpacking compiler archive...' ${PROGRESS_HEIGHT} 70
tar xfz ${L4T_COMPILER}
echo '80' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge 'Unpacking documentation archive...' ${PROGRESS_HEIGHT} 70
tar xf ${L4T_DOCS}
echo '90' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${BUILD}" --gauge 'Unpacking kernel archive...' ${PROGRESS_HEIGHT} 70
case $REL in
R27_1)
tar xjf ${KERNEL_SOURCES}
;;
R28_1)
tar xjf ${KERNEL_SOURCES_DIR}/${KERNEL_SOURCES}
;;
esac
if [ -f ${L4T_DOCS} ]; then
dialog --colors --defaultno --backtitle "${ABACO_TITLE}${VERSION}" \
--yesno "Do you want to open the kernel documentation?\n" 6 60
response=$?
case $response in
0) firefox $ROOT/nvl4t_docs/index.html &> /dev/null &;;
esac
fi
# create .config the offer to edit it (menuconfig)
cd $ROOT/$KERNEL &> /dev/null
mkdir $TEGRA_KERNEL_OUT &> /dev/null
make mrproper
BOX_TYPE=--programbox
make -j$CORES O=$TEGRA_KERNEL_OUT ${CONFIG} 2> /dev/null | dialog --colors --backtitle "${ABACO_TITLE} - \Z1Please wait for build to complete\Z0" --timeout $TIMEOUT $BOX_TYPE "Building ${CONFIG}..." 25 85
dialog --colors --defaultno --backtitle "${ABACO_TITLE}${VERSION}" \
--yesno "Do you want to run menuconfig?\n" 6 60
response=$?
MENUCONFIG="Setting up Menuconfig"
case $response in
0) echo '50' | dialog --backtitle "${ABACO_TITLE}${VERSION}" --title "${MENUCONFIG}" --gauge 'Installing libcursers...' ${PROGRESS_HEIGHT} 70
apt-get -qqy install libncurses5-dev &> /dev/null # cant build menusystem without this on 16.04 LTS
make menuconfig KCONFIG_CONFIG=$TEGRA_KERNEL_OUT/.config 2> /dev/null
;;
esac
dialog --backtitle "${ABACO_TITLE}${VERSION}" \
--title "Build Environment" \
--colors \
--ok-label "Build Kernel" \
--msgbox "CROSS_COMPILE=${CROSS_COMPILE}
TEGRA_KERNEL_OUT=$TEGRA_KERNEL_OUT\n
ARCH=$ARCH\n
CONFIG=$CONFIG\n
KERNEL=/$KERNEL\n" 10 70
KBUILD_START=$SECONDS
make -j$CORES O=$TEGRA_KERNEL_OUT zImage 2> /dev/null | dialog --colors --backtitle "${ABACO_TITLE} - \Z1Please wait for build to complete\Z0" --timeout $TIMEOUT $BOX_TYPE "Building zImage..." 25 85
make -j$CORES O=$TEGRA_KERNEL_OUT dtbs 2> /dev/null | dialog --colors --backtitle "${ABACO_TITLE} - \Z1Please wait for build to complete\Z0" --timeout $TIMEOUT $BOX_TYPE "Building dtbs..." 25 85
make -j$CORES O=$TEGRA_KERNEL_OUT modules 2> /dev/null | dialog --colors --backtitle "${ABACO_TITLE} - \Z1Please wait for build to complete\Z0" --timeout $TIMEOUT $BOX_TYPE "Building modules..." 25 85
mkdir $TEGRA_KERNEL_OUT/modules
make -j$CORES O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=./modules | dialog --colors --backtitle "${ABACO_TITLE} - \Z1Please wait for build to complete\Z0" --timeout $TIMEOUT $BOX_TYPE "Installing Modules..." 25 85
cd $TEGRA_KERNEL_OUT/modules &> /dev/null
tar --owner root --group root -cjf kernel_supplements.tbz2 lib/modules
cd - &> /dev/null
KBUILD_END=$SECONDS
KBUILD_TIME=$(($KBUILD_END - $KBUILD_START))
# Basic usage info (anonymous)
wget -O /dev/null "http://dweet.io/dweet/for/abaco-kernel-setup?OS=Ubuntu_Base&Version=16.04.2&Setup_Time=$SECONDS&Build_Time=$KBUILD_TIME&Date=$DATE" &> /dev/null
dialog --backtitle "${ABACO_TITLE}${VERSION}" \
--title "Compilation Complete (${SECONDS}s)" \
--colors \
--ok-label "Quit" \
--msgbox "
Copy the kernel to your target /boot :\n\n
\Z6./kernel/kernel-4.4/build/arch/arm64/boot/Image\Zn\n
\Z6./kernel/kernel-4.4/build/arch/arm64/boot/zImage\Zn\n
\Z6./kernel/kernel-4.4/build/modules/kernel_supplements.tbz2\Zn\n\n
To remove downloads type :\n
\Z6$SELF clean\Zn\n
\Z6$SELF kclean (remove kernel dir only)\Zn\n\n
To finish desktop installation please run ./complete_desktop_install.sh on target." 14 70
cd - &> /dev/null
cleanup
clear
}
##
## Main scripting block
## Check filesystem choice and invoke setup. This script will:
## * Download the neccessary files
## * Expand the archives
## * Do any filesystem configuration
## * Apply nVidia binaries
## * Flash the image to the target
##
# Check for non interactive commands
if [ "$1" = "clean" ]
then
echo Removing file system directory...
rm -f ${SAMPLE_FS_PACKAGE}
rm -f ${SAMPLE_BASE_FS_PACKAGE}
rm -f ${L4T_RELEASE_PACKAGE}
rm -rf Linux_for_Tegra/
rm -rf install
rm -rf kernel
rm -rf nvl4t_docs
rm -rf build
rm -rf hardware
rm -f *.tar
rm -f *.tgz
rm -f *.tbz2
rm -f *.txt
rm -f *.html
echo Done.
exit
fi
if [ "$1" = "kclean" ]
then
echo Removing kernel directory...
rm -rf kernel
echo Done.
exit
fi
if [ "$1" = "remove" ]
then
echo Removing install dependancies...
apt-get -qqy remove libncurses5-dev dialog
apt -qqy autoremove
echo Done.
exit
fi
if [ "$1" = "create" ]
then
echo Creating template $PACKAGES_FILENAME...
create_packages $PACKAGES_FILENAME
echo Done.
exit
fi
check_setup
dialog --backtitle "${ABACO_TITLE}" \
--title "nVidia TX2 device setup tool" \
--colors \
--ok-label "Install R28.1" \
--extra-button \
--extra-label "Install R27.1" \
--yesno " \n
TX2 build and flash script \n
ross.newman@abaco.com (Field Applications Engineer) \n
\n
Script to download and flash TX2 Tegra sample file systems.\n
$ abaco-flash.sh (interactive setup)\n
$ abaco-flash.sh clean (remove all temporary files)\n
$ abaco-flash.sh kclean (remove kernel temporary file)\n
$ abaco-flash.sh remove (remove apt-get installer packages)\n
$ abaco-flash.sh create (create template packages file)\n
\n
Please place board into recovery mode and connect to (this) host machine.\n\n
\Z3WARNING: Computer must be connected to the internet to download required packages\Z0\n\n
\Z1NOTE: This script is provided without any warrenty or support what so ever, for refference only.\Z0\n" 23 75
response=$?
case $response in
0) select_release R28_1;;
1) abort; clear; exit -1;;
3) select_release R27_1;;
255) abort; clear; echo "[ESC] key pressed."; exit -1;;
esac
### display main menu ###
if [ -f ./Linux_for_Tegra/bootloader/system.img ];then
FLASH_QUICK_MENU='"Quickly flash the last system.img"'
FLASH_QUICK=quick
else
FLASH_QUICK_MENU=
FLASH_QUICK=''
fi
if [ -f ./Linux_for_Tegra/bootloader/tegraflash.py ];then
# The clone function appears to no longer work on the TX2 so removing it for now
# BACKUP_MENU='"Create a backup image"'
# BACKUP=backup
# RESTORE_MENU='"Quickly flash the last system.img"'
# RESTORE=restore
dummy=0
fi
INPUT=/tmp/menu.sh.$$
# Not supported
# arch \"Install the latest version of archlinux (Alpha)\" \
cmd="dialog --backtitle \"${ABACO_TITLE}\" \
--title \"Select your filesystem\" \
--no-cancel \
--menu \"You can use the UP/DOWN arrow keys, the first letter of the choice as a hot key.\" 16 65 6 \
flash \"Flash a filesystem\" \
kernel \"Rebuild the Linux kernel\" \
${FLASH_QUICK} ${FLASH_QUICK_MENU} \
Exit \"Exit to the shell\" 2> \"${INPUT}\""
eval $cmd
menuitem=$(cat ${INPUT})
# make decsion
case $menuitem in
flash) setup_l4t;;
kernel) rebuild_kernel;;
quick) cd $ROOT/Linux_for_Tegra &> /dev/null;pwd; exit;flash_filesystem -r;cd ..;clear;;
Exit) abort;exit;;
esac
cleanup
echo " How did I get here ?"