summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2017-05-15 21:27:31 +1000
committerNathan Rossi <nathan@nathanrossi.com>2017-05-15 21:27:31 +1000
commit0264be4b1718048e89f073825c61b10b858ebeab (patch)
treede75264391f810ff2a68a9cfb9e392f3caf7ea18
parent0303b641295bb893c2f17f3fc7dd080ec76875ab (diff)
downloadmeta-xilinx-0264be4b1718048e89f073825c61b10b858ebeab.tar.gz
u-boot-zynq-uenv.bb: Add recipe to generate uEnv.txt environment
Add a recipe to generate uEnv.txt environments for SD boot of Zynq targets. This replaces the existing uEnv.txt for zc702/zedboard that were manually created and populated only for u-boot-xlnx builds. The generated uEnv.txt files also support auto loading of the fpga bitstream before the kernel. Also enable the use of this recipe for all *-zynq7 machines that use U-Boot and have SD/eMMC available. And additionally setup IMAGE_BOOT_FILES for these machines. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
-rw-r--r--conf/machine/microzed-zynq7.conf8
-rw-r--r--conf/machine/picozed-zynq7.conf8
-rw-r--r--conf/machine/zc702-zynq7.conf2
-rw-r--r--conf/machine/zc706-zynq7.conf8
-rw-r--r--conf/machine/zedboard-zynq7.conf2
-rw-r--r--conf/machine/zybo-linux-bd-zynq7.conf6
-rw-r--r--conf/machine/zybo-zynq7.conf8
-rw-r--r--recipes-bsp/u-boot/u-boot-xlnx/zc702-zynq7/uEnv.txt4
-rw-r--r--recipes-bsp/u-boot/u-boot-xlnx/zedboard-zynq7/uEnv.txt4
-rw-r--r--recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb6
-rw-r--r--recipes-bsp/u-boot/u-boot-zynq-uenv.bb82
11 files changed, 120 insertions, 18 deletions
diff --git a/conf/machine/microzed-zynq7.conf b/conf/machine/microzed-zynq7.conf
index 8e24d5f5..ec28c3ff 100644
--- a/conf/machine/microzed-zynq7.conf
+++ b/conf/machine/microzed-zynq7.conf
@@ -12,9 +12,15 @@ MACHINE_FEATURES = "ext2 vfat usbhost"
12UBOOT_MACHINE = "zynq_microzed_config" 12UBOOT_MACHINE = "zynq_microzed_config"
13SPL_BINARY = "spl/boot.bin" 13SPL_BINARY = "spl/boot.bin"
14 14
15EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv"
16
15SERIAL_CONSOLE = "115200 ttyPS0" 17SERIAL_CONSOLE = "115200 ttyPS0"
16 18
17MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" 19MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree"
18 20
19IMAGE_BOOT_FILES += "boot.bin ${MACHINE}.dtb" 21IMAGE_BOOT_FILES += " \
22 boot.bin \
23 ${MACHINE}.dtb \
24 uEnv.txt \
25 "
20 26
diff --git a/conf/machine/picozed-zynq7.conf b/conf/machine/picozed-zynq7.conf
index e1d723c4..2fb310b9 100644
--- a/conf/machine/picozed-zynq7.conf
+++ b/conf/machine/picozed-zynq7.conf
@@ -16,9 +16,15 @@ MACHINE_FEATURES = "ext2 vfat usbhost usbgadget"
16UBOOT_MACHINE = "zynq_picozed_config" 16UBOOT_MACHINE = "zynq_picozed_config"
17SPL_BINARY = "spl/boot.bin" 17SPL_BINARY = "spl/boot.bin"
18 18
19EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv"
20
19SERIAL_CONSOLE = "115200 ttyPS0" 21SERIAL_CONSOLE = "115200 ttyPS0"
20 22
21MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" 23MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree"
22 24
23IMAGE_BOOT_FILES += "boot.bin ${MACHINE}.dtb" 25IMAGE_BOOT_FILES += " \
26 boot.bin \
27 ${MACHINE}.dtb \
28 uEnv.txt \
29 "
24 30
diff --git a/conf/machine/zc702-zynq7.conf b/conf/machine/zc702-zynq7.conf
index 503caa31..ef423013 100644
--- a/conf/machine/zc702-zynq7.conf
+++ b/conf/machine/zc702-zynq7.conf
@@ -19,6 +19,8 @@ MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost"
19UBOOT_MACHINE = "zynq_zc702_config" 19UBOOT_MACHINE = "zynq_zc702_config"
20SPL_BINARY = "spl/boot.bin" 20SPL_BINARY = "spl/boot.bin"
21 21
22EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv"
23
22SERIAL_CONSOLE = "115200 ttyPS0" 24SERIAL_CONSOLE = "115200 ttyPS0"
23 25
24KERNEL_DEVICETREE = "zynq-zc702.dtb" 26KERNEL_DEVICETREE = "zynq-zc702.dtb"
diff --git a/conf/machine/zc706-zynq7.conf b/conf/machine/zc706-zynq7.conf
index 1aff9d09..0df5aa71 100644
--- a/conf/machine/zc706-zynq7.conf
+++ b/conf/machine/zc706-zynq7.conf
@@ -19,8 +19,16 @@ MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost usbgadget"
19UBOOT_MACHINE = "zynq_zc706_config" 19UBOOT_MACHINE = "zynq_zc706_config"
20SPL_BINARY = "spl/boot.bin" 20SPL_BINARY = "spl/boot.bin"
21 21
22EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv"
23
22SERIAL_CONSOLE = "115200 ttyPS0" 24SERIAL_CONSOLE = "115200 ttyPS0"
23 25
24KERNEL_DEVICETREE = "zynq-zc706.dtb" 26KERNEL_DEVICETREE = "zynq-zc706.dtb"
25KERNEL_FEATURES += "features/rtc/rtc.scc" 27KERNEL_FEATURES += "features/rtc/rtc.scc"
26 28
29IMAGE_BOOT_FILES += " \
30 boot.bin \
31 ${KERNEL_IMAGETYPE}-zynq-zc706.dtb \
32 uEnv.txt \
33 "
34
diff --git a/conf/machine/zedboard-zynq7.conf b/conf/machine/zedboard-zynq7.conf
index 90dc993b..58cee372 100644
--- a/conf/machine/zedboard-zynq7.conf
+++ b/conf/machine/zedboard-zynq7.conf
@@ -16,6 +16,8 @@ require conf/machine/include/machine-xilinx-board.inc
16UBOOT_MACHINE = "zynq_zed_config" 16UBOOT_MACHINE = "zynq_zed_config"
17SPL_BINARY = "spl/boot.bin" 17SPL_BINARY = "spl/boot.bin"
18 18
19EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv"
20
19SERIAL_CONSOLE = "115200 ttyPS0" 21SERIAL_CONSOLE = "115200 ttyPS0"
20 22
21KERNEL_DEVICETREE = "zynq-zed.dtb" 23KERNEL_DEVICETREE = "zynq-zed.dtb"
diff --git a/conf/machine/zybo-linux-bd-zynq7.conf b/conf/machine/zybo-linux-bd-zynq7.conf
index a5505c06..d44575bd 100644
--- a/conf/machine/zybo-linux-bd-zynq7.conf
+++ b/conf/machine/zybo-linux-bd-zynq7.conf
@@ -21,11 +21,15 @@ UBOOT_MACHINE = "zynq_zybo_config"
21SPL_BINARY = "spl/boot.bin" 21SPL_BINARY = "spl/boot.bin"
22FORCE_PLATFORM_INIT = "1" 22FORCE_PLATFORM_INIT = "1"
23 23
24EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv"
25
24EXTRA_IMAGEDEPENDS += "virtual/bitstream" 26EXTRA_IMAGEDEPENDS += "virtual/bitstream"
25 27
26IMAGE_BOOT_FILES += "boot.bin \ 28IMAGE_BOOT_FILES += " \
29 boot.bin \
27 ${MACHINE}.dtb \ 30 ${MACHINE}.dtb \
28 bitstream \ 31 bitstream \
32 uEnv.txt \
29 " 33 "
30 34
31KERNEL_FEATURES += " \ 35KERNEL_FEATURES += " \
diff --git a/conf/machine/zybo-zynq7.conf b/conf/machine/zybo-zynq7.conf
index 361d7ccd..ddddfba1 100644
--- a/conf/machine/zybo-zynq7.conf
+++ b/conf/machine/zybo-zynq7.conf
@@ -16,9 +16,15 @@ MACHINE_FEATURES = "ext2 vfat usbhost usbgadget"
16UBOOT_MACHINE = "zynq_zybo_config" 16UBOOT_MACHINE = "zynq_zybo_config"
17SPL_BINARY = "spl/boot.bin" 17SPL_BINARY = "spl/boot.bin"
18 18
19EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv"
20
19SERIAL_CONSOLE = "115200 ttyPS0" 21SERIAL_CONSOLE = "115200 ttyPS0"
20 22
21KERNEL_DEVICETREE = "zynq-zybo.dtb" 23KERNEL_DEVICETREE = "zynq-zybo.dtb"
22 24
23IMAGE_BOOT_FILES += "boot.bin ${KERNEL_IMAGETYPE}-zynq-zybo.dtb" 25IMAGE_BOOT_FILES += " \
26 boot.bin \
27 ${KERNEL_IMAGETYPE}-zynq-zybo.dtb \
28 uEnv.txt \
29 "
24 30
diff --git a/recipes-bsp/u-boot/u-boot-xlnx/zc702-zynq7/uEnv.txt b/recipes-bsp/u-boot/u-boot-xlnx/zc702-zynq7/uEnv.txt
deleted file mode 100644
index b7d57396..00000000
--- a/recipes-bsp/u-boot/u-boot-xlnx/zc702-zynq7/uEnv.txt
+++ /dev/null
@@ -1,4 +0,0 @@
1kernel_image=uImage
2devicetree_image=uImage-zynq-zc702.dtb
3bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk
4uenvcmd=echo Copying Linux from SD to RAM... && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000
diff --git a/recipes-bsp/u-boot/u-boot-xlnx/zedboard-zynq7/uEnv.txt b/recipes-bsp/u-boot/u-boot-xlnx/zedboard-zynq7/uEnv.txt
deleted file mode 100644
index 22b922a5..00000000
--- a/recipes-bsp/u-boot/u-boot-xlnx/zedboard-zynq7/uEnv.txt
+++ /dev/null
@@ -1,4 +0,0 @@
1kernel_image=uImage
2devicetree_image=uImage-zynq-zed.dtb
3bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk
4uenvcmd=echo Copying Linux from SD to RAM... && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000
diff --git a/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb b/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb
index 99ce95a0..71d11324 100644
--- a/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb
+++ b/recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb
@@ -20,12 +20,6 @@ SRC_URI_append_kc705-microblazeel = " file://microblaze-kc705-Convert-microblaze
20LICENSE = "GPLv2+" 20LICENSE = "GPLv2+"
21LIC_FILES_CHKSUM = "file://README;beginline=1;endline=6;md5=157ab8408beab40cd8ce1dc69f702a6c" 21LIC_FILES_CHKSUM = "file://README;beginline=1;endline=6;md5=157ab8408beab40cd8ce1dc69f702a6c"
22 22
23UBOOT_ENV_zc702-zynq7 = "uEnv"
24UBOOT_ENV_zedboard-zynq7 = "uEnv"
25
26SRC_URI_append_zc702-zynq7 = " file://uEnv.txt"
27SRC_URI_append_zedboard-zynq7 = " file://uEnv.txt"
28
29# u-boot 2016.07 has support for these 23# u-boot 2016.07 has support for these
30HAS_PLATFORM_INIT ?= " \ 24HAS_PLATFORM_INIT ?= " \
31 zynq_microzed_config \ 25 zynq_microzed_config \
diff --git a/recipes-bsp/u-boot/u-boot-zynq-uenv.bb b/recipes-bsp/u-boot/u-boot-zynq-uenv.bb
new file mode 100644
index 00000000..60b2759c
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-zynq-uenv.bb
@@ -0,0 +1,82 @@
1SUMMARY = "U-Boot uEnv.txt SD boot environment generation for Zynq targets"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
4
5INHIBIT_DEFAULT_DEPS = "1"
6PACKAGE_ARCH = "${MACHINE_ARCH}"
7
8COMPATIBLE_MACHINE = "^$"
9COMPATIBLE_MACHINE_zynq = "zynq"
10
11inherit deploy
12
13def bootfiles_bitstream(d):
14 expectedfiles = [("bitstream", True)]
15 expectedexts = [(".bit", True), (".bin", False)]
16 # search for bitstream paths, use the renamed file. First matching is used
17 for f in (d.getVar("IMAGE_BOOT_FILES") or "").split():
18 sf, rf = f, f
19 if ';' in f:
20 sf, rf = f.split(';')
21
22 # skip boot.bin, it is not a bitstream
23 if sf == "boot.bin" or rf == "boot.bin":
24 continue
25
26 for e, t in expectedfiles:
27 if sf == e or rf == e:
28 return rf, t
29 for e, t in expectedexts:
30 if sf.endswith(e) or rf.endswith(e):
31 return rf, t
32 return "", False
33
34def bootfiles_dtb_filepath(d):
35 if d.getVar("IMAGE_BOOT_FILES"):
36 dtbs = d.getVar("IMAGE_BOOT_FILES").split(" ")
37 # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>'
38 dtbs = [f.split(";")[0] for f in dtbs]
39 dtbs = [f for f in dtbs if f.endswith(".dtb")]
40 if len(dtbs) != 0:
41 return dtbs[0]
42 return ""
43
44do_compile() {
45 echo "machine_name=${MACHINE}" > ${WORKDIR}/uEnv.txt
46
47 echo "kernel_image=${KERNEL_IMAGETYPE}" >> ${WORKDIR}/uEnv.txt
48 echo "devicetree_image=${@bootfiles_dtb_filepath(d)}" >> ${WORKDIR}/uEnv.txt
49
50 # bootargs, default to booting with the rootfs device being partition 2 of the first mmc device
51 echo 'bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk' >> ${WORKDIR}/uEnv.txt
52
53 echo 'loadkernel=fatload mmc 0 ${kernel_load_address} ${kernel_image}' >> ${WORKDIR}/uEnv.txt
54 echo 'loaddtb=fatload mmc 0 ${devicetree_load_address} ${devicetree_image}' >> ${WORKDIR}/uEnv.txt
55 echo 'bootkernel=run loadkernel && run loaddtb && bootm ${kernel_load_address} - ${devicetree_load_address}' >> ${WORKDIR}/uEnv.txt
56
57 BITSTREAMPATH="${@bootfiles_bitstream(d)[0]}"
58 if [ ! -z "$BITSTREAMPATH" ]; then
59 echo "bitstream_image=$BITSTREAMPATH" >> ${WORKDIR}/uEnv.txt
60 # if bitstream is "bit" format use loadb, otherwise use load
61 echo "bitstream_type=${@'loadb' if bootfiles_bitstream(d)[1] else 'load'}" >> ${WORKDIR}/uEnv.txt
62 echo 'loadfpga=fatload mmc 0 ${loadbit_addr} ${bitstream_image} && fpga ${bitstream_type} 0 ${loadbit_addr} ${filesize}' >> ${WORKDIR}/uEnv.txt
63
64 # load bitstream first
65 echo "uenvcmd=run loadfpga && run bootkernel" >> ${WORKDIR}/uEnv.txt
66 else
67 # no need to load bitstream during boot
68 echo "uenvcmd=run bootkernel" >> ${WORKDIR}/uEnv.txt
69 fi
70}
71
72FILES_${PN} += "/boot/uEnv.txt"
73
74do_install() {
75 install -Dm 0644 ${WORKDIR}/uEnv.txt ${D}/boot/uEnv.txt
76}
77
78do_deploy() {
79 install -Dm 0644 ${WORKDIR}/uEnv.txt ${DEPLOYDIR}/uEnv.txt
80}
81addtask do_deploy after do_compile before do_build
82