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: 
Highlighted
Participant shahid
Participant
9,393 Views
Registered: ‎03-25-2016

Running elf on petalinux

Jump to solution

Hello,

 

I petalinux configure with PL bitstream create BOOT.bin.

 

I have created a linux application using xsdk. I copied all necessary file of petalinux to SD card and also copied liux_app.elf to SD card. I boot petalinux on zedboard its booting normally but i could not find the linux application which i have copied to SD card.

 

I tried to run using ./liux_app.elf but its not there.

 

I have attached the screen shot of SD card contents and highlited is the application which i have build using xsdk and copied to SD card.

 

How i can solve this problem?

 

Please help me.

Tags (2)
SDCard_petalinux.JPG
0 Kudos
1 Solution

Accepted Solutions
Participant pete_128
Participant
17,401 Views
Registered: ‎04-02-2016

Re: Running elf on petalinux

Jump to solution

There must be something as root otherwise Linux wouldn't be able to boot to a working shell.

 

Try some of the following:

pwd
ls / ls /dev/ which ls

If you have a dev node for SD, usually /dev/mmcblk* where * may have numbers and p's, try mounting it:

mkdir -p /mnt
mount /dev/mmcblk<partition> /mnt

You should then see your elf in the /mnt dir.

 

HTH

View solution in original post

13 Replies
Participant pete_128
Participant
9,369 Views
Registered: ‎04-02-2016

Re: Running elf on petalinux

Jump to solution

what do you see if you ls the root dir in your booted system? Is the sd card mounted as root? Depending on configuration the SD card may or may not be root. E.g. you could be at the initramfs or initrd with the SD card unmounted.

0 Kudos
Participant shahid
Participant
9,352 Views
Registered: ‎03-25-2016

Re: Running elf on petalinux

Jump to solution

Hi,

 

When i do ls root. it shows nothing. I have not mounted card as root. I simply format it and copied all files to it. is it problem?. How i can mount it as root?

0 Kudos
Participant pete_128
Participant
17,402 Views
Registered: ‎04-02-2016

Re: Running elf on petalinux

Jump to solution

There must be something as root otherwise Linux wouldn't be able to boot to a working shell.

 

Try some of the following:

pwd
ls / ls /dev/ which ls

If you have a dev node for SD, usually /dev/mmcblk* where * may have numbers and p's, try mounting it:

mkdir -p /mnt
mount /dev/mmcblk<partition> /mnt

You should then see your elf in the /mnt dir.

 

HTH

View solution in original post

Participant shahid
Participant
9,308 Views
Registered: ‎03-25-2016

Re: Running elf on petalinux

Jump to solution

Thanks for help.

 

Now i can access all files of SD card.

 

 

0 Kudos
Participant shahid
Participant
9,298 Views
Registered: ‎03-25-2016

Re: Running elf on petalinux

Jump to solution

Can you help.

 

I tried to make application for linux using the struct and functions provided by XSDk. I have attached code but when i execute it shows following error.

 

 

/dev/uio0 opened.

segmentation fault.

 

i have checked uio0 is there in /dev.

0 Kudos
Explorer
Explorer
9,218 Views
Registered: ‎11-22-2015

Re: Running elf on petalinux

Jump to solution

Hello,

 

You are trying to mmap the uio file descriptor which is sure to cause problems.  Also, just for reference the SD partitions are not mounted by default because of a problem in the mount script(at least in 2015.4) so you have to mount them manually.  

 

jeff

0 Kudos
Participant shahid
Participant
9,215 Views
Registered: ‎03-25-2016

Re: Running elf on petalinux

Jump to solution

Hi  jeffdaq,

 

Thanks for help.

 

How i can over come this problem caused by mmap the uio file descriptor?

 

I cannot skip it is must for me.

0 Kudos
Explorer
Explorer
9,196 Views
Registered: ‎11-22-2015

Re: Running elf on petalinux

Jump to solution

Hello,

 

Actually, I looked at this again and i was wrong.   In my UIO userspace code I did not map the uio fd because I had to access multiple devices so I just mmaped in /dev/mem.  So you should NOT have a problem mmaping the uio fd.  However,  I don't think you allocated any memory for the alu pointer and you try to dereference when you make the mmap call.

 

jeff

0 Kudos
Participant shahid
Participant
9,153 Views
Registered: ‎03-25-2016

Re: Running elf on petalinux

Jump to solution

Hello jeffdaq,

 

Thanks for reply.

 

By memory allocation mean, i should set it to base address and then call mmap or something else?

0 Kudos
Explorer
Explorer
7,264 Views
Registered: ‎11-22-2015

Re: Running elf on petalinux

Jump to solution
 

I mean a pointer has to be initialized to point to memory.  Either you have to malloc memory or initialize the pointer to the adress of another variable. I don't remember seeing that in your code.

 

jeff

 

0 Kudos
5,411 Views
Registered: ‎06-17-2016

Re: Running elf on petalinux

Jump to solution

I too have tried to build and run ELF files on PetaLinux running on the target board. But none of the ways mentioned here worked out for me. I even tried chmod. Didn't work. When I executed the file, it displayed "Illegal Instruction". 

 

The way to go around this is to create the application in PetaLinux SDK itself. When you build this application, it creates an executable which can be found in /bin.

0 Kudos
Participant shahid
Participant
5,403 Views
Registered: ‎03-25-2016

Re: Running elf on petalinux

Jump to solution

Hi akshaykamathk,

 

Yes you can create an application using Petalinux. But you cannot debug when it has some problem. First you have to copy it in SD card and then insert card to board and if it doesn,t work then again you have to go for petalinux. Which is really time consuming process.

 

The most efficient way to copy elf file to running board is through SSH. 
You can make application in XSDK then you should configure Ethernet port of board and make an SSH with board.

 

One thing you should keep in mind. You should enable drop bear while building kernel in petalinux.

 

I hope this will help you.

Visitor ubuntu65
Visitor
564 Views
Registered: ‎05-23-2019

Re: Running elf on petalinux

Jump to solution

Hi all,

I move the elf file via ssh. but whenever I run the my_sys.elf I get the following error: my_sys.elf: error while loading shared libraries: libsds.so: cannot open shared object file: no such file or directory.

Please let me know how can I resolve this issue. Thanks in advance.

Best regards,

 

0 Kudos