cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Participant
Participant
10,090 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
Highlighted
Anonymous
Not applicable
18,098 Views

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
Highlighted
Anonymous
Not applicable
10,066 Views

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
Highlighted
Participant
Participant
10,049 Views
Registered: ‎03-25-2016

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
Highlighted
Anonymous
Not applicable
18,099 Views

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

Highlighted
Participant
Participant
10,005 Views
Registered: ‎03-25-2016

Thanks for help.

 

Now i can access all files of SD card.

 

 

0 Kudos
Highlighted
Participant
Participant
9,995 Views
Registered: ‎03-25-2016

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
Highlighted
Explorer
Explorer
9,915 Views
Registered: ‎11-22-2015

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

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
Highlighted
Explorer
Explorer
9,893 Views
Registered: ‎11-22-2015

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

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
Highlighted
Explorer
Explorer
7,961 Views
Registered: ‎11-22-2015
 

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
Highlighted
6,108 Views
Registered: ‎06-17-2016

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
Highlighted
Participant
Participant
6,100 Views
Registered: ‎03-25-2016

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.

Highlighted
Visitor
Visitor
1,261 Views
Registered: ‎05-23-2019

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