qemu/riscv32-virt: Fix missing linux-headers patch
PATCH 1/1 qemu/riscv32-virt: Fix missing linux-headers patch
Commit f9993797959 "configs/qemu_riscv32_virt: update to 5.1 kernel" broke the qemu/riscv32-virt machine build as the BR2_LINUX_KERNEL_PATCH mechanism was replaced with the BR2_GLOBAL_PATCH_DIR mechanism when the patch was applied. This results in the linux-headers not having the patch applied which causes a glibc build failure.
Add a symbolic link to ensure the linux patch is applied to linux and linux-headers.
--- board/qemu/riscv32-virt/patches/linux-headers | 1 + 1 file changed, 1 insertion(+) create mode 120000 board/qemu/riscv32-virt/patches/linux-headers
board/qemu/riscv32-virt/patches/linux-headers new file +1 -0
@@ -0,0 +1 @@ +linux
Signature · 1 line
2.22.0
PATCH 1/1 qemu/riscv32-virt: Fix missing linux-headers patch
Hello Francis,
+Yann in Cc.
First of all, my apologies for breaking the build with my change.
Quoted 21 lines · On Thu, 20 Jun 2019 10:56:48 -0700 Alistair Francis <[email protected]>…
Commit
f9993797959"configs/qemu_riscv32_virt: update to 5.1 kernel" broke the qemu/riscv32-virt machine build as theBR2_LINUX_KERNEL_PATCHmechanism was replaced with theBR2_GLOBAL_PATCH_DIRmechanism when the patch was applied. This results in the linux-headers not having the patch applied which causes a glibc build failure.Add a symbolic link to ensure the linux patch is applied to linux and linux-headers.
Signed-off-by Alistair Francis <[email protected]>--- board/qemu/riscv32-virt/patches/linux-headers | 1 + 1 file changed, 1 insertion(+) create mode 120000 board/qemu/riscv32-virt/patches/linux-headersboard/qemu/riscv32-virt/patches/linux-headers new file +0
-0
board/qemu/riscv32-virt/patches/linux-headers line 1
Quoted 2 lines
board/qemu/riscv32-virt/patches/linux-headers new file +1
-0@@ -0,0 +1 @@ +linux
I understand the problem, but I am not sure it is the right solution. Indeed, when the option BR2_KERNEL_HEADERS_AS_KERNEL is enabled, we really expect that linux-headers will use the same source code as the kernel, including all patches. The linux-headers.mk is already doing some effort to achieve this, but it does not do it entirely due do BR2_GLOBAL_PATCH_DIR patches.
So what I would propose instead is this:
package/linux-headers/linux-headers.mk +2 -1
@@ -60,7 +60,8 @@ endif # LINUX_HEADERS_CUSTOM_TARBALL # Apply any necessary patches if we are using the headers from a kernel # build. ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL),y) -LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) +LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) \ + $(wildcard $(addsuffix /linux,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))) # We rely on the generic package infrastructure to download and apply # remote patches (downloaded from ftp, http or https). For local
Yann, what do you think of this ?
However, Francis & Mark: it is not normal that we can't build a RISC-V 32 toolchain out of the box, as I reported separately. So while this linux-headers/linux patch consistency issue is real, I think we need something better for RISC-V 32. Indeed a user who would build a RISC-V 32 system, but not for Qemu, would not use this defconfig, and would therefore not have this patch. Do you expect this issue to be resolved in the near future on the kernel side ?
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 qemu/riscv32-virt: Fix missing linux-headers patch
Quoted 6 lines · Thomas Petazzoni
Hello Francis,
+Yann in Cc.
First of all, my apologies for breaking the build with my change.
No worries.
Quoted 42 lines
Quoted 21 lines · On Thu, 20 Jun 2019 10:56:48 -0700 Alistair Francis <[email protected]>…
Commit
f9993797959"configs/qemu_riscv32_virt: update to 5.1 kernel" broke the qemu/riscv32-virt machine build as theBR2_LINUX_KERNEL_PATCHmechanism was replaced with theBR2_GLOBAL_PATCH_DIRmechanism when the patch was applied. This results in the linux-headers not having the patch applied which causes a glibc build failure.Add a symbolic link to ensure the linux patch is applied to linux and linux-headers.
Signed-off-by Alistair Francis <[email protected]>--- board/qemu/riscv32-virt/patches/linux-headers | 1 + 1 file changed, 1 insertion(+) create mode 120000 board/qemu/riscv32-virt/patches/linux-headersboard/qemu/riscv32-virt/patches/linux-headers new file +0
-0board/qemu/riscv32-virt/patches/linux-headers line 1
Quoted 2 lines
board/qemu/riscv32-virt/patches/linux-headers new file +1
-0@@ -0,0 +1 @@ +linuxI understand the problem, but I am not sure it is the right solution. Indeed, when the option
BR2_KERNEL_HEADERS_AS_KERNELis enabled, we really expect that linux-headers will use the same source code as the kernel, including all patches. The linux-headers.mk is already doing some effort to achieve this, but it does not do it entirely due doBR2_GLOBAL_PATCH_DIRpatches.So what I would propose instead is this:
package/linux-headers/linux-headers.mk +0
-0
package/linux-headers/linux-headers.mk endif # LINUX_HEADERS_CUSTOM_TARBALL · line 67
Quoted 9 lines
package/linux-headers/linux-headers.mk +2
-1@@ -60,7 +60,8 @@ endif # LINUX_HEADERS_CUSTOM_TARBALL # Apply any necessary patches if we are using the headers from a kernel # build. ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL),y) -LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) +LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) \ + $(wildcard $(addsuffix /linux,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))) # We rely on the generic package infrastructure to download and apply # remote patches (downloaded from ftp, http or https). For local
This is fine with me, although I haven't tested to make sure it works.
Quoted 10 lines
Yann, what do you think of this ?
However, Francis & Mark: it is not normal that we can't build a RISC-V 32 toolchain out of the box, as I reported separately. So while this linux-headers/linux patch consistency issue is real, I think we need something better for RISC-V 32. Indeed a user who would build a RISC-V 32 system, but not for Qemu, would not use this defconfig, and would therefore not have this patch. Do you expect this issue to be resolved in the near future on the kernel side ?
Ah, now I understand what you mean.
Yes this is a bad situation.
From my understanding the glibc port for RV32 is basically done, it just needs a little bit of cleaning and then more effort to submit it. In saying that no one is really pushing for it at the moment. I'll take a look to see if I can help get it in.
In the meantime we can either apply a patch to Linux, or we should be able to user older kernel headers (I think 5.0 should be fine). Is that a better solution?
Alistair
Quoted 8 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 1/1 qemu/riscv32-virt: Fix missing linux-headers patch
In reply to Thomas PetazzoniThomas, Alistair, Mark, All,
On 2019-06-20 20:54 +0200, Thomas Petazzoni spake thusly:
Quoted 1 line
+Yann in Cc.
I seem to consistently been dragged into weird corner-cases... ;-)
Quoted 4 lines
Quoted 2 lines · On Thu, 20 Jun 2019 10:56:48 -0700 Alistair Francis <[email protected]>…
Add a symbolic link to ensure the linux patch is applied to linux and linux-headers.
[--SNIP--]
Quoted 6 lines
I understand the problem, but I am not sure it is the right solution. Indeed, when the option
BR2_KERNEL_HEADERS_AS_KERNELis enabled, we really expect that linux-headers will use the same source code as the kernel, including all patches. The linux-headers.mk is already doing some effort to achieve this, but it does not do it entirely due doBR2_GLOBAL_PATCH_DIRpatches.
Agreed.
Quoted 17 lines
So what I would propose instead is this:
package/linux-headers/linux-headers.mk +2
-1@@ -60,7 +60,8 @@ endif # LINUX_HEADERS_CUSTOM_TARBALL # Apply any necessary patches if we are using the headers from a kernel # build. ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL),y) -LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) +LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) \ + $(wildcard $(addsuffix /linux,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))) # We rely on the generic package infrastructure to download and apply # remote patches (downloaded from ftp, http or https). For local
Quoted 1 line
Yann, what do you think of this ?
Quoted 7 lines
However, Francis & Mark: it is not normal that we can't build a RISC-V 32 toolchain out of the box, as I reported separately. So while this linux-headers/linux patch consistency issue is real, I think we need something better for RISC-V 32. Indeed a user who would build a RISC-V 32 system, but not for Qemu, would not use this defconfig, and would therefore not have this patch. Do you expect this issue to be resolved in the near future on the kernel side ?
So, upstream is broken. Our response is usually that we patch it, and cary the patch(es) in the package directory (or in a per-version subdirectory thereof).
However, for the kernel, it is more complex, because we usually can't know what version the user will end up using (and it is definitely not uncommon that they go with a non upstream kernel), and so we can't have an automatic way to locate that patch. And even if we could, it may or may not apply (e.g. not on older kernels that don't have riscv).
So, besides providing a defconfig, like this one for qemu or for a real board, which has the patch we can point users at, I don;t see what we can do. Oh, yes I see: we can wait the kernel to get fixed. ;-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 qemu/riscv32-virt: Fix missing linux-headers patch
Quoted 61 lines · Yann E. MORIN
Thomas, Alistair, Mark, All,
On 2019-06-20 20:54 +0200, Thomas Petazzoni spake thusly:
Quoted 1 line
+Yann in Cc.
I seem to consistently been dragged into weird corner-cases... ;-)
Quoted 4 lines
Quoted 2 lines · On Thu, 20 Jun 2019 10:56:48 -0700 Alistair Francis <[email protected]>…
Add a symbolic link to ensure the linux patch is applied to linux and linux-headers.
[--SNIP--]
Quoted 6 lines
I understand the problem, but I am not sure it is the right solution. Indeed, when the option
BR2_KERNEL_HEADERS_AS_KERNELis enabled, we really expect that linux-headers will use the same source code as the kernel, including all patches. The linux-headers.mk is already doing some effort to achieve this, but it does not do it entirely due doBR2_GLOBAL_PATCH_DIRpatches.Agreed.
Quoted 17 lines
So what I would propose instead is this:
package/linux-headers/linux-headers.mk +2
-1@@ -60,7 +60,8 @@ endif # LINUX_HEADERS_CUSTOM_TARBALL # Apply any necessary patches if we are using the headers from a kernel # build. ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL),y) -LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) +LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) \ + $(wildcard $(addsuffix /linux,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))) # We rely on the generic package infrastructure to download and apply # remote patches (downloaded from ftp, http or https). For localQuoted 1 line
Yann, what do you think of this ?
Acked-by Yann E. MORIN <[email protected]>Quoted 7 lines
However, Francis & Mark: it is not normal that we can't build a RISC-V 32 toolchain out of the box, as I reported separately. So while this linux-headers/linux patch consistency issue is real, I think we need something better for RISC-V 32. Indeed a user who would build a RISC-V 32 system, but not for Qemu, would not use this defconfig, and would therefore not have this patch. Do you expect this issue to be resolved in the near future on the kernel side ?
So, upstream is broken. Our response is usually that we patch it, and cary the patch(es) in the package directory (or in a per-version subdirectory thereof).
However, for the kernel, it is more complex, because we usually can't know what version the user will end up using (and it is definitely not uncommon that they go with a non upstream kernel), and so we can't have an automatic way to locate that patch. And even if we could, it may or may not apply (e.g. not on older kernels that don't have riscv).
Quoted 3 lines
So, besides providing a defconfig, like this one for qemu or for a real board, which has the patch we can point users at, I don;t see what we can do. Oh, yes I see: we can wait the kernel to get fixed. ;-)
I started looking at fixing glibc, but it seems to be a large task as without __ARCH_WANT_TIME32_SYSCALLS defined in the kernel we need to implement a lot of syscalls in glibc.
Alistair
Quoted 11 lines
Regards,
Yann E. MORIN.--
.-----------------.--------------------.------------------.--------------------.| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |'------------------------------^-------^------------------^--------------------'
Quoted 75 lines · Yann E. MORIN
Thomas, Alistair, Mark, All,
On 2019-06-20 20:54 +0200, Thomas Petazzoni spake thusly:
Quoted 1 line
+Yann in Cc.
I seem to consistently been dragged into weird corner-cases... ;-)
Quoted 4 lines
Quoted 2 lines · On Thu, 20 Jun 2019 10:56:48 -0700 Alistair Francis <[email protected]>…
Add a symbolic link to ensure the linux patch is applied to linux and linux-headers.
[--SNIP--]
Quoted 6 lines
I understand the problem, but I am not sure it is the right solution. Indeed, when the option
BR2_KERNEL_HEADERS_AS_KERNELis enabled, we really expect that linux-headers will use the same source code as the kernel, including all patches. The linux-headers.mk is already doing some effort to achieve this, but it does not do it entirely due doBR2_GLOBAL_PATCH_DIRpatches.Agreed.
Quoted 17 lines
So what I would propose instead is this:
package/linux-headers/linux-headers.mk +2
-1@@ -60,7 +60,8 @@ endif # LINUX_HEADERS_CUSTOM_TARBALL # Apply any necessary patches if we are using the headers from a kernel # build. ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL),y) -LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) +LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) \ + $(wildcard $(addsuffix /linux,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))) # We rely on the generic package infrastructure to download and apply # remote patches (downloaded from ftp, http or https). For localQuoted 1 line
Yann, what do you think of this ?
Acked-by Yann E. MORIN <[email protected]>Quoted 7 lines
However, Francis & Mark: it is not normal that we can't build a RISC-V 32 toolchain out of the box, as I reported separately. So while this linux-headers/linux patch consistency issue is real, I think we need something better for RISC-V 32. Indeed a user who would build a RISC-V 32 system, but not for Qemu, would not use this defconfig, and would therefore not have this patch. Do you expect this issue to be resolved in the near future on the kernel side ?
So, upstream is broken. Our response is usually that we patch it, and cary the patch(es) in the package directory (or in a per-version subdirectory thereof).
However, for the kernel, it is more complex, because we usually can't know what version the user will end up using (and it is definitely not uncommon that they go with a non upstream kernel), and so we can't have an automatic way to locate that patch. And even if we could, it may or may not apply (e.g. not on older kernels that don't have riscv).
So, besides providing a defconfig, like this one for qemu or for a real board, which has the patch we can point users at, I don;t see what we can do. Oh, yes I see: we can wait the kernel to get fixed. ;-)
Regards,
Yann E. MORIN.--
.-----------------.--------------------.------------------.--------------------.| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |'------------------------------^-------^------------------^--------------------'
PATCH 1/1 qemu/riscv32-virt: Fix missing linux-headers patch
In reply to Yann E. MORINQuoted 14 lines · On Thu, 20 Jun 2019 22:43:14 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 14 lines
So what I would propose instead is this:
package/linux-headers/linux-headers.mk +2
-1@@ -60,7 +60,8 @@ endif # LINUX_HEADERS_CUSTOM_TARBALL # Apply any necessary patches if we are using the headers from a kernel # build. ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL),y) -LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) +LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) \ + $(wildcard $(addsuffix /linux,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))
Quoted 6 lines
Quoted 4 lines
package/linux-headers/linux-headers.mk +0
-0# We rely on the generic package infrastructure to download and apply # remote patches (downloaded from ftp, http or https). For localYann, what do you think of this ?
Acked-by Yann E. MORIN <[email protected]>
Thanks. One thing I'm sure of is the order in which patches will be applied between the patches in BR2_GLOBAL_PATCH_DIR and BR2_LINUX_KERNEL_PATCH. We need to make sure that what happens for the linux package happens in the same order for the linux-headers package.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com