install.sh 20.1 KB
Newer Older
1
#!/usr/bin/env bash
2

3
4
set -e

5
6
7
QEMU_DIR=${QEMU_DIR:=qemu-eos}

# paths relative to QEMU_DIR (where it will be installed)
alex@thinkpad's avatar
alex@thinkpad committed
8
QEMU_NAME=${QEMU_NAME:=qemu-2.5.0}
9
10
11
ML_PATH=${ML_PATH:=../magic-lantern}

ML_NAME=${ML_PATH##*/}
12
GREP=${GREP:=grep}
13
ALLOW_64BIT_GDB=n
14
WGET_OPTS="-c -q --show-progress --progress=dot:giga"
15
16
17
18
19
20

echo
echo "This will setup QEMU for emulating Magic Lantern."
echo "Thou shalt not be afraid of compiling stuff on Linux ;)"
echo -n "Continue? [y/n] "
read answer
21
22
23
if test "$answer" != "Y" -a "$answer" != "y"; then exit 0; fi
echo

24
function install_gcc {
25
26
27

    UNTAR="tar -jxf"

28
    if [ $(uname) == "Darwin" ]; then
29
        # Mac: 64-bit (we'll have to compile a 32-bit GDB)
30
31
32
33
34
        TOOLCHAIN=gcc-arm-none-eabi-7-2017-q4-major
        DOWNLOAD=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2017q4/
        MIRROR="$DOWNLOAD"
        TARBALL=$TOOLCHAIN-mac.tar.bz2
    elif [  -n "$(uname -a | grep Microsoft)" ]; then
35
        # WSL: 64-bit (we'll have to compile a 32-bit GDB)
36
37
38
39
        TOOLCHAIN=gcc-arm-none-eabi-7-2017-q4-major
        DOWNLOAD=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2017q4/
        MIRROR="$DOWNLOAD"
        TARBALL=$TOOLCHAIN-linux.tar.bz2
40
    else
41
42
43
44
45
        # Linux (other than WSL) - use a 32-bit build (preferred, even though it's older)
        TOOLCHAIN=gcc-arm-none-eabi-5_4-2016q3
        DOWNLOAD=https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/
        MIRROR=https://developer.arm.com/-/media/Files/downloads/gnu-rm/5_4-2016q3/
        TARBALL=$TOOLCHAIN-20160926-linux.tar.bz2
46
    fi
47

48
49
50
51
    echo "*** Will download $TOOLCHAIN from:"
    echo "    https://developer.arm.com/open-source/gnu-toolchain/gnu-rm"
    echo

52
53
    if [ ! -f ~/$TOOLCHAIN/bin/arm-none-eabi-gdb ]; then
        cd ~
54
        wget $WGET_OPTS $DOWNLOAD$TARBALL || wget $WGET_OPTS $MIRROR$TARBALL \
55
            && $UNTAR $TARBALL && rm $TARBALL
56
57
58
59
60
        cd -
    else
        echo "*** Toolchain already installed in:"
        echo "    ~/$TOOLCHAIN"
    fi
61

62
63
    echo
    echo "*** Please add GCC binaries to your executable PATH, then run this script again."
64
65
    echo "*** Run this command, or paste it into your .profile and reopen the terminal:"
    echo "    export PATH=~/$TOOLCHAIN/bin:\$PATH"
66
    echo
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
    exit
}

function install_gdb {
    # we may need to compile a recent GDB
    # the latest pre-built version is buggy (at the time of writing)
    # on Linux, the old 32-bit version works fine, but we can't run it on Mac/WSL
    GDB_DIR=$HOME/gdb-arm-none-eabi-8_1

    if [ ! -f $GDB_DIR/bin/arm-none-eabi-gdb ]; then
        pushd . > /dev/null
        local MIRROR=https://ftp.gnu.org/gnu
        mkdir $GDB_DIR
        cd $GDB_DIR
        echo "*** Setting up GDB in $(pwd)..."
        mkdir src
        cd src
        wget $WGET_OPTS $MIRROR/gdb/gdb-8.1.tar.xz
        echo
        tar xJf gdb-8.1.tar.xz || exit 1
        echo
        mkdir build-gdb
        cd build-gdb
        echo "Configuring arm-none-eabi-gdb... (configure.log)"
        ../gdb-8.1/configure --target=arm-none-eabi --prefix=$GDB_DIR/ &> configure.log || exit 1
        echo "Building arm-none-eabi-gdb... (make.log)"
        make all &> make.log || exit 1
        echo "Installing arm-none-eabi-gdb... (install.log)"
        make install &> install.log || exit 1
        popd > /dev/null
    else
        echo "*** GDB already installed in:"
        echo "    $GDB_DIR/bin/"
    fi

    echo
    echo "*** Please add GDB binaries to your executable PATH, then run this script again."
    echo "*** Run this command, or paste it into your .profile and reopen the terminal:"
    echo "    export PATH=$GDB_DIR/bin/:\$PATH"
    echo
    exit
108
109
}

110
function valid_arm_gdb {
111
112
113
114
115
    if ! arm-none-eabi-gdb -v &> /dev/null; then
        # not installed, or not able to run for any reason
        return 1
    fi

116
117
118
119
120
    if arm-none-eabi-gdb -v | grep " 8.1" &> /dev/null; then
        # this one is good, even if compiled for 64-bit
        return 0
    fi

121
122
    if [ "$ALLOW_64BIT_GDB" != "y" ]; then
        if arm-none-eabi-gdb -v | grep -q "host=x86_64"; then
123
            # 64-bit version - doesn't work well
124

125
126
            if [ $(uname) == "Darwin" ] || [  -n "$(uname -a | grep Microsoft)" ]; then
                # we don't have a 64-bit option on these systems
127
128
129
130
                # just warn about it (--strict is used for that), but consider it valid
                if [ "$1" != "--strict" ]; then
                    return 0
                fi
131
            fi
132
133
134
135
136

            # systems assumed to be able to run a 32-bit GDB
            # consider the 64-bit one invalid
            echo "*** WARNING: 64-bit GDB is known to have issues."
            return 1
137
        fi
138
139
140
141
142
143
144
    fi

    # assume it's OK
    # todo: check version number
    return 0
}

145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
function valid_arm_gcc {
    if ! arm-none-eabi-gcc -v &> /dev/null; then
        # not installed, or not able to run for any reason
        return 1
    fi

    echo "#include <stdlib.h>" > arm-gcc-test.c
    if ! arm-none-eabi-gcc -c arm-gcc-test.c; then
        echo "*** WARNING: your arm-none-eabi-gcc is unable to compile a simple program."
        rm arm-gcc-test.c
        return 1
    fi

    rm arm-gcc-test.c
    return 0
}

162
163
164
if [ $(uname) == "Darwin" ]; then
    echo "*** Installing dependencies for Mac..."
    echo
165
166
167
168
169
    # brew is "The missing package manager for macOS"
    # https://brew.sh
    if ! brew -v &> /dev/null; then
        ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    fi
170

171
    packages="python wget mercurial xz grep pkg-config glib automake libtool pixman mtools"
172
173
174
    for pkg in $packages; do
        brew list $pkg &> /dev/null || brew install $pkg
    done
175

176
    GREP=ggrep
177
178
fi

179
if [  -n "$(lsb_release -i 2>/dev/null | grep Ubuntu)" ]; then
180
    # Ubuntu-based system? (including WSL)
181
182
183
    # install these packages, if not already
    # only request sudo if any of them is missing
    # instead of GTK (libgtk2.0-dev), you may prefer SDL (libsdl1.2-dev)
184
    packages="
185
        build-essential mercurial pkg-config libtool
186
        git libglib2.0-dev libpixman-1-dev zlib1g-dev
187
        libgtk2.0-dev xz-utils mtools netcat-openbsd
188
189
190
191
192
193
        python python-pip python-docutils"

    # if a valid arm-none-eabi-gcc/gdb is already in PATH, try to use that
    # otherwise, we'll try to install something
    if ! valid_arm_gdb || ! valid_arm_gcc; then
        echo "*** You do not seem to have an usable arm-none-eabi-gcc and/or gdb installed."
194
        echo "*** 64-bit GDB is known to have issues, so you may want to install a 32-bit version."
195
196
197
        echo
        echo "*** You have a few options:"
        echo
alex@thinkpad's avatar
alex@thinkpad committed
198

199
        # 32-bit binaries not working under WSL - hide these options
alex@thinkpad's avatar
alex@thinkpad committed
200
201
202
        # fixme: hidden options can still be selected
        if [  -z "$(uname -a | grep Microsoft)" ]; then
            echo "1 - Install gdb-arm-none-eabi:i386 and gcc-arm-none-eabi from Ubuntu repo (recommended)"
203
            echo "    This will install 32-bit binaries."
204
            echo
alex@thinkpad's avatar
alex@thinkpad committed
205
            if dpkg -l binutils-arm-none-eabi 2>/dev/null | grep -q '^.i'; then
206
                echo "2 - Remove Ubuntu toolchain and install the one from gcc-arm-embedded PPA (gcc 6.x)"
alex@thinkpad's avatar
alex@thinkpad committed
207
208
209
210
                echo "    This will:"
                echo "    - sudo apt-get remove gcc-arm-none-eabi gdb-arm-none-eabi \\"
                echo "           binutils-arm-none-eabi libnewlib-arm-none-eabi"
            else
211
                echo "2 - Install the toolchain from gcc-arm-embedded PPA (gcc 6.x)"
alex@thinkpad's avatar
alex@thinkpad committed
212
213
214
215
                echo "    This will:"
            fi
            echo "    - sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa"
            echo "    - install the gcc-arm-embedded:i386 package."
216
            echo "    This will install 32-bit binaries."
alex@thinkpad's avatar
alex@thinkpad committed
217
            echo
218
219
            echo "3 - Install gcc-arm-none-eabi from Ubuntu repository (64-bit)"
            echo "    and compile arm-none-eabi-gdb 8.1 from source."
220
            echo
221
            echo "4 - Manually install arm-none-eabi-gdb from https://launchpad.net/gcc-arm-embedded"
222
223
            echo "    or any other source, make sure it is in PATH, then run this script again."
            echo
224
        else
225
            # WSL
226
            echo "1-2: options not available on Windows 10 WSL (32-bit Linux binaries not supported)."
227
            echo
228
229
            echo "3 - Install gcc-arm-none-eabi from Ubuntu repository (64-bit)"
            echo "    and compile arm-none-eabi-gdb 8.1 from source."
230
231
            echo "    Sorry, we don't have a better option yet -> this is the recommended choice."
            echo
232
            echo "4 - Manually install arm-none-eabi-gdb from https://launchpad.net/gcc-arm-embedded"
233
234
235
236
            echo "    or any other source (choose 64-bit Linux binaries),"
            echo "    make sure it is in PATH, then run this script again."
            echo "    WARNING: this may not be able to run all our GDB scripts."
            echo
237
        fi
238
239

        if arm-none-eabi-gdb -v &> /dev/null; then
240
            echo "5 - Just use the current 64-bit toolchain."
241
242
243
            echo "    WARNING: this will not be able to run all our GDB scripts."
        fi

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
        echo
        echo -n "Your choice? "
        read answer
        echo
        case $answer in
            1)
                # Ubuntu's 32-bit arm-none-eabi-gdb works fine
                # gcc-arm-none-eabi:i386 does not include libnewlib - Ubuntu bug?
                packages="$packages gdb-arm-none-eabi:i386 "
                packages="$packages gcc-arm-none-eabi libnewlib-arm-none-eabi"
                ;;
            2)
                # gcc-arm-embedded conflicts with gcc-arm-none-eabi
                # but the dependencies are not configured properly
                # so we have to fix the conflict manually...
                if dpkg -l binutils-arm-none-eabi 2>/dev/null | grep -q '^.i'; then
                    echo
                    echo "*** Please double-check - the following might remove additional packages!"
                    echo
                    sudo apt-get remove gcc-arm-none-eabi gdb-arm-none-eabi \
                         binutils-arm-none-eabi libnewlib-arm-none-eabi
                fi
266
                packages="$packages gcc-arm-embedded:i386"
267
268
269
270
271
                echo
                echo "*** Adding the team-gcc-arm-embedded PPA repository..."
                echo "    sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa"
                echo
                sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
272
                ;;
273
274
            3)
                # install 64-bit gcc and compile arm-none-eabi-gdb from source
275
                packages="$packages gcc-arm-none-eabi:amd64 libnewlib-arm-none-eabi"
276
                ;;
277
            4)
278
                # user will install arm-none-eabi-gdb and run the script again
279
280
                exit 0
                ;;
281
            5)
282
                # use the installed version, even though it's known not to work well
283
                ALLOW_64BIT_GDB=y
284
                ;;
285
            *)
286
                # invalid choice
287
288
289
290
291
292
293
                exit 1
                ;;
        esac
    else
        echo "*** You have a valid ARM GCC/GDB already installed - using that one."
    fi

294
295
    echo "*** Checking dependencies for Ubuntu..."
    echo
296
297
298
    # https://wiki.debian.org/ListInstalledPackages
    # dpkg -l also returns packages that are not installed
    deps_installed=yes
299
    for package in $packages; do
300
301
302
        if ! dpkg -l $package 2>/dev/null | grep -q '^.i'; then
            echo Not installed: $package
            deps_installed=no
303
304
        fi
    done
305
306
307
308
309

    if [ "$deps_installed" == "no" ]; then
        echo
        echo "*** Installing dependencies for Ubuntu..."
        echo
310
311
        if [[ "$packages" == *i386* ]]; then
            sudo dpkg --add-architecture i386
312
        fi
313
        sudo apt-get update
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
        sudo apt-get install $packages
        echo
    fi

    deps_installed=yes
    for package in $packages; do
        if ! dpkg -l $package 2>/dev/null | grep -q '^.i'; then
            echo Not installed: $package
            deps_installed=no
        fi
    done

    if [ "$deps_installed" == "no" ]; then
        echo
        echo "*** Error: Ubuntu dependencies could not be installed."
329
        echo
330
        exit 1
331
    fi
332
333
fi

334
# all systems (including Mac, or Ubuntu if the installation from repositories failed)
335
if ! valid_arm_gcc; then
336
    echo
337
    echo "*** WARNING: a valid arm-none-eabi-gcc could not be found."
338
    echo "*** Downloading a toolchain and installing it without the package manager."
339
    echo "*** Will be installed in your home directory (Makefile.user.default expects it there)."
340
    echo
341
342
343
344
345
346
347
    echo -n "Continue? [y/n] "
    read answer
    if test "$answer" != "Y" -a "$answer" != "y"; then exit 0; fi
    echo
    install_gcc
