diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2017-05-15 21:27:31 +1000 |
---|---|---|
committer | Nathan Rossi <nathan@nathanrossi.com> | 2017-05-15 21:27:31 +1000 |
commit | 0264be4b1718048e89f073825c61b10b858ebeab (patch) | |
tree | de75264391f810ff2a68a9cfb9e392f3caf7ea18 | |
parent | 0303b641295bb893c2f17f3fc7dd080ec76875ab (diff) | |
download | meta-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.conf | 8 | ||||
-rw-r--r-- | conf/machine/picozed-zynq7.conf | 8 | ||||
-rw-r--r-- | conf/machine/zc702-zynq7.conf | 2 | ||||
-rw-r--r-- | conf/machine/zc706-zynq7.conf | 8 | ||||
-rw-r--r-- | conf/machine/zedboard-zynq7.conf | 2 | ||||
-rw-r--r-- | conf/machine/zybo-linux-bd-zynq7.conf | 6 | ||||
-rw-r--r-- | conf/machine/zybo-zynq7.conf | 8 | ||||
-rw-r--r-- | recipes-bsp/u-boot/u-boot-xlnx/zc702-zynq7/uEnv.txt | 4 | ||||
-rw-r--r-- | recipes-bsp/u-boot/u-boot-xlnx/zedboard-zynq7/uEnv.txt | 4 | ||||
-rw-r--r-- | recipes-bsp/u-boot/u-boot-xlnx_2016.4.bb | 6 | ||||
-rw-r--r-- | recipes-bsp/u-boot/u-boot-zynq-uenv.bb | 82 |
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" | |||
12 | UBOOT_MACHINE = "zynq_microzed_config" | 12 | UBOOT_MACHINE = "zynq_microzed_config" |
13 | SPL_BINARY = "spl/boot.bin" | 13 | SPL_BINARY = "spl/boot.bin" |
14 | 14 | ||
15 | EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv" | ||
16 | |||
15 | SERIAL_CONSOLE = "115200 ttyPS0" | 17 | SERIAL_CONSOLE = "115200 ttyPS0" |
16 | 18 | ||
17 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" | 19 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" |
18 | 20 | ||
19 | IMAGE_BOOT_FILES += "boot.bin ${MACHINE}.dtb" | 21 | IMAGE_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" | |||
16 | UBOOT_MACHINE = "zynq_picozed_config" | 16 | UBOOT_MACHINE = "zynq_picozed_config" |
17 | SPL_BINARY = "spl/boot.bin" | 17 | SPL_BINARY = "spl/boot.bin" |
18 | 18 | ||
19 | EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv" | ||
20 | |||
19 | SERIAL_CONSOLE = "115200 ttyPS0" | 21 | SERIAL_CONSOLE = "115200 ttyPS0" |
20 | 22 | ||
21 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" | 23 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" |
22 | 24 | ||
23 | IMAGE_BOOT_FILES += "boot.bin ${MACHINE}.dtb" | 25 | IMAGE_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" | |||
19 | UBOOT_MACHINE = "zynq_zc702_config" | 19 | UBOOT_MACHINE = "zynq_zc702_config" |
20 | SPL_BINARY = "spl/boot.bin" | 20 | SPL_BINARY = "spl/boot.bin" |
21 | 21 | ||
22 | EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv" | ||
23 | |||
22 | SERIAL_CONSOLE = "115200 ttyPS0" | 24 | SERIAL_CONSOLE = "115200 ttyPS0" |
23 | 25 | ||
24 | KERNEL_DEVICETREE = "zynq-zc702.dtb" | 26 | KERNEL_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" | |||
19 | UBOOT_MACHINE = "zynq_zc706_config" | 19 | UBOOT_MACHINE = "zynq_zc706_config" |
20 | SPL_BINARY = "spl/boot.bin" | 20 | SPL_BINARY = "spl/boot.bin" |
21 | 21 | ||
22 | EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv" | ||
23 | |||
22 | SERIAL_CONSOLE = "115200 ttyPS0" | 24 | SERIAL_CONSOLE = "115200 ttyPS0" |
23 | 25 | ||
24 | KERNEL_DEVICETREE = "zynq-zc706.dtb" | 26 | KERNEL_DEVICETREE = "zynq-zc706.dtb" |
25 | KERNEL_FEATURES += "features/rtc/rtc.scc" | 27 | KERNEL_FEATURES += "features/rtc/rtc.scc" |
26 | 28 | ||
29 | IMAGE_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 | |||
16 | UBOOT_MACHINE = "zynq_zed_config" | 16 | UBOOT_MACHINE = "zynq_zed_config" |
17 | SPL_BINARY = "spl/boot.bin" | 17 | SPL_BINARY = "spl/boot.bin" |
18 | 18 | ||
19 | EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv" | ||
20 | |||
19 | SERIAL_CONSOLE = "115200 ttyPS0" | 21 | SERIAL_CONSOLE = "115200 ttyPS0" |
20 | 22 | ||
21 | KERNEL_DEVICETREE = "zynq-zed.dtb" | 23 | KERNEL_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" | |||
21 | SPL_BINARY = "spl/boot.bin" | 21 | SPL_BINARY = "spl/boot.bin" |
22 | FORCE_PLATFORM_INIT = "1" | 22 | FORCE_PLATFORM_INIT = "1" |
23 | 23 | ||
24 | EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv" | ||
25 | |||
24 | EXTRA_IMAGEDEPENDS += "virtual/bitstream" | 26 | EXTRA_IMAGEDEPENDS += "virtual/bitstream" |
25 | 27 | ||
26 | IMAGE_BOOT_FILES += "boot.bin \ | 28 | IMAGE_BOOT_FILES += " \ |
29 | boot.bin \ | ||
27 | ${MACHINE}.dtb \ | 30 | ${MACHINE}.dtb \ |
28 | bitstream \ | 31 | bitstream \ |
32 | uEnv.txt \ | ||
29 | " | 33 | " |
30 | 34 | ||
31 | KERNEL_FEATURES += " \ | 35 | KERNEL_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" | |||
16 | UBOOT_MACHINE = "zynq_zybo_config" | 16 | UBOOT_MACHINE = "zynq_zybo_config" |
17 | SPL_BINARY = "spl/boot.bin" | 17 | SPL_BINARY = "spl/boot.bin" |
18 | 18 | ||
19 | EXTRA_IMAGEDEPENDS += "u-boot-zynq-uenv" | ||
20 | |||
19 | SERIAL_CONSOLE = "115200 ttyPS0" | 21 | SERIAL_CONSOLE = "115200 ttyPS0" |
20 | 22 | ||
21 | KERNEL_DEVICETREE = "zynq-zybo.dtb" | 23 | KERNEL_DEVICETREE = "zynq-zybo.dtb" |
22 | 24 | ||
23 | IMAGE_BOOT_FILES += "boot.bin ${KERNEL_IMAGETYPE}-zynq-zybo.dtb" | 25 | IMAGE_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 @@ | |||
1 | kernel_image=uImage | ||
2 | devicetree_image=uImage-zynq-zc702.dtb | ||
3 | bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk | ||
4 | uenvcmd=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 @@ | |||
1 | kernel_image=uImage | ||
2 | devicetree_image=uImage-zynq-zed.dtb | ||
3 | bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk | ||
4 | uenvcmd=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 | |||
20 | LICENSE = "GPLv2+" | 20 | LICENSE = "GPLv2+" |
21 | LIC_FILES_CHKSUM = "file://README;beginline=1;endline=6;md5=157ab8408beab40cd8ce1dc69f702a6c" | 21 | LIC_FILES_CHKSUM = "file://README;beginline=1;endline=6;md5=157ab8408beab40cd8ce1dc69f702a6c" |
22 | 22 | ||
23 | UBOOT_ENV_zc702-zynq7 = "uEnv" | ||
24 | UBOOT_ENV_zedboard-zynq7 = "uEnv" | ||
25 | |||
26 | SRC_URI_append_zc702-zynq7 = " file://uEnv.txt" | ||
27 | SRC_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 |
30 | HAS_PLATFORM_INIT ?= " \ | 24 | HAS_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 @@ | |||
1 | SUMMARY = "U-Boot uEnv.txt SD boot environment generation for Zynq targets" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
4 | |||
5 | INHIBIT_DEFAULT_DEPS = "1" | ||
6 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
7 | |||
8 | COMPATIBLE_MACHINE = "^$" | ||
9 | COMPATIBLE_MACHINE_zynq = "zynq" | ||
10 | |||
11 | inherit deploy | ||
12 | |||
13 | def 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 | |||
34 | def 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 | |||
44 | do_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 | |||
72 | FILES_${PN} += "/boot/uEnv.txt" | ||
73 | |||
74 | do_install() { | ||
75 | install -Dm 0644 ${WORKDIR}/uEnv.txt ${D}/boot/uEnv.txt | ||
76 | } | ||
77 | |||
78 | do_deploy() { | ||
79 | install -Dm 0644 ${WORKDIR}/uEnv.txt ${DEPLOYDIR}/uEnv.txt | ||
80 | } | ||
81 | addtask do_deploy after do_compile before do_build | ||
82 | |||