MYiR-Tech | www.myirtech.com
Z-turn Lite Board Linux Development Manual
Z-turn Lite Board
Linux Development
Manual
Version 1.0
July 3, 2017
MYiR-Tech | www.myirtech.com
Z-turn Lite Board Linux Development Manual
Revision History
Version Description Date
V1.0 Initial release 2017/7/3
V1.1
MYiR-Tech | www.myirtech.com
Z-turn Lite Board Linux Development Manual
Table of Contents
Table of Contents............................................................................................................... 1
Chapter 1 Overview and Introduction of Software Resource ....................................... 2
1.1 Overview ....................................................................................................................... 2
1.2 Software Resources .................................................................................................. 2
Chapter 2 Build Linux Development Environment ........................................................ 3
2.1 Establishment Working Directory ......................................................................... 3
2.2 Set Cross Compile Tool ........................................................................................... 3
2.3 Install Tool ................................................................................................................... 3
Chapter 3 Linux System Compile .................................................................................... 4
3.1 Compile Bootloader .................................................................................................. 4
3.2 Compile Linux kernel ................................................................................................ 4
3.3 Make File System ....................................................................................................... 4
3.3.1Make Ramdisk ...................................................................................................... 5
3.3.2Modify Rootfs ........................................................................................................ 5
Chapter 4 Download Linux System ................................................................................. 7
4.1 Create a Micro SD Card ............................................................................................ 7
4.2 Prepare Image File ..................................................................................................... 8
4.3 Start Install ................................................................................................................... 8
Chapter 5 Linux Application ............................................................................................. 9
5.1 LED ................................................................................................................................ 9
5.2 Button ........................................................................................................................... 9
Appendix 1 Warranty & Technical Support Services .................................................. 10
MYiR-Tech | www.myirtech.com2 / 15
Z-turn Lite Board Linux Development Manual
Chapter 1 Overview and Introduction of
Software Resource
1.1 Overview
Z-turn Lite Board provides abundant hardware and software resource. This manual will
start from building the environment and introduce how to develop a Z-turn Board Linux
program step by step. The development commands of thismanual are illustrated based-on
Ubuntu system.
1.2 Software Resources
Category Name Remark Code
Tool
chains gcc 4.6.1
gcc version 4.6.1
(Sourcery CodeBench Lite 2011.09-50)
Boot
loader boot.bin First bootstrap Include FSBL and u-boot Yes
Linux
Kernel Linux 3.15.0
Linux kernel customized for the Z-turn Lite
Board hardware Yes
Driver
USB OTG USB OTG driver Yes
Ethernet Gigabit Ethernet driver Yes
MMC/SD/TF MMC/SD/TF card driver Yes
Button Button driver Yes
UART UART driver Yes
LED LED driver Yes
GPIO GPIO driver Yes
File
system
Ramdisk Ramdisk image system
Rootfs Rootfs image system
Table 1-1
MYiR-Tech | www.myirtech.com3 / 15
Z-turn Lite Board Linux Development Manual
Chapter 2 Build Linux Development
Environment
2.1 Establishment Working Directory
Copy the document in Z-turn Lite Board DVD disk to the host:
$ mkdir -p <WORKDIR>
$ cp -a <DVDROM>/04-Linux_Source/* <WORKDIR>
2.2 Set Cross Compile Tool
$ cd <WORKDIR>/Toolchain
$ tar –xvjf Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux.tar.bz2
$export PATH=$PATH:<WORKDIR>/Toolchain/\
CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin
$export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
After executing the "export" commands, input “arm” and then press the Tab key to check
whether or not the "export" settings has been executed successfully. These settings are
only valid for the current terminal; if it is required to keep them permanently, please add
above commands to script file: “~/.bashrc”
2.3 Install Tool
Install other necessary tools:
$sudo apt-get install build-essential git-core libncurses5-dev \
flex bison texinfo zip tar zlib1g-dev gettext \
gperf libsdl-dev libesd0-dev libwxgtk2.6-dev \
uboot-mkimage \
g++ xz-utils
MYiR-Tech | www.myirtech.com4 / 15
Z-turn Lite Board Linux Development Manual
Chapter 3 Linux System Compile
3.1 Compile Bootloader
Enter Bootloader director, tar U-boot source code:
$ cd <WORKDIR>/Bootloader
$ tar –jxvf u-boot-xlnx.tar.bz2
$ cd u-boot-xlnx
Compile the source code:
$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- distclean
$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi-\
zynq_zturn_config
$make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi-
After compiling, it will generate “u-boot” ELF files in the current directory.It is crucial to
rename this file to “u-boot.elf” when using this image to make “boot.bin”.
3.2 Compile Linux kernel
Enter the “Kernel” director, and tar the kernel source code:
$ cd <WORKDIR>/Kernel
$ tar –xvjf linux-xlnx.tar.bz2
$ cd linux-xlnx
Compile the source code:
$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- distclean
$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- \
zynq_zturn_defconfig
$make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- uImage
$make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- dtbs
After compiling, it will generate the “uImage” in the “arch/arm/boot” directory and the
“zynq_zturn.dtb” file in the “arch/arm/boot/dts/” directory.
3.3 Make File System
MYiR-Tech | www.myirtech.com5 / 15
Z-turn Lite Board Linux Development Manual
3.3.1Make Ramdisk
⑴Mount ramdisk
Create a new directory “tmp”, and copy the “uramdisk.image.gz” to this directory:
$cd <WORKDIR>/Filesystem
$ mkdir tmp
$ cp uramdisk.image.gz tmp/
$ cd tmp/
Delete the 64 bytes header file generated by “mkimage”, and generate a new
“ramdisk.image.gz”:
$ dd if=uramdisk.image.gz of=ramdisk.image.gz bs=64 skip=1
gunzip “ramdisk.image.gz” to generate “ramdisk.image”:
$ gunzip ramdisk.image.gz
Create a new mount directory "rootfs", and mount the “ramdisk.image” file:
$ mkdir -p rootfs
$ sudo mount -o loop,rw ramdisk.image rootfs
Enter the “rootfs” directory, and modifyit if necessary.
⑵Generatea new ramdisk
Synchronize the file system and unmount the ramdisk file system:
$ sync
$ sudo umount rootfs
Compress “ramdisk.image” with gzip, and generate “ramdisk.image.gz”:
$ gzip -9 ramdisk.image
Add new head file with mkimage, generate a new “uramdisk.image.gz” file for u-boot:
$ mkimage -A arm -T ramdisk -C gzip -n Ramdisk -d ramdisk.image.gz
uramdisk.image.gz
Delete temporary file “ramdisk.image.gz”:
$ rm ramdisk.image.gz
3.3.2Modify Rootfs
(1)Extract the tar :
$ cd <WORKDIR>/Filesystem
$ mkdir -p rootfs
$ sudo tar rootfs.tar –C ./rootfs/
(2)Modifying Filesystem,add new file.
MYiR-Tech | www.myirtech.com6 / 15
Z-turn Lite Board Linux Development Manual
(3)Archive tar
$ cd ./rootfs
$ tar cvf ../rootfs.tar ./*
MYiR-Tech | www.myirtech.com7 / 15
Z-turn Lite Board Linux Development Manual
Chapter 4 Download Linux System
In here, we will boot from Micro SD Card using Ramdisk, then install bootloader and
kernel to QSPI-Flash, install rootfs to eMMC.
4.1 Create a Micro SD Card
⑴ TF card format
Please format the TF Card using the “HP USB Disk Storage Format Tool 2.0.6” tool in
directory “03-Tools” of the DVD disk.
① Insert the TF card into the USB card reader, then connect the card reader with a
computer;
② Open “HP USB Disk Storage Format Tool 2.0.6”. It will prompt up a dialog as the
following:
Figure 4-1
③ Select the "FAT32" file system;
④ click “Start”;
⑤ After formatting accomplishes, click “OK”.
MYiR-Tech | www.myirtech.com8 / 15
Z-turn Lite Board Linux Development Manual
NOTE: The “HP USB Disk Storage Format Tool 2.0.6” Tool will clear all data in the TF
card. Please make backup before formatting.
4.2 Prepare Image File
Copy the image to the Micro SD Card which just create. You can find all of them in the
CDROM..
Image Description
boot.bin
This is the system startup program, including“fsbl”, and “u-boot”.
The specific building methods will be described in "Z-turn Board
Programmable Logic Development Manual".
7z007.bit/7z010.bit XC7Z007S/XC7Z010 Bitstream File
devicetree.dtb Device Tree
uramdisk.image.gz Ramdisk file system
uEnv.txt U-boot Environment File
rootfs.tar Root filesystem, it will copy to eMMC
Table 4-2
4.3 Start Install
⑴Close JP2 and open JP1:
(2)Insert TF card which just copyed image. Connect the serial port set baud rate to
115200, then powered on;
(3) It will load into Ramdisk, Enter Linux command, keyin as follow:
welcome to myir board
myir login: root
[root@myir ~]#/updatesys.sh /mnt/mmcblk1p1
The script will be copy BOOT.bin, 7z010.bit, devicetree.dtb and uImage into the
QSPI-Flash, copy the rootfs.tar to eMMC.
(4) After the programming is completed, Close JP2, and Close JP1, Power ON again.
MYiR-Tech | www.myirtech.com9 / 15
Z-turn Lite Board Linux Development Manual
Chapter 5 Linux Application
Z-turn Lite Board provides demo programs for common peripherals. These programs and
source codes are storaged in the "<WORKDIR>/Examples/" directory. Please compile the
source codes according to the “Makefile” or “README” file in directory:
$ cd <WORKDIR>/Examples/
$ export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
$ make
Connect J24, set the baud rate for 115200, 8 data bits, stop bits 1, no parity; Copy the
corresponding executable program to the development board. If the program can not be
executed, please execute the following command first:
# chmod +x <program-to-be-executed>*
5.1 LED
This example demonstrates how to use LED by Linux API, please refer to the source
codes for detailed information.
Copy the executable file “led-test” from directory "<WORKDIR>/Examples/led-test" to the
development board, and connect J24 to PC. Execute the following command and the LED
on the development board, will flash rapidly:
# ./led-test
5.2 Button
This example demonstrates how to read the button by Linux API, please refer to the
source codes for detailed information.
Copy the executable file “btn-test” from directory "<WORKDIR>/Examples/btn-test" to the
development board, Execute the following command and press K3 on the development
board, related information will output from the serial port:
# ./btn-test
MYiR-Tech | www.myirtech.com10 / 15
Z-turn Lite Board Linux Development Manual
Appendix 1 Warranty & Technical Support
Services
MYIR Tech Limited is a global provider of ARM hardware and software tools, design
solutions for embedded applications. We support our customers in a wide range of
services to accelerate your time to market.
MYIR is an ARM Connected Community Member and work closely with ARM and many
semiconductor vendors. We sell products ranging from board level products such as
development boards, single board computers and CPU modules to help with your
evaluation, prototype, and system integration or creating your own applications. Our
products are used widely in industrial control, medical devices, consumer electronic,
telecommunication systems, Human Machine Interface (HMI) and more other embedded
applications. MYIR has an experienced team and provides custom design services based
on ARM processors to help customers make your idea a reality.
The contents below introduce to customers the warranty and technical support services
provided by MYIR as well as the matters needing attention in using MYIR’s products.
Service Guarantee
MYIR regards the product quality as the life of an enterprise. We strictly check and control
the core board design, the procurement of components, production control, product
testing, packaging, shipping and other aspects and strive to provide products with best
quality to customers. We believe that only quality products and excellent services can
ensure the long-term cooperation and mutual benefit.
Price
MYIR insists on providing customers with the most valuable products. We do not pursue
excess profits which we think only for short-time cooperation. Instead, we hope to
establish long-term cooperation and win-win business with customers. So we will offer
reasonable prices in the hope of making the business greater with the customers together
hand in hand.
Delivery Time
MYIR will always keep a certain stock for its regular products. If your order quantity is less
than the amount of inventory, the delivery time would be within three days; if your order
quantity is greater than the number of inventory, the delivery time would be always four to
MYiR-Tech | www.myirtech.com11 / 15
Z-turn Lite Board Linux Development Manual
six weeks. If for any urgent delivery, we can negotiate with customer and try to supply the
goods in advance.
Technical Support
MYIR has a professional technical support team. Customer can contact us by email
([email protected]), we will try to reply you within 48 hours. For mass production
and customized products, we will specify person to follow the case and ensure the smooth
production.
After-sale Service
MYIR offers one year free technical support and after-sales maintenance service from the
purchase date. The service covers:
1. Technical support service
a) MYIR offers technical support for the hardware and software materials
which have provided to customers;
b) To help customers compile and run the source code we offer;
c) To help customers solve problems occurred during operations if users
follow the user manual documents;
d) To judge whether the failure exists;
e) To provide free software upgrading service.
However, the following situations are not included in the scope of our free technical
support service:
a) Hardware or software problems occurred during customers’ own
development;
b) Problems occurred when customers compile or run the OS which is tailored
by themselves;
c) Problems occurred during customers’ own applications development;
d) Problems occurred during the modification of MYIR’s software source code.
2. After-sales maintenance service
The products except LCD, which are not used properly, will take the twelve months free
maintenance service since the purchase date. But following situations are not included in
the scope of our free maintenance service:
a) The warranty period is expired;
b) The customer cannot provide proof-of-purchase or the product has no serial number;
MYiR-Tech | www.myirtech.com12 / 15
Z-turn Lite Board Linux Development Manual
c) The customer has not followed the instruction of the manual which has caused the
damage the product;
d) Due to the natural disasters (unexpected matters), or natural attrition of the
components, or unexpected matters leads the defects of appearance/function;
e) Due to the power supply, bump, leaking of the roof, pets, moist, impurities into the
boards, all those reasons which have caused the damage of the products or defects of
appearance;
f) Due to unauthorized weld or dismantle parts or repair the products which has caused
the damage of the products or defects of appearance;
g) Due to unauthorized installation of the software, system or incorrect configuration or
computer virus which has caused the damage of products.
Warm tips:
1) MYIR does not supply maintenance service to LCD. We suggest the customer first
check the LCD when receiving the goods. In case the LCD cannot run or no display,
customer should contact MYIR within 7 business days from the moment get the
goods.
2) Please do not use finger nails or hard sharp object to touch the surface of the LCD.
3) MYIR suggests user purchasing a piece of special wiper to wipe the LCD after long
time use, please avoid clean the surface with fingers or hands to leave fingerprint.
4) Do not clean the surface of the screen with chemicals.
5) Please read through the product user manual before you using MYIR’s products.
6) For any maintenance service, customers should communicate with MYIR to confirm
the issue first. MYIR’s support team will judge the failure to see if the goods need to be
returned for repair service, we will issue you RMA number for return maintenance
service after confirmation.
3. Maintenance period and charges
a) MYIR will test the products within three days after receipt of the returned goods and
inform customer the testing result. Then we will arrange shipment within one week for the
repaired goods to the customer. For any special failure, we will negotiate with customers
to confirm the maintenance period.
b) For products within warranty period and caused by quality problem, MYIR offers free
maintenance service; for products within warranty period but out of free maintenance
MYiR-Tech | www.myirtech.com13 / 15
Z-turn Lite Board Linux Development Manual
service scope, MYIR provides maintenance service but shall charge some basic material
cost; for products out of warranty period, MYIR provides maintenance service but shall
charge some basic material cost and handling fee.
4. Shipping cost
During the warranty period, the shipping cost which delivered to MYIR should be
responsible by user; MYIR will pay for the return shipping cost to users when the product
is repaired. If the warranty period is expired, all the shipping cost will be responsible by
users.
5. Products Life Cycle
MYIR will always select mainstream chips for our design, thus to ensure at least ten years
continuous supply; if meeting some main chip stopping production, we will inform
customers in time and assist customers with products updating and upgrading.
Value-added Services
1. MYIR provides services of driver development base on MYIR’s products, like serial
port, USB, Ethernet, LCD, etc.
2. MYIR provides the services of OS porting, BSP drivers’ development, API software
development, etc.
3. MYIR provides other products supporting services like power adapter, LCD panel, etc.
4. ODM/OEM services.
MYIR Tech Limited
Room 1306, Wensheng Center, Wenjin Plaza,
North Wenjin Road, Luohu District, Shenzhen, China 518020
Support Email: [email protected]
Sales Email: [email protected]
Phone: +86-755-22984836
Fax: +86-755-25532724
Website: www.myirtech.com