fi

348
if ! valid_arm_gdb --strict; then
349
350
351
352
353
354
355
356
    echo
    echo "*** WARNING: a valid arm-none-eabi-gdb could not be found."
    echo "*** Will compile gdb 8.1 from source and install it under your home directory."
    echo
    echo -n "Continue? [y/n] "
    read answer
    if test "$answer" != "Y" -a "$answer" != "y"; then exit 0; fi
    echo
357
    install_gdb
358
359
fi

360
# make sure we have a valid arm-none-eabi-gdb (regardless of operating system)
361
if ! valid_arm_gdb --strict; then
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
    if ! arm-none-eabi-gdb -v &> /dev/null; then
        echo "*** Please set up a valid arm-none-eabi-gdb before continuing."
        exit 1
    else
        # valid_arm_gdb will print why the current one is not good
        echo -n "Continue anyway? [y/N] "
        read answer
        if test "$answer" != "Y" -a "$answer" != "y"; then exit 1; fi
        echo
    fi
fi

# same for arm-none-eabi-gcc
if ! valid_arm_gcc; then
    echo "*** Please set up a valid arm-none-eabi-gcc before continuing."
377
378
379
    exit 1
fi

380
381
382
echo
echo -n "*** Using GCC: "
command -v arm-none-eabi-gcc
383
arm-none-eabi-gcc -v 2>&1 | grep "gcc version"
384
echo
385
386
387
388
echo -n "*** Using GDB: "
command -v arm-none-eabi-gdb
arm-none-eabi-gdb -v | head -n1
echo
389

390
# install docutils (for compiling ML modules) and vncdotool (for test suite)
391
392
393
# only install if any of them is missing
pip2 list | grep docutils  || rst2html -h  > /dev/null || pip2 install docutils
pip2 list | grep vncdotool || vncdotool -h > /dev/null || pip2 install vncdotool
394

395
396
function die { echo "${1:-"Unknown Error"}" 1>&2 ; exit 1; }

397
pwd | grep $ML_NAME/contrib/qemu > /dev/null || die "error: we should be in $ML_NAME/contrib/qemu"
398
399
400

# go to the parent of magic-lantern folder
cd ../../..
401
ls | $GREP $ML_NAME > /dev/null || die "error: expecting to find $ML_NAME here"
402

403
404
mkdir -p $QEMU_DIR
cd $QEMU_DIR
405
406

