machinekit / machinekit-hal

Universal framework for machine control based on Hardware Abstraction Layer principle
https://www.machinekit.io
Other
106 stars 62 forks source link

possible aarch64 support #96

Closed ArcEye closed 3 years ago

ArcEye commented 5 years ago

Issue by bjharper Sun Sep 3 03:34:00 2017 Originally opened as https://github.com/machinekit/machinekit/issues/1269


I have had some success compiling and running LinuxCNC on aarch64 (Ubuntu 16.04) using Realtime preempt 4.11 kernel but I am struggling a little with machine kit. I seems to always end up with an error looking for sys/io.h

Compiling machinetalk/support/sizes.c
In file included from rtapi/rtapi.h:1016:0,
                 from hal/lib/hal.h:126,
                 from ./emc/motion/motion.h:80,
                 from machinetalk/support/sizes.c:2:
rtapi/rtapi_io.h:39:43: fatal error: sys/io.h: No such file or directory
compilation terminated.
Makefile:420: recipe for target 'objects/machinetalk/support/sizes.o' failed

Basic steps is to install all dependencies then $ debian/configure -pr $ sudo mk-build-deps -ir $ cd src $ ./autogen.sh $ ./configure --with-rt-preempt --with-posix $ make -j2

Kernel im working with at the moment is development Realtime PREEEMT branch "'Linux odroid64 4.11.12-rt10 #6 SMP PREEMPT RT Sat Aug 26 17:27:03 AEST 2017 aarch64 aarch64 aarch64 GNU/Linux"

Im working on a HAL driver for the Odroid C2 and its GPIO pins so I dont know if I really need the io.h support in rtapi (no PCI interface ill be hitting GPIO registers directly hopefully) and if I need outb / inb functions then it looks like I could probably emulate them myself.

Looks like I will need to setup an aarch64 specific configuration in the machinekit source or maybe install for further dependencies for aarch64? Im compiling machinekit on an aarch64 platform also, no cross-compiling.

ArcEye commented 5 years ago

Comment by sirop Sun Sep 3 04:31:24 2017


@bjharper Can't you use either Debian Jessie or Stretch instead? See https://forum.odroid.com/viewtopic.php?f=138&t=27449 .

ArcEye commented 5 years ago

Comment by bjharper Sun Sep 3 04:50:35 2017


Thanks I will try Debian and see how it goes.

ArcEye commented 5 years ago

Comment by sirop Sun Sep 3 05:16:02 2017


Could you please publish your instructions for building Linux odroid64 4.11.12-rt10, as then I'd try it on my site too.

ArcEye commented 5 years ago

Comment by ArcEye Sun Sep 3 06:00:21 2017


rtapi/rtapi_io.h:39:43: fatal error: sys/io.h: No such file or directory

You will probably find it is in a subdirectory within /usr/include that relates to the arch type. Ubuntu especially kept moving things around, I just used to symlink the contents to the main dir and all worked fine.

ArcEye commented 5 years ago

Comment by bjharper Sun Sep 3 09:59:03 2017


Linux odroid64 4.11.12-rt10 has some limitations for the moment (the main one being no hdmi output), I was testing LinuxCNC over remote X11 sessions but want to use MachineKit for the extra features such as web UI (particularly as I have no HDMI) and more customised devices such as what has been done with Beaglebone and Pi. HDMI support for C2 should be soon enough in mainline Linux but 4.11 is enough to get me started for now.

The kernel build is straightforward on an aarch64 platform but the installation is a bit more complex.

The kernel itself can be a little troublesome to install as it must be made into a compatible uImage for uboot and booted with a different configuration from uboot but I will provide some instruction on the build as soon as I can document it a little clearer.

I did a search through /usr/include but no io.h on Ubuntu. I notice in my kernel source there is an io.h but most likely not the user library im after for aarch64? I will try again on Debian to see if I can work it out or it has different libraries.

Thanks!

ArcEye commented 5 years ago

Comment by sirop Sun Sep 3 10:18:36 2017


@bjharper Thanks so far.

It would be interesting to compare the latency of Odroid C2 with that of Pi3 https://github.com/koppi/mk/blob/master/Machinekit-RT-Preempt-RPI.md#latency-evaluation .

ArcEye commented 5 years ago

Comment by bjharper Sun Sep 3 11:09:34 2017


`odroid@odroid64:\~$ uname -a Linux odroid64 4.11.12-rt10 #6 SMP PREEMPT RT Sat Aug 26 17:27:03 AEST 2017 aarch64 aarch64 aarch64 GNU/Linux odroid@odroid64:~$ sudo cyclictest -t1 -p 80 -n -i 10000 -l 10000 # /dev/cpu_dma_latency set to 0us policy: fifo: loadavg: 0.93 0.42 0.16 2/218 27058

T: 0 (27052) P:80 I:10000 C: 10000 Min: 7 Act: 10 Avg: 10 Max: 23`

that was done with a odroid@odroid64:~$ cat /dev/zero > /dev/null on the odroid and a $ sudo ping -i 0.01 10.1.1.12 from my host to the odroid. Impressive I guess but I can bust the max out if I really try. (ie 100 x glxgears running over ssh & X11 or heavy disk IO got it up to 200 ms)

ArcEye commented 5 years ago

Comment by sirop Sun Sep 3 11:18:31 2017


Yes, very impressive latency results.

Some time ago with an older kernel 3.XX there was a problem with the network driver on C2. Have you noticed anything like that with the newer kernel?

Anyway: waiting for kernel installation instructions.

ArcEye commented 5 years ago

Comment by bjharper Sun Sep 3 11:58:36 2017


Some time ago with an older kernel 3.XX there was a problem with the network driver on C2.

I actually had issues with the USB drivers in 3.10.y kernel, disabling usb got the numbers down nicely but I was not pushing the network to tell if it could be a problem. In 4.11 the latency is a worse with a 100Mbit connection, 1GBit gives better results. I did some ftrace latency tests and could see ethernet getting in the way if I maxed it out and the same with emmc card for disk.

I will do install instructions for stretch as soon as I can.

ArcEye commented 5 years ago

Comment by ArcEye Sun Sep 3 12:58:58 2017


rtapi/rtapi_io.h:39:43: fatal error: sys/io.h: No such file or directory

You will probably find it is in a subdirectory within /usr/include that relates to the arch type. Ubuntu especially kept moving things around, I just used to symlink the contents to the main dir and all worked fine.

On an armhf system, (Debian Stretch) the path is /usr/include/arm-linux-gnueabihf/sys/io.h Yours will be very similar

ArcEye commented 5 years ago

Comment by bjharper Mon Sep 4 13:07:02 2017


I've wrote a quick README on how I installed on meveric's Debian Stretch and then the 4.11-y-rt kernel. Please let me know if there are any questions, errors or something does not work.

http://www.builtonline.net/c2rt-v4.11.12-rt11/README

I havent attempted compiling machinekit as yet on Stretch, but I have checked Debian for io.h. No sign of it (does not exist in /usr/include/aarch64-linux-gnu/sys/io.h or /usr/include/aarch64-linux-gnu/asm/io.h or anywhere). I will check the kernel config to see if it should be installed as part of the headers as maybe this is where I am going wrong.

ArcEye commented 5 years ago

Comment by ArcEye Mon Sep 4 13:37:15 2017


I havent attempted compiling machinekit as yet on Stretch, but I have checked Debian for io.h. No sign of it (does not exist in /usr/include/aarch64-linux-gnu/sys/io.h or /usr/include/aarch64-linux-gnu/asm/io.h or anywhere).

In that case it is probably the same situation I had when I compiled machinekit on the Pine64 some time back.

There was no io.h for 64 bit ARM and I had to create my own. The ARM architecture does not support some of the calls (ioperm & iopl), the asm code is different and assumptions about ports and base addresses don't work.

This is the file I wrote which works with Pine64 What may well not be right for your board is the base address PCI_IOBASE. I had to compute this after determining the start memory address that insmod uses to load modules, as explained in the comments.

* 
A largely dummy io.h to statisfy the requirements of Machinekit  
on aarch64
The functions still require a valid base address, which appears to be
#define PCI_IOBASE              ((void __iomem *)(MODULES_VADDR - SZ_2M))
MODULES_VADDR being the address at which insmod begins loading kernel modules
*/

#ifndef _SYS_IO_H
#define _SYS_IO_H

#include <features.h>

// as per arch/.../memory.txt
#define PCI_IOBASE   0xfee00000UL
// ((void __iomem *)(MODULES_VADDR - SZ_2M))
//((void __iomem *)PCI_IO_START)

__BEGIN_DECLS

/* If TURN_ON is TRUE, request for permission to do direct i/o on the
   port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
   permission off for that range.  This call requires root privileges.

   Portability note: not all Linux platforms support this call.  Most
   platforms based on the PC I/O architecture probably will, however.
   E.g., Linux/Alpha for Alpha PCs supports this.  */
//extern int ioperm (unsigned long int __from, unsigned long int __num,
//                   int __turn_on) __THROW;

/* Set the I/O privilege level to LEVEL.  If LEVEL>3, permission to
   access any I/O port is granted.  This call requires root
   privileges. */

// Does not appear this call is supported
// dummy function to return 0 (success and keep pci_write happy

//int iopl(int __level) { return 0; }

#if defined __GNUC__ && __GNUC__ >= 2

// Does not appear this call is supported
// dummy function to return 0 (success and keep pci_write happy

static __inline int iopl(int __level) { return 0; }

static __inline unsigned char 
inb (unsigned short int __port)
{
    unsigned char val;
    unsigned long addr = ((unsigned long) __port + PCI_IOBASE);

    asm volatile("ldrb %w0, [%1]" : "=r" (val) : "r" (addr));
    return val;
}

static __inline unsigned short int
inw (unsigned short int __port)
{
    unsigned short val;
    unsigned long addr = ((unsigned long) __port + PCI_IOBASE);

    asm volatile("ldrh %w0, [%1]" : "=r" (val) : "r" (addr));
    return val;
}

static __inline unsigned int
inl (unsigned short int __port)
{
    unsigned int val;
    unsigned long addr = ((unsigned long) __port + PCI_IOBASE);

    asm volatile("ldrh %w0, [%1]" : "=r" (val) : "r" (addr));

    return val;
}

///////////////////////////////////////////////////////////////////

static __inline void
outb (unsigned char __value, unsigned short int __port)
{
    unsigned long addr = ((unsigned long) __port + PCI_IOBASE);
    asm volatile("strb %w0, [%1]" : : "r" (__value), "r" (addr));
}

static __inline void
outw (unsigned short int __value, unsigned short int __port)
{
    unsigned long addr = ((unsigned long) __port + PCI_IOBASE);
    asm volatile("strh %w0, [%1]" : : "r" (__value), "r" (addr));
}

static __inline void
outl (unsigned int __value, unsigned short int __port)
{
    unsigned long addr = ((unsigned long) __port + PCI_IOBASE);
    asm volatile("strh %w0, [%1]" : : "r" (__value), "r" (addr));
}

#endif  /* GNU C */

__END_DECLS
#endif /* _SYS_IO_H */
ArcEye commented 5 years ago

Comment by sirop Mon Sep 4 14:40:08 2017


What about https://kernel.googlesource.com/pub/scm/linux/kernel/git/rt/linux-rt-devel/+/v4.11.12-rt11/include/asm-generic/io.h ?

ArcEye commented 5 years ago

Comment by bjharper Wed Sep 6 02:01:47 2017


Thanks @ArcEye im looking at the code and looking into a dummy address to use for the Odroid C2 and PCI_IOBASE

@sirop I think https://kernel.googlesource.com/pub/scm/linux/kernel/git/rt/linux-rt-devel/+/v4.11.12-rt11/include/asm-generic/io.h is kernel libraries but we need userspace which is not being exported to /usr/include for aarch64 on Odroid C2

ArcEye commented 5 years ago

Comment by bjharper Thu Sep 7 13:26:33 2017


Its now compiling doing what you have suggested @ArcEye For PCI_IOBASE I used what was reported at startup for the PCI virtual address allocation PCI I/O : 0xffff7dfffee00000 - 0xffff7dffffe00000 ( 16 MB)

Im not sure this is right, need to look at it further (insmod was using a different address)

I had some troubles building various versions of zeromq and czmq but got a working config on stretch.

The GUI is working over remote X and emcweb is working when enabled in sim mode so I can now starting playing with some config and looking at the HAL driver.

Thanks!

ArcEye commented 5 years ago

Comment by ArcEye Thu Sep 7 13:41:39 2017


Glad you got there.

Regards czmq and zeromq, I made some packages, see https://github.com/machinekit/machinekit/issues/1228#issuecomment-316364736

They work fine, I am building on Stretch amd64, i386 and armhf using them.

ArcEye commented 5 years ago

Comment by bjharper Thu Sep 7 14:06:04 2017


I did actually see them but im using aarch64 and didnt think you would have a port there?

ArcEye commented 5 years ago

Comment by ArcEye Thu Sep 7 14:12:18 2017


Of course you are, my brain is trying to do too many things at once!

I may have later, but it is someway down the list. I just built from sources as you did and then forgot all about it.

If you want to produce a package, because you are likely to do this repeatedly or want to circulate it, the easiest way is to use checkinstall.

Build the library then from its root run checkinstall install=no make install Answer the q's and change whatever and it will output a usable .deb

That is what I did initially with the other Stretch packages until I got a build system sorted.

ArcEye commented 5 years ago

Comment by bjharper Mon Sep 11 08:38:14 2017


I uploaded the zseromq and czmq packages I created here http://www.builtonline.net/c2rt-v4.11.12-rt11/ Sorry im not the best with debian packaging so they are /usr/local but should work ok. Ill try to provide some detail on the machinekit build process as there were some dependencies required for stretch minimal image. The 2 packages zeromq and czmq where the only ones I needed to compile from source and then the sys/io.h

I have been working on a basic gpio hal driver for the C2 starting as a base with the Beaglebone hal_bb_gpio.c to control GPIO and also incorporating an option to build machinekit for the C2. So far so good everything is compiling ok (I think) optimised for A-53 cores with neon, floating point and compiler specific options enabled.

I now need to create a hal config which raises a question, am I better to have pin config in a devicetree for the board or in a .hal config file in userspace or both? I need to either make the hal driver search the devicetree or check a hal config file for pin configuration. Im using hal_gpio_demo.hal file (Raspberry) as a test hal config and starting point for debug on the Odroid C2.

ArcEye commented 5 years ago

Comment by machinekoder Sun Oct 1 09:44:04 2017


@bjharper I described how to create a GPIO HAL driver here. For the pin config, I suggest using the device tree overlay to stay consistent with other GPIO drivers. The solution used for the BBB and CHIP passing the GPIO pins via an HAL argument works very well and does not need any checking of the GPIO configuration from the HAL driver.

ArcEye commented 5 years ago

Comment by machinekoder Tue Dec 5 12:57:40 2017


@bjharper What is the status of your project? I have a spare ODroid C2 I', thinking about putting to use with Machinekit.

the-snowwhite commented 4 years ago

@zultron What is the correct way to build the mk-cross-builder/dockerfile ?

I'm trying to look into modifying the docker cross build image to add arm64 mk packages: I'm using this as a base: dovetailautomata/mk-cross-builder/dockerfile I'm able to build a docker file. However when running the scripts/build_docker I get stuck into:

missing package  protobuf 

Reverting back to just building the plain unmodified script as is (settings I have attempted to figure out):

docker build -t mk-cross-builder2:armhf_9 --build-arg BASE_IMAGE=debian:stretch --build-arg DISTRO_VER=9 --build-arg DEBIAN_ARCH=armhf --build-arg DISTRO_CODENAME=stretch --build-arg SYS_ROOT=armhf .

this command

scripts/build_docker -t armhf_9 -c deb

leads to:

docker build -t mk-cross-builder2:armhf_9 --build-arg BASE_IMAGE=debian:stretch --build-arg 
DISTRO_VER=9 --build-arg DEBIAN_ARCH=armhf --build-arg DISTRO_CODENAME=stretch -- 
build-arg SYS_ROOT=armhf .
zultron commented 4 years ago

@the-snowwhite aarch64 support, great! I'm going to be porting to the new BBAI soon; sounds like you're knocking out a major piece.

I don't know where the missing package protobuf error message would come from without more context.

Building aarch64 support takes changes in both the Docker image and Machinekit. I'm assuming you have already discovered the GH repo associated with the Docker Hub images you linked to above. Since I don't know how far you've gotten modifying those sources to add aarch64 support, here's how I'd start.

Following the armhf support examples, I'd grep around for armhf, arm-linux-gnueabihf, ARM_HOST_MULTIARCH, armelf_linux_eabi, and add their aarch64, aarch64-linux-gnu, ARM64_HOST_MULTIARCH, aarch64elf counterparts.

Then build the container. Your above docker build command line looks reasonable, but you'll need to substitute s/armhf/aarch64/.

A quick look indicates the changes aren't too many. It's always a big challenge to add a new distro, but I'm crossing my fingers that adding a new architecture won't be such a big deal. If you get stuck, commit your changes and point me to them, and I'll take a look.

the-snowwhite commented 4 years ago

@zultron Thanks I found it best to take a step back and see if I can build an umodified stretch armhf dockerimage, and then get that to build some (mk-hal)debs, so far without sucess so:

  1. step at a time:

First I'm using kde neon bionic 18.04 on my workstation.

Docker version 19.03.1, build 74b1e89

I run following commands:

cd ../mk-cross-builder
docker build -t mk-cross-builder:armhf_9 --build-arg BASE_IMAGE=debian:stretch --build-arg DISTRO_VER=9 --build-arg DEBIAN_ARCH=armhf --build-arg DISTRO_CODENAME=stretch --build-arg SYS_ROOT=armhf .

which gives this build log

what I notice is that all the constructs like this:

RUN test $DISTRO_VER -gt 8 \
    ||{ \
        VER=4.9.4-2017.01 && \
        ARCH=arm-linux-gnueabihf && \
        DIR=gcc-linaro-${VER}-x86_64_${ARCH} && \
        TXZ=${DIR}.tar.xz && \
        URI=http://releases.linaro.org/components/toolchain/binaries/latest-4/${ARCH} && \
        WORKD=/tmp/linaro && \
        mkdir -p ${WORKD} && cd ${WORKD} && \
        echo "Downloading gcc-linaro-${VER}" && \
        wget --progress=dot:mega ${URI}/${TXZ} && \
        wget -q ${URI}/${TXZ}.asc && \
        echo "Validating checksum of compiler download" && \
        md5sum -c ${TXZ}.asc && \
        echo "Extracting compiler to /opt/" && \
        tar xCf /opt ${WORKD}/${TXZ} && \
        ln -snf ${DIR} /opt/gcc-linaro-hf && \
        rm -rf ${WORKD} && \
        ln -s ../../bin/ccache /usr/lib/ccache/arm-linux-gnueabihf-gcc && \
        ln -s ../../bin/ccache /usr/lib/ccache/arm-linux-gnueabihf-g++ ; \
    }

Don't work as expected unless they are changed to use if .. then like this:

RUN if test $DISTRO_VER -gt 8; \
    then \
        VER=4.9.4-2017.01 && \
        ARCH=arm-linux-gnueabihf && \
        DIR=gcc-linaro-${VER}-x86_64_${ARCH} && \
        TXZ=${DIR}.tar.xz && \
        URI=http://releases.linaro.org/components/toolchain/binaries/latest-4/${ARCH} && \
        WORKD=/tmp/linaro && \
        mkdir -p ${WORKD} && cd ${WORKD} && \
        echo "Downloading gcc-linaro-${VER}" && \
        wget --progress=dot:mega ${URI}/${TXZ} && \
        wget -q ${URI}/${TXZ}.asc && \
        echo "Validating checksum of compiler download" && \
        md5sum -c ${TXZ}.asc && \
        echo "Extracting compiler to /opt/" && \
        tar xCf /opt ${WORKD}/${TXZ} && \
        ln -snf ${DIR} /opt/gcc-linaro-hf && \
        rm -rf ${WORKD} && \
        ln -s ../../bin/ccache /usr/lib/ccache/arm-linux-gnueabihf-gcc && \
        ln -s ../../bin/ccache /usr/lib/ccache/arm-linux-gnueabihf-g++ ; \
    fi

Further on running:

cd ../machinekit-hal
export NO_PULL=1
scripts/build_docker -i mk-cross-builder -t armhf_9 -c deb

ends up with a

checking for CZMQ... no
configure: error: Package requirements (libczmq > 4.0) were not met:

No package 'libczmq' found

build failure log here

So first I have to find out If I need to change distro for the docker build or if its correct to place in if .. then substitutes ?

cerna commented 4 years ago
checking for CZMQ... no
configure: error: Package requirements (libczmq > 4.0) were not met:

No package 'libczmq' found

Isn't this caused by the fact that ZeroMQ libraries are downloaded from Machinekit Debian repository and there is not any aarch64 package? Try official repository from here.

zultron commented 4 years ago

These constructs ARE working as intended:

RUN test $DISTRO_VER -gt 8 \
    ||{ \
    [...] \
    }

This confusing notation means "only run this block if $DISTRO_VER equals 8".

It would be good to convert these to more the more readable form you suggest, but the logic needs to be done right:

RUN if test $DISTRO_VER -eq 8; then \
        [...] \
    fi

I'll try out this build myself. Seems like your build command should work, so I wonder if bit-rot has set in.

the-snowwhite commented 4 years ago

@cerna This is from a armhf docker build and the libczmq packages are installed from the official Stretch repo by the docker build script

@zultron

This confusing notation means "only run this block if $DISTRO_VER equals 8".

No wonder I messed up yesterday attempting to rewrite that logic, I can't wrap my head around:

 (greater than or equal (-gt) ) (or (||) ) = only if equal ...
the-snowwhite commented 4 years ago

Here the script is installing native (amd64) packages instead of forigin arch (armhf, arm64)Dockerfile#L298


No the armhf packages are actuallt installed but in the sysroot path

zultron commented 4 years ago

Actually, "(greater than or equal (-gt) ) (or (||) ) x = do x only if less than or equal". I think at the time I was experimenting with getting the syntax more brief, where we now see I simultaneously succeeded and failed. :P

Anyway, I just ran through the armhf_9 Docker image and MK package build, no problems:

$ cd mk-cross-builder
$ ./hooks/build zultron/mk-cross-builder:armhf_9
$ cd ../machinekit-hal
$ scripts/build_docker -t armhf_9 -c deb -i zultron/mk-cross-builder

So if the image you built is suspect, you should simply pull the one we use in production:

$ docker pull dovetailautomata/mk-cross-builder:armhf_9
$ scripts/build_docker -t armhf_9 -c deb

Can you confirm that these work?

the-snowwhite commented 4 years ago

Oh yes the one in production works flawlessly here... however I can't just pull a arm64/aarch64_9/10 before I or someone else build's at leat one revision....:-)

zultron commented 4 years ago

I got through a whole arm64 image build with this branch. MK-hal doesn't build yet after the changes in this branch, but it's super late here and I have to pass out. I don't remember how I fooled dpkg-buildpackage into finding build deps for armhf, a question for tomorrow.

the-snowwhite commented 4 years ago

@zultron OK I noticed some of your inspired work ..great meanwhile I found out I got the SYS_ROOT variable wrong and missed spme variables in my former build attempts, the correct docker buildline is:

docker build -t mk-cross-builder:armhf_9 --build-arg BASE_IMAGE=debian:stretch \
--build-arg DISTRO_VER=9 --build-arg DEBIAN_ARCH=armhf \
--build-arg DISTRO_CODENAME=stretch --build-arg SYS_ROOT="/sysroot" \
--build-arg HOST_MULTIARCH=arm-linux-gnueabihf \
--build-arg LDEMULATION="armelf_linux_eabi" .

And I now got .deb packages freshly compiled, from my home built mk_cross_builder docker container. Can't wait to follow up on the aarkh64 Ultra96 work ... :+1:

zultron commented 4 years ago

Your docker build command is building for armhf, not arm64 architecture. I must have missed that you weren't trying to produce arm64 binaries, and in my confusion didn't clearly point out that this command would have gotten your Docker image built without the headache, sorry:

./hooks/build mk-cross-builder:armhf_9

As far as building for arm64, I found my typo on the MK side that broke the build, and this time made it as far as finding the problem with missing inb()/outb() on aarch64. This has been seen before in the MK project.

the-snowwhite commented 4 years ago

OK About the missing io.h: In my aarch rip build attempt I got past that using @ArcEye 's solution umodified as I did not know what to do about the

#define PCI_IOBASE   0xfee00000UL

Entry (Ultra96 has no pci implementation), or how to find out the base module loading address on the Ultra96.

This solution worked well enough to make me able to compile finish and run the simulator

the-snowwhite commented 4 years ago

@zultron I forked your debbuilder repo and added to your branch a the @ArcEye fix for the sys/io.h and another fix for the next

ld: cannot open linker script file ldscripts/aarch64elf.xr: No such file or directory

I found here next I then ran into this error:

touch build-stamp
fakeroot debian/rules binary-arch
## have to test after build or Makefile.inc will not exist ##
cp debian/machinekit-hal-posix.install.in debian/machinekit-hal-posix.install
cp debian/machinekit-hal-rt-preempt.install.in debian/machinekit-hal-rt-preempt.install
cp debian/machinekit-hal-xenomai.install.in debian/machinekit-hal-xenomai.install
if (grep ^USERMODE_PCI=yes src/Makefile.inc -q); then \
    echo "usr/include/linuxcnc/userpci/*.h" >> debian/machinekit-hal-posix.install; \
    echo "usr/include/linuxcnc/userpci/*.h" >> debian/machinekit-hal-rt-preempt.install; \
    echo "usr/include/linuxcnc/userpci/*.h" >> debian/machinekit-hal-xenomai.install; \
fi
## only want this for armhf builds ##
if [ ! -f debian/platform_pc ] ; then \
    echo "usr/lib/linuxcnc/prubin/*" >> debian/machinekit-hal-posix.install; \
    echo "usr/lib/linuxcnc/prubin/*" >> debian/machinekit-hal-rt-preempt.install; \
    echo "usr/lib/linuxcnc/prubin/*" >> debian/machinekit-hal-xenomai.install; \
fi
dh_testdir
dh_testroot
dh_prep
mkdir -p debian/tmp/usr/lib/python2.7/dist-packages/gladevcp
dh_installdirs
mkdir -p debian/tmp
(cd debian/extras && cp -a * ../tmp)
(cd src; export DESTDIR=`pwd`/../debian/tmp; /usr/bin/make V= install)
make[1]: Entering directory '/home/mibr/Developer/ext-repos_git/machinekit-hal/src'

install -d -m 0755 -o root  /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/linuxcnc/posix \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/linuxcnc /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/include/linuxcnc \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/doc/linuxcnc /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/linuxcnc/ncfiles \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/libexec/linuxcnc \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/tcltk/linuxcnc/scripts \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/man/man1 \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/man/man3 \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/man/man9 \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/rsyslog.d \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/security/limits.d \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/udev/rules.d \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/linuxcnc/examples/sample-configs \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp../include/userpci
install -d -m 0755 -o root      /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/include/linuxcnc/userpci
install -m 4755 -o root ../libexec/rtapi_app_* /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/libexec/linuxcnc
install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinekit
install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinekit/nosetests
install -m 4755 -o root ../libexec/pci_write /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/libexec/linuxcnc
install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinetalk
install -m 4755 -o root ../libexec/pci_read /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/libexec/linuxcnc
install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinetalk/protobuf
install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/fdm
install -m 0755 -o root ../libexec/inivar /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/libexec/linuxcnc
install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/drivers
install -m 0755 -o root ../libexec/rtapi_msgd /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/libexec/linuxcnc
install -m 0755 -o root ../bin/hal_input /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../libexec/flavor /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/libexec/linuxcnc
install -m 0755 -o root ../bin/hal_gpio_mcp23017 /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0644 -o root ../etc/linuxcnc/rtapi.ini /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/linuxcnc
install -m 0755 -o root ../bin/hal_pwm_pca9685 /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
# RTAPI modules:  install userland flavor .so modules into
# e.g. /usr/lib/linuxcnc/modules and kthread flavor .ko
install -m 0755 -o root ../bin/hal_storage /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
# modules for each kver into e.g. /lib/modules/<kver>/linuxcnc
for flavor in posix rt-preempt; do \
    if test ${flavor%-kernel} = ${flavor}; then \
        echo Installing modules for userland flavor $flavor; \
        install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/linuxcnc/$flavor; \
        install -m 0644 -o root ../rtlib/$flavor/* \
            /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/linuxcnc/$flavor; \
    else \
        echo Installing modules for kthreads flavor $flavor; \
        for srcdir in ../rtlib/$flavor/*; do \
            kver=`basename $srcdir`; \
            echo Installing modules for flavor $flavor, kver $kver; \
            install -d -m 0755 -o root /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/lib/modules/$kver/linuxcnc; \
            install -m 0644 -o root $srcdir/* /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/lib/modules/$kver/linuxcnc; \
        done; \
    fi; \
done
install -m 0755 -o root ../bin/hal_temp_ads7828 /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
Installing modules for userland flavor posix
install -m 0755 -o root ../bin/hal_temp_bbb /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../bin/hal_temp_atlas /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../bin/pyvcp /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../bin/gladevcp /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0644 -o root ../lib/python/*.py ../lib/python/*.so /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages
install -m 0644 -o root ../lib/python/machinekit/*.py /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinekit/
install -m 0644 -o root ../lib/python/machinekit/nosetests/*.py /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinekit/nosetests
install -m 0644 -o root ../lib/python/machinekit/*.so /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinekit/
install -m 0644 -o root ../lib/python/machinetalk/*.py /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinetalk/
install -m 0644 -o root ../lib/python/machinetalk/protobuf/*.py /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/machinetalk/protobuf/
install -m 0644 -o root ../lib/python/drivers/*.py /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/drivers
install -m 0644 -o root ../lib/python/gladevcp/*.* /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/python2.7/dist-packages/gladevcp
install -m 0755 -o root ../bin/mklauncher /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
Installing modules for userland flavor rt-preempt
install -m 0755 -o root ../bin/configserver /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../bin/videoserver /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../bin/yapps /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../scripts/realtime /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../scripts/halrun /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0755 -o root ../bin/sizes ../bin/rtprintf ../bin/encdec ../bin/position ../bin/unionread ../bin/npbdecode ../bin/linmove ../bin/haltalk ../bin/halstreamer ../bin/halsampler ../bin/adxl345 ../bin/scounter ../bin/gs2_vfd ../bin/shuttlexpress ../bin/xhc-hb04 ../bin/hy_vfd ../bin/xhc-whb04b-6 ../bin/halcmd ../bin/halmeter ../bin/halscope ../bin/comp ../bin/instcomp ../bin/halshow /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
install -m 0644 -o root ../lib/libmachinetalk-npb.so.0 ../lib/libmachinetalk-pb2++.so.0 ../lib/libmtalk.so.0 ../lib/librtapi_math.so.0 ../lib/liblinuxcncini.so.0 ../lib/libposemath.so.0 ../lib/liblinuxcnculapi.so.0 ../lib/liblinuxcncshm.so.0 ../lib/liblinuxcnchal.so.0 /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib
cp --no-dereference ../lib/libmachinetalk-npb.so ../lib/libmachinetalk-pb2++.so ../lib/libmtalk.so ../lib/librtapi_math.so ../lib/liblinuxcncini.so ../lib/libposemath.so ../lib/liblinuxcnculapi.so ../lib/liblinuxcncshm.so ../lib/liblinuxcnchal.so ../lib/python/machinekit/hal.so ../lib/python/machinekit/rtapi.so ../lib/python/machinekit/compat.so ../lib/python/machinekit/shmcommon.so /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib
install -m 0644 -o root ../rtlib/ulapi-*.so /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib/linuxcnc
test -n "$FAKED_MODE" || ldconfig /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/lib
install -m 0644 -o root ../include/config.h ../include/hal_accessor.h ../include/hal_accessor_macros.h ../include/config_module.h ../include/hal_group.h ../include/hal.h ../include/hal_iring.h ../include/hal_internal.h ../include/hal_iter.h ../include/hal_list.h ../include/hal_logging.h ../include/hal_object.h ../include/hal_object_selectors.h ../include/hal_parport.h ../include/hal_priv.h ../include/hal_rcomp.h ../include/hal_ring.h ../include/hal_types.h ../include/vtable.h ../include/hal_spi.h ../include/inifile.h ../include/inifile.hh ../include/posemath.h ../include/gotypes.h ../include/gomath.h ../include/sincos.h ../include/message.pb.h ../include/types.pb.h ../include/canon.npb.h ../include/config.pb.h ../include/firmware.npb.h ../include/jplan.pb.h ../include/sample.pb.h ../include/message.npb.h ../include/motcmds.pb.h ../include/object.npb.h ../include/preview.pb.h ../include/rtapicommand.npb.h ../include/rtapi_message.pb.h ../include/task.npb.h ../include/test.pb.h ../include/value.npb.h ../include/canon.pb.h ../include/emcclass.npb.h ../include/firmware.pb.h ../include/log.npb.h ../include/nanopb.npb.h ../include/object.pb.h ../include/ros.npb.h ../include/rtapicommand.pb.h ../include/status.npb.h ../include/task.pb.h ../include/types.npb.h ../include/value.pb.h ../include/config.npb.h ../include/emcclass.pb.h ../include/jplan.npb.h ../include/sample.npb.h ../include/log.pb.h ../include/motcmds.npb.h ../include/nanopb.pb.h ../include/preview.npb.h ../include/ros.pb.h ../include/rtapi_message.npb.h ../include/status.pb.h ../include/test.npb.h ../include/pb.h ../include/pb_common.h ../include/pb_encode.h ../include/pb_decode.h ../include/multiframe_flag.h ../include/rtapi.h ../include/rtapi_app.h ../include/rtapi_atomics.h ../include/rtapi_bitops.h ../include/rtapi_byteorder.h ../include/rtapi_export.h ../include/rtapi_compat.h ../include/rtapi_hexdump.h ../include/rtapi_int.h ../include/rtapi_kdetect.h ../include/rtapi_limits.h ../include/rtapi_math.h ../include/rtapi_math64.h ../include/rtapi_common.h ../include/rtapi_exception.h ../include/rtapi_global.h ../include/rtapi_shmkeys.h ../include/rtapi_io.h ../include/rtapi_ctype.h ../include/rtapi_errno.h ../include/rtapi_string.h ../include/rtapi_pci.h ../include/rtapi_proc.h ../include/rtapi_heap.h ../include/rtapi_heap_private.h ../include/ring.h ../include/triple-buffer.h ../include/multiframe.h ../include/rtapi_mbarrier.h ../include/rt-preempt.h ../include/shmdrv.h /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/include/linuxcnc/
install -m 0644 -o root ../include/userpci/device.h ../include/userpci/firmware.h ../include/userpci/gfp.h ../include/userpci/list.h ../include/userpci/module.h ../include/userpci/slab.h ../include/userpci/string.h /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/include/linuxcnc/userpci
install -m 0644 -o root Makefile.modinc /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/linuxcnc
install -m 0644 -o root Makefile.inc /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/share/linuxcnc
install -m 0644 -o root rtapi/rsyslogd-linuxcnc.conf /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/rsyslog.d/linuxcnc.conf
install -m 0644 -o root rtapi/shmdrv/limits.d-machinekit.conf \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/security/limits.d/machinekit.conf
install -m 0644 -o root rtapi/shmdrv/shmdrv.rules \
        /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/udev/rules.d/50-shmdrv.rules
install -m 0644 -o root ../etc/linuxcnc/machinekit.ini /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/etc/linuxcnc
install -m 0755 -o root ../bin/mank /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp/usr/bin
Installed in /home/mibr/Developer/ext-repos_git/machinekit-hal/src/../debian/tmp with prefix /usr
make[1]: Leaving directory '/home/mibr/Developer/ext-repos_git/machinekit-hal/src'
mkdir -p debian/tmp/usr/lib debian/tmp/usr/include/linuxcnc \
    debian/tmp/usr/include/linuxcnc/machinetalk/nanopb \
    debian/tmp/usr/include/linuxcnc/machinetalk/protobuf 
mkdir -p debian/tmp/etc/udev/rules.d
cp src/rtapi/shmdrv/shmdrv.rules \
    debian/tmp/etc/udev/rules.d/50-shmdrv.rules
mkdir -p debian/tmp/etc/security/limits.d
cp src/rtapi/shmdrv/limits.d-machinekit.conf \
    debian/tmp/etc/security/limits.d/machinekit.conf
## only want this for armhf builds too ##
if [ -f debian/platform_pc ] ; then \
    rm -f debian/platform_pc; \
else \
    mkdir -p debian/tmp/usr/lib/linuxcnc/prubin; \
    cp rtlib/prubin/* debian/tmp/usr/lib/linuxcnc/prubin; \
    cat debian/posix-postinst.add >> debian/machinekit-hal-posix.postinst; \
    cat debian/rt-preempt-postinst.add >> debian/machinekit-hal-rt-preempt.postinst; \
    cat debian/xenomai-postinst.add >> debian/machinekit-hal-xenomai.postinst; \
fi
cp: cannot stat 'rtlib/prubin/*': No such file or directory
dh_install --sourcedir=debian/tmp --fail-missing -Xusr/bin/pasm
dh_install: Cannot find (any matches for) "usr/lib/linuxcnc/prubin/*" (tried in "debian/tmp" and "debian/tmp")
dh_install: machinekit-hal-posix missing files: usr/lib/linuxcnc/prubin/*
dh_install: Cannot find (any matches for) "usr/lib/linuxcnc/prubin/*" (tried in "debian/tmp" and "debian/tmp")
dh_install: machinekit-hal-rt-preempt missing files: usr/lib/linuxcnc/prubin/*
dh_install: missing files, aborting
debian/rules:144: recipe for target 'install' failed
make: *** [install] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary-arch gave error exit status 2

Not supposed to compile for prubin on aarch64 ? (an armhf depedency....)

luminize commented 4 years ago

only want this for armhf builds too

if [ -f debian/platform_pc ] ; then \ rm -f debian/platform_pc; \ else \ mkdir -p debian/tmp/usr/lib/linuxcnc/prubin; \ cp rtlib/prubin/ debian/tmp/usr/lib/linuxcnc/prubin; \ cat debian/posix-postinst.add >> debian/machinekit-hal-posix.postinst; \ cat debian/rt-preempt-postinst.add >> debian/machinekit-hal-rt-preempt.postinst; \ cat debian/xenomai-postinst.add >> debian/machinekit-hal-xenomai.postinst; \ fi cp: cannot stat 'rtlib/prubin/': No such file or directory dh_install --sourcedir=debian/tmp --fail-missing -Xusr/bin/pasm dh_install: Cannot find (any matches for) "usr/lib/linuxcnc/prubin/" (tried in "debian/tmp" and "debian/tmp") dh_install: machinekit-hal-posix missing files: usr/lib/linuxcnc/prubin/ dh_install: Cannot find (any matches for) "usr/lib/linuxcnc/prubin/" (tried in "debian/tmp" and "debian/tmp") dh_install: machinekit-hal-rt-preempt missing files: usr/lib/linuxcnc/prubin/ dh_install: missing files, aborting debian/rules:144: recipe for target 'install' failed make: *** [install] Error 2 dpkg-buildpackage: error: fakeroot debian/rules binary-arch gave error exit status 2 Not supposed to compile for prubin on aarch64 ? (an armhf depedency....)

I think prubin is beaglebone (PRU) specific.

the-snowwhite commented 4 years ago

@luminize Got that with this patch to @zultron 's current machinekit-hal arm64 branch. (I have some pending commits in my own machinekit-hal fork, so I paste the patch here)


From 375fbbeeddb275e27fdb1ce64e36260a27c7d896 Mon Sep 17 00:00:00 2001
From: Michael Brown <producer@holotronic.dk>
Date: Sun, 1 Sep 2019 20:59:23 +0200
Subject: [PATCH 2/2] arm64: remove prubin from packaging in aarch6

---
debian/rules.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules.in b/debian/rules.in
index 234bd023b..839f40cf7 100755
--- a/debian/rules.in
+++ b/debian/rules.in
@@ -153,7 +153,7 @@ install: build
    fi

    ## only want this for armhf builds ##
-   if [ ! -f debian/platform_pc ] ; then \
+   if [ ! -f debian/platform_pc -a ! "$(DEB_HOST_ARCH)" = "arm64" ] ; then \
        echo "usr/lib/linuxcnc/prubin/*" >> debian/machinekit-hal-posix.install; \
        echo "usr/lib/linuxcnc/prubin/*" >> debian/machinekit-hal-rt-preempt.install; \
        echo "usr/lib/linuxcnc/prubin/*" >> debian/machinekit-hal-xenomai.install; \
-- 
2.20.1

So now I have installable arm64 machinekit-hal debs onto machinekit-cnc ....

the-snowwhite commented 4 years ago

Sigh ... running halrun (with re-preempt package) gives these messages:

Warning - /usr/libexec/linuxcnc/rtapi_app_posix not setuid
'sudo make setuid' missing?
msgd:0 stopped
rtapi:0 stopped
Warning - /usr/libexec/linuxcnc/rtapi_app_posix not setuid
'sudo make setuid' missing?
rtapi_msgd command:  /usr/libexec/linuxcnc/rtapi_msgd --instance=0 --rtmsglevel=1 --usrmsglevel=1 --halsize=524288
rtapi_app command:  /usr/libexec/linuxcnc/rtapi_app_posix --instance=0
/usr/bin/realtime: line 237: /usr/libexec/linuxcnc/rtapi_app_posix: No such file or directory
rtapi_app startup failed; aborting
halcmd: cant connect to rtapi_app: -1 (uri= uuid=dd080a3c-60cc-45c1-b0ab-fdebf329df9d): rtapi_rpc(): reply timeout

halcmd: the rtapi:0 RT demon is not running - please investigate /var/log/linuxcnc.log
E: 19-09-01 23:24:48 dangling 'DEALER' socket created at hal/utils/halcmd_rtapiapp.cc:284
halcmd: cant connect to rtapi_app: -1 (uri= uuid=dd080a3c-60cc-45c1-b0ab-fdebf329df9d): rtapi_rpc(): reply timeout

halcmd: the rtapi:0 RT demon is not running - please investigate /var/log/linuxcnc.log
E: 19-09-01 23:24:54 dangling 'DEALER' socket created at hal/utils/halcmd_rtapiapp.cc:284
halcmd: cant connect to rtapi_app: -1 (uri= uuid=dd080a3c-60cc-45c1-b0ab-fdebf329df9d): rtapi_rpc(): reply timeout

halcmd: the rtapi:0 RT demon is not running - please investigate /var/log/linuxcnc.log
E: 19-09-01 23:24:59 dangling 'DEALER' socket created at hal/utils/halcmd_rtapiapp.cc:284
Warning - /usr/libexec/linuxcnc/rtapi_app_posix not setuid
'sudo make setuid' missing?
ERROR:  msgd:0 failed to exit on its own; sending SIGTERM

Halrun does work with the posix package installed however hm2_socfpga.ol driver is then missing.

While Xilinx petalinux has no official support for rt-preempt I was able to apply the rt patch on the kernel however... same result.

machinekit@mksocfpga-nano-soc:~$ uname -a
Linux mksocfpga-nano-soc 4.14.0-rt1 #1 SMP Sun Sep 1 20:59:42 UTC 2019 aarch64 GNU/Linux
the-snowwhite commented 4 years ago
machinekit@mksocfpga-nano-soc:~$ cat /var/log/linuxcnc.log

Sep  1 23:24:43 mksocfpga-nano-soc msgd:0: startup pid=4741 flavor=posix rtlevel=1 usrlevel=1 halsize=524288 shm=Posix cc=gcc 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4]  version=v0.2~arm64~a7ec1fc3d
Sep  1 23:24:43 mksocfpga-nano-soc msgd:0: ØMQ=4.2.1 czmq=4.0.2 protobuf=3.0.0 atomics=gcc intrinsics    libwebsockets=2.0.3
Sep  1 23:24:43 mksocfpga-nano-soc msgd:0: configured: sha=a7ec1fc3d
Sep  1 23:24:43 mksocfpga-nano-soc msgd:0: built:      Sep  1 2019 18:38:36 sha=a7ec1fc3d
Sep  1 23:24:43 mksocfpga-nano-soc msgd:0: register_stuff: actual hostname as announced by avahi='mksocfpga-nano-soc.local'
Sep  1 23:24:43 mksocfpga-nano-soc msgd:0: zeroconf: registering: 'Log service on mksocfpga-nano-soc.local pid 4741'
Sep  1 23:24:44 mksocfpga-nano-soc msgd:0: zeroconf: registered 'Log service on mksocfpga-nano-soc.local pid 4741' _machinekit._tcp 49152 TXT "uuid=dd080a3c-60cc-45c1-b0ab-fdebf329df9d" "instance=ea36a960-ccfe-11e9-b804-000ec6e1e19a" "service=log" "dsn=tcp://mksocfpga-nano-soc.local:49152"
Sep  1 23:25:05 mksocfpga-nano-soc msgd:0: msgd:0: Terminated - shutting down
Sep  1 23:25:05 mksocfpga-nano-soc msgd:0: zeroconf: unregistering 'Log service on mksocfpga-nano-soc.local pid 4741'
Sep  1 23:25:05 mksocfpga-nano-soc msgd:0: log buffer hwm: 0% (0 msgs, 0 bytes out of 524288)
Sep  1 23:25:05 mksocfpga-nano-soc msgd:0: normal shutdown - global segment detached
the-snowwhite commented 4 years ago

Just to confirm it's not a kernel issue as halrun loads fine in my (arm64)mk-rip image, so I guess some files are missing...in the deb packaging...

the-snowwhite commented 4 years ago

I was just going to sleep when my thoughts came to this construct:

-   if [ ! -f debian/platform_pc ] ; then \
+   if [ ! -f debian/platform_pc -a ! "$(DEB_HOST_ARCH)" = "arm64" ] ; then \

the platform_pc variable must be set somewhere to differenitiate (originially) between the beaglebone and the pc (non soc) platform's and has then been carried over to mksocfpga (armhf + arm64).

The differentiation between armhf and arm64 and pc can instead/also be implemented as:

if [ "$(DEB_HOST_ARCH)" = "armhf" ]; then

or

if [ "$(DEB_HOST_ARCH)" = "arm64" ]; then

???

zultron commented 4 years ago

Yes, the platform_pc test need to be replaced with testing debian/rules arch flags, as you suggest (I already have in my unified modules branch). We'll need arm64 PRU support for the BBAI, but to suit your purposes and not break the status quo, I think your second suggestion makes the best sense:

if [ "$(DEB_HOST_ARCH)" = "armhf" ]; then
zultron commented 4 years ago

I'm getting close to supporting arm64 in the Docker images and MK sources. See this branch. I think I have a proper fix for the inb()/outb() issue in there.

@ArcEye, no rush, can we have your custom libck-dev packages for Buster arm64-architecture in the MK package repo?

the-snowwhite commented 4 years ago

OK I just had a long fight getting the Ultra96 sd-image properly setup with: rt prempt kernel Correct devicetree settings Bitfile generated by Vivado For now its just a messy hack that now gets detected by my earlier made Machinekit aarch64 debs. @zultron I'm now ready once again to catch up on your work here:

the-snowwhite commented 4 years ago

This is my latest linuxcnc log:

`    machinekit@mksocfpga-ultra96-soc:~$ cat /var/log/linuxcnc.log

Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: startup pid=4692 flavor=rt-preempt rtlevel=5 usrlevel=5 halsize=524288 shm=Posix cc=gcc 6.3.1 20170404  version=v0.2~arm64~456745530
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: ØMQ=4.2.1 czmq=4.0.2 protobuf=3.0.0 atomics=concurrencykit 0.5.2   libwebsockets=2.0.3
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: configured: sha=456745530
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: built:      Sep  2 2019 23:37:42 sha=456745530
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: register_stuff: actual hostname as announced by avahi='mksocfpga-ultra96-soc.local'
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: zeroconf: registering: 'Log service on mksocfpga-ultra96-soc.local pid 4692'
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 2:rtapi_app:4697:user rtapi:0: cannot create core dumps - /proc/sys/fs/suid_dumpable contains 0
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 2:rtapi_app:4697:user you might have to run 'echo 1 > /proc/sys/fs/suid_dumpable' as root to enable rtapi_app core dumps
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user rtapi.so default iparms: ''
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user RTAPI:0  rt-preempt v0.2~arm64~456745530 init
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 3:rtapi_app:4697:user libcgroup initialization failed: (50001) Cgroup is not mounted
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user rtapi: loaded from rtapi.so
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hal_lib.so default iparms: ''
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user rtapi_app_main:195 HAL: initializing RT hal_lib support
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_xinitfv:90 HAL: initializing component 'hal_lib' type=4 arg1=0 arg2=0/0x0
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hal_heap_addmem:58 HAL: extending arena by 262144 bytes
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_export_xfunctfv:85 HAL: exporting function 'newinst' type 2 fp=0 owner=66
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_export_xfunctfv:85 HAL: exporting function 'delinst' type 2 fp=0 owner=66
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_xinitfv:271 HAL: singleton component 'hal_lib' id=66 initialized
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user rtapi_app_main:199 HAL: RT hal_lib support initialized rc=66
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hal_lib: loaded from hal_lib.so
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user accepting commands at ipc:///tmp/0.rtapi.dd080a3c-60cc-45c1-b0ab-fdebf329df9d
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 3:rtapi_app:4697:user rtapi_app:0 ready flavor=rt-preempt gcc=6.3.1 20170404 git=v0.2~arm64~456745530
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user pid=4697 flavor=rt-preempt gcc=6.3.1 20170404 git=v0.2~arm64~456745530
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user pid=4697 flavor=rt-preempt gcc=6.3.1 20170404 git=v0.2~arm64~456745530
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: ulapi:4698:user _ulapi_init(): ulapi rt-preempt v0.2~arm64~456745530 loaded
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: ulapi:4698:user halg_xinitfv:271 HAL: singleton component 'hal_lib4698' id=70 initialized
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: hal_lib:4698:user --halcmd ping
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: hal_lib:4698:user halg_exit:293 HAL: removing component 72 'halcmd4698'
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: hal_lib:4698:user ulapi_hal_lib_cleanup:235 HAL: lib_module_id=70
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: hal_lib:4698:user halg_exit:293 HAL: removing component 70 'hal_lib4698'
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: hal_lib:4698:user halg_exit:315 HAL: hal_errorcount()=0
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: hal_lib:4698:user halg_exit:316 HAL: _halerrno=0
Sep 11 13:15:42 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user pid=4697 flavor=rt-preempt gcc=6.3.1 20170404 git=v0.2~arm64~456745530
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: ulapi:4703:user _ulapi_init(): ulapi rt-preempt v0.2~arm64~456745530 loaded
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: ulapi:4703:user halg_xinitfv:271 HAL: singleton component 'hal_lib4703' id=74 initialized
Sep 11 13:15:42 mksocfpga-ultra96-soc msgd:0: hal_lib:4703:user --halcmd -kf
Sep 11 13:15:43 mksocfpga-ultra96-soc msgd:0: zeroconf: registered 'Log service on mksocfpga-ultra96-soc.local pid 4692' _machinekit._tcp 0 TXT "uuid=dd080a3c-60cc-45c1-b0ab-fdebf329df9d" "instance=7df71dc8-d485-11e9-9a87-000ec6e1e19a" "service=log" "dsn=ipc:///tmp/0.log.dd080a3c-60cc-45c1-b0ab-fdebf329df9d"
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hostmot2.so default iparms: ''
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_xinitfv:90 HAL: initializing component 'hostmot2' type=1 arg1=0 arg2=0/0x0
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hostmot2: loaded from hostmot2.so
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2_soc_ol.so default iparms: 'debug=0 no_init_llio=0 num=0 already_programmed=0'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_xinitfv:90 HAL: initializing component 'hm2_soc_ol' type=1 arg1=0 arg2=0/0x0
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2_soc_ol: loaded from hm2_soc_ol.so
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user do_newinst_cmd: instargs='already_programmed=1 -- config="num_pwmgens=1 num_stepgens=1" debug=1'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_inst_create:59 HAL: rtapi: creating instance 'hm2-socfpga0' size 368
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2_soc_ol: mapping pre-programmed hm2_soc_ol_board hm2-socfpga0
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2_soc_ol: hm2 cookie check OK, board name='A961ULTR'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: parsing config string "num_pwmgens=1 num_stepgens=1"
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: final config:
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_encoders=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_mencoders=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_absencs=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_resolvers=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_pwmgens=1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_3pwmgens=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     sserial_port_0=00000000#012                    sserial_port_1=00000000#012                    sserial_port_2=00000000#012                    sserial_port_3=00000000
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_stepgens=1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_bspis=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_dbspis=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_uarts=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_pktuarts=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_dplls=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_leds=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     enable_raw=0
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     enable_adc=0
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     num_capsensors=-1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0:     firmware=(NULL)
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user halg_param_newfv:143 HAL: creating parameter 'hm2_ultr.0.io_error'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: protobuf raw size=79, aligned to 80
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user fwid msg at 0x6db9d90:00000000: 0a 07 34 65 38 34 37 30 64 12 05 78 63 7a 75 33  ..4e8470d..xczu3
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user fwid msg at 0x6db9d90:00000010: 1a 0f 0a 08 47 50 49 4f 30 2e 50 31 15 11 00 00  ....GPIO0.P1....
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user fwid msg at 0x6db9d90:00000020: 00 1a 0f 0a 08 47 50 49 4f 30 2e 50 32 15 11 00  .....GPIO0.P2...
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user fwid msg at 0x6db9d90:00000030: 00 00 25 01 00 00 00 2a 04 55 4c 54 52 32 10 24  ..%....*.ULTR2.$
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user fwid msg at 0x6db9d90:00000040: 42 55 49 4c 44 5f 55 52 4c 20 75 6e 73 65 74     BUILD_URL unset
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: board_name = 'ULTR'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: build_sha = '4e8470d'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: fpga_part_number = 'xczu3'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: num_leds = 1
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: comment = $BUILD_URL unset
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: connector 0 name = 'GPIO0.P1'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: connector 0 pins = 17
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: connector 1 name = 'GPIO0.P2'
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 4:rtapi_app:4697:user hm2/hm2_ultr.0: connector 1 pins = 17
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 1:rtapi_app:4697:user signal 7 - 'Bus error' received, dumping core (current dir=/home/machinekit)
Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 1:rtapi_app:4697:user (backtrace not available - libbacktrace not found during build)
Sep 11 13:15:47 mksocfpga-ultra96-soc msgd:0: hal_lib:4697:rt hm2: loading Mesa HostMot2 driver version 0.15
Sep 11 13:15:47 mksocfpga-ultra96-soc msgd:0: hal_lib:4697:rt hm2_soc_ol: loading Mesa AnyIO HostMot2 socfpga overlay driver version 0.9
Sep 11 13:15:47 mksocfpga-ultra96-soc msgd:0: rtapi_app exit detected - scheduled shutdown
Sep 11 13:15:49 mksocfpga-ultra96-soc msgd:0: msgd shutting down
Sep 11 13:15:49 mksocfpga-ultra96-soc msgd:0: zeroconf: unregistering 'Log service on mksocfpga-ultra96-soc.local pid 4692'
Sep 11 13:15:49 mksocfpga-ultra96-soc msgd:0: log buffer hwm: 0% (5 msgs, 406 bytes out of 524288)
Sep 11 13:15:49 mksocfpga-ultra96-soc msgd:0: normal shutdown - global segment detached

`

the-snowwhite commented 4 years ago

@zultron Seems like something got off on the wrong foot in first commit in your patch Definitely want to change the Platform to MKSOCFPGA instead of BEAGLEBONE (no BB style pru), I'm currently trying to work thru the inb()/outb() issue's as something (probably PCI_PLATFORM) is disabling compilation of all other mesa cores than hm2_soc_ol ...

zultron commented 4 years ago

@the-snowwhite, glad you're looking at that branch.

Seems like something got off on the wrong foot in first commit in your patch Definitely want to change the Platform to MKSOCFPGA instead of BEAGLEBONE (no BB style pru),

Are you talking about the TARGET_PLATFORM_* Makefile variable and config.h macro?

That hunk sets TARGET_PLATFORM_BEAGLEBONE on aarch64 in order to support the PRUs on the BBAI. Following the armhf architecture build rule, TARGET_PLATFORM_BEAGLEBONE gets set by default on all ARM architectures.

Maybe the problem you're seeing is your platform needs the same treatment. I'm not familiar with the various ARM boards, so I selfishly added only my own target platform, but sounds like we should add it for TARGET_PLATFORM_SOCFPGA also.

I'm currently trying to work thru the inb()/outb() issue's as something (probably PCI_PLATFORM) is disabling compilation of all other mesa cores than hm2_soc_ol ...

After reviewing the code, I fixed the inb()/outb() issues in fdfa9732 simply by dropping them from ARM builds. The commit log explains; TLDR, the simply aren't used in any drivers we normally use on ARM architectures.

This is my latest linuxcnc log: [...] Sep 11 13:15:47 mksocfpga-ultra96-soc rtapi:0: 1:rtapi_app:4697:[user signal 7 - 'Bus error' received, dumping core (current dir=/home/machinekit)

Do you think the inb()/outb() issue is related to this? Is this a run from my branch or yours? What does the gdb backtrace on the core file show?

the-snowwhite commented 4 years ago

@zultron thanks for you swift answer. I'm only talking about the TARGETPLATFORM* Makefile variable (haven't found out about the config.h macro yet..) There seems to be some confusion as to whats aarch64 and whats armhf I initially thought the BBB X15(AI) was 64-bit however: the: BBAI is Cortex-A15 --> armv7,armhf toolchain The Ultra96 / Xilinx Zynq UltraScale+ MPSoC ZU3EG A484 is Cortex A53 --> ARMv8-A aarch64/arm64 toolchain.


This stil leaves TARGET_PLATFORM_BEAGLEBONE stuck to the 32-bit armhf and not aarch64 ? (the aarch64 toolchain thrown lots of errors about prubin.xxx unless these parts are disselected)


I have been running the machinekit packages I compiled from this branch off the main machinekit-hal repo (10 days ago) compiled with @ArcEye 's sys/io.h file suggestion added to the docker cross-builder.

Do you think the inb()/outb() issue is related to this? Is this a run from my branch or yours? What does the gdb backtrace on the core file show?

I imagine inb()/outb() issue is related to this, reason why I would test swapping out the sys/io.h file approach with your more elegant seeming solution.


I haven't made a gdb backtrace for years can you give me some (verbose) pointers as to how to make a gdb backtrace on the core file ?

luminize commented 4 years ago

@the-snowwhite I always use this one: http://www.machinekit.io/docs/code/Debugging-RT-components/

the-snowwhite commented 4 years ago

@luminize thanks Ok so I worked thru applying the @zultron inb()/outb() fixes (plus some crude hacks for adding missing USERMODE_PCI dependable linuxcnc/userpc hostmot2.c requirements)

in this branch on top of current machinekit-hal

I ended up with the same error as my former attempt:


so here is the coretrace:

`root@mksocfpga-ultra96-soc:~# gdb /usr/libexec/linuxcnc/rtapi_app_rt-preempt /home/machinekit/core
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/libexec/linuxcnc/rtapi_app_rt-preempt...Reading symbols from /usr/lib/debug/.build-id/9c/38e87f575a8cb9f4b6e62f655d1ad18acc6b81.debug...done.
done.

warning: core file may not match specified executable file.
[New LWP 4608]
[New LWP 4612]
[New LWP 4613]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Core was generated by `rtapi:0                                                          '.
Program terminated with signal SIGBUS, Bus error.
#0  memcpy () at ../sysdeps/aarch64/memcpy.S:102
102     ../sysdeps/aarch64/memcpy.S: No such file or directory.
[Current thread is 1 (Thread 0x7f88212000 (LWP 4608))]
(gdb) backtrace
#0  memcpy () at ../sysdeps/aarch64/memcpy.S:102
#1  0x0000007f86dbe10c in hm2_soc_read (this=0x7f87f7aee0, addr=260, buffer=0x7fe50809e0, size=8) at hal/drivers/mesa-hostmot2/hm2_soc_ol.c:175
#2  0x0000007f86de6ad4 in hm2_register (llio=0x7f87f7aee0, config_string=0x7f8805be40 <error: Cannot access memory at address 0x7f8805be40>)
    at hal/drivers/mesa-hostmot2/hostmot2.c:1475
#3  0x0000007f86dbec38 in hm2_soc_register (brd=0x7f87f7ae88, fwid=0x0, fwid_len=0, inst_id=82) at hal/drivers/mesa-hostmot2/hm2_soc_ol.c:473
#4  0x0000007f86dbf210 in instantiate (argc=4, argv=0x55baa45c30) at hal/drivers/mesa-hostmot2/hm2_soc_ol.c:601
#5  0x0000007f87fb98b0 in create_instance (fa=0x7fe5080c18) at hal/lib/hal_comp.c:507
#6  0x0000007f87f9a28c in hal_call_usrfunct (name=0x558ecfe038 "newinst", argc=4, argv=0x55baa45c30, ureturn=0x7fe5080d14) at hal/lib/hal_funct.c:192
#7  0x000000558ece4dec in do_newinst_cmd (comp="hm2_soc_ol", instname=<error reading variable: Cannot access memory at address 0x0>, args=..., pbreply=..., 
    instance=<optimized out>) at rtapi/rt-preempt/rtapi_app.cc:511
#8  0x000000558ece8e8c in rtapi_request (loop=<optimized out>, socket=0x55baa44010, arg=<optimized out>) at rtapi/rt-preempt/rtapi_app.cc:928
#9  0x0000007f88a828e0 in zloop_start () from /usr/lib/aarch64-linux-gnu/libczmq.so.4
#10 0x000000558ece8410 in mainloop (argc=<optimized out>, argv=<optimized out>) at rtapi/rt-preempt/rtapi_app.cc:1414
#11 0x000000558ece2fa4 in main (argc=3, argv=0x7fe5081f18) at rtapi/rt-preempt/rtapi_app.cc:1769

`

A problem with memcpy ....