Merge branch 'master' of https://github.com/EPiCS/reconos
[reconos.git] / tools / zynq_boot_jtag.sh
blob4d1ba5e6fc0cdb7000255bc95ef3e444f8b71903
1 #!/bin/bash
3 # This is a simple script which helps you to boot the linux kernel
4 # on a Zynq board by using uImage and loading the linux kernel via
5 # TFTP.
6 # If you call it the first time you have to specify a uImage (the
7 # linux kernel), a compiled device tree blob, the ps7_init.tcl
8 # script and a u-boot executable.
9 # The last used files are cached by the script and can be reused
10 # the next time by calling the script with no parameters. This
11 # makes it easy to use because during the development cycle the
12 # needed files does not change very often.
14 cache="$RECONOS/cache/os_boot"
15 c_uimage="$cache/uImage"
16 c_dtb="$cache/devicetree.dtb"
17 c_init="$cache/ps7_init.tcl"
18 c_uboot="$cache/u-boot"
20 if [ ! -d $cache ]
21 then
22 mkdir -p $cache
26 if [ $# -ne 3 -a $# -ne 0 -a $# -ne 4 ]
27 then
28 echo "ERROR: Wrong number of arguments."
29 exit 0
33 if [ $# -ge 3 ]
34 then
35 uimage=$1
36 dtb=$2
37 init=$3
39 cp $uimage $c_uimage
40 cp $dtb $c_dtb
41 cp $init $c_init
43 if [ $# -eq 4 ]
44 then
45 uboot=$4
46 cp $uboot $c_uboot
47 else
48 uboot=$c_uboot
50 else
51 uimage=$c_uimage
52 dtb=$c_dtb
53 init=$c_init
54 uboot=$c_uboot
55 echo "No boot-files specified, using cached ones."
58 echo "Booting Linux on Zynq ..."
59 echo " Linux image (uImage): $uimage"
60 echo " Device-Tree-Blob: $dtb"
61 echo " Init-Skript (ps7_init.tcl): $init"
62 echo " U-Boot executable: $uboot"
64 echo -e "connect arm hw\nrst\nsource $init\nps7_init\nps7_post_config\ndow -data $dtb 0x02a00000\ndow -data $uimage 0x03000000\ndow $uboot\nrun" | xmd