Microtelecom / libperseus-sdr

Perseus Software Defined Radio Control Library for Linux
http://microtelecom.it/perseus/
GNU Lesser General Public License v3.0
16 stars 7 forks source link

Compiling on Alpine Linux brings up xxd errors #11

Open jketterl opened 4 years ago

jketterl commented 4 years ago

I tried to integrate libperseus-sdr into the docker builds of OpenWebRX, and while the compilation does seem to pass, there is multiple errors coming from xxd about the lack of a -i flag.

xxd: unrecognized option: i
BusyBox v1.30.1 (2019-10-26 11:23:07 UTC) multi-call binary.

Usage: xxd [OPTIONS] [FILE]

Hex dump FILE (or stdin)

        -g N            Bytes per group
        -c N            Bytes per line
        -p              Show only hex bytes, assumes -c30
        -l LENGTH       Show only first LENGTH bytes
        -s OFFSET       Skip OFFSET bytes

They seem to be coming from the generate_fpga_code.sh. I'm not sure if this error is fatal, but my impression is that invalid FPGA code (that is probably uploaded to the SDR at some point) may cause some major issues, so I'm holding this back on my end for now.

I know that busybox really isn't much help, but I have failed to come up with a way to get some other version of xxd in there.

Is there an alternative generation method?

amontefusco commented 4 years ago

Yes, that part is about generating blobs for FPGA.Let me investigate as I didn't remember why that option is there.

amontefusco commented 4 years ago
-i | -include 
output in C include file style. A complete static array definition is written (named after the input file), unless xxd reads from stdin.

So, that option is there for a good reason. It seems that xxd in Alpine Linux is a very stripped down one when compared with the ones found in major distribution.

https://helpmanual.io/man1/xxd/

amontefusco commented 4 years ago

Is there an alternative generation method?

I will try to develop some other things. Which are the tools in that limited environment available ? Shell script ? Perl ?

amontefusco commented 4 years ago

I assume that at least a C program can be compiled, so the safer option would be to rewrite generate_fpga_code.sh as C program.

jketterl commented 4 years ago

Yes, the busybox stuff is really stripped down to the bare minimum. It has been the cause of many headaches in the past. It's originally intended to run on embedded hardware, and is widely used on routers or NAS boxes.

I've seen how the -i is used, and that's what led me to the conclusion to not include this for now. The first thing I'd recommend (independently on how we resolve this) is to include error handling and stop the build in case of errors.

I have been researching on what I could possibly do on my end:

jketterl commented 4 years ago

OK another update... I just found out that a proper version of xxd is bundled with the vim package. Not very intuitive, but I can solve the problem with that, at least for now. I'll leave it to you if you want to pursue this further :slightly_smiling_face: