How to build static libgpiod-tools executables for arm64?

397 views Asked by At

Is there a way to build the static version of libgpiod-tools executables for arm64? I need the static-linked version, because I need to pack them into a ramdisk for an embedded system (for debug purpose).

I can find a static version of the tools from a yocto/openbmc build result, but they are for 32-bit machines, and it seems that they can not run on arm64.

[cmic@sr223 libgpio-tools.32bit]$ ls -la
total 84
drwxr-xr-x. 2 cmic cmic   101 Apr 21 22:12 .
drwxrwxr-x. 5 cmic cmic   106 Apr 21 22:13 ..
-rwxr-xr-x. 1 cmic cmic  9652 Apr 21 22:10 gpiodetect
-rwxr-xr-x. 1 cmic cmic  9652 Apr 21 22:10 gpiofind
-rwxr-xr-x. 1 cmic cmic  9648 Apr 21 22:10 gpioget
-rwxr-xr-x. 1 cmic cmic 13748 Apr 21 22:10 gpioinfo
-rwxr-xr-x. 1 cmic cmic 13744 Apr 21 22:10 gpiomon
-rwxr-xr-x. 1 cmic cmic 13744 Apr 21 22:10 gpioset
[cmic@sr223 libgpio-tools.32bit]$ file gpiodetect
gpiodetect: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=61afc5cfee96d4a155876775f148eb9009ada03b, for GNU/Linux 3.2.0, stripped
[cmic@sr223 libgpio-tools.32bit]$ ldd gpiodetect
        not a dynamic executable
[cmic@sr223 libgpio-tools.32bit]$ ./gpiodetect
-bash: ./gpiodetect: cannot execute binary file: Exec format error

Or I can download such executables from somewhere?

1

There are 1 answers

0
John b On BEST ANSWER

I would recommend you build this package from source, using the build system openbmc uses. This is the most reliable, and fastest way to add software to an image.

There is already a recipe for libgpiod-tool. Is is supported in meta-openbedded (which openbmc is based on) Here is the recipe in openbmc.

You will need to add the recipe to a openbmc machine. Try adding

IMAGE_INSTALL:append = " libgpiod-tools"  

to the conf/local.conf for the machine you want to build use this on.

Then you can either build the full image or only the libgpiod pacakge

$ bitbake  libgpiod

or

$ bitbake  obmc-phosphor-image

Then the executable that match the aritture of the machine should be in build/tmp/work/armv7a-openbmc-linux-gnueabi/libgpiod/1.6.3-r0/packages-split/libgpiod-tools/usr/bin

You can move you new binaries over, or install a new image, to run your libgpiod-tool.

Also feel free to ask any questions you have on the openbmc discord found here https://discord.gg/69Km47zH98, or the openbmc mailing list here https://lists.ozlabs.org/listinfo/openbmc.