update-linux-headers.sh fails on clean kernel dir
Hi QEMU developers,
If I run scripts/update-linux-headers.sh from a clean checkout of QEMU and point it at a clean checkout of a recent linux kernel (4.10-rc1 or later), it fails:
$ scripts/update-linux-headers.sh ~/tmp/linux/
...
scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/arm/include/generated/uapi/asm/unistd-common.h. Stop.
This seems to be because the script passes the arch to the kernel makefile using "SRCARCH" rather than "ARCH".
(SRCARCH seems to be intended as an internal value, and setting it does not propagate the setting to ARCH. Because ARCH is left empty, the prerequisites that should generate unistd-common.h fail. If ARCH is set, SRCARCH is set automatically and everything works.)
Changing the script to use "ARCH" seems to fixe the problem.
(Note: when testing this be careful: unistd-common.h is not removed by "make clean" in the kernel directory.)
Does this seem correct?
Should I send a patch even though it's a very small change?
Cheers,
Sam.
Hi
Quoted 16 lines · Sam Bobroff
Hi QEMU developers,
If I run
scripts/update-linux-headers.shfrom a clean checkout of QEMU and point it at a clean checkout of a recent linux kernel (4.10-rc1 or later), it fails:$ scripts/update-linux-headers.sh ~/tmp/linux/...
scripts/Makefile.headersinst:62: *** Missing generated UAPI file./arch/arm/include/generated/uapi/asm/unistd-common.h. Stop.This seems to be because the script passes the arch to the kernel makefile using "SRCARCH" rather than "ARCH".
Quoted 7 lines
(SRCARCH seems to be intended as an internal value, and setting it does not propagate the setting to ARCH. Because ARCH is left empty, the prerequisites that should generate
unistd-common.hfail. If ARCH is set, SRCARCH is set automatically and everything works.)Changing the script to use "ARCH" seems to fixe the problem.
That's also what Documentation/kbuild/headers_install.txt documents.
Quoted 8 lines
(Note: when testing this be careful:
unistd-common.his not removed by "make clean" in the kernel directory.)Does this seem correct?
Should I send a patch even though it's a very small change?
I think so, thanks
Quoted 5 lines
Cheers,
Sam.--
Marc-André Lureau
Quoted 34 lines · Marc-André Lureau
Hi
Quoted 16 lines · Sam Bobroff
Hi QEMU developers,
If I run
scripts/update-linux-headers.shfrom a clean checkout of QEMU and point it at a clean checkout of a recent linux kernel (4.10-rc1 or later), it fails:$ scripts/update-linux-headers.sh ~/tmp/linux/...
scripts/Makefile.headersinst:62: *** Missing generated UAPI file./arch/arm/include/generated/uapi/asm/unistd-common.h. Stop.This seems to be because the script passes the arch to the kernel makefile using "SRCARCH" rather than "ARCH".
Quoted 7 lines
(SRCARCH seems to be intended as an internal value, and setting it does not propagate the setting to ARCH. Because ARCH is left empty, the prerequisites that should generate
unistd-common.hfail. If ARCH is set, SRCARCH is set automatically and everything works.)Changing the script to use "ARCH" seems to fixe the problem.
That's also what
Documentation/kbuild/headers_install.txtdocuments.Quoted 3 lines
(Note: when testing this be careful:
unistd-common.his not removed by "make clean" in the kernel directory.)
Quoted 6 lines
Quoted 5 lines
Does this seem correct?
Should I send a patch even though it's a very small change?
I think so, thanks
Thanks for the quick answer, I'll post a patch ASAP.
Perhaps you wouldn't mind commenting on this followup issue, since that fix isn't enough to get the script working nicely...
With that fixed, update-linux-headers.sh still doesn't work as I would expect. It seems that since commit 7e71da7f124fc47a2f2bc1fbfb32f0e8ee3e7d44
QEMU makes use of virtio_mmio.h but that file isn't installed by the kernel's "install_headers" target so running update-linux-headers.sh causes virtio_mmio.h to be deleted from the QEMU source rather than updated.
(It looks like virtio_mmio.h was manually added by commit 5878b13642ddf8da44186ef93ac91319ff53668b )
It looks like the reason virtio_mmio.h isn't installed is that it's not a uapi header and the reason this causes the deletion is that the file has been placed in include/standard-headers/...
So, it seems there are several possible approaches:
(1) Move QEMU's copy of the file out of standard-headers.
(2) Ask the kernel to make virtio_mmio.h a uapi header.
(3) Change update-linux-headers.sh to manually copy that file.
(4) Manually copy that file in after running the script.
(1) seems to be the easiest to me, and (2) possibly the cleanest, but what would you recommend? Should I try posting a patch for this too?
Thanks,
Sam.