UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer david.perlaza
Observer
14,680 Views
Registered: ‎11-04-2013

Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

Hi, 

 

I'm trying to add pre-compiled libraries (OpenCV to be more specific) to my Petalinux root file system. I have tested the libraries by coping them to an SD card and setting the environment variable LD_LIBRARY_PATH accordingly, and they work correctly. The problem I am facing is that the documentation for Petalinux does not provide a procedure for this. I have found this AR (http://www.xilinx.com/support/answers/55976.htm); however, the procedure seems to be out of date. I have built my linux system successfully but it does not include the OpenCV libraries.

 

Any advice would be much appreciated. The version of Petalinux I'm using is 2014.2

 

 

Thanks,

David

0 Kudos
1 Solution

Accepted Solutions
Observer david.perlaza
Observer
22,866 Views
Registered: ‎11-04-2013

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

Hi John (and those who may be interested),

 

The issue has been solved by editing the makefile as follows:

 

ifndef PETALINUX
$(error "Error: PETALINUX environment variable not set.  Change to the root of your PetaLinux install, and source the settings.sh file")
endif

include libs.common.mk

LIB_DIR=lib
# Add any other object files to this list below


all: build install

.PHONY: build
build:
#Skip Building Libraries. (Already precompiled for ARM platform)


install:
	# Install libraries template
	mkdir -p "$(TARGETDIR)/lib/fonts"
	find $(LIB_DIR)/ -maxdepth 1 -name "*.*" -print0 | xargs -0 cp -pP -r -t "$(TARGETDIR)/lib/"

clean:
	# No Clean operation for pre-built binaries.

 

 

Regards,

David

View solution in original post

0 Kudos
7 Replies
Xilinx Employee
Xilinx Employee
14,670 Views
Registered: ‎09-10-2008

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution
Hi David,

I can't say I've used this feature, but petalinux-create -t libs is the way they intend you to do this. The help, petalinux-create ?, sort of tells a bit but it's pretty sparse.

I just gave it a quick test and it does create the lib in components/libs/<name> and there's a makefile that looks like a good start. It's really just copying the libs and header files to the root file system I believe.

Thanks,
John

0 Kudos
Observer david.perlaza
Observer
14,662 Views
Registered: ‎11-04-2013

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

Hi John,

 

Yes, I have already tried "petalinux-create -t libs -n <name> -s <path to libraries>/lib" and have modified the makefile in a similar way to what is shown in AR# 55976. The libraries are copied to the following folder <root of petalinux project>/build/linux/rootfs/stage/lib, but not to the actual rootfs of my linux system. 

 

Do you have any advice on how to modify the makefile to get the libraries copied to the rootfs?

 

 

Thanks,

David

 

0 Kudos
Observer david.perlaza
Observer
22,867 Views
Registered: ‎11-04-2013

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

Hi John (and those who may be interested),

 

The issue has been solved by editing the makefile as follows:

 

ifndef PETALINUX
$(error "Error: PETALINUX environment variable not set.  Change to the root of your PetaLinux install, and source the settings.sh file")
endif

include libs.common.mk

LIB_DIR=lib
# Add any other object files to this list below


all: build install

.PHONY: build
build:
#Skip Building Libraries. (Already precompiled for ARM platform)


install:
	# Install libraries template
	mkdir -p "$(TARGETDIR)/lib/fonts"
	find $(LIB_DIR)/ -maxdepth 1 -name "*.*" -print0 | xargs -0 cp -pP -r -t "$(TARGETDIR)/lib/"

clean:
	# No Clean operation for pre-built binaries.

 

 

Regards,

David

View solution in original post

0 Kudos
Adventurer
Adventurer
13,489 Views
Registered: ‎04-26-2012

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

gf

thanks
shweta
space appplication center
ahmedabad
0 Kudos
12,681 Views
Registered: ‎02-08-2015

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

David,

 

I'm trying to make the same thing - build patalinux with opencv libs.

I have added opencv libs (from SDK) to petalinux (petalinux-create -t libs), enable it in rootfs and edit Makefile to copy them into /usr/local/lib/opencv (to add this path to LD_LIBRARY_PATH at runtime).

But when I invoke petalinux-build - I got error.

As far as I understand error is about size of rootfs - opencv libs are to ig to fit in ramfs (rootfs is INITRAMFS).

When I change INITRAMFS to something else - than petalinux-build is ok but petalinux-boot --qemu is not - it can not load rootfs.

How you configure you rootfs to let opencv fit into it?

Or you have made separate image with opencv? Than how you prepare it and mount runtime?

0 Kudos
Observer david.perlaza
Observer
12,626 Views
Registered: ‎11-04-2013

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

Hi Oleg,

 

I am not familiar with QEMU; however, I think you are experiencing the same problem I had some time ago. The problem is that the kernel image grows to some 25 MB when OpenCV is added to the rootfs. Then, when the second-stage bootloader decompresses the kernel image, it runs out of memory and the image gets overwritten.

 

I solved the problem by following fanat9's advice here. Instead of 64 MB, I used 32 MB (0x2000000).

 

Please note that if you add OpenCV to your PetaLinux project, you won't need to add the libraries to the environment variable LD_LIBRARY_PATH at runtime. This is only required when the libraries are not part of the rootfs image, e.g. when the libraries are stored in the SD card. 

 

 

Cheers,

 

David

0 Kudos
2,212 Views
Registered: ‎08-17-2018

Re: Adding pre-compiled libraries to Petalinux rootfs

Jump to solution

> "... by editing the Makefile"

Which Makefile??? in the petalinux build area there are 590 of them. (not making this number up, I counted them) This area is still poorly documented. Please help.

0 Kudos