1

Objective

I want to turn off HDMI on my Raspberry Pi 3 Model B. The binaries for Raspbian does not work on my OS because it is linked to a different standard c library. Before I go down the rabbit hole I need to ask, what is the line of least resistance?

  • Do arm6hf or aarch64 binaries for musl exist?
  • Are there other ways of turning off HDMI without using tvservice?

Attempt

There were many steps to compile and I guessed some of it along the way. I don't have much experience with cmake either, so I could have made mistakes.

I got the source from github.com/raspberrypi/userland/ and compiled tvservice for musl-aarch64 using a docker cross-compiler based on these instructions. I was not able to compile everything defined in userland/buildme script, so I changed cmake to this line:

cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE -DARM64=$ARCH --target host_applications/linux ../../..

The target parameter seemed to work! I checked the binary type and linked libraries to make sure everything looked right.

# file tvservice
tvservice: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, not stripped
# ldd tvservice
    /lib/ld-musl-aarch64.so.1 (0x4000000000)
    libvchiq_arm.so => /opt/userland/build/lib/libvchiq_arm.so (0x40008c7000)
    libvcos.so => /opt/userland/build/lib/libvcos.so (0x40008df000)
    libc.musl-aarch64.so.1 => /lib/ld-musl-aarch64.so.1 (0x4000000000)

Next I moved the build output directory (/opt/userland/build) from my container to my Raspberry Pi. After moving and executing the linked libraries were not found. I tried setting LD_LIBRARY_PATH but it did not help, so I moved the libraries libvchiq_arm.so and libvcos.so to /lib/ (on OpenWRT /lib64 is syblinked to /lib). I ran tvservice -o again and it just hanged with no errors or any output.

I don't have much experience with GDB (GNU Debugger). Not sure if that's the right way forward. I am using a Raspberry Pi 3 Model B with OpenWRT, however, I'm looking for a solution that will work with any Raspberry Pi on any musl based OS like Apline/Void.

PS: I wanted to add these tags: musl, apline, tvservice but I don't have enough reputation.

Mohi Rostami
  • 4,434
  • 1
  • 20
  • 39
Keehl
  • 11
  • 1

0 Answers0