Skip to content

Commit 68f7935

Browse files
committed
[add] linux kernel image, devicetree and u-boot for PYNQ-Z1
1 parent 0128d8d commit 68f7935

File tree

9 files changed

+601
-5
lines changed

9 files changed

+601
-5
lines changed

Readme.md

Lines changed: 119 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ This Repository provides a Linux Boot Image(U-boot, Kernel, Root-fs) for FPGA-So
1212

1313
* Hardware
1414
+ ZYBO : Xilinx Zynq-7000 ARM/FPGA SoC Trainer Board by Digilent
15+
+ PYNQ-Z1 : Python Productive for Zynq by Digilent
1516
+ DE0-Nano-SoC : Altera SoC FPGA Development Kit by terasic
1617
* U-Boot v2016.03 (customized)
17-
+ Build for ZYBO and DE0-Nano-SoC
18+
+ Build for ZYBO, PYNQ-Z1 and DE0-Nano-SoC
1819
+ Customized boot by uEnv.txt
1920
+ Customized boot by boot.scr
2021
* Linux Kernel Version v4.8.17
@@ -55,8 +56,8 @@ shell$ git lfs pull origin master
5556
- design_1_wrapper.bit : FPGA configuration file (Xilinx Bitstream Format)
5657
- u-boot.img : Stage 2 Boot Loader(U-boot)
5758
- uEnv.txt : U-Boot environment variables for linux boot
58-
- zImage-4.8.17-armv7-fpga : Linux Kernel Image (use Git LFS)
59-
- devicetree-4.8.17-zynq-zybo.dtb : Linux Device Tree Blob (use Git LFS)
59+
- zImage-4.8.17-armv7-fpga : Linux Kernel Image
60+
- devicetree-4.8.17-zynq-zybo.dtb : Linux Device Tree Blob
6061
- devicetree-4.8.17-zynq-zybo.dts : Linux Device Tree Source
6162
+ examples-001.tgz : Examples Programs (use Git LFS)
6263
* debian8-rootfs-vanilla.tgz : Debian8 Root File System (use Git LFS)
@@ -90,6 +91,57 @@ shell# umount mnt/usb1
9091
shell# umount mnt/usb2
9192
````
9293

94+
### PYNQ-Z1
95+
96+
#### Downlowd from github
97+
98+
```
99+
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
100+
shell$ cd FPGA-SoC-Linux
101+
shell$ git lfs pull origin master
102+
```
103+
104+
#### File Description
105+
106+
* tareget/zynq-pynqz1/
107+
+ boot/
108+
- boot.bin : Stage 1 Boot Loader(U-boot-spl)
109+
- u-boot.img : Stage 2 Boot Loader(U-boot)
110+
- uEnv.txt : U-Boot environment variables for linux boot
111+
- zImage-4.8.17-armv7-fpga : Linux Kernel Image
112+
- devicetree-4.8.17-zynq-pynqz1.dtb : Linux Device Tree Blob
113+
- devicetree-4.8.17-zynq-pynqz1.dts : Linux Device Tree Source
114+
* debian8-rootfs-vanilla.tgz : Debian8 Root File System (use Git LFS)
115+
* linux-image-4.8.17-armv7-fpga_4.8.17-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
116+
* linux-headers-4.8.17-armv7-fpga_4.8.17-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
117+
* fpga-soc-linux-drivers-4.8.17-armv7-fpga_0.0.3-1_armhf.deb : Device Drivers Package (use Git LFS)
118+
119+
#### Format SD-Card
120+
121+
````
122+
shell# fdisk /dev/sdc
123+
:
124+
:
125+
:
126+
shell# mkfs-vfat /dev/sdc1
127+
shell# mkfs.ext3 /dev/sdc2
128+
````
129+
130+
#### Write to SD-Card
131+
132+
````
133+
shell# mount /dev/sdc1 /mnt/usb1
134+
shell# mount /dev/sdc2 /mnt/usb2
135+
shell# cp target/zynq-pynqz1/boot/* /mnt/usb1
136+
shell# tar xfz debian8-rootfs-vanilla.tgz -C /mnt/usb2
137+
shell# cp linux-image-4.8.17-armv7-fpga_4.8.17-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga
138+
shell# cp linux-headers-4.8.17-armv7-fpga_4.8.17-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga
139+
shell# cp fpga-soc-linux-drivers-4.8.17-armv7-fpga_0.0.3-1_armhf.deb /mnt/usb2/home/fpga
140+
shell# tar xfz target/zynq-zybo/examples-001.tgz -C /mnt/usb2/home/fpga
141+
shell# umount mnt/usb1
142+
shell# umount mnt/usb2
143+
````
144+
93145
### DE0-Nano-SoC
94146

95147
#### Downlowd from github
@@ -106,8 +158,8 @@ shell$ git lfs pull origin master
106158
+ boot/
107159
- DE0_NANO_SOC.rbf : FPGA configuration file (Raw Binary Format)
108160
- uEnv.txt : U-Boot environment variables for linux boot
109-
- zImage-4.8.17-armv7-fpga : Linux Kernel Image (use Git LFS)
110-
- devicetree-4.8.17-socfpga.dtb : Linux Device Tree Blob (use Git LFS)
161+
- zImage-4.8.17-armv7-fpga : Linux Kernel Image
162+
- devicetree-4.8.17-socfpga.dtb : Linux Device Tree Blob
111163
- devicetree-4.8.17-socfpga.dts : Linux Device Tree Source
112164
+ u-boot/
113165
- u-boot-spl.sfp : Stage 1 Boot Loader(U-boot-spl)
@@ -765,6 +817,58 @@ shell$ cp spl/boot.bin ../zynq-zybo/boot/
765817
shell$ cp u-boot.img ../zynq-zybo/boot/
766818
```
767819
820+
### Build U-boot for PYNQ-Z1
821+
822+
There are two ways
823+
824+
1. run scripts/build-u-boot-zynq-pynqz1.sh (easy)
825+
2. run this chapter step-by-step (annoying)
826+
827+
#### Download U-boot Source
828+
829+
##### Clone from git.denx.de/u-boot.git
830+
831+
```
832+
shell$ git clone git://git.denx.de/u-boot.git u-boot-zynq-pynqz1
833+
````
834+
835+
##### Checkout v2016.03
836+
837+
```
838+
shell$ cd u-boot-zynq-pynqz1
839+
shell$ git checkout -b u-boot-2016.03-zynq-pynqz1 refs/tags/v2016.03
840+
```
841+
842+
#### Patch for zynq-zybo
843+
844+
```
845+
shell$ patch -p0 < ../files/u-boot-2016.03-zynq-pynqz1.diff
846+
shell$ git add --update
847+
shell$ git commit -m "patch for zynq-pynqz1"
848+
```
849+
850+
#### Setup for Build
851+
852+
```
853+
shell$ cd u-boot-zynq-pynqz1
854+
shell$ export ARCH=arm
855+
shell$ export CROSS_COMPILE=arm-linux-gnueabihf-
856+
shell$ make zynq_pynqz1_defconfig
857+
```
858+
859+
#### Build u-boot
860+
861+
```
862+
shell$ make
863+
```
864+
865+
#### Copy boot.bin and u-boot.img to zybo-pynqz1/boot/
866+
867+
```
868+
shell$ cp spl/boot.bin ../zynq-pynqz1/boot/
869+
shell$ cp u-boot.img ../zynq-pynqz1/boot/
870+
```
871+
768872
### Build U-boot for DE0-Nano-SoC
769873
770874
There are two ways
@@ -845,6 +949,7 @@ shell$ git checkout -b linux-4.8.17-armv7-fpga refs/tags/v4.8.17
845949
shell$ patch -p0 < ../files/linux-4.8.17-armv7-fpga.diff
846950
shell$ git add --update
847951
shell$ git add arch/arm/configs/armv7_fpga_defconfig
952+
shell$ git add arch/arm/boot/dts/zynq-pynqz1.dts
848953
shell$ git commit -m "patch for armv7-fpga"
849954
shell$ git tag -a v4.8.17-armv7-fpga -m "relase v4.8.17-armv7-fpga"
850955
```
@@ -863,6 +968,7 @@ shell$ make armv7_fpga_defconfig
863968
````
864969
shell$ make deb-pkg
865970
shell$ make zynq-zybo.dtb
971+
shell$ make zynq-pynqz1.dtb
866972
shell$ make socfpga_cyclone5_de0_sockit.dtb
867973
````
868974

@@ -874,6 +980,14 @@ shell$ cp arch/arm/boot/dts/zynq-zybo.dtb ../target/zynq-zybo/boot/devicetree-4.
874980
shell$ dtc -I dtb -O dts -o ../target/zynq-zybo/boot/devicetree-4.8.17-zynq-zybo.dts arch/arm/boot/dts/zynq-zybo.dtb
875981
```
876982

983+
#### Copy zImage and devicetree to target/zybo-pynqz1/boot/
984+
985+
```
986+
shell$ cp arch/arm/boot/zImage ../target/zynq-pynqz1/boot/zImage-4.8.17-armv7-fpga
987+
shell$ cp arch/arm/boot/dts/zynq-pynqz1.dtb ../target/zynq-pynqz1/boot/devicetree-4.8.17-zynq-pynqz1.dtb
988+
shell$ dtc -I dtb -O dts -o ../target/zynq-pynqz1/boot/devicetree-4.8.17-zynq-pynqz1.dts arch/arm/boot/dts/zynq-pynqz1.dtb
989+
```
990+
877991
#### Copy zImage and devicetree to target/de0-nano-soc/boot/
878992

879993
```

files/linux-4.8.17-armv7-fpga.diff

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,85 @@
1+
diff --git arch/arm/boot/dts/Makefile arch/arm/boot/dts/Makefile
2+
index faacd52..9d09920 100644
3+
--- arch/arm/boot/dts/Makefile
4+
+++ arch/arm/boot/dts/Makefile
5+
@@ -863,6 +863,7 @@ dtb-$(CONFIG_ARCH_VT8500) += \
6+
wm8850-w70v2.dtb
7+
dtb-$(CONFIG_ARCH_ZYNQ) += \
8+
zynq-parallella.dtb \
9+
+ zynq-pynqz1.dtb \
10+
zynq-zc702.dtb \
11+
zynq-zc706.dtb \
12+
zynq-zed.dtb \
13+
diff --git arch/arm/boot/dts/zynq-pynqz1.dts arch/arm/boot/dts/zynq-pynqz1.dts
14+
new file mode 100644
15+
index 0000000..4a4a7b2
16+
--- /dev/null
17+
+++ arch/arm/boot/dts/zynq-pynqz1.dts
18+
@@ -0,0 +1,64 @@
19+
+/*
20+
+ * Digilent PYNQ-Z1 board DTS
21+
+ *
22+
+ * Copyright (C) 2016 Digilent
23+
+ *
24+
+ * SPDX-License-Identifier: GPL-2.0+
25+
+ */
26+
+/dts-v1/;
27+
+#include "zynq-7000.dtsi"
28+
+
29+
+/ {
30+
+ model = "Zynq ARTY Z7 Development Board";
31+
+ compatible = "digilent,zynq-pynqz1", "xlnx,zynq-7000";
32+
+
33+
+ aliases {
34+
+ ethernet0 = &gem0;
35+
+ serial0 = &uart0;
36+
+ };
37+
+
38+
+ memory {
39+
+ device_type = "memory";
40+
+ reg = <0x0 0x20000000>;
41+
+ };
42+
+
43+
+ chosen {
44+
+ bootargs = "earlycon";
45+
+ stdout-path = "serial0:115200n8";
46+
+ };
47+
+
48+
+ usb_phy0: phy0 {
49+
+ #phy-cells = <0>;
50+
+ compatible = "usb-nop-xceiv";
51+
+ reset-gpios = <&gpio0 46 1>;
52+
+ };
53+
+};
54+
+
55+
+&clkc {
56+
+ ps-clk-frequency = <50000000>;
57+
+ fclk-enable = <0xf>;
58+
+};
59+
+
60+
+&gem0 {
61+
+ status = "okay";
62+
+ phy-mode = "rgmii-id";
63+
+ phy-handle = <&ethernet_phy>;
64+
+
65+
+ ethernet_phy: ethernet-phy@0 { /* rtl8211e-vl */
66+
+ reg = <1>;
67+
+ };
68+
+};
69+
+
70+
+&sdhci0 {
71+
+ status = "okay";
72+
+};
73+
+
74+
+&uart0 {
75+
+ status = "okay";
76+
+};
77+
+
78+
+&usb0 {
79+
+ status = "okay";
80+
+ dr_mode = "host";
81+
+ usb-phy = <&usb_phy0>;
82+
+};
183
diff --git arch/arm/boot/dts/zynq-zybo.dts arch/arm/boot/dts/zynq-zybo.dts
284
index d9e0f3e..c99ddc3 100644
385
--- arch/arm/boot/dts/zynq-zybo.dts

scripts/build-linux-kernel.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ git checkout -b linux-4.8.17-armv7-fpga refs/tags/v4.8.17
1212
patch -p0 < ../files/linux-4.8.17-armv7-fpga.diff
1313
git add --update
1414
git add arch/arm/configs/armv7_fpga_defconfig
15+
git add arch/arm/boot/dts/zynq-pynqz1.dts
1516
git commit -m "patch for armv7-fpga"
1617
git tag -a v4.8.17-armv7-fpga -m "relase v4.8.17-armv7-fpga"
1718

@@ -23,13 +24,19 @@ make armv7_fpga_defconfig
2324
### Build Linux Kernel and device tree
2425
make deb-pkg
2526
make zynq-zybo.dtb
27+
make zynq-pynqz1.dtb
2628
make socfpga_cyclone5_de0_sockit.dtb
2729

2830
### Copy zImage and devicetree to tareget/zybo-zynq/boot/
2931
cp arch/arm/boot/zImage ../target/zynq-zybo/boot/zImage-4.8.17-armv7-fpga
3032
cp arch/arm/boot/dts/zynq-zybo.dtb ../target/zynq-zybo/boot/devicetree-4.8.17-zynq-zybo.dtb
3133
dtc -I dtb -O dts -o ../target/zynq-zybo/boot/devicetree-4.8.17-zynq-zybo.dts arch/arm/boot/dts/zynq-zybo.dtb
3234

35+
### Copy zImage and devicetree to tareget/zybo-pynqz1/boot/
36+
cp arch/arm/boot/zImage ../target/zynq-pynqz1/boot/zImage-4.8.17-armv7-fpga
37+
cp arch/arm/boot/dts/zynq-pynqz1.dtb ../target/zynq-pynqz1/boot/devicetree-4.8.17-zynq-pynqz1.dtb
38+
dtc -I dtb -O dts -o ../target/zynq-pynqz1/boot/devicetree-4.8.17-zynq-pynqz1.dts arch/arm/boot/dts/zynq-pynqz1.dtb
39+
3340
### Copy zImage and devicetree to tareget/de0-nano-soc/boot/
3441
cp arch/arm/boot/zImage ../target/de0-nano-soc/boot/zImage-4.8.17-armv7-fpga
3542
cp arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dtb ../target/de0-nano-soc/boot/devicetree-4.8.17-socfpga.dtb

target/zynq-pynqz1/boot/boot.bin

75.4 KB
Binary file not shown.
7.72 KB
Binary file not shown.

0 commit comments

Comments
 (0)