echo
407
echo "*** Setting up QEMU in $(pwd)..."
408
409
echo

alex@thinkpad's avatar
alex@thinkpad committed
410
if [ -d $QEMU_NAME ]; then
411
  DATE=`date '+%Y-%m-%d_%H-%M-%S'`
412
  echo "*** Directory $(pwd)/$QEMU_NAME already exists."
413
414
415
  echo "*** To reinstall, please rename or delete it first."
  echo ""
  echo "  - R or r        : rename to $(pwd)/${QEMU_NAME}_$DATE/"
alex@thinkpad's avatar
alex@thinkpad committed
416
  echo "  - C or c        : make clean & rename to $(pwd)/${QEMU_NAME}_$DATE/"
417
418
  echo "  - uppercase D   : delete $(pwd)/$QEMU_NAME/ without confirmation (!)"
  echo "  - any other key : cancel the operation (exit the script)"
419
420
  echo ""
  echo -n "Your choice? "
421
422
423
424
425
426
  read answer
  case "$answer" in
      D)
        rm -Rf $QEMU_NAME
        ;;
      R|r)
427
        mv $QEMU_NAME ${QEMU_NAME}_$DATE
428
        ;;
alex@thinkpad's avatar
alex@thinkpad committed
429
430
431
432
      C|c)
        make -C $QEMU_NAME clean
        mv $QEMU_NAME ${QEMU_NAME}_$DATE
        ;;
433
434
435
436
      *)
        exit 1
        ;;
  esac
437
438
fi

439
# get qemu
440
wget $WGET_OPTS http://wiki.qemu-project.org/download/$QEMU_NAME.tar.bz2
441
echo
442
tar jxf $QEMU_NAME.tar.bz2
443
echo
444

445
446
# initialize a git repo, to make it easy to track changes to QEMU source
cd $QEMU_NAME
447
448
449
if [ ! -d .git ]; then
  git init
  # git requires a valid email; if not setup, add one for this directory only
450
451
  git config user.email || git config user.email qemu-eos@magiclantern.fm
  git config user.name || git config user.name qemu-eos
452
  git add . && git commit -q -m "$QEMU_NAME vanilla"
453
fi
454
455
cd ..

456
457
echo "Copying files..."

458
# copy our helper scripts
459
cp -r $ML_PATH/contrib/qemu/scripts/* .
460
chmod +x *.sh
461
462
463

# copy our testing scripts
mkdir -p tests
464
cp -r $ML_PATH/contrib/qemu/tests/* tests/
465
466
467
chmod +x tests/*.sh

# apply our patch
468
cd ${QEMU_NAME}
469
mkdir -p hw/eos
470
471
cp -r ../$ML_PATH/contrib/qemu/eos/* hw/eos/
cp -r ../$ML_PATH/src/backtrace.[ch] hw/eos/dbi/
472
if gcc -v 2>&1 | grep -q "gcc version 7"; then
473
  patch -N -p1 < ../$ML_PATH/contrib/qemu/$QEMU_NAME-gcc7.patch
474
475
476
  git add -u . && git commit -q -m "$QEMU_NAME patched for gcc 7.x"
fi

477
patch -N -p1 < ../$ML_PATH/contrib/qemu/$QEMU_NAME.patch
478
479
# don't commit this one - we'll use "git diff" to update the above patch

480
481
cd ..

482
483
484
# setup the card image
if [ ! -f "sd.img" ]; then
    echo "Setting up SD card image..."
485
    cp -v $ML_PATH/contrib/qemu/sd.img.xz .
486
487
488
489
490
491
492
493
494
495
496
497
    unxz -v sd.img.xz
else
    echo "SD image already exists, skipping."
fi

if [ ! -f "cf.img" ]; then
    echo "Setting up CF card image..."
    cp -v sd.img cf.img
else
    echo "CF image already exists, skipping."
fi

498
499
500
501
502
503
echo ""
echo "Next steps:"
echo "==========="
echo
echo "1) Compile QEMU"
echo
504
echo "   cd `pwd`/${QEMU_NAME}"
505
echo "   ../configure_eos.sh"
506
echo "   make -j`$GREP -c processor /proc/cpuinfo 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1`"
507
echo
508
echo -n "Shall this script attempt to compile QEMU now? [y/n] "
509
510
511
512
513
514
read answer
if test "$answer" == "Y" -o "$answer" == "y"
 then
    cd `pwd`/${QEMU_NAME}
    ../configure_eos.sh
    if make -j`$GREP -c processor /proc/cpuinfo 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1`; then
515
        cd ..
516
517
518
519
520
521
522
523
524
525
526
        echo
        echo "*** Done compiling."
        echo
        echo
        echo "Next steps:"
        echo "==========="
        echo
        echo "1) Go to QEMU directory"
        echo
        echo "   cd `pwd`/"
    else
527
        cd ..
528
529
530
        echo
        echo "*** Compilation failed."
        echo "*** Please check what went wrong, try to fix it and report back."
alex@thinkpad's avatar
alex@thinkpad committed
531
        exit 1
532
533
534
    fi
fi
echo
535
536
537
538
echo "2) Grab a copy of the Canon firmware from your own camera"
echo "   (don't request one and don't share it online - it's copyrighted)"
echo
echo "   Look on your SD card - you should find ML/LOGS/ROM0.BIN and ROM1.BIN"
539
540
echo "   Copy them under your camera model's subdirectory, for example:"
echo "   `pwd`/60D/"
541
echo
542
543
echo "   For models that use a serial flash, you may have to dump its contents"
echo "   using the sf_dump module, then copy SFDATA.BIN as well."
544
echo
545
echo "3) Install Magic Lantern on your SD/CF card image:"
546
echo
547
echo "   make -C ../magic-lantern 60D_install_qemu "
548
echo
549
550
echo "   The included card image is bootable and contains a small autoexec.bin"
echo "   that runs on all supported EOS cameras and prints some basic info."
551
echo
552
echo "4) Start emulation with:"
553
554
echo
echo "   cd `pwd`/"
555
556
557
echo "   ./run_canon_fw.sh 60D"
echo
echo "   This will recompile QEMU, but not ML."
558
echo
559
echo "   Note: Canon GUI emulation (menu navigation, no LiveView) only works on:"
560
echo -n "   "; echo $($GREP --color=never -oPz "(?<=GUI_CAMS=\( )[^()]*(?=\))" tests/run_tests.sh | tr '\0' '\n');
561
echo
562
echo "5) Tips & tricks:"
563
564
echo "   - to enable or disable the boot flag in ROM, use something like:"
echo "     ./run_canon_fw.sh 60D,firmware=\"boot=1\""
565
566
echo "   - to use multiple firmware versions, place the ROMs under e.g. 5D3/113/ROM*.BIN and run:"
echo "     ./run_canon_fw.sh 5D3,firmware=\"113;boot=1\""
567
568
569
570
571
echo "   - to show MMIO activity (registers) and interrupts, use:"
echo "     ./run_canon_fw.sh 60D -d io,int"
echo "   - to show the executed ASM code, step by step, use:"
echo "     ./run_canon_fw.sh 60D -d exec,int -singlestep"
echo "   - to trace debug messages and various functions in the firmware, use:"
572
echo "     ./run_canon_fw.sh 60D -d debugmsg -s -S & arm-none-eabi-gdb -x 60D/debugmsg.gdb"
573
echo "   - some camera models require GDB patches to bypass tricky code sequences:"
alex@thinkpad's avatar
alex@thinkpad committed
574
echo "     ./run_canon_fw.sh EOSM -s -S & arm-none-eabi-gdb -x EOSM/patches.gdb"
575
echo
576
577
578
echo
echo "Online documentation: "
echo
alex@thinkpad's avatar
alex@thinkpad committed
579
580
echo "   https://bitbucket.org/hudson/magic-lantern/src/qemu/contrib/qemu/README.rst"
echo "   https://bitbucket.org/hudson/magic-lantern/src/qemu/contrib/qemu/HACKING.rst"
581
582
echo
echo "Enjoy!"
alex@thinkpad's avatar
alex@thinkpad committed
583
584
echo

585
if [ $(uname) != "Darwin" ] && ! [[ $DISPLAY ]]; then
alex@thinkpad's avatar
alex@thinkpad committed
586
587
588
589
590
591
592
    echo "P.S. To run the GUI, please make sure you have a valid DISPLAY."
    if [  -n "$(uname -a | grep Microsoft)" ]; then
        echo "Under Windows, you may install either VcXsrv or XMing."
        echo "Start it, then type the following into the terminal:"
        echo "    export DISPLAY=:0"
    fi
fi