Getting Started With Embedded
Linux – ZedBoard
Revision:
January 13, 2013
1300 NE Henley Court, Suite 3
Pullman, WA 99163
(509) 334 6306 Voice | (509) 334 6300 Fax
Overview
Booting the Zynq-7000
TM
All Programmable SoC (Zynq AP SoC) from an SD card, or another form of
compatible memory, requires that you first place four items onto your storage device. The four
required items are the Linux file system (either Linaro or BusyBox), a Linux kernel image, a
BOOT.BIN file, and a compiled device tree.
This guide provides instructions on how to generate these four items and on using them to boot the
ZedBoard from an SD card. To complete these instructions, you must first ensure that you have a
computer running a Linux distribution, a working knowledge of how to use the corresponding package
manager to obtain software applications and libraries (e.g. yum for Fedora, or apt-get for Ubuntu), a
4GB or larger SD card, and a card reader.
Formatting the SD Card
Booting Linux on the ZedBoard from an SD card requires that you first set up the correct partitions on
the SD card. You must format the first two partitions on the SD card to specific parameters. The first
partition must have a FAT file system and be at least 1GB and the second partition must have an ext4
file system and be at least 3GB.
The second partition is only necessary when using the Linaro file system. However, Digilent Inc.
recommends formatting your SD card with both partitions in case you decide to switch file systems in
the future. Follow steps 1-4 on a Linux computer to properly format the SD card with both partitions.
Note:
The shaded terminal display sections in this guide show operator input in bold characters.
1) Identify the SD card device node. Identify this node by making sure to remove the SD card
from your Linux machine and then running
lsblk
.
[tinghui.wang@DIGILENT_LINUX ~]$
lsblk
NAME
MAJ:MIN RM
SIZE RO TYPE MOUNTPOINT
sda
8:0
0 465.8G 0 disk
├─sda1
8:1
0
500M 0 part /boot
└─sda2
8:2
0 465.3G 0 part
├─VolGroup-lv_root (dm-0) 253:0
0 455.5G 0 lvm /
└─VolGroup-lv_swap (dm-1) 253:1
0
9.8G 0 lvm [SWAP]
sr0
11:0
1
6.8G 0 rom
After first running
lsblk
, insert the SD card and run the command again.
page 1 of 12
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Getting Started with Embedded Linux – ZedBoard
[tinghui.wang@DIGILENT_LINUX ~]$
lsblk
NAME
MAJ:MIN RM
SIZE RO TYPE MOUNTPOINT
sda
8:0
0 465.8G 0 disk
├─sda1
8:1
0
500M 0 part /boot
└─sda2
8:2
0 465.3G 0 part
├─VolGroup-lv_root (dm-0) 253:0
0 455.5G 0 lvm /
└─VolGroup-lv_swap (dm-1) 253:1
0
9.8G 0 lvm [SWAP]
sr0
11:0
1
6.8G 0 rom
sdd
8:48
1
7.5G 0 disk
└─sdd1
8:49
1
3.7G 0 part /media/ZED_BOOT
A new line containing the SD card device node will appear the second time you run
lsblk
. In
the example above, the SD card device node is
/dev/sdd
, highlighted in red.
2) Some distributions will automatically mount any partitions on an SD Card when you insert it.
Input the
df
command to see if the SD card has any mounted partitions. If it does, ensure that
you unmount these automatically mounted partitions before you repartition the disk.
[tinghui.wang@DIGILENT_LINUX ~]$
df
Filesystem
1K-blocks
Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
470166952 316061992 130221800 71% /
tmpfs
3988440
976
3987464
1% /dev/shm
/dev/sda1
495844
65557
404687 14% /boot
/dev/sdd1
3862528
10268
3852260
1% /media/ZED_BOOT
Call
umount
for each of the mounted partitions on your SD Card to remove them.
[tinghui.wang@DIGILENT_LINUX ~]$
sudo umount /media/ZED_BOOT/
[tinghui.wang@DIGILENT_LINUX ~]$
df
Filesystem
1K-blocks
Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
470166952 316062016 130221776 71% /
tmpfs
3988440
976
3987464
1% /dev/shm
/dev/sda1
495844
65557
404687 14% /boot
3) Once you have unmounted all of the partitions, you can begin to repartition the SD card with
the
fdisk
tool. Open the SD card device using
fdisk
and issue command
p
to print the
current SD card partition table.
www.digilentinc.com
page 2 of 12
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Getting Started with Embedded Linux – ZedBoard
[tinghui.wang@DIGILENT_LINUX ~]$
sudo fdisk /dev/sdd
[sudo] password for tinghui.wang:
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help):
p
Disk /dev/sdd: 3965 MB, 3965190144 bytes
228 heads, 2 sectors/track, 16983 cylinders
Units = cylinders of 456 * 512 = 233472 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00047708
Device Boot
/dev/sdd1
Start
1
End
16978
Blocks
3870720
Id
b
System
W95 FAT32
Input the
d
command to delete any existing partitions. If only one partition exists, it will be
selected automatically.
Command (m for help):
d
Selected partition 1
Command (m for help):
p
Disk /dev/sdd: 3965 MB, 3965190144 bytes
228 heads, 2 sectors/track, 16983 cylinders
Units = cylinders of 456 * 512 = 233472 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00047708
Device Boot
Start
End
Blocks
Id
System
Once you have deleted the existing partitions, you can create the new partitions with the
n
command. Create two primary partitions with these properties.
Partition Number 1: A primary partition starting from the first cylinder with a size of
1GB.
Partition Number 2: A primary partition starting from the next available cylinder that
ideally takes up the remainder of the available space on the SD Card.
Use the commands in the following terminal display to create these two partitions.
Note:
The system will set any prompt you leave blank to the default value.
www.digilentinc.com
page 3 of 12
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Getting Started with Embedded Linux – ZedBoard
Command (m for help):
n
Command action
e
extended
p
primary partition (1-4)
p
Partition number (1-4):
1
First cylinder (1-16983, default 1):
1
Last cylinder, +cylinders or +size{K,M,G} (1-16983, default 16983):
+1G
Command (m for help):
p
Disk /dev/sdd: 3965 MB, 3965190144 bytes
228 heads, 2 sectors/track, 16983 cylinders
Units = cylinders of 456 * 512 = 233472 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00047708
Device Boot
/dev/sdd1
Start
1
End
4600
Blocks
1048799
Id
83
System
Linux
Command (m for help):
n
Command action
e
extended
p
primary partition (1-4)
p
Partition number (1-4):
2
First cylinder (4601-16983, default 4601):
Using default value 4601
Last cylinder, +cylinders or +size{K,M,G} (4601-16983, default 16983):
Using default value 16983
Command (m for help):
p
Disk /dev/sdd: 3965 MB, 3965190144 bytes
228 heads, 2 sectors/track, 16983 cylinders
Units = cylinders of 456 * 512 = 233472 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00047708
Device Boot
/dev/sdd1
/dev/sdd2
Start
1
4601
End
4600
16983
Blocks
1048799
2823324
Id
83
83
System
Linux
Linux
Once you make the required changes, use command
w
to write them to the SD card’s partition
table. Issuing command
w
will cause
fdisk
to automatically exit.
Command (m for help):
w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
www.digilentinc.com
page 4 of 12
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Getting Started with Embedded Linux – ZedBoard
4) The final step to partitioning your SD card is creating the file systems. Format Partition
Number 1 to FAT with the label “ZED_BOOT” and Partition Number 2 to EXT4 with the label
“ROOT_FS”. Use the utility
mkfs
to format your partitions.
[tinghui.wang@DIGILENT_LINUX ~]$
sudo mkfs -t vfat -n ZED_BOOT /dev/sdd1
mkfs.vfat 3.0.9 (31 Jan 2010)
[tinghui.wang@DIGILENT_LINUX ~]$
sudo mkfs -t ext4 -L ROOT_FS /dev/sdd2
mke2fs 1.41.12 (17-May-2010)
Filesystem label=ROOT_FS
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
176704 inodes, 705831 blocks
35291 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=725614592
22 block groups
32768 blocks per group, 32768 fragments per group
8032 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
The SD card should be ready for the Linux file system once you have correctly formatted the
partitions.
The Linux File System
The ZedBoard currently supports two different Linux file systems, a BusyBox ramdisk and a Linaro
Ubuntu distribution.
The BusyBox ramdisk is a very small file system that includes basic functionality and runs through
RAM. BusyBox is non-persistent, which means it will not save any changes you make during your
operating session after you power down the ZedBoard. (See Figure 1.)
www.digilentinc.com
page 5 of 12
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.