cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
4,178 Views
Registered: ‎01-22-2017

OpenSSL in Petalinux 2016.4

OpenSSL is not a menu item, when one calls

petalinux-config -c rootfs

 

But on the other hand, all files from OpenSSL seem to be in the distribution. There are also menu items referring to

OpenSSL in the config file associated to the rootfs configuration.

 

My questions are,

Why is OpenSSL not in the rootfs config menu?

How can I include OpenSSL in my Petalinux project?

 

BL, Rainer

0 Kudos
9 Replies
Highlighted
Moderator
Moderator
4,165 Views
Registered: ‎12-04-2016

Re: OpenSSL in Petalinux 2016.4

Hi Rainer

 

Why is OpenSSL not in the rootfs config menu?

 

To make boot image minimal, we are just adding only required basic packages to rootfs.

 

How can I include OpenSSL in my Petalinux project?

OpenSSL is part of recipe-connectivity layer. If we want to add openssl package to Zynq/ZynqMP architecture, follow these steps:

1. Go to petalinux installation directcory (Ex:/opt/pkg/petalinux/)

2. Locate this file: /opt/pkg/petalinux/components/yocto/source/aarch64/layers/meta-petalinux/recipes-core/packagegroups/packagegroup-petalinux.bb

3. Add the desired package at the end of ZYNQ_EXTRAS (something like this: openssl \ )

4. save the file

5. bitbake to get the new RPM: MACHINE=zynq-generic bitbake petalinux-image

 

 

Best Regards

Shabbir

0 Kudos
Highlighted
Observer
Observer
4,124 Views
Registered: ‎03-14-2016

Re: OpenSSL in Petalinux 2016.4

So you are saying that I would need to make changes to my petalinux install just to include openssl in the rootfs of one of my petalinux projects? That seems pretty hacky to me.

I don't have a lot of experience with 2016.4, but isn't there a way to include openssl using only the rootfs menuconfig? I find it hard to believe that you have to hack the yocto backend in order to do this basic task.
Highlighted
Adventurer
Adventurer
4,097 Views
Registered: ‎07-08-2016

Re: OpenSSL in Petalinux 2016.4

I am also very interested in just getting a minimal linux image with openVPN (and therefore openSSL as a dependency) as the only add-ons, but have been struggling quite a bit.

 

@shabbirk could you please provide more detail on step 3? How do we know that just by listing openSSL as a desired package, that it will be included in the build (how does petalinux find the source?).

 

I would also like to do the same for openVPN. Is this possible? 

 

Any tutorials you have on the subject would be helpful (I have already gone through all of the petalinux documentation, but it seems that this task is beyond the petalinux layer and dives deeper into Yocto builds)

 

Also, Is this really a non-standard task? I would have thought that all of the GNU project stuff would be available? 

Thanks!

Brett

 

0 Kudos
Highlighted
Visitor
Visitor
3,974 Views
Registered: ‎01-22-2017

Re: OpenSSL in Petalinux 2016.4

Hi Shabbir,

step 1 to 4 are fine. But step 5 is not necessary, because the call "Petalinux-config -c rootfs" does this automatically.

Moreover , step 5 wI'll not work without proper sourcing of the environment and it is nowhere stated how to do it.

 

BR,

Rainer

0 Kudos
Highlighted
Moderator
Moderator
3,971 Views
Registered: ‎12-04-2016

Re: OpenSSL in Petalinux 2016.4

Hi Rainer

 

Yes step 5 wIll  work only after proper sourcing of the environment and here is how you need to do:

cd /opt/pkg/petalinux/components/yocto/source/aarch64/layers/poky

source oe-init-build-env

MACHINE=zynq-generic bitbake petalinux-image (make sure you are in build directory to run this)

 

 

Best Regards

Shabbir

 

0 Kudos
Highlighted
Visitor
Visitor
1,801 Views
Registered: ‎03-21-2017

Re: OpenSSL in Petalinux 2016.4

Hi all,

 

Let’s say that I have followed the Step 1 to 4 written by Shabbirk. I executed already the “petalinux-config -c rootfs”, and activated the openssl library in my project directory.

 

The openssl library’s activation is already done based on the content of my “/build/tmp/sysroots/plnx_arm/usr/lib/openssl/ptest/include/openssl”. The folder contains many header files related to openssl, such as “rand.h”, “pem.h”, sha.h”, etc.

 

Once, I created a file, named as opensapp.c, calling functions provided by openssl, and it can be compiled and targeted to an object file with gcc and its -lcrypto in a common linux OS terminal of my host desktop. With the this approach, I am able to use certain functions related to the header files provided by openssl to run a certain functionality.

 

Then, I tried to make another application, named as myapp.c, using petalinux 2017.1 SDK having the same content of the opensapp.c. I also tried to compile it using petalinux-build, and found some errors. To make and compile an application calling functions provided by openssl, I don’t change the Makefile.

 

My questions are: do I need to change the Makefile to make the compilation of myapp.c works? What should I write in myapp.c to define header files provided in the directory “/build/tmp/sysroots/plnx_arm/usr/lib/openssl/ptest/include/openssl”? For instance, do I need to write include “…/openssl/rand.h” in myapp.c, so it is compilable and executable?

 

Thanks.

Mysarm

0 Kudos
Highlighted
Visitor
Visitor
1,773 Views
Registered: ‎03-21-2017

Re: OpenSSL in Petalinux 2016.4

I mean after I had chosen to add the openssl by executing “petalinux-config -c rootfs” and marking in the options of libs to activate the openssl, I ran the “petalinux-build”.

 

In the “build” directory of my petalinux application, I find a certain file header which I need to use in my application, for instance “evp.h” in following directories:

 

./build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/openssl/1.0.2j-r0/sysroot-destdir/usr/include/openssl/evp.h

./build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/openssl/1.0.2j-r0/sysroot-destdir/usr/lib/openssl/ptest/include/openssl/evp.h

./build/tmp/sysroots/plnx_arm/usr/include/openssl/evp.h

./build/tmp/sysroots/plnx_arm/usr/lib/openssl/ptest/include/openssl/evp.h

./build/tmp/sysroots/x86_64-linux/usr/include/openssl/evp.h

 

Can you tell me, how I should write the “evp.h” in my application file (app.c) if I want to use the header file? How about the Makefile?

 

I have tried to write #include <openssl/evp.h> in my application file, and compile the application, but the compilation results an error, i.e. the openssl/evp.h cannot be found.

 

Then, I changed also the Makefile to:

 

$(APP): $(APP_OBJS)

$(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS) -lcrypto

...

 

The compilation shows also another error. I expect the compilation will be:

gcc app.c -o object_file -lcrypto

I need to execute this since in linux os’s user space it was successful. However, there is also an error during compilation.

 

What should I do to make the application’s compilation successful and I can run the app.c in my petalinux later?

 

Mysarm

0 Kudos
Highlighted
Observer
Observer
1,724 Views
Registered: ‎07-03-2018

Re: OpenSSL in Petalinux 2016.4


@shabbirk wrote:

Hi Rainer

 

Yes step 5 wIll  work only after proper sourcing of the environment and here is how you need to do:

cd /opt/pkg/petalinux/components/yocto/source/aarch64/layers/poky

source oe-init-build-env

MACHINE=zynq-generic bitbake petalinux-image (make sure you are in build directory to run this)

 

 

Best Regards

Shabbir

 


Can you provide updates instructions for Petalinux 2018.1?  The folder you reference does not exist.

0 Kudos
Highlighted
Scholar
Scholar
1,688 Views
Registered: ‎06-10-2008

Re: OpenSSL in Petalinux 2016.4

Beware, OpenSSL in Petalinux 2018.1 is broken, due to a change in the used binutils.

0 Kudos