[wily/master-next,1/1] UBUNTU: SAUCE: (no-up) add compat_uts_machine= kernel command line override
diff mbox

Message ID 1452675882-12805-2-git-send-email-apw@canonical.com
State New
Headers show

Commit Message

Andy Whitcroft Jan. 13, 2016, 9:04 a.m. UTC
We wish to use the arm64 buildds to build armhf binaries in 32bit chroots.
To make this work we need uname to return armv7l machine type.  To achieve
this add a kernel command line override for the 32bit machine type.
Add compat_uts_machine=<type> to allow the LINUX32 personality to return
that type for uname.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 kernel/sys.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Tim Gardner Jan. 13, 2016, 1:14 p.m. UTC | #1
Needs Buglink when applied
Brad Figg Jan. 20, 2016, 6:03 p.m. UTC | #2
On Wed, Jan 13, 2016 at 09:04:42AM +0000, Andy Whitcroft wrote:
> We wish to use the arm64 buildds to build armhf binaries in 32bit chroots.
> To make this work we need uname to return armv7l machine type.  To achieve
> this add a kernel command line override for the 32bit machine type.
> Add compat_uts_machine=<type> to allow the LINUX32 personality to return
> that type for uname.
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  kernel/sys.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/kernel/sys.c b/kernel/sys.c
> index 259fda2..a2a48f0 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -1099,6 +1099,21 @@ out:
>  DECLARE_RWSEM(uts_sem);
>  
>  #ifdef COMPAT_UTS_MACHINE
> +static char compat_uts_machine[__OLD_UTS_LEN+1] = COMPAT_UTS_MACHINE;
> +
> +static int __init parse_compat_uts_machine(char *arg)
> +{
> +	strncpy(compat_uts_machine, arg, __OLD_UTS_LEN);
> +	compat_uts_machine[__OLD_UTS_LEN] = 0;
> +	return 0;
> +}
> +early_param("compat_uts_machine", parse_compat_uts_machine);
> +
> +#undef COMPAT_UTS_MACHINE
> +#define COMPAT_UTS_MACHINE compat_uts_machine
> +#endif
> +
> +#ifdef COMPAT_UTS_MACHINE
>  #define override_architecture(name) \
>  	(personality(current->personality) == PER_LINUX32 && \
>  	 copy_to_user(name->machine, COMPAT_UTS_MACHINE, \
> -- 
> 2.7.0.rc3
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Looks good.

Patch
diff mbox

diff --git a/kernel/sys.c b/kernel/sys.c
index 259fda2..a2a48f0 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1099,6 +1099,21 @@  out:
 DECLARE_RWSEM(uts_sem);
 
 #ifdef COMPAT_UTS_MACHINE
+static char compat_uts_machine[__OLD_UTS_LEN+1] = COMPAT_UTS_MACHINE;
+
+static int __init parse_compat_uts_machine(char *arg)
+{
+	strncpy(compat_uts_machine, arg, __OLD_UTS_LEN);
+	compat_uts_machine[__OLD_UTS_LEN] = 0;
+	return 0;
+}
+early_param("compat_uts_machine", parse_compat_uts_machine);
+
+#undef COMPAT_UTS_MACHINE
+#define COMPAT_UTS_MACHINE compat_uts_machine
+#endif
+
+#ifdef COMPAT_UTS_MACHINE
 #define override_architecture(name) \
 	(personality(current->personality) == PER_LINUX32 && \
 	 copy_to_user(name->machine, COMPAT_UTS_MACHINE, \