How to compile binary executable files


MOHAMMED HASSAN
 

Hi guys,
I am new to yocto needed your help.
I have an executable binary file that is probably compiled using the gcc compiler. I am using yocto dunfell for my project my build_sys is "x86_64-linux" , my target_sys is "aarch64-poky-linux".

Can you please guide me as to what I need to load this binary executable file is my generated image file.

Thanks and Regards,
Hassan  
 


Michael Opdenacker
 

Hi Hassan

On 31.03.23 at 06:34, MOHAMMED HASSAN wrote:
Hi guys,
I am new to yocto needed your help.
I have an executable binary file that is probably compiled using the gcc compiler. I am using yocto dunfell for my project my build_sys is "x86_64-linux" , my target_sys is "aarch64-poky-linux".

Can you please guide me as to what I need to load this binary executable file is my generated image file.

Is this binary statically linked? Otherwise, you have no guarantee that it will run on your root filesystem.

If so, you could write a recipe to integrate the binary into your root filesystem, as it's possible to do with pre-compiled libraries : https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries. Caution, in this document, the new override syntax (with ":" instead of "_") is shown, it doesn't apply to Dunfell.

I hope this helps
Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


MOHAMMED HASSAN
 

Can you please guide me as to what I need to load this binary
executable file is my generated image file.

Is this binary statically linked? Otherwise, you have no guarantee that
it will run on your root filesystem.
It is statically linked file written using c language.
If so, you could write a recipe to integrate the binary into your root
filesystem, as it's possible to do with pre-compiled libraries :
https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries.
Caution, in this document, the new override syntax (with ":" instead of
"_") is shown, it doesn't apply to Dunfell.

I hope this helps
Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Will it be okay for me to refer the above link for my specific case?

Thanks and regards,
Hassan


Michael Opdenacker
 

On 31.03.23 at 09:36, MOHAMMED HASSAN wrote:

Can you please guide me as to what I need to load this binary
executable file is my generated image file.


Is this binary statically linked? Otherwise, you have no guarantee
that
it will run on your root filesystem.

It is statically linked file written using c language.

Good then.

If so, you could write a recipe to integrate the binary into your
root
filesystem, as it's possible to do with pre-compiled libraries :
https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries.

Caution, in this document, the new override syntax (with ":"
instead of
"_") is shown, it doesn't apply to Dunfell.

I hope this helps
Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Will it be okay for me to refer the above link for my specific case?

I'd say yes, write a similar recipe for your binary.
Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


MOHAMMED HASSAN
 

If so, you could write a recipe to integrate the binary into your
root
filesystem, as it's possible to do with pre-compiled libraries :
https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries.

Caution, in this document, the new override syntax (with ":"
instead of
"_") is shown, it doesn't apply to Dunfell.
Will it be okay for me to refer the above link for my specific case?I'd say yes, write a similar recipe for your binary.
Its a .exe binary file. Will it work?


Michael Opdenacker
 

On 31.03.23 at 11:42, MOHAMMED HASSAN wrote:
If so, you could write a recipe to integrate the binary into your
root
filesystem, as it's possible to do with pre-compiled libraries :
https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries.

Caution, in this document, the new override syntax (with ":"
instead of
"_") is shown, it doesn't apply to Dunfell.

Will it be okay for me to refer the above link for my specific
case?I'd say yes, write a similar recipe for your binary.

Its a .exe binary file. Will it work?

Not if that's a Windows executable (you can check with the "file" command). Just try to run it on your target system a
Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


MOHAMMED HASSAN
 

Will it be okay for me to refer the above link for my specific
case?I'd say yes, write a similar recipe for your binary.

Its a .exe binary file. Will it work?

Not if that's a Windows executable (you can check with the "file"
command). Just try to run it on your target system a
Sorry, Ive made some errors here. I just run file command to check, and it seems I was misled by my team into believing it was a statically linked binary.
Ive attached a screenshot for your reference about the type of file it is. 
Maybe that would help clear out the mess Ive made.

Thanks and regards,
Hassan




MOHAMMED HASSAN
 

On Fri, Mar 31, 2023 at 03:01 AM, MOHAMMED HASSAN wrote:
Will it be okay for me to refer the above link for my specific
case?I'd say yes, write a similar recipe for your binary.

Its a .exe binary file. Will it work?

Not if that's a Windows executable (you can check with the "file"
command). Just try to run it on your target system a
Sorry, Ive made some errors here. I just run file command to check, and it seems I was misled by my team into believing it was a statically linked binary.
Ive attached a screenshot for your reference about the type of file it is. 
Maybe that would help clear out the mess Ive made.

Thanks and regards,
Hassan



I think the pictures are not clear so you can refer the attachements.
Ive also copied and pasted what in the attachments here.
$: file Z3GatewayHostm 
Z3GatewayHostm: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=5eef6bf3e27434a4e20b7fdd50b3c13f929366ec, with debug_info, not stripped
 


MOHAMMED HASSAN
 

Can you help me to compile for dynamically linked executable file in yocto dunfell?
Thanks 

On Fri, Mar 31, 2023 at 3:20 PM Michael Opdenacker <michael.opdenacker@...> wrote:

On 31.03.23 at 11:42, MOHAMMED HASSAN wrote:
> If so, you could write a recipe to integrate the binary into your
> root
> filesystem, as it's possible to do with pre-compiled libraries :
> https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries.
>
> Caution, in this document, the new override syntax (with ":"
> instead of
> "_") is shown, it doesn't apply to Dunfell.
>
>     Will it be okay for me to refer the above link for my specific
>     case?I'd say yes, write a similar recipe for your binary.
>
> Its a .exe binary file. Will it work?


Not if that's a Windows executable (you can check with the "file"
command). Just try to run it on your target system a
Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Michael Opdenacker
 

Hi

On 31.03.23 at 12:35, MOHAMMED HASSAN wrote:
Can you help me to compile for dynamically linked executable file in yocto dunfell?
Thanks

For a dynamically linked executable you should definitely build it from source.
There is no shortcut here. You should take the time to read the Yocto manual to know how to do it: https://docs.yoctoproject.org/
Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com