TAj-src / piBayCom

Raspberry Pi KISS driver for the BayCom serial modem
GNU General Public License v3.0
2 stars 0 forks source link

Doesn't compile on Rasperry Pi Zero WH #1

Closed kinzi-net closed 1 year ago

kinzi-net commented 2 years ago

Hi,

the source code doesn't compile on Rasperry Pi Zero WH running Debian 11.

I've already installed the kernel-headers, but something must still be missing. Since I'm a complete C dyslexic I've no clue what. I'd guess some libraries are still missing. The errors are:

`make -C /lib/modules/5.10.103+/build/ M=/home/pi/src/piBayCom modules make[1]: Verzeichnis „/usr/src/linux-headers-5.10.103+“ wird betreten CC [M] /home/pi/src/piBayCom/piBayComLKM.o /home/pi/src/piBayCom/piBayComLKM.c: In function ‘ebbchar_init’: /home/pi/src/piBayCom/piBayComLKM.c:159:27: error: storage size of ‘init_ts_current’ isn’t known static struct timespec init_ts_current; ^~~~~~~ /home/pi/src/piBayCom/piBayComLKM.c:171:4: error: implicit declaration of function ‘getnstimeofday’; did you mean ‘getname_flags’? [-Werror=implicit-function-declaration] getnstimeofday(&ts_last); // set the last time to be the current time ^~~~~~ getname_flags /home/pi/src/piBayCom/piBayComLKM.c:172:14: error: implicit declaration of function ‘timespec_sub’; did you mean ‘timespec64_sub’? [-Werror=implicit-function-declaration] ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^~~~ timespec64_sub /home/pi/src/piBayCom/piBayComLKM.c:172:27: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^~~ /home/pi/src/piBayCom/piBayComLKM.c:172:36: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^~~ /home/pi/src/piBayCom/piBayComLKM.c:172:12: error: ‘ts_diff’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^ /home/pi/src/piBayCom/piBayComLKM.c:178:47: error: invalid use of undefined type ‘struct timespec’ seconds = (init_ts_current.tv_sec - ts_last.tv_sec); ^ /home/pi/src/piBayCom/piBayComLKM.c:179:73: error: invalid use of undefined type ‘struct timespec’ micros = ((seconds * 100000000) + init_ts_current.tv_nsec) - (ts_last.tv_nsec); ^ /home/pi/src/piBayCom/piBayComLKM.c:159:27: warning: unused variable ‘init_ts_current’ [-Wunused-variable] static struct timespec init_ts_current; ^~~~~~~ /home/pi/src/piBayCom/piBayComLKM.c: In function ‘ebbgpio_irq_handler’: /home/pi/src/piBayCom/piBayComLKM.c:282:27: error: ‘ts_current’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_current, ts_last); // Determine the time difference between last 2 presses ^~~~~~ /home/pi/src/piBayCom/piBayComLKM.c:282:39: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_current, ts_last); // Determine the time difference between last 2 presses ^~~ /home/pi/src/piBayCom/piBayComLKM.c:282:12: error: ‘ts_diff’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_current, ts_last); // Determine the time difference between last 2 presses ^ /home/pi/src/piBayCom/piBayComLKM.c:283:12: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_last = ts_current; // Store the current time as the last time ts_last ^ /home/pi/src/piBayCom/piBayComLKM.c:287:35: error: invalid use of undefined type ‘struct timespec’ bittime_arr[arr_pos++]= ts_diff.tv_nsec/1000; ^ /home/pi/src/piBayCom/piBayComLKM.c: At top level: /home/pi/src/piBayCom/piBayComLKM.c:68:24: error: storage size of ‘ts_last’ isn’t known static struct timespec ts_last, ts_current, ts_diff; ^~~ /home/pi/src/piBayCom/piBayComLKM.c:68:33: error: storage size of ‘ts_current’ isn’t known static struct timespec ts_last, ts_current, ts_diff; ^~~~~~ /home/pi/src/piBayCom/piBayComLKM.c:68:45: error: storage size of ‘ts_diff’ isn’t known static struct timespec ts_last, ts_current, ts_diff; ^~~ cc1: some warnings being treated as errors make[2]: [scripts/Makefile.build:280: /home/pi/src/piBayCom/piBayComLKM.o] Fehler 1 make[1]: [Makefile:1825: /home/pi/src/piBayCom] Fehler 2 make[1]: Verzeichnis „/usr/src/linux-headers-5.10.103+“ wird verlassen make: *** [Makefile:4: all] Fehler 2

Any help would be strongly appreciated. :-)

Regards kinzi`

TAj-src commented 2 years ago

Kinzi This will be the kernel 5 changes made to linux with respect to the 64 but timers it uses. This was written on a pi 3 using sub ver5 kernel. It will need modifying to be compatible for both versions of kernel.

It needs a bit of a re write anyway as the sending code especially is quite awful (in cpu hogging)

I will have a look and see if I can work out what changes are needed and reply back.

73s Steve

On Fri, 17 Jun 2022, 08:18 kinzi-net, @.***> wrote:

Hi,

the source code doesn't compile on Rasperry Pi Zero WH running Debian 11.

I've already installed the kernel-headers, but something must still be missing. Since I'm a complete C dyslexic I've no clue what. I'd guess some libraries are still missing. The errors are:

`make -C /lib/modules/5.10.103+/build/ M=/home/pi/src/piBayCom modules make[1]: Verzeichnis „/usr/src/linux-headers-5.10.103+“ wird betreten CC [M] /home/pi/src/piBayCom/piBayComLKM.o /home/pi/src/piBayCom/piBayComLKM.c: In function ‘ebbchar_init’: /home/pi/src/piBayCom/piBayComLKM.c:159:27: error: storage size of ‘init_ts_current’ isn’t known static struct timespec init_ts_current; ^~~~~~~ /home/pi/src/piBayCom/piBayComLKM.c:171:4: error: implicit declaration of function ‘getnstimeofday’; did you mean ‘getname_flags’? [-Werror=implicit-function-declaration] getnstimeofday(&ts_last); // set the last time to be the current time ^~~~~~ getname_flags /home/pi/src/piBayCom/piBayComLKM.c:172:14: error: implicit declaration of function ‘timespec_sub’; did you mean ‘timespec64_sub’? [-Werror=implicit-function-declaration] ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^~~~ timespec64_sub /home/pi/src/piBayCom/piBayComLKM.c:172:27: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^~~ /home/pi/src/piBayCom/piBayComLKM.c:172:36: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^~~ /home/pi/src/piBayCom/piBayComLKM.c:172:12: error: ‘ts_diff’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_last, ts_last); // set the initial time difference to be 0 ^ /home/pi/src/piBayCom/piBayComLKM.c:178:47: error: invalid use of undefined type ‘struct timespec’ seconds = (init_ts_current.tv_sec - ts_last.tv_sec); ^ /home/pi/src/piBayCom/piBayComLKM.c:179:73: error: invalid use of undefined type ‘struct timespec’ micros = ((seconds * 100000000) + init_ts_current.tv_nsec) - (ts_last.tv_nsec); ^ /home/pi/src/piBayCom/piBayComLKM.c:159:27: warning: unused variable ‘init_ts_current’ [-Wunused-variable] static struct timespec init_ts_current; ^~~~~~~ /home/pi/src/piBayCom/piBayComLKM.c: In function ‘ebbgpio_irq_handler’: /home/pi/src/piBayCom/piBayComLKM.c:282:27: error: ‘ts_current’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_current, ts_last); // Determine the time difference between last 2 presses ^~~~~~ /home/pi/src/piBayCom/piBayComLKM.c:282:39: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_current, ts_last); // Determine the time difference between last 2 presses ^~~ /home/pi/src/piBayCom/piBayComLKM.c:282:12: error: ‘ts_diff’ has an incomplete type ‘struct timespec’ ts_diff = timespec_sub(ts_current, ts_last); // Determine the time difference between last 2 presses ^ /home/pi/src/piBayCom/piBayComLKM.c:283:12: error: ‘ts_last’ has an incomplete type ‘struct timespec’ ts_last = ts_current; // Store the current time as the last time ts_last ^ /home/pi/src/piBayCom/piBayComLKM.c:287:35: error: invalid use of undefined type ‘struct timespec’ bittime_arr[arr_pos++]= ts_diff.tv_nsec/1000; ^ /home/pi/src/piBayCom/piBayComLKM.c: At top level: /home/pi/src/piBayCom/piBayComLKM.c:68:24: error: storage size of ‘ts_last’ isn’t known static struct timespec ts_last, ts_current, ts_diff; ^~~ /home/pi/src/piBayCom/piBayComLKM.c:68:33: error: storage size of ‘ts_current’ isn’t known static struct timespec ts_last, ts_current, ts_diff; ^~~~~~ /home/pi/src/piBayCom/piBayComLKM.c:68:45: error: storage size of ‘ts_diff’ isn’t known static struct timespec ts_last, ts_current, ts_diff; ^~~ cc1: some warnings being treated as errors make[2]: [scripts/Makefile.build:280: /home/pi/src/piBayCom/piBayComLKM.o] Fehler 1 make[1]: [Makefile:1825: /home/pi/src/piBayCom] Fehler 2 make[1]: Verzeichnis „/usr/src/linux-headers-5.10.103+“ wird verlassen make: *** [Makefile:4: all] Fehler 2

Any help would be strongly appreciated. :-)

Regards kinzi`

— Reply to this email directly, view it on GitHub https://github.com/TAj-src/piBayCom/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBPCYIANILIGGECDLBY5WLVPQRENANCNFSM5ZBKOB5Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kinzi-net commented 2 years ago

Steve,

thanks for your quick reply! Looking forward to your findings. Otherwise I could manage to use a distro running 4.x kernels if this would solve the problem, as I solely want to use the Pi as a Packet Radio modem. So out of date distro would not really be a problem.

vy73!

TAj-src commented 2 years ago

Version 4 should work fine. I will look into updating things for 5 but I can't say when that might be.

73s Steve

On Fri, 17 Jun 2022, 12:55 kinzi-net, @.***> wrote:

Steve,

thanks for your quick reply! Looking forward to your findings. Otherwise I could manage to use a distro running 4.x kernels if this would solve the problem, as I solely want to use the Pi as a Packet Radio modem. So out of date distro would not really be a problem.

vy73!

— Reply to this email directly, view it on GitHub https://github.com/TAj-src/piBayCom/issues/1#issuecomment-1158798076, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBPCYKXWSKBNV2VG4NCAFDVPRRU3ANCNFSM5ZBKOB5Q . You are receiving this because you commented.Message ID: @.***>

kinzi-net commented 2 years ago

OK, after "enjoying" downgrade the pi to 4.9.11+ it compiles! :-)

rpi-update 13711648ecf6f2e5aed380baaed00d47f56bcc3f

This installs Kernel 4.9.11+.

apt install linux-headers-rpi

This installs header files for 4.9.0.6 (ARGH!). You need to ln -s /lib/modules/4.9.0.6/build to /lib/modules/4.9.11+/

I'll give it a try. Will leave feedback later.

Regards kinzi

kinzi-net commented 2 years ago

OK, using kernel 4.9 it compiles, but then ...

insmod ./piBayComLKM.ko RX_PIN=17 TX_PIN=23 PTT_PIN=27
insmod: ERROR: could not insert module ./piBayComLKM.ko: Invalid module format

... ?

[EDIT]

tail /var/log/kern.log -f

Jun 17 19:23:30 raspbery kernel: [12843.619363] piBayComLKM: disagrees about version of symbol module_layout Jun 17 19:23:50 raspberry kernel: [12863.685306] piBayComLKM: disagrees about version of symbol module_layout

[/EDIT]

TAj-src commented 2 years ago

This is the error I was referring to about ver 5 headers. It is mismatched kernel and headers. You will need to go back to the version of kernel you have headers for I think.

73s Steve

On Fri, 17 Jun 2022, 18:25 kinzi-net, @.***> wrote:

OK, using kernel 4.9 it compiles, but then ...

insmod ./piBayComLKM.ko RX_PIN=17 TX_PIN=23 PTT_PIN=27 insmod: ERROR: could not insert module ./piBayComLKM.ko: Invalid module format

... ?

— Reply to this email directly, view it on GitHub https://github.com/TAj-src/piBayCom/issues/1#issuecomment-1159092017, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBPCYMAPKNCTQFYI3WBN3TVPSYJBANCNFSM5ZBKOB5Q . You are receiving this because you commented.Message ID: @.***>

kinzi-net commented 2 years ago

OK, this seems not that easy on RasPi. I'll hunt for a version incliuding correct headers. Stay tuned. :-)

kinzi-net commented 2 years ago

It seems older images of Raspbian OS (2020 and elder) - before renaming to "RaspiOS" - are totally fucked up at

https://downloads.raspberrypi.org/raspbian_lite/images/

Tried two of them - imaging using dd is not working, Raspi Imager neither works ("Not a valid image!").

So I can't downgrade to kernel 4.x atm.

TAj-src commented 2 years ago

Kinzi

OK that's not good. I will check when I'm back home what version of kernel mine is on but then I should really try to fix it for newer ones otherwise its useless lol

Thanks for the feedback. Steve

On Sat, 18 Jun 2022, 17:23 kinzi-net, @.***> wrote:

It seems older images of Raspbian OS (2020 and elder) - before renaming to "RaspiOS" - are totally fucked up at

https://downloads.raspberrypi.org/raspbian_lite/images/

Tried two of them - imaging using dd is not working, Raspi Imager neither works ("Not a valid image!").

So I can't downgrade to kernel 4.x atm.

— Reply to this email directly, view it on GitHub https://github.com/TAj-src/piBayCom/issues/1#issuecomment-1159502565, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBPCYLKG64CGYTCICAA2IDVPXZWLANCNFSM5ZBKOB5Q . You are receiving this because you commented.Message ID: @.***>

kinzi-net commented 2 years ago

OK, it works now.

Seems an apt update && apt upgrade after all did the trick - it lifted the kernel and the headers to 4.19.66+ , make runs fine and insmod is working now.

Next step is to hook up my C64 directly to the Pi (using a voltage divider), so I'll get a KISS interface for the C64 to hook it up to XNET via LAN. :-)

Will post final results here. Thanks so far!

Regards kinzi

kinzi-net commented 2 years ago

Hooked up the Pi to the C64 directly. Running cal with option 3 will cause Digicom on the C64 to display "RECV" - indicating a signal is detected by it's soft-DCD. So it seems to work. Now I have to figure out how I can attach piBayCom to common software. I'll open a new issue for this.

This one is temporarily solved, thank you. I you'll ever find time to adopt it to newer sources this would be a nice extra.

73 kinzi

TAj-src commented 2 years ago

That's good! Yes please let me know how it goes.

Yes headers are in a right mess. Even for ver 5 trying to get them right is hard and sometimes they are so wrong things won't run, even though they install

Steve

On Fri, 17 Jun 2022, 14:59 kinzi-net, @.***> wrote:

OK, after "enjoying" downgrade the pi to 4.9.11+ it compiles! :-)

rpi-update 13711648ecf6f2e5aed380baaed00d47f56bcc3f

This installs Kernel 4.9.11+.

apt install linux-headers-rpi

This installs header files for 4.9.0.6 (ARGH!). You need to ln -s /lib/modules/4.9.0.6/build to /lib/modules/4.9.11+/

I'll give it a try. Will leave feedback later.

Regards kinzi

— Reply to this email directly, view it on GitHub https://github.com/TAj-src/piBayCom/issues/1#issuecomment-1158900312, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBPCYP23OCIEIA2ELCVCOLVPSAEDANCNFSM5ZBKOB5Q . You are receiving this because you commented.Message ID: @.***>

TAj-src commented 1 year ago

Header mis-match. Code is only pre V4 kernel. It should trap that until a fix / re-work is implimented.