-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aarch64 compatibility #173
Comments
Thanks in investigating, including rpitx on Kali could effectively be a good point. For revision detection, think that there is some more easy way I doing now. Have to check it. Hope to get back on project soon. |
I saw that you're patching the makefile of csdr so maybe those issues could be easily solved in the same way. From what I've read, the output of /proc/cpuinfo is related to the output of CPUID instruction (and I've 0 clues about why kali is showing a different thing) so maybe it could be solved with some assembly/instinsic instruction but if there exists a simpler solution would be nice! |
I have also stumbled across the very same issue and I guess it's not really kali but the fact that it uses aarch64. Actually have a look at F5OEO/librpitx#11 I wonder how you solved all these problems and why rpitx is running correctly for you, I gave up at the mmap error after having fixed everything else so far, but first things first: The next thing were a few fixes to librpitx and commenting out dvbt etc, but the terminating issue for now is the implementation of "hello-fft" from broadcom, which is what librpitx uses especially in mailbox.c. Why?
So I just installed a fresh 32bit kali and rpitx works (I just need to figure out doing FSK in an easy way, but that's my task for the weekend) Oh: And maybe all I've said is untrue and maybe there is an aarch64 implementation of |
You're right, I've cross-compiled rpitx for 32bit. At first, I've tried to compile everything for aarch64 but I've seen that without changing the options, csdr try to compile non-portable armv7 assembly code so I've changed to approach without investigating too much. I guess the reason you were able to compile csdr on aarch64 was because you're compiling without -DNEON_OPTS and other non-portable options. As for the mmap error, I think I was definitely able to mmap the addresses so I'm not really sure about the kernel thing. If you see the ctor of generalgpio, it accept an address that is computed by adding a base offset to an offset that is dependent on the specific revision of the raspberry. If the detection fails, the latter offset become zero and you get the error. As I've said, this is related to the output of /proc/cpuinfo, that it seems to be different between armv8/aarch64 and armv7 (the incriminated code is this: https://github.com/F5OEO/librpitx/blob/5475c41ccf202b544cac6cf0c670ae40210a9f4b/src/raspberry_pi_revision.c#L371). If you fix this, you also fix the mmap error. |
I don't know if you were able to work around this because of 32bit cross compilation, I just tried Oh, after reading the gpio.cpp code, it could very well be that mmap refuses to work because that region is wrong for the raspberry pi 3 and thus is blocked. The problem is, rpi_revision looks very detailed to me, my solution was:
device-tree might expose more information, but I don't know if it will be as detailed as what is required/if one needs (unreliable) string parsing. |
This. At the moment I don't see anything to backup the hypothesis that I was able to mmap only because I'm building against armv7, because if I don't hard-code the revision inside I had the issue in the same code you linked, but this is the consequence of the wrong detection of the revision that is done into
This does not surprise me too much because that address is in the first few MB of RAM and by the way it's a totally different address from what it should be if this worked well, as
I really don't know if this information is enough to infer all the information librpitx needs in order to run correctly and if it has the same format between all the raspberrys, all the distros etc. |
Yeah, your findings look like that is the issue. I would've imagined that 64bit is more strict than 32bit in regards of physical memory protection and that for 32bit emulation it maybe runs in compability mode. But I guess that's not the case.
I think /proc/device-tree/* is better because even if cpuid would work (and I guess cat /proc/cpuinfo is populated by cpuid already?), you can't rely on it, as not necessairly every BCM2837 device is a rpi. But maybe the correct solution is ahybrid of this, the best would actually be to test the various outputs on a few popular distributions (though I guess mainly raspbian and kali will suffice or at least be better than the present state). |
Well, that's some kind of extreme situation, don't you think? It's not clear to me why anyone would need to put a software that is called "raspberrypitx" on a device that is not a raspberry pi and by the way I guess that whoever does such a thing is savvy enough to know what he's doing. Anyway, those addresses are taken from datasheet. As you can read here at page 90, for that particular chipset at bus address The gotcha here is that you're not doing anything wrong accessing that specific region expecting to find DMA for GPIO, or, in other words: you can run that code on every device, on every system, etc. Provided that the chipset is |
Thanks for your hard work @MeFisto94 . Fixed in current commit |
Hi,
I've tried to build rpitx on a Raspberry Pi 3 B+ running Kali linux but compilation fails badly while compiling csdr with this error:
So, the problem is that Kali Linux compiled against armv8/aarch64 architecture, but rpitx is tested only on armv7.
I've tried 2 things to solve the issue:
Modify the options in order to build an aarch64 version of csdr. This don't work because csdr contains some "neon" assembly code that is highly coupled with armv7-a.
Run
And then manually patched cdsr/rpitx Makefile with:
This seems to solve the problem but unfortunately I'm getting "mmap error" in the constructor of generalgpio.
After digging a little bit I've found the culprit to be the output of /proc/cpuinfo.
This is the output on Raspbian:
And this is the output on Kali:
As you can see, the lines about hardware and revision at the end is totally missing in kali.
For the moment, I've hardcoded the revision in the code and I managed to get rpitx run correctly, but it would be great to fix this.
Do you have any hints about how to either make the process of retreiving the revision of the raspberry more reliable or fix this in kali?
Thanks
The text was updated successfully, but these errors were encountered: