2 ________ _________ ____ / __ \/ ___/
3 / ___/ _ \/ ___/ __ \/ __ \/ / / /\__ \
4 / / / __/ /__/ /_/ / / / / /_/ /___/ /
5 /_/ \___/\___/\____/_/ /_/\____//____/
7 ======================================================================
9 title: Setup of ReconOS
12 author: Christoph RĂ¼thing, University of Paderborn
13 description: This is an introduction to linux on Zynq as the base
14 operating system of ReconOS.
15 It describes some general aspects of the Zynq platform
16 and how to setup linux.
19 Date | Rev | Author | What
20 ---------+-----+---------------+------------------------
21 19.04.13 | 1.0 | C. RĂ¼thing | Initial Version
22 ---------+-----+---------------+------------------------
24 ======================================================================
28 ReconOS depends on an existing operating system. This section gives
29 a brief introduction to the Zynq platform and describes how to setup
30 linux. As the past has shown, most of the problems in the setup
31 process were originated in setting up linux so you should read this
39 The Zynq platform combines an arm processor with an FPGA on a single
40 SoC. The arm processor together with some additional controllers
41 constitutes the processing system (PS) which can be used completely
42 independent from the FPGA. For a deeper understanding of the
43 architecture you should take a look at the Zynq-Documentation
44 (the Technical Reference Manual (UG585) includes everything you want
45 to know about) and the Zynq-page in XPS (the green boxes are
48 2.2 Bootsequence of the PS
50 To setup Linux on the Zynq you should understand how the boot sequence
51 works. There are different boot-modes, but there are mainly two
52 conceptionally different ones:
55 +------+ +---------------+ +------------+ +--------------+
56 | Boot | -> | Processor | -> | Initialize | -> | Download and |
57 | ROM | | runs bootloop | | PS | | run elf |
58 +------+ +---------------+ +------------+ +--------------+
60 The Processor runs a bootloop until it is interrupted via jtag and an
61 executable is downloaded. The initialization configures the multiplexed
62 IO (MIO), the DDR-Controller, ... and can be done in xmd by executing
63 ps7_init. The related ps7_init.tcl is generated by xps according to the
64 configuration of the PS.
67 +------+ +----------------+ +--------------+
68 | Boot | -> | Load and run | -> | Load and run |
69 | ROM | | fsbl (Init PS) | | elf |
70 +------+ +----------------+ +--------------+
72 The Boot-ROM loads the First-Statge-Bootloader (fsbl) from SD-Card or
73 other another memory and executes it. The fsbl does the initialization
74 of the PS (ps7_init) and can be generated with the SDK.
76 In both boot-modes the last stage elf will be u-boot to run the linux
77 kernel. For development with ReconOS we will use the JTAG-boot-mode.
79 The boot-modes can be configured by setting the appropriate jumpers.
80 Just take a look into your board-description to figure out, how to
85 To boot linux you first need a bootloader which will be u-boot for know.
86 To build u-boot only a couple of steps are needed:
87 - download u-boot (git.xilix.com/u-boot-xlnx)
88 - configure u-boot (see below)
89 - compile u-boot by make zynq_<board>_config && make
91 The configuration of u-boot is done by editing include/configs/zynq_common.h
92 You can adjust this file per your desires but the following configuration
94 - adjust ip-addresses if you want to load the kernel via TFTP
95 - adjust default-boot configuration in EXTRA_ENV_SETTING
98 You must decide if you want u-boot to load the kernel image an the
99 device-tree via TFTP or if you want to downlad them via JTAG yourself.
100 TFTP is much faster than JTAG but requires a TFTP-Server.
103 Export your kernel image and device-tree-blob via tft.
105 "jtagboot=echo TFTPing Linux to RAM...;" \
106 "tftp 0x3000000 ${kernel_image};" \
107 "tftp 0x2A00000 ${devicetree_image};" \
108 "bootm 0x3000000 - 0x2A00000\0"
111 Download kernel image and device-tree-blob via jtag into memory at
112 addresses 0x3000000 and 0x2A00000.
114 "jtagboot=echo Booting Linux from RAM...;" \
115 "bootm 0x3000000 - 0x2A00000\0"
119 To boot Linux you also need a device-tree. Because the Processing
120 System is more or less fixed we do not need a device-tree-Generator.
121 Just use the standard device-tree provided in the Linux sources and
122 delete the peripheral you have turned of.
123 Then you can compile the devic-tree by usinge the device-tree-compile
124 included in the kernel tree:
125 scripts/dtc/dtc -I dts -O dtb -o device-tree.dtb device-tree.dts
127 2.5 Kernel Source, Configuration and Compilation
129 Now you can download the Linux kernel sources. Because the vanilla
130 kernel from kernel.org does not include all needed drivers yet you
131 should use the kernel provided by Xilinx (linux-xlnx). In the future
132 these drivers should be also available in the kernel source tree.
134 To run on Zynq the kernel needs to be configured correctly. As a
135 starting point you can either use the default config included in the
136 kernel or the reduced .config in the ReconOS repository. Just play
137 around with the different kernel options.
139 To compile linux you need your cross compilers and also u-boot,
140 especially mkimage to create the uImage.
142 2.6 The root filesystem
144 Besides the kernel you also need to build your own root filesystem. It
145 can be mountet from different locations - we will use nfs for this,
146 because it offers the highest flexibility for development.
148 You can either build your own root filesystem or use the one provided
149 in the repository. If you do not create your own one consider that you
150 eventually have to insert your own shared libraries.
151 Building your own root filesystem is also not complicated:
152 - download and compile busybox (git.busybox.net/busybox)
153 - create directories (dev etc etc/init.d mnt opt proc root sys tmp var)
154 - create /etc/fstab, /etc/inittab and /etc/init.d/rcS (see example)
155 - create device-files in dev (see example)
158 2.7 Step-By-Step Guide
160 The following sections provide a sketchy step-by-step guide for
161 different tasks. Consider, that the different parts may have
162 dependencies you have to take care on your own.
163 These steps depends on a properly configured environment with cross
168 Checkout u-boot sources
169 $> git clone git://git.xilinx.com/u-boot-xlnx.git
171 Adjust the configuration files as described above
172 $> vim include/configs/...
175 $> make zynq_<board>_config
178 4.7.2 Compiling Linux
180 Checkout kernel sources
181 $> git clone git://git.xilinx.com/linux-xlnx.git
183 Create .config file out of defconfig or example
184 $> make xilinx_zynq_defconfig && make menuconfig
186 $> cp $RECONOS/.../.config .
188 Compile kernel (mkimage needed)