版主: 51FPGA

分享到:
共1条 1/1 1   

Zynq Linux

    [您是本帖的第1994位阅读者]
xilinx论坛
我是MM
高级会员

最后登陆时间:2015-03-19 10:58:07

直达楼层
1# 发表于 2015-07-01 14:01:02
Introduction
The purpose of this page is to describe the Xilinx Zynq Linux kernel. The kernel is based on the 3.0 Linux kernel from kernel.org together with Xilinx unique changes. It is typically updated to stay close to the latest version from kernel.org on a regular basis. In general, the Xilinx Linux kernel for Zynq follows normal ARM Linux processes for building and running.GeneralXilinx Zynq Linux Strategy
Xilinx is striving to push code from the Xilinx GIT server to the open source community (kernel.org, u-boot, etc.). Pushing the code takes time such that the Xilinx GIT servers contain the latest code base and is recommended for customer use. A minimal BSP for Zynq has been pushed to the mainline (kernel.org) and is available there. At this time, Xilinx only supports Linux from the Xilinx GIT server.Xilinx Zynq Linux Support
Xilinx Zynq Linux is based on open source software (the kernel from kernel.org). Xilinx provides support for Xilinx specific parts of the Linux kernel (drivers and BSP). Xilinx also supports Linux thru the Embedded Linux forum on http://forums.xilinx.com/. As with many open source projects, Xilinx also expects customers to also use the open source mailing lists for Linux in areas that are not specific to Xilinx Zynq.Assumptions
Building the Linux kernel is only supported from a Linux based host. It is not supported from Windows.GNU Tools
GNU tools are required to build the Linux kernel. See the wiki page Zynq Tools for more GNU tools details.The Details of Building LinuxDownloading the Kernel Tree
The kernel can be downloaded from the Xilinx GIT repository using the command as illustated below.bash> git clone git://git.xilinx.com/linux-xlnx.git

Note that another repository, linux-2.6-xarm, was previously being used. This repository still exists til 12/1/11 but is not being updated.Configuring the Linux Kernel
The kernel must be configured to build the Xilinx BSP and drivers into the kernel.
Configure the kernel for the ZC702 or ZC770 hardware using the command line as shown below.bash> make ARCH=arm xilinx_zynq_defconfig
Building the Linux Kernel
The build process creates files named Image and zImage located in the arch/arm/boot directory of the kernel tree. The Image file is a non-compressed kernel image such that it's bigger. The zImage file is a compressed kernel image which will uncompress itself when it starts. Build the kernel using the command line shown below.bash> make ARCH=arm
Known Issues
  • An initrd ramdisk is being used with Linux. An initramfs ramdisk may have issues.
Kernel DetailsThe Board Support Package (BSP)
The primary code for the platform is in arch/arm/mach-zynq directory of the kernel tree. The BSP contains some drivers and utilizes some existing drivers from arch/arm.
Hardware Block Driver Name Notes Detailed Page
GIC gic.c in arch/arm/common
PL330 pl330.c a different driver now exists in kernel.org
PS2 ps2.c support for keyboard and mouse in QEMU
SCU Global Timer scu_gtimer.c provides primitive abilities only
System Level Control Registers slcr.c SLCR
Triple Timer Counter timer.c Only supports 1 TTC currently
Device Drivers
The Xilinx Linux kernel includes drivers for each hardware block. The following table contains more detailed information about each driver.
Hardware Block Driver Name Notes Detailed Page
CAN not supported
GEM xilinx_emacps.c
GPIO xilinx_gpiops.c
I2C i2c-xilinx_ps.c
NAND xilinx_nandpss.c
QSPI xilinx_qspipc.c
SCU WDT xilinx_scuwdt.c
SPI xilinx_spips.c
System WDT xilinx_wdtps.c
UART xilinx_uartps.c
USB Host ehci-xilinx-usbps.c
USB Device xilinx_usbps_udc.c
USB OTG xilinx_usbps_otg.c
Device Tree Support
Device tree is a process by which the Linux kernel initializes itself based on the hardware platform. Device tree allows a single kernel image to run on multiple hardware platforms. A device tree file, named *.dts, is a text file that describes the hardware platform. It is compiled into a device tree blob, *.dtb, which is loaded into memory before the Linux kernel is started. The Linux kernel then uses that device tree blob to initialize itself at runtime.
Device tree is supported and required for the Xilinx ARM kernel. Previously to Linux kernel 3.0, most ARM Linux kernels did not support device tree and were based on platform data. PowerPC and MicroBlaze also use device tree initialization.Device Tree In Memory
The kernel has 2 ways it can find a device tree in memory. The 1st and industry standard method is that it expects the address of the device tree to be in register R2 when the boots. Note that this is not the default kernel configuration at this time.
The 2nd method, and the default in the Xilinx kernel configuration, is hard coded such that it expects the device tree at address 0x1000000 (16 MB). This is referred to as Device Tree At Fixed Address in the kernel configuration. The purpose of the fixed address for a device tree is to allow the go command in u-boot (which does not set up R2 to point to the device tree) to continue to be used.
This method can be disabled in the kernel configuration and must be disabled if a device tree is to loaded at other addresses while using the bootm command in u-boot. The bootm command does extra checking on the image in u-boot which is very slow on the EP107 platform.
Note that the Device Tree At Fixed Address kernel configuration option is only available in the menu when device tree has been enabled in the kernel configuration.Disabling Fixed Device Tree Address Kernel Configuration
From the main menu of the kernel configuration, select System Type, followed by Xilinx Specific Options. De-select Device Tree At Fixed Address. The bootm command must be used with this kernel configuration as it sets the R2 register to the address of the device tree before transferring control to Linux.Device Tree Generation
There is no device tree generator yet for Zynq yet such that hand editing the device tree is the current method.
For Linux kernel 3.3 and later, the device tree syntax has changed for denoting interrupts. To calculate the correct value in these releases, use Table 7-3 in the Zynq-7000 EPP TRM to locate the correct SPI ID# for the desired peripheral. Then, subtract 32 from this value. The result is what should be entered into the device tree interrupt field.
Example: From Table 7-3, UART 1 has a value of "82" for the SPI ID#. Subtracting 32 from this yields "50." "50" is the value found in the interrupt field for the UART 1 peripheral in the device tree.Predefined Device Trees
All device trees are contained in the Linux kernel tree at arch/arm/boot/dts directory of the kernel tree.
Board DTS File Name Notes
EP107 (emulation platform) zynq-ep107.dts
ZC702 zynq-zc702.dts
ZC770 zynq-zc770-xm010.dts
Kernel Command Line
The kernel has 2 ways for it to get the command line. The default kernel configuration causes the kernel to get the command line from the device tree.
There is a kernel configuration option that allows the command line to always be used from the kernel configuration ignoring the command line string in the device tree. From the main menu of the kernel configuration, select Boot Options, followed by Always use the default kernel command string.Compiling a Device Tree
The device tree compiler is located in the Linux kernel tree in the scripts/dtc directory. Note that the kernel needs to be built with device tree turned on in the kernel configuration for the device tree compiler (dtc) binary to be present in the scripts/dtc/dtc directory. The device tree file (dts) can be compiled using the following command (assuming this is executed from the root directory of a Linux kernel tree).bash> scripts/dtc/dtc -I dts -O dtb -o <output file name> <input file path and name>
SMP
By default the kernel is configured to use both CPUs in SMP mode. The following command shows the CPU information and should indicate two CPUs, numbered 0 and 1.
By default, the kernel handles all interrupts on the 1st CPU. They can be pushed to the 2nd CPU and there are user space daemons that will do interrupt load balancing.zynq> cat /proc/cpuinfo
Only Using A Single CPU
A user may cause it to use only one CPU by adding "maxcpus=1" to the kernel command line in the device tree.Specifying A CPU
A user may cause an application to run on a specific CPU using the BusyBox utility taskset.
The following command will display the help information for the taskset command.zynq> taskset --help

The mask field of the command specifies the CPU and is a value of 1 or 2.
The following command starts the application top running on the 2nd CPU.zynq> taskset 2 top
Prebuilt Ramdisk Image
A prebuilt BusyBox based root filesystem is provided to make it easy for users to get Linux running. The source for the ramdisk is available from http://git.xilinx.com/. The binary image can be downloaded fromZynq Root File System.Prebuilt Ramdisk Contents
The ramdisk image incorporates the following features.
Application Name Source Details
Telnet BusyBox there is no login, a shell is started
SSH Dropbear user: root, password: root
Web server BusyBox
FTP BusyBox
GDB Server GNU Tools
Prebuilt Ramdisk Details
The Linux kernel command line is using DHCP for eth0 device such that the root file system is not setting up the IP address. The purpose for this is to allow a common ramdisk between QEMU and the EP107 system.
共1条 1/1 1   
快速回复主题
  • 匿名不能发帖!请先 [ 登陆 注册 ]