Skip to contentSkip to conversation

RedHat 5 support fixes

PATCH New Thomas De Schampheleire 4 participants 11 messages Sep 2, 2014 – Oct 5, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RedHat 5 support fixes

This small patch series fixes two issues when using Buildroot on RedHat 5. Granted, RedHat 5 is an old distribution, but in some corporate environments it is still used. As the fixes are relatively small, I hope they can be accepted.

The corresponding problems have been introduced somewhere between 2013.05 and 2014.05, and are still present on current master.

---
Thomas De Schampheleire (2)
check-kernel-headers: mktemp --tmpdir not available on RedHat 5
kmod: add patches to support build on Redhat 5

 package/kmod/kmod-0001-fix-O_CLOEXEC.patch                    |  38 ++++++
 package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch |  41 +++++++
 support/scripts/check-kernel-headers.sh                       |   2 +-
 3 files changed, 80 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/1 check-kernel-headers: mktemp --tmpdir not available on RedHat 5

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153076 -7200
# Mon Aug 04 13:51:16 2014 +0200
# Node ID 2c7735c0247a4c83a3c2ea1d58e74be613465255
# Parent 6af0c3866b64670bb6d62302b64f3164b1f70fb6
check-kernel-headers: mktemp --tmpdir not available on RedHat 5

mktemp --tmpdir is not available on older Redhat 5 machines. The alternative that has the same behavior is 'mktemp -t'.

---
 support/scripts/check-kernel-headers.sh |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
support/scripts/check-kernel-headers.sh +1 -1
@@ -8,7 +8,7 @@
 HDR_V="${HDR_VER#*.}"
 HDR_m="${HDR_V%%.*}"
 
-EXEC="$(mktemp --tmpdir check-headers.XXXXXX)"
+EXEC="$(mktemp -t check-headers.XXXXXX)"
 
 # We do not want to account for the patch-level, since headers are
 # not supposed to change for different patchlevels, so we mask it out.
#6 lore raw

PATCH 1/1 kmod: add patches to support build on Redhat 5

In reply to Thomas De Schampheleire

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153133 -7200
# Mon Aug 04 13:52:13 2014 +0200
# Node ID f2b8b2b5efec1b2340c423f14f12df11a95ceac7
# Parent 2c7735c0247a4c83a3c2ea1d58e74be613465255
kmod: add patches to support build on Redhat 5

kmod uses certain features not available on older Redhat 5 machines. This commit imports two patches from OpenEmbedded to fix that.

---
 package/kmod/kmod-0001-fix-O_CLOEXEC.patch                    |  38 ++++++
 package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch |  41 +++++++
 2 files changed, 79 insertions(+), 0 deletions(-)
package/kmod/kmod-0001-fix-O_CLOEXEC.patch new file +38 -0
new file mode 100644
@@ -0,0 +1,38 @@
+From bd43367eee868059770188fd9e9db38520dc6fff Mon Sep 17 00:00:00 2001
+From: Robert Yang <[email protected]>
+Date: Wed, 22 Jan 2014 01:06:40 -0500
+Subject: [PATCH] libkmod/libkmod-internal.h: check whether O_CLOEXEC is
+ defined or not
+
+O_CLOEXEC is introduced from Linux 2.6.23, so old kernel doesn't have
+it, we need check before use.
+
+This patch is much more like a workaround, since it may need fcntl() use
+FD_CLOEXEC to replace.
+
+This problem was reported by "Ting Liu <[email protected]>"
+Signed-off-by: Robert Yang <[email protected]>
+
+Upstream-Status: Pending
+---
+ libkmod/libkmod-internal.h |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h
+index 0180124..100b40f 100644
+--- a/libkmod/libkmod-internal.h
++++ b/libkmod/libkmod-internal.h
+@@ -9,6 +9,10 @@
+ #include "macro.h"
+ #include "libkmod.h"
+ 
++#ifndef O_CLOEXEC
++#define O_CLOEXEC 0
++#endif
++
+ static _always_inline_ _printf_format_(2, 3) void
+ 	kmod_log_null(struct kmod_ctx *ctx, const char *format, ...) {}
+ 
+-- 
+1.7.10.4
+
package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch new file +41 -0

41 lines not on this page · raw message

#2 lore raw

PATCH 1/1 check-kernel-headers: mktemp --tmpdir not available on RedHat 5

In reply to Thomas De Schampheleire

Thomas, All,

On 2014-09-02 11:25 +0200, Thomas De Schampheleire spake thusly:

Quoted 8 lines

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153076 -7200
# Mon Aug 04 13:51:16 2014 +0200
# Node ID 2c7735c0247a4c83a3c2ea1d58e74be613465255
# Parent 6af0c3866b64670bb6d62302b64f3164b1f70fb6
check-kernel-headers: mktemp --tmpdir not available on RedHat 5

Quoted 4 lines

mktemp --tmpdir is not available on older Redhat 5 machines. The alternative that has the same behavior is 'mktemp -t'.

Regards,
Yann E. MORIN.

Quoted 20 lines
---
 support/scripts/check-kernel-headers.sh |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
support/scripts/check-kernel-headers.sh +1 -1
@@ -8,7 +8,7 @@
 HDR_V="${HDR_VER#*.}"
 HDR_m="${HDR_V%%.*}"
 
-EXEC="$(mktemp --tmpdir check-headers.XXXXXX)"
+EXEC="$(mktemp -t check-headers.XXXXXX)"
 
 # We do not want to account for the patch-level, since headers are
 # not supposed to change for different patchlevels, so we mask it out.

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 check-kernel-headers: mktemp --tmpdir not available on RedHat 5

In reply to Thomas De Schampheleire
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153076 -7200
# Mon Aug 04 13:51:16 2014 +0200
# Node ID 2c7735c0247a4c83a3c2ea1d58e74be613465255
# Parent 6af0c3866b64670bb6d62302b64f3164b1f70fb6

Is all of this hg noise needed? Your patches didn't used to contain this.

Quoted 4 lines

check-kernel-headers: mktemp --tmpdir not available on RedHat 5

mktemp --tmpdir is not available on older Redhat 5 machines. The alternative that has the same behavior is 'mktemp -t'.

Redhat Linux 5.0, that was one of the very first Linux distributions I ever used - It's been a while ;)

I guess you mean RHEL 5, so I've adjusted the commit message and committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 check-kernel-headers: mktemp --tmpdir not available on RedHat 5

Peter Korsgaard <[email protected]> schreef:

Quoted 11 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153076 -7200
# Mon Aug 04 13:51:16 2014 +0200
# Node ID 2c7735c0247a4c83a3c2ea1d58e74be613465255
# Parent 6af0c3866b64670bb6d62302b64f3164b1f70fb6

Is all of this hg noise needed? Your patches didn't used to contain this.

Oi sorry, I have forgotten a switch to turn this off here.

Quoted 11 lines
Quoted 5 lines

check-kernel-headers: mktemp --tmpdir not available on RedHat 5

mktemp --tmpdir is not available on older Redhat 5 machines. The alternative that has the same behavior is 'mktemp -t'.

Redhat Linux 5.0, that was one of the very first Linux distributions I ever used - It's been a while ;)

I guess you mean RHEL 5, so I've adjusted the commit message and committed, thanks.

Thanks, I do indeed mean RHEL5, wasn't aware that there was a difference.

Best regards,
Thomas

#7 lore raw

PATCH 1/1 kmod: add patches to support build on Redhat 5

In reply to Thomas De Schampheleire
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153133 -7200
# Mon Aug 04 13:52:13 2014 +0200
# Node ID f2b8b2b5efec1b2340c423f14f12df11a95ceac7
# Parent 2c7735c0247a4c83a3c2ea1d58e74be613465255
kmod: add patches to support build on Redhat 5

kmod uses certain features not available on older Redhat 5 machines. This commit imports two patches from OpenEmbedded to fix that.

Quoted 6 lines
---
 package/kmod/kmod-0001-fix-O_CLOEXEC.patch                    |  38 ++++++
 package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch |  41 +++++++
 2 files changed, 79 insertions(+), 0 deletions(-)

The first patch looks ok, but:

Quoted 30 lines
package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch new file +25 -0
new file mode 100644
@@ -0,0 +1,41 @@
+From 0c4dbadc9db3cda1cfca64e44ea08c6e89919ea7 Mon Sep 17 00:00:00 2001
+From: Ting Liu <[email protected]>
+Date: Tue, 10 Sep 2013 13:44:18 +0800
+Subject: [PATCH] Change to calling bswap_* instead of htobe* and be*toh
+
+We can't use htobe* and be*toh functions because they are not
+available on older versions of glibc, For example, shipped on Centos 5.5.
+
+Change to directly calling bswap_* as defined in+byteswap.h.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Ting Liu <[email protected]>
+---
+ libkmod/libkmod-signature.c |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
+index 6b80caa..3544a36 100644
+--- a/libkmod/libkmod-signature.c
++++ b/libkmod/libkmod-signature.c
+@@ -19,6 +19,7 @@
+  */
+ 
+ #include <endian.h>

package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch line 35

Quoted 10 lines
package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch new file +10 -0
++#include <byteswap.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -121,7 +122,7 @@ bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signat
+ 			modsig->hash >= PKEY_HASH__LAST ||
+ 			modsig->id_type >= PKEY_ID_TYPE__LAST)
+ 		return false;
+-	sig_len = be32toh(get_unaligned(&modsig->sig_len));
++	sig_len = bswap_32(get_unaligned(&modsig->sig_len));

Ehh, so what happens when we want to build kmod for a big endian target?

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/1 check-kernel-headers: mktemp --tmpdir not available on RedHat 5

In reply to Thomas De Schampheleire
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

Hi,

Quoted 7 lines
Quoted 5 lines

Redhat Linux 5.0, that was one of the very first Linux distributions I ever used - It's been a while ;)

I guess you mean RHEL 5, so I've adjusted the commit message and committed, thanks.

Thanks, I do indeed mean RHEL5, wasn't aware that there was a difference.

https://en.wikipedia.org/wiki/Red_Hat_Linux

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw

PATCH 1/1 kmod: add patches to support build on Redhat 5

In reply to Peter Korsgaard
Quoted 57 lines · Peter Korsgaard
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153133 -7200
# Mon Aug 04 13:52:13 2014 +0200
# Node ID f2b8b2b5efec1b2340c423f14f12df11a95ceac7
# Parent 2c7735c0247a4c83a3c2ea1d58e74be613465255
kmod: add patches to support build on Redhat 5

kmod uses certain features not available on older Redhat 5 machines. This commit imports two patches from OpenEmbedded to fix that.

Quoted 6 lines
---
 package/kmod/kmod-0001-fix-O_CLOEXEC.patch                    |  38 ++++++
 package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch |  41 +++++++
 2 files changed, 79 insertions(+), 0 deletions(-)

The first patch looks ok, but:

Quoted 34 lines
package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch new file +29 -0
new file mode 100644
@@ -0,0 +1,41 @@
+From 0c4dbadc9db3cda1cfca64e44ea08c6e89919ea7 Mon Sep 17 00:00:00 2001
+From: Ting Liu <[email protected]>
+Date: Tue, 10 Sep 2013 13:44:18 +0800
+Subject: [PATCH] Change to calling bswap_* instead of htobe* and be*toh
+
+We can't use htobe* and be*toh functions because they are not
+available on older versions of glibc, For example, shipped on Centos 5.5.
+
+Change to directly calling bswap_* as defined in+byteswap.h.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Ting Liu <[email protected]>
+---
+ libkmod/libkmod-signature.c |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
+index 6b80caa..3544a36 100644
+--- a/libkmod/libkmod-signature.c
++++ b/libkmod/libkmod-signature.c
+@@ -19,6 +19,7 @@
+  */
+
+ #include <endian.h>
++#include <byteswap.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
Quoted 9 lines

package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch line 35

Quoted 6 lines
package/kmod/kmod-0002-use-bswap-instead-of-htobe-betoh.patch new file +6 -0
+@@ -121,7 +122,7 @@ bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signat
+                    modsig->hash >= PKEY_HASH__LAST ||
+                    modsig->id_type >= PKEY_ID_TYPE__LAST)
+            return false;
+-   sig_len = be32toh(get_unaligned(&modsig->sig_len));
++   sig_len = bswap_32(get_unaligned(&modsig->sig_len));

Ehh, so what happens when we want to build kmod for a big endian target?

Hmm, indeed, that doesn't seem right.
I found another patch that looks better [1], sent to the linux-modules mailing list in September 2013, received some comments and a v2 was promised but never arrived (AFAICS). I will adopt the patch and fix the comments, then resend to buildroot + linux-modules.

[1] http://www.spinics.net/lists/linux-modules/msg01127.html

Thanks,
Thomas

#9 lore raw

PATCH 1/1 kmod: add patches to support build on Redhat 5

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

Hi,

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
+-   sig_len = be32toh(get_unaligned(&modsig->sig_len));
++   sig_len = bswap_32(get_unaligned(&modsig->sig_len));

Ehh, so what happens when we want to build kmod for a big endian target?

Quoted 7 lines

Hmm, indeed, that doesn't seem right.
I found another patch that looks better [1], sent to the linux-modules mailing list in September 2013, received some comments and a v2 was promised but never arrived (AFAICS). I will adopt the patch and fix the comments, then resend to buildroot + linux-modules.

[1] http://www.spinics.net/lists/linux-modules/msg01127.html

Thanks, that patch (+ suggested changes) looks sensible to me.

Signature · 1 line
Bye, Peter Korsgaard
#10 lore raw

PATCH 1/1 kmod: add patches to support build on Redhat 5

In reply to Thomas De Schampheleire

Dear Thomas De Schampheleire,

Quoted 8 lines · Thomas De Schampheleire

# HG changeset patch
# User Thomas De Schampheleire <[email protected]> # Date 1407153133 -7200
# Mon Aug 04 13:52:13 2014 +0200
# Node ID f2b8b2b5efec1b2340c423f14f12df11a95ceac7
# Parent 2c7735c0247a4c83a3c2ea1d58e74be613465255
kmod: add patches to support build on Redhat 5

Quoted 4 lines

kmod uses certain features not available on older Redhat 5 machines. This commit imports two patches from OpenEmbedded to fix that.

Following the discussion with Peter, I'm marking this patch as Changes requested in patchwork.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com