Xen Zynq Distribution Support Forums
Using Petalinux to build custom apps that use Xen libraries - Printable Version

+- Xen Zynq Distribution Support Forums (http://xzdforums.dornerworks.com)
+-- Forum: General Xilinx Support (http://xzdforums.dornerworks.com/forumdisplay.php?fid=1)
+--- Forum: Getting Started (http://xzdforums.dornerworks.com/forumdisplay.php?fid=10)
+--- Thread: Using Petalinux to build custom apps that use Xen libraries (/showthread.php?tid=718)

Pages: 1 2


Using Petalinux to build custom apps that use Xen libraries - brettstahlman - 10-09-2017

I'm trying to build a custom app that uses Xen libraries and runs in Dom0. The docs I've seen suggest creating a custom app like this:
Code:
petalinux-create -t apps -n myapp --enable

But I haven't seen any documentation on the Makefile incantations required to make Xen header files and libraries accessible. Xen itself defines a bunch of helpful macros in $(XEN_ROOT)/tools/Rules.mk, but when I attempted to include Rules.mk in the custom app Makefile created by Petalinux, the build failed with an error indicating I needed to run ./configure before building or installing the tools. Further complicating matters is the path munging Petalinux performs on the gcc command line used to build the custom app's C file. I suspect the path munging is needed because source files are copied to a location under "build/linux/rootfs", but it makes determination of -I directives messy; moreover, even after adjusting the -I directives to fix the "file not found" errors, I'm still getting a slough of weird compile errors from standard header files. Note that the actual custom code is still stubbed out at this point; the errors stem from my attempt to include a single Xen header file. The --sysroot option is pointing to build/linux/rootfs/stage. I've also used -I to add the following directories to CFLAGS...

build/linux/rootfs/apps/xen/xen-src/xen/include/public
build/linux/rootfs/apps/xen/xen-src/tools/libs/foreignmemory/include
build/linux/rootfs/apps/xen/xen-src/tools/include
build/linux/kernel/xlnx-4.6/source/include

It occurred to me that it might be easier to create my app under the Xen source tree: i.e.,

components/apps/xen/xen-src/tools/myapp

But I'm not sure whether/how this approach would be supported by Petalinux. I tried creating a tool app manually, by adding a C file and updating the common tools Makefile accordingly, but I couldn't get Petalinux to build it. Apparently, Xen itself doesn't depend on these tools, and it wasn't clear from the help how to force petalinux-build to build a specific tool under components/apps/xen/xen-src/tools.

I can't imagine that what I'm trying to do is all that unusual, which makes me think there must be a standard mechanism for it. Any information/documentation you can provide would be greatly appreciated...

Thanks,
Brett Stahlman


RE: Using Petalinux to build custom apps that use Xen libraries - Nathan.Studer - 10-10-2017

I'll check to see if someone else has built an application linked against the Xen tools using Petalinux, but I've not personally done it.

I have built an application linked against the Xen tools outside Petalinux:  manually and with Yocto.  Since the 2016.3 XZD release uses buildroot, of these two only the manual method would be available.  For an example of how to do it manually you can look at how the a653_sched application is compiled.

The important pieces are getting the include paths into the Petalinux xen directory correct and pointing the 'sysroot' parameter at the buildroot one.

Code:
BUILD_ROOT_DIR := $(RELEASE_DIR)/buildroot

CC := $(BUILD_ROOT_DIR)/output/host/usr/bin/aarch64-buildroot-linux-gnu-gcc
XENPATH := $(RELEASE_DIR)/XenZynqDist/components/apps/xen/xen-src/
SYSROOT := $(BUILD_ROOT_DIR)/output/host/usr/aarch64-buildroot-linux-gnu/sysroot/
LDPATH := $(XENPATH)/dist/install/usr/local/lib/

$(TARGET): $(TARGET).c
    $(CC) --sysroot=$(SYSROOT) -I$(XENPATH)tools/include/ -I$(XENPATH)tools/libxc/include/ -I$(XENPATH)tools/xenstore/include/ \
             -I$(XENPATH)tools/libs/toollog/include/ -o $@ $^ -L$(LDPATH) -luuid -lxenctrl -lxenstore

Once the application is built it can be transferred to the rootfs.

     Nate


RE: Using Petalinux to build custom apps that use Xen libraries - brettstahlman - 10-10-2017

(10-10-2017, 11:57 AM)Nathan.Studer Wrote: I'll check to see if someone else has built an application linked against the Xen tools using Petalinux, but I've not personally done it.

I have built an application linked against the Xen tools outside Petalinux:  manually and with Yocto.  Since the 2016.3 XZD release uses buildroot, of these two only the manual method would be available.  For an example of how to do it manually you can look at how the a653_sched application is compiled.

The important pieces are getting the include paths into the Petalinux xen directory correct and pointing the 'sysroot' parameter at the buildroot one.

Code:
BUILD_ROOT_DIR := $(RELEASE_DIR)/buildroot

CC := $(BUILD_ROOT_DIR)/output/host/usr/bin/aarch64-buildroot-linux-gnu-gcc
XENPATH := $(RELEASE_DIR)/XenZynqDist/components/apps/xen/xen-src/
SYSROOT := $(BUILD_ROOT_DIR)/output/host/usr/aarch64-buildroot-linux-gnu/sysroot/
LDPATH := $(XENPATH)/dist/install/usr/local/lib/

$(TARGET): $(TARGET).c
    $(CC) --sysroot=$(SYSROOT) -I$(XENPATH)tools/include/ -I$(XENPATH)tools/libxc/include/ -I$(XENPATH)tools/xenstore/include/ \
             -I$(XENPATH)tools/libs/toollog/include/ -o $@ $^ -L$(LDPATH) -luuid -lxenctrl -lxenstore

Once the application is built it can be transferred to the rootfs.

     Nate

Makes sense, but I'm not seeing any buildroot in my XZD 2016.12.31 distribution. Something is copying the kernel to build/linux/kernel/xlnx-4.6, but I don't see anything that would indicate it's buildroot. There's no "buildroot" folder in my $RELEASE_DIR (~/XZD_20161231).

Thanks,
Brett S.


RE: Using Petalinux to build custom apps that use Xen libraries - Nathan.Studer - 10-10-2017

(10-10-2017, 03:12 PM)brettstahlman Wrote:
(10-10-2017, 11:57 AM)Nathan.Studer Wrote: The important pieces are getting the include paths into the Petalinux xen directory correct and pointing the 'sysroot' parameter at the buildroot one.

Code:
BUILD_ROOT_DIR := $(RELEASE_DIR)/buildroot

     Nate

Makes sense, but I'm not seeing any buildroot in my XZD 2016.12.31 distribution. Something is copying the kernel to build/linux/kernel/xlnx-4.6, but I don't see anything that would indicate it's buildroot. There's no "buildroot" folder in my $RELEASE_DIR (~/XZD_20161231).

Thanks,
Brett S.

If you're using PetaLinux for the rootfs, these instructions aren't going to work.

Refer to section 5.3 "Build the Dom0 File System" of the 2016.3 version of the User Manual for instructions on using buildroot directly.  After performing those instructions you should have the buildroot sysrootfs needed to build applications.

     Nate


RE: Using Petalinux to build custom apps that use Xen libraries - brettstahlman - 10-10-2017

I'd already started trying to make it work by pointing to another copy of buildroot, but was getting conflicting definitions for int64_t (and other such types), due to slightly different typedef's in the sysroot vs buildroot kernel trees... Will try the approach outlined in section 5.3 in hopes that it will give a different result (though it's not immediately apparent to me why it would)...


RE: Using Petalinux to build custom apps that use Xen libraries - brettstahlman - 10-11-2017

(10-10-2017, 05:28 PM)Nathan.Studer Wrote:
(10-10-2017, 03:12 PM)brettstahlman Wrote:
(10-10-2017, 11:57 AM)Nathan.Studer Wrote: The important pieces are getting the include paths into the Petalinux xen directory correct and pointing the 'sysroot' parameter at the buildroot one.

Code:
BUILD_ROOT_DIR := $(RELEASE_DIR)/buildroot

     Nate

Makes sense, but I'm not seeing any buildroot in my XZD 2016.12.31 distribution. Something is copying the kernel to build/linux/kernel/xlnx-4.6, but I don't see anything that would indicate it's buildroot. There's no "buildroot" folder in my $RELEASE_DIR (~/XZD_20161231).

Thanks,
Brett S.

If you're using PetaLinux for the rootfs, these instructions aren't going to work.

Refer to section 5.3 "Build the Dom0 File System" of the 2016.3 version of the User Manual for instructions on using buildroot directly.  After performing those instructions you should have the buildroot sysrootfs needed to build applications.

     Nate

I attempted to follow the instructions in section 5.3, but after running for a long time, the buildroot make failed at 'target-finalize'. I've pasted the output (beginning with the first error) below... I can re-run and capture all output if it would be helpful. Note that rootfs.tar was not built.
Thanks,
Brett S.

Code:
.
.
>>>   Finalizing target directory
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/luarocks
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/pod
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/aarch64-linux/CORE
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/python3.4 -name '*.py' -print0 | xargs -0 rm -f
grep -q '^hvc0$' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty || echo 'hvc0' >> /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "xilinx-buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hostname
/bin/sed -i -e '$a \127.0.1.1\txilinx-buildroot' -e '/^127.0.1.1/d' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hosts
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/issue
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/interfaces
[ -n "root" ] && TARGET_GENERIC_ROOT_PASSWD_HASH=$(/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/mkpasswd -m "md5" "root"); /bin/sed -i -e "s,^root:[^:]*:,root:$TARGET_GENERIC_ROOT_PASSWD_HASH:," /home/bstahlman/XZD_20161231/buildroot/output/target/etc/shadow
ln -sf /bin/bash /home/bstahlman/XZD_20161231/buildroot/output/target/bin/sh
/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~hvc0::respawn:/sbin/getty -L  hvc0 115200 vt100 #~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
rm -f /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge; done
for dir in /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/locale /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man; do for lang in $(cd $dir; ls .|grep -v man); do grep -qx $lang /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge || rm -rf $dir/$lang; done; done
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/include /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/aclocal \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/pkgconfig /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/pkgconfig \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/cmake /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/cmake
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gdb
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/info /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/info
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/doc /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/doc
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gtk-doc
rmdir /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share 2>/dev/null
Makefile:566: recipe for target 'target-finalize' failed
make: [target-finalize] Error 1 (ignored)
find /home/bstahlman/XZD_20161231/buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name '*.ko' \) -print | xargs /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
if test -d /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules; then \
    find /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules -type f -name '*.ko' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-unneeded; fi
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib -type f -name 'libpthread*.so*' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-debug
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
# Mandatory configuration file and auxilliary cache directory
# for recent versions of ldconfig
touch /home/bstahlman/XZD_20161231/buildroot/output/target/etc/ld.so.conf
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/var/cache/ldconfig
if [ -x "/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig" ]; \
then \
    /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
else \
    /sbin/ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
fi
( \
    echo "NAME=Buildroot"; \
    echo "VERSION=2015.02-rc1-g95eb37e"; \
    echo "ID=buildroot"; \
    echo "VERSION_ID=2015.02-rc1"; \
    echo "PRETTY_NAME=\"Buildroot 2015.02-rc1\"" \
) >  /home/bstahlman/XZD_20161231/buildroot/output/target/etc/os-release
>>>   Copying overlay /home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay
rsync: change_dir "/home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Makefile:566: recipe for target 'target-finalize' failed
make: *** [target-finalize] Error 23



RE: Using Petalinux to build custom apps that use Xen libraries - brettstahlman - 10-11-2017

(10-11-2017, 06:54 PM)brettstahlman Wrote:
(10-10-2017, 05:28 PM)Nathan.Studer Wrote:
(10-10-2017, 03:12 PM)brettstahlman Wrote:
(10-10-2017, 11:57 AM)Nathan.Studer Wrote: The important pieces are getting the include paths into the Petalinux xen directory correct and pointing the 'sysroot' parameter at the buildroot one.

Code:
BUILD_ROOT_DIR := $(RELEASE_DIR)/buildroot

     Nate

Makes sense, but I'm not seeing any buildroot in my XZD 2016.12.31 distribution. Something is copying the kernel to build/linux/kernel/xlnx-4.6, but I don't see anything that would indicate it's buildroot. There's no "buildroot" folder in my $RELEASE_DIR (~/XZD_20161231).

Thanks,
Brett S.

If you're using PetaLinux for the rootfs, these instructions aren't going to work.

Refer to section 5.3 "Build the Dom0 File System" of the 2016.3 version of the User Manual for instructions on using buildroot directly.  After performing those instructions you should have the buildroot sysrootfs needed to build applications.

     Nate

I attempted to follow the instructions in section 5.3, but after running for a long time, the buildroot make failed at 'target-finalize'. I've pasted the output (beginning with the first error) below... I can re-run and capture all output if it would be helpful. Note that rootfs.tar was not built.
Thanks,
Brett S.

Code:
.
.
>>>   Finalizing target directory
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/luarocks
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/pod
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/aarch64-linux/CORE
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/python3.4 -name '*.py' -print0 | xargs -0 rm -f
grep -q '^hvc0$' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty || echo 'hvc0' >> /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "xilinx-buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hostname
/bin/sed -i -e '$a \127.0.1.1\txilinx-buildroot' -e '/^127.0.1.1/d' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hosts
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/issue
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/interfaces
[ -n "root" ] && TARGET_GENERIC_ROOT_PASSWD_HASH=$(/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/mkpasswd -m "md5" "root"); /bin/sed -i -e "s,^root:[^:]*:,root:$TARGET_GENERIC_ROOT_PASSWD_HASH:," /home/bstahlman/XZD_20161231/buildroot/output/target/etc/shadow
ln -sf /bin/bash /home/bstahlman/XZD_20161231/buildroot/output/target/bin/sh
/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~hvc0::respawn:/sbin/getty -L  hvc0 115200 vt100 #~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
rm -f /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge; done
for dir in /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/locale /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man; do for lang in $(cd $dir; ls .|grep -v man); do grep -qx $lang /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge || rm -rf $dir/$lang; done; done
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/include /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/aclocal \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/pkgconfig /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/pkgconfig \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/cmake /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/cmake
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gdb
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/info /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/info
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/doc /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/doc
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gtk-doc
rmdir /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share 2>/dev/null
Makefile:566: recipe for target 'target-finalize' failed
make: [target-finalize] Error 1 (ignored)
find /home/bstahlman/XZD_20161231/buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name '*.ko' \) -print | xargs /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
if test -d /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules; then \
    find /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules -type f -name '*.ko' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-unneeded; fi
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib -type f -name 'libpthread*.so*' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-debug
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
# Mandatory configuration file and auxilliary cache directory
# for recent versions of ldconfig
touch /home/bstahlman/XZD_20161231/buildroot/output/target/etc/ld.so.conf
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/var/cache/ldconfig
if [ -x "/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig" ]; \
then \
    /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
else \
    /sbin/ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
fi
( \
    echo "NAME=Buildroot"; \
    echo "VERSION=2015.02-rc1-g95eb37e"; \
    echo "ID=buildroot"; \
    echo "VERSION_ID=2015.02-rc1"; \
    echo "PRETTY_NAME=\"Buildroot 2015.02-rc1\"" \
) >  /home/bstahlman/XZD_20161231/buildroot/output/target/etc/os-release
>>>   Copying overlay /home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay
rsync: change_dir "/home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Makefile:566: recipe for target 'target-finalize' failed
make: *** [target-finalize] Error 23

Weird. I was able to fix that error by running `make menuconfig` and changing the overlay name from "dom0-overlay" to "guest-overlay". The fact that this was necessary would seem to indicate a problem with the defaults. (I didn't change the default configuration at all before the failed build attempt.)

Thanks,
Brett S.

(10-11-2017, 07:56 PM)brettstahlman Wrote:
(10-11-2017, 06:54 PM)brettstahlman Wrote:
(10-10-2017, 05:28 PM)Nathan.Studer Wrote:
(10-10-2017, 03:12 PM)brettstahlman Wrote:
(10-10-2017, 11:57 AM)Nathan.Studer Wrote: The important pieces are getting the include paths into the Petalinux xen directory correct and pointing the 'sysroot' parameter at the buildroot one.

Code:
BUILD_ROOT_DIR := $(RELEASE_DIR)/buildroot

     Nate

Makes sense, but I'm not seeing any buildroot in my XZD 2016.12.31 distribution. Something is copying the kernel to build/linux/kernel/xlnx-4.6, but I don't see anything that would indicate it's buildroot. There's no "buildroot" folder in my $RELEASE_DIR (~/XZD_20161231).

Thanks,
Brett S.

If you're using PetaLinux for the rootfs, these instructions aren't going to work.

Refer to section 5.3 "Build the Dom0 File System" of the 2016.3 version of the User Manual for instructions on using buildroot directly.  After performing those instructions you should have the buildroot sysrootfs needed to build applications.

     Nate

I attempted to follow the instructions in section 5.3, but after running for a long time, the buildroot make failed at 'target-finalize'. I've pasted the output (beginning with the first error) below... I can re-run and capture all output if it would be helpful. Note that rootfs.tar was not built.
Thanks,
Brett S.

Code:
.
.
>>>   Finalizing target directory
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/luarocks
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/pod
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/aarch64-linux/CORE
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/python3.4 -name '*.py' -print0 | xargs -0 rm -f
grep -q '^hvc0$' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty || echo 'hvc0' >> /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "xilinx-buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hostname
/bin/sed -i -e '$a \127.0.1.1\txilinx-buildroot' -e '/^127.0.1.1/d' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hosts
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/issue
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/interfaces
[ -n "root" ] && TARGET_GENERIC_ROOT_PASSWD_HASH=$(/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/mkpasswd -m "md5" "root"); /bin/sed -i -e "s,^root:[^:]*:,root:$TARGET_GENERIC_ROOT_PASSWD_HASH:," /home/bstahlman/XZD_20161231/buildroot/output/target/etc/shadow
ln -sf /bin/bash /home/bstahlman/XZD_20161231/buildroot/output/target/bin/sh
/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~hvc0::respawn:/sbin/getty -L  hvc0 115200 vt100 #~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
rm -f /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge; done
for dir in /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/locale /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man; do for lang in $(cd $dir; ls .|grep -v man); do grep -qx $lang /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge || rm -rf $dir/$lang; done; done
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/include /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/aclocal \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/pkgconfig /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/pkgconfig \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/cmake /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/cmake
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gdb
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/info /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/info
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/doc /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/doc
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gtk-doc
rmdir /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share 2>/dev/null
Makefile:566: recipe for target 'target-finalize' failed
make: [target-finalize] Error 1 (ignored)
find /home/bstahlman/XZD_20161231/buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name '*.ko' \) -print | xargs /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
if test -d /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules; then \
    find /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules -type f -name '*.ko' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-unneeded; fi
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib -type f -name 'libpthread*.so*' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-debug
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
# Mandatory configuration file and auxilliary cache directory
# for recent versions of ldconfig
touch /home/bstahlman/XZD_20161231/buildroot/output/target/etc/ld.so.conf
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/var/cache/ldconfig
if [ -x "/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig" ]; \
then \
    /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
else \
    /sbin/ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
fi
( \
    echo "NAME=Buildroot"; \
    echo "VERSION=2015.02-rc1-g95eb37e"; \
    echo "ID=buildroot"; \
    echo "VERSION_ID=2015.02-rc1"; \
    echo "PRETTY_NAME=\"Buildroot 2015.02-rc1\"" \
) >  /home/bstahlman/XZD_20161231/buildroot/output/target/etc/os-release
>>>   Copying overlay /home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay
rsync: change_dir "/home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Makefile:566: recipe for target 'target-finalize' failed
make: *** [target-finalize] Error 23

Weird. I was able to fix that error by running `make menuconfig` and changing the overlay name from "dom0-overlay" to "guest-overlay". The fact that this was necessary would seem to indicate a problem with the defaults. (I didn't change the default configuration at all before the failed build attempt.)

Thanks,
Brett S.

Got another error: this time on step 6 (Building the Xen tools). But I'm wondering whether what I've already done (through Step 5) gives me all I need to build applications. All of the make vars in your sample Makefile (CC, XENPATH, SYSROOT, LDPATH) reference valid files/directories, so perhaps it's not necessary to complete the remaining steps, especially given that this particular buildroot instance is being used only to build my Xen-linking application?

Thanks,
Brett S.


RE: Using Petalinux to build custom apps that use Xen libraries - brettstahlman - 10-11-2017

(10-11-2017, 07:56 PM)brettstahlman Wrote:
(10-11-2017, 06:54 PM)brettstahlman Wrote:
(10-10-2017, 05:28 PM)Nathan.Studer Wrote:
(10-10-2017, 03:12 PM)brettstahlman Wrote:
(10-10-2017, 11:57 AM)Nathan.Studer Wrote: The important pieces are getting the include paths into the Petalinux xen directory correct and pointing the 'sysroot' parameter at the buildroot one.

Code:
BUILD_ROOT_DIR := $(RELEASE_DIR)/buildroot

     Nate

Makes sense, but I'm not seeing any buildroot in my XZD 2016.12.31 distribution. Something is copying the kernel to build/linux/kernel/xlnx-4.6, but I don't see anything that would indicate it's buildroot. There's no "buildroot" folder in my $RELEASE_DIR (~/XZD_20161231).

Thanks,
Brett S.

If you're using PetaLinux for the rootfs, these instructions aren't going to work.

Refer to section 5.3 "Build the Dom0 File System" of the 2016.3 version of the User Manual for instructions on using buildroot directly.  After performing those instructions you should have the buildroot sysrootfs needed to build applications.

     Nate

I attempted to follow the instructions in section 5.3, but after running for a long time, the buildroot make failed at 'target-finalize'. I've pasted the output (beginning with the first error) below... I can re-run and capture all output if it would be helpful. Note that rootfs.tar was not built.
Thanks,
Brett S.

Code:
.
.
>>>   Finalizing target directory
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/luarocks
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/pod
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/aarch64-linux/CORE
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/python3.4 -name '*.py' -print0 | xargs -0 rm -f
grep -q '^hvc0$' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty || echo 'hvc0' >> /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "xilinx-buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hostname
/bin/sed -i -e '$a \127.0.1.1\txilinx-buildroot' -e '/^127.0.1.1/d' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hosts
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/issue
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/interfaces
[ -n "root" ] && TARGET_GENERIC_ROOT_PASSWD_HASH=$(/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/mkpasswd -m "md5" "root"); /bin/sed -i -e "s,^root:[^:]*:,root:$TARGET_GENERIC_ROOT_PASSWD_HASH:," /home/bstahlman/XZD_20161231/buildroot/output/target/etc/shadow
ln -sf /bin/bash /home/bstahlman/XZD_20161231/buildroot/output/target/bin/sh
/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~hvc0::respawn:/sbin/getty -L  hvc0 115200 vt100 #~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
rm -f /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge; done
for dir in /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/locale /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man; do for lang in $(cd $dir; ls .|grep -v man); do grep -qx $lang /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge || rm -rf $dir/$lang; done; done
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/include /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/aclocal \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/pkgconfig /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/pkgconfig \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/cmake /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/cmake
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gdb
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/info /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/info
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/doc /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/doc
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gtk-doc
rmdir /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share 2>/dev/null
Makefile:566: recipe for target 'target-finalize' failed
make: [target-finalize] Error 1 (ignored)
find /home/bstahlman/XZD_20161231/buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name '*.ko' \) -print | xargs /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
if test -d /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules; then \
    find /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules -type f -name '*.ko' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-unneeded; fi
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib -type f -name 'libpthread*.so*' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-debug
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
# Mandatory configuration file and auxilliary cache directory
# for recent versions of ldconfig
touch /home/bstahlman/XZD_20161231/buildroot/output/target/etc/ld.so.conf
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/var/cache/ldconfig
if [ -x "/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig" ]; \
then \
    /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
else \
    /sbin/ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
fi
( \
    echo "NAME=Buildroot"; \
    echo "VERSION=2015.02-rc1-g95eb37e"; \
    echo "ID=buildroot"; \
    echo "VERSION_ID=2015.02-rc1"; \
    echo "PRETTY_NAME=\"Buildroot 2015.02-rc1\"" \
) >  /home/bstahlman/XZD_20161231/buildroot/output/target/etc/os-release
>>>   Copying overlay /home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay
rsync: change_dir "/home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Makefile:566: recipe for target 'target-finalize' failed
make: *** [target-finalize] Error 23

Weird. I was able to fix that error by running `make menuconfig` and changing the overlay name from "dom0-overlay" to "guest-overlay". The fact that this was necessary would seem to indicate a problem with the defaults. (I didn't change the default configuration at all before the failed build attempt.)

Thanks,
Brett S.

(10-11-2017, 07:56 PM)brettstahlman Wrote:
(10-11-2017, 06:54 PM)brettstahlman Wrote:
(10-10-2017, 05:28 PM)Nathan.Studer Wrote:
(10-10-2017, 03:12 PM)brettstahlman Wrote: Makes sense, but I'm not seeing any buildroot in my XZD 2016.12.31 distribution. Something is copying the kernel to build/linux/kernel/xlnx-4.6, but I don't see anything that would indicate it's buildroot. There's no "buildroot" folder in my $RELEASE_DIR (~/XZD_20161231).

Thanks,
Brett S.

If you're using PetaLinux for the rootfs, these instructions aren't going to work.

Refer to section 5.3 "Build the Dom0 File System" of the 2016.3 version of the User Manual for instructions on using buildroot directly.  After performing those instructions you should have the buildroot sysrootfs needed to build applications.

     Nate

I attempted to follow the instructions in section 5.3, but after running for a long time, the buildroot make failed at 'target-finalize'. I've pasted the output (beginning with the first error) below... I can re-run and capture all output if it would be helpful. Note that rootfs.tar was not built.
Thanks,
Brett S.

Code:
.
.
>>>   Finalizing target directory
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/luarocks
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/pod
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/aarch64-linux/CORE
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/python3.4 -name '*.py' -print0 | xargs -0 rm -f
grep -q '^hvc0$' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty || echo 'hvc0' >> /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "xilinx-buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hostname
/bin/sed -i -e '$a \127.0.1.1\txilinx-buildroot' -e '/^127.0.1.1/d' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hosts
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/issue
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/interfaces
[ -n "root" ] && TARGET_GENERIC_ROOT_PASSWD_HASH=$(/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/mkpasswd -m "md5" "root"); /bin/sed -i -e "s,^root:[^:]*:,root:$TARGET_GENERIC_ROOT_PASSWD_HASH:," /home/bstahlman/XZD_20161231/buildroot/output/target/etc/shadow
ln -sf /bin/bash /home/bstahlman/XZD_20161231/buildroot/output/target/bin/sh
/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~hvc0::respawn:/sbin/getty -L  hvc0 115200 vt100 #~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
rm -f /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge; done
for dir in /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/locale /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man; do for lang in $(cd $dir; ls .|grep -v man); do grep -qx $lang /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge || rm -rf $dir/$lang; done; done
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/include /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/aclocal \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/pkgconfig /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/pkgconfig \
    /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/cmake /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/cmake
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gdb
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/info /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/info
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/doc /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/doc
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gtk-doc
rmdir /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share 2>/dev/null
Makefile:566: recipe for target 'target-finalize' failed
make: [target-finalize] Error 1 (ignored)
find /home/bstahlman/XZD_20161231/buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name '*.ko' \) -print | xargs /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
if test -d /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules; then \
    find /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules -type f -name '*.ko' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-unneeded; fi
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib -type f -name 'libpthread*.so*' | \
    xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-debug
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
# Mandatory configuration file and auxilliary cache directory
# for recent versions of ldconfig
touch /home/bstahlman/XZD_20161231/buildroot/output/target/etc/ld.so.conf
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/var/cache/ldconfig
if [ -x "/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig" ]; \
then \
    /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
else \
    /sbin/ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
fi
( \
    echo "NAME=Buildroot"; \
    echo "VERSION=2015.02-rc1-g95eb37e"; \
    echo "ID=buildroot"; \
    echo "VERSION_ID=2015.02-rc1"; \
    echo "PRETTY_NAME=\"Buildroot 2015.02-rc1\"" \
) >  /home/bstahlman/XZD_20161231/buildroot/output/target/etc/os-release
>>>   Copying overlay /home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay
rsync: change_dir "/home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Makefile:566: recipe for target 'target-finalize' failed
make: *** [target-finalize] Error 23

Weird. I was able to fix that error by running `make menuconfig` and changing the overlay name from "dom0-overlay" to "guest-overlay". The fact that this was necessary would seem to indicate a problem with the defaults. (I didn't change the default configuration at all before the failed build attempt.)

Thanks,
Brett S.

Got another error: this time on step 6 (Building the Xen tools). But I'm wondering whether what I've already done (through Step 5) gives me all I need to build applications. All of the make vars in your sample Makefile (CC, XENPATH, SYSROOT, LDPATH) reference valid files/directories, so perhaps it's not necessary to complete the remaining steps, especially given that this particular buildroot instance is being used only to build my Xen-linking application?

Thanks,
Brett S.

Hmm... Tried building a dummy app against the libraries in $LDPATH, but got a linker error because the shared objects seem to have been built for x86-64. In the petalinux project I've been using, the corresponding shared objects are ARM aarch64. I built the "zynq_ultra_mpsoc_dom0_defconfig" config as recommended in the UM, so why is my dist/install/usr/local/lib dir built for x86? Starting to think maybe Step 6 is the one that builds the ARM64 version of the libraries...

The make in Step 6 is failing because the cross-compiler is attempting to link against libraries under...
$(RELEASE_DIR)/XenZynqDist/components/apps/xen/xen-src/tools/libs/
...and these libraries were built for x86-64. Here's the command that fails:
Code:
aarch64-buildroot-linux-gnu-gcc    -pthread -Wl,-soname -Wl,libxenctrl.so.4.7 -shared -o libxenctrl.so.4.7.0 xc_altp2m.opic xc_core.opic xc_core_arm.opic xc_cpupool.opic xc_domain.opic xc_evtchn.opic xc_gnttab.opic xc_misc.opic xc_flask.opic xc_physdev.opic xc_private.opic xc_csched.opic xc_csched2.opic xc_arinc653.opic xc_rt.opic xc_tbuf.opic xc_pm.opic xc_cpu_hotplug.opic xc_resume.opic xc_tmem.opic xc_vm_event.opic xc_monitor.opic xc_mem_paging.opic xc_mem_access.opic xc_memshr.opic xc_hcall_buf.opic xc_foreign_memory.opic xc_kexec.opic xc_resource.opic xc_linux.opic xc_evtchn_compat.opic xc_gnttab_compat.opic /home/bstahlman/XZD_20161231/XenZynqDist/components/apps/xen/xen-src/tools/libxc/../../tools/libs/toollog/libxentoollog.so /home/bstahlman/XZD_20161231/XenZynqDist/components/apps/xen/xen-src/tools/libxc/../../tools/libs/evtchn/libxenevtchn.so /home/bstahlman/XZD_20161231/XenZynqDist/components/apps/xen/xen-src/tools/libxc/../../tools/libs/gnttab/libxengnttab.so /home/bstahlman/XZD_20161231/XenZynqDist/components/apps/xen/xen-src/tools/libxc/../../tools/libs/gnttab/libxengnttab.so /home/bstahlman/XZD_20161231/XenZynqDist/components/apps/xen/xen-src/tools/libxc/../../tools/libs/call/libxencall.so /home/bstahlman/XZD_20161231/XenZynqDist/components/apps/xen/xen-src/tools/libxc/../../tools/libs/foreignmemory/libxenforeignmemory.so  
/home/bstahlman/XZD_20161231/XenZynqDist/components/apps/xen/xen-src/tools/libxc/../../tools/libs/toollog/libxentoollog.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:220: recipe for target 'libxenctrl.so.4.7.0' failed

Are the libraries in that location supposed to be x86-64? If so, why is the ARM cross-compiler trying to link against them? And if not, why were they built as x86-64?

Thanks,
Brett S.


RE: Using Petalinux to build custom apps that use Xen libraries - brettstahlman - 10-12-2017

Nathan,
Just did a `find -iname '*.so' | xargs file` in $RELEASE_DIR/XenZynqDist/components/apps/xen/xen-src and discovered that *all* the shared objects are x86-64. Note that this includes the objects under dist/install/usr/local/lib, which corresponds to LDPATH in the Makefile snippet you sent. Clearly, I'm missing something... Where are the Xen *target* (ARM) libraries I'll need to link against?

Starting to wonder whether the problem stems from the way my XenZynqDist was created, presumably when I ran section 5.2 (months ago)...

Thanks,
Brett S.


RE: Using Petalinux to build custom apps that use Xen libraries - Nathan.Studer - 10-13-2017

(10-11-2017, 09:38 PM)brettstahlman Wrote: I attempted to follow the instructions in section 5.3, but after running for a long time, the buildroot make failed at 'target-finalize'. I've pasted the output (beginning with the first error) below... I can re-run and capture all output if it would be helpful. Note that rootfs.tar was not built.

Thanks,
Brett S.

Code:
.
.
>>>   Finalizing target directory
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/luarocks
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/pod
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/5.20.1/aarch64-linux/CORE
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/python3.4 -name '*.py' -print0 | xargs -0 rm -f
grep -q '^hvc0$' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty || echo 'hvc0' >> /home/bstahlman/XZD_20161231/buildroot/output/target/etc/securetty
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "xilinx-buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hostname
/bin/sed -i -e '$a \127.0.1.1\txilinx-buildroot' -e '/^127.0.1.1/d' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/hosts
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/issue
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/bstahlman/XZD_20161231/buildroot/output/target/etc/network/interfaces
[ -n "root" ] && TARGET_GENERIC_ROOT_PASSWD_HASH=$(/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/mkpasswd -m "md5" "root"); /bin/sed -i -e "s,^root:[^:]*:,root:$TARGET_GENERIC_ROOT_PASSWD_HASH:," /home/bstahlman/XZD_20161231/buildroot/output/target/etc/shadow
ln -sf /bin/bash /home/bstahlman/XZD_20161231/buildroot/output/target/bin/sh
/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~hvc0::respawn:/sbin/getty -L  hvc0 115200 vt100 #~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/bstahlman/XZD_20161231/buildroot/output/target/etc/inittab
rm -f /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge; done
for dir in /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/locale /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man; do for lang in $(cd $dir; ls .|grep -v man); do grep -qx $lang /home/bstahlman/XZD_20161231/buildroot/output/build/locales.nopurge || rm -rf $dir/$lang; done; done
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/include /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/aclocal \
/home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/pkgconfig /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/pkgconfig \
/home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib/cmake /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/cmake
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find /home/bstahlman/XZD_20161231/buildroot/output/target/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gdb
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/man /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/man
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/info /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/info
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/doc /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/doc
rm -rf /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share/gtk-doc
rmdir /home/bstahlman/XZD_20161231/buildroot/output/target/usr/share 2>/dev/null
Makefile:566: recipe for target 'target-finalize' failed
make: [target-finalize] Error 1 (ignored)
find /home/bstahlman/XZD_20161231/buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name '*.ko' \) -print | xargs /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
if test -d /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules; then \
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib/modules -type f -name '*.ko' | \
xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-unneeded; fi
find /home/bstahlman/XZD_20161231/buildroot/output/target/lib -type f -name 'libpthread*.so*' | \
xargs -r /home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-strip --remove-section=.comment --remove-section=.note --strip-debug
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/etc
# Mandatory configuration file and auxilliary cache directory
# for recent versions of ldconfig
touch /home/bstahlman/XZD_20161231/buildroot/output/target/etc/ld.so.conf
mkdir -p /home/bstahlman/XZD_20161231/buildroot/output/target/var/cache/ldconfig
if [ -x "/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig" ]; \
then \
/home/bstahlman/XZD_20161231/buildroot/output/host/usr/bin/aarch64-buildroot-linux-gnu-ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
else \
/sbin/ldconfig -r /home/bstahlman/XZD_20161231/buildroot/output/target; \
fi
( \
echo "NAME=Buildroot"; \
echo "VERSION=2015.02-rc1-g95eb37e"; \
echo "ID=buildroot"; \
echo "VERSION_ID=2015.02-rc1"; \
echo "PRETTY_NAME=\"Buildroot 2015.02-rc1\"" \
) >  /home/bstahlman/XZD_20161231/buildroot/output/target/etc/os-release
>>>   Copying overlay /home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay
rsync: change_dir "/home/bstahlman/XZD_20161231/buildroot/board/xilinx/zynq-ultra-mpsoc/dom0-overlay" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
Makefile:566: recipe for target 'target-finalize' failed
make: *** [target-finalize] Error 23

Oops.  It looks like the user manual isn't pointing to a version tag, so it's building the development branch which was updated to 2016.4.  Please
check out the 20161231 release branch, and try the build from there.  Some of your other issues probably stem from this mismatch as well.

Code:
git fetch origin
git checkout 20161231



(10-11-2017, 09:38 PM)brettstahlman Wrote: Got another error: this time on step 6 (Building the Xen tools). But I'm wondering whether what I've already done (through Step 5) gives me all I need to build applications. All of the make vars in your sample Makefile (CC, XENPATH, SYSROOT, LDPATH) reference valid files/directories, so perhaps it's not necessary to complete the remaining steps, especially given that this particular buildroot instance is being used only to build my Xen-linking application?

Thanks,
Brett S.

This step builds the libraries used by the tools, which are the libraries you are trying to link against, so you will not be able to build your application if this step doesn't work.  As long as you're using the XZD rootfs, you shouldn't need to follow any of the remaining steps though.

     Nate