-
Notifications
You must be signed in to change notification settings - Fork 5.2k
raspberrypi-kernel-headers (1.20190925-2): Wrong exec format in scripts in buster #3279
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
Comments
I've also seen this problem on all my Raspberry Pi's running buster when trying to build wireguard. It can be worked around by applying the patches described here: Based on that article it may be a cross compilation error. |
Yes, the files are all aarch64:
|
Looking into it. Not sure what happened between raspberrypi/firmware#1155 was fixed and now. I'll also add a check to make sure it doesn't happen again. |
The instruction in
For my needs I only need the other three, so this is just FYI. |
Looks like the problem is that fixdep is built with HOSTCC. To add aarch64 kernel headers, I moved the build across to an aarch64 system - raspbian doesn't have an aarch64 cross-compiler. I think the solution for now is to get rid of the headers matching kernel8.img. Since the headers package is for Raspbian and you won't be able to build out of tree modules for kernel8 anyway, that's probably not an issue. Looking into whether there's a way to tell the build system to cross_compile fixdep as well first. |
For what it is worth I have had some luck with dealing with fixdep being built for AMD64 in ubuntu mainline kernel packages previously by installing qemu-user-binfmt , qemu-user, and libc6-amd64-cross like this:
(Of course the headers in mainline ubuntu arm64 kernels are borked at the moment anyways... sigh.) So something like this might work to let arm64 fixdep in headers work on a non arm64 system.
Similarly, for an arm64 system (say booted with kernel8.img) with armhf fixdep in headers this might work:
Frankly, it's annoying how much hackery is involved in cross-compiling the headers properly on a non-native system. Though I've managed to make it work using this spaghetti on ubuntu amd64 to get arm64 kernel packages built.:
|
Should be fixed in |
Fixed. Thank you all for the extremly quick response and successful fix!! |
The respeaker out-of-tree modules also work fine now. respeaker/seeed-voicecard#190 |
FWIW, and for the record, I had another thought on that strange advice, and I think the patch itself is bogus. What actually mattered is the 2nd step - Anyway, the new header package works. I just thought it is important to clarify what "voodoo" advices, like those, actually do... |
I skimmed through it when you originally posted it, but couldn't make sense of it. If all it's doing is rebuilding 'scripts' (which fixdep is a part of), then it makes sense, but doesn't work around the cross-compiling issue. A proper fix would look a bit more like this: https://bugs.launchpad.net/ubuntu/+source/linux-ti-omap4/+bug/666267/comments/16 or would involve patching the build system itself. |
You are not the only one puzzled by that strange piece of advice :-). I think that patch itself is bogus - especially given that all it does, is just adding two header files. Those I would assume, not used, since nothing else refer to them. What really happens is that the kernel's make system detects two new header files newer than "fixdep", and this causes "make scripts" to re-compile them on a native system. I agree with you that this does not fix cross-compiling.
Playing with the timestamp like so:
sudo touch tools/include/tools/*.h
sudo make scripts
instead of applying a bogus patch, would have done the job too, I think.
|
@XECDesign hi, just curious how this was fixed in the end? I see the source package seems to be just repackaged binary tar balls. Am trying to crossbuild ubuntu kernel debs from x86_64 - it seems to work , except the same issue is cropping up (where fixdep targets x86_64...) |
I build the full package on armhf and then reprepro identifies which dsc files need a rebuild, those files get pushed to appropriate build servers and the output it added back to reprepro. So they all end up being native builds. |
@XECDesign thanks. I guess |
Yeah, I gave up on trying to get it to cross-compile the right 'host' binaries. |
I found the two linaro patches and discussions about them - they are quite large (touches about 4-5 files in non-trivial ways) and I kind-of agree they should not be merged. I wonder if it is possible to do post-install compile / pre-uninstall delete: this means the header package needs to depend on the compiler, but that's not bad since people installing the header likely wants to compile (out-of-tree drivers etc). |
I'm not sure if there are additional files which would need to be added to the headers package for that to work. I'm fairly content with it as is for now. |
I think post-install compile + pre-install delete can probably work somewhat neatly (with the undesirable complication of the header package depending on build-essential or something), though I totally understand the desire not to spend too much time on fiddling with cross-compilation. I only realize quite recently that I have not done a full-kernel compilation for almost a decade! (ever since secure-boot became the norm, I think). Out-of-tree optional/additional module build is mostly what I have been doing, if I touch anything inside the kernel at all. Btw, is the raspbian kernel package build log /procedure available on-line anywhere? I do mean the "deb package" build log, rather than the kernel ("make bcm2711_defconfig"). The purpose being to build packages which are drop-in compatible except for small and necessary tweaks/workarounds (like #4099 ). |
It kind of built up from a much smaller package that was never intended to be used the way it currently is, so it's a bit of a hideous mess that nobody should look at. I run You'll need to make sure submodules are updated and 'upstream' remote needs to point to |
Thanks - I found https://github.com/RPi-Distro/firmware (from |
Yeah, reworking the whole thing and basing it on either the Debian or Ubuntu packages is something I've kept telling myself I'll do any day now for a while. |
Yeah, I think many people have a lot of misgivings about repository of binaries in general. I do that myself - for rarely changed/updated components - c# - which are neither available prepackaged nor too system-dependent - but has been told off by "purists" often. So yeah, it would be nice to migrate to something closer to "mainstream". The ubuntu raspberrypi pi kernel package is not difficult to cross-built (caveat the same fixdep issue here) - I even managed to do it on Fedora (a non-deb based system), without building any tools myself. It looks like I cannot do the same for raspbian, as |
If you cross-build their package how do they handle the foreign binaries in headers issue? |
They don't. That goes back to my initial query here: I managed to finish ubuntu deb cross-build but ended up with the same problems - fixdep and a few things under scripts required for dkms ending up being the arch of the build host. Hence my question... I am just going to put |
The two patches mentioned was still carried by linaro-ubuntu-packaging, but had not been upstreamed further: |
Fwiw, for 5.4 and/or ubuntu, neither of the approaches ("touch ... ; make scripts") or patching with KBUID_SCRIPTROOT patches works. The former ends with it prompting for config changes, the latter seems that the 3 binaries built for linaro-ubuntu then (fixdep, conf, mk_elfconfig) are not those needed for dkms (fixdep, recordmcount, modpost). So I made a mess on my ubuntu pi install. But they do one thing better than raspbian: they allow multiple kernels installed, and symlink / update-initramfs between them; so it is possible to just copy the wrongly-built binaries from another header tree after experimenting. The kbuid_scriptroot patches seems the proper way of doing it, except it needs a hell lot of update after almost a decade of bitrot... |
FYI, if you want a current headers package for the rpi-update 64-bit kernels, I'm using this: https://gist.github.com/satmandu/a507c59d84737f6d29ff353395819d51 (I use it to install current 2.0.x zfs-dkms packages.) |
@satmandu Thanks for the URL, but I don't think the script explicitly caters for cross-compilation (which is what caused the issue here)? |
Is this the right place for my bug report?
yes
Describe the bug
/lib/modules/4.19.75-v7l+/build/scripts/basic/fixdep: Binary has wrong exec format
To reproduce
Fresh install of raspberrypi-kernel-headers (1.20190925-2) on a RPi4 with raspian buster. Executing the various tools for building kernel modules (i.e. wireguard) all complain about wrong exec format.
Expected behaviour
This did not happen on kernel version 4.19.66-v7l, so the bug is in the package of 4.19.75-v7l. Rebuild the packages with the correct target architecture.
Actual behaviour
see above
System
Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:
Pi4B
cat /etc/rpi-issue
)?Raspberry Pi reference 2019-07-10
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 175dfb027ffabd4b8d5080097af0e51ed9a4a56c, stage2
vcgencmd version
)?Sep 24 2019 17:34:59
Copyright (c) 2012 Broadcom
version cd3add54955f8fa065b414d8fc07c525e7ddffc8 (clean) (release) (start_cd)
uname -a
)?Linux xxxxxx 4.19.75-v7l+ solved issue of mirroring screen after rotation. #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux
Logs
Additional context
The text was updated successfully, but these errors were encountered: