linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package
@ 2019-06-17  6:14 Cedric Hombourger
  2019-07-04  0:43 ` Masahiro Yamada
  0 siblings, 1 reply; 15+ messages in thread
From: Cedric Hombourger @ 2019-06-17  6:14 UTC (permalink / raw)
  Cc: isar-users, Cedric Hombourger, yamada.masahiro, michal.lkml,
	linux-kbuild, linux-kernel

Debian-based distributions place libc header files in a machine
specific directory (/usr/include/<libc-machine>) instead of
/usr/include/asm to support installation of the linux-libc-dev
package from multiple architectures. Move headers installed by
"make headers_install" accordingly.

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Reviewed-by: Henning Schild <henning.schild@siemens.com>
---
 scripts/package/builddeb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index b03dd56a4782..8f7afb3a84e9 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -132,6 +132,11 @@ fi
 if [ "$ARCH" != "um" ]; then
 	$MAKE -f $srctree/Makefile headers_check
 	$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
+	# move asm headers to /usr/include/<libc-machine>/asm to match the structure
+	# used by Debian-based distros (to support multi-arch)
+	libc_mach=$($CC -dumpmachine)
+	mkdir $libc_headers_dir/usr/include/$libc_mach
+	mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$libc_mach/
 fi
 
 # Install the maintainer scripts
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-06-17  6:14 [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
@ 2019-07-04  0:43 ` Masahiro Yamada
  2019-07-04 12:39   ` Cedric Hombourger
  2019-07-04 13:10   ` Ben Hutchings
  0 siblings, 2 replies; 15+ messages in thread
From: Masahiro Yamada @ 2019-07-04  0:43 UTC (permalink / raw)
  To: Cedric Hombourger
  Cc: isar-users, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, Ben Hutchings, Riku Voipio

CCed a couple of people.

On Mon, Jun 17, 2019 at 3:15 PM Cedric Hombourger
<Cedric_Hombourger@mentor.com> wrote:
>
> Debian-based distributions place libc header files in a machine
> specific directory (/usr/include/<libc-machine>) instead of
> /usr/include/asm to support installation of the linux-libc-dev
> package from multiple architectures. Move headers installed by
> "make headers_install" accordingly.
>
> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> Reviewed-by: Henning Schild <henning.schild@siemens.com>
> ---
>  scripts/package/builddeb | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index b03dd56a4782..8f7afb3a84e9 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -132,6 +132,11 @@ fi
>  if [ "$ARCH" != "um" ]; then
>         $MAKE -f $srctree/Makefile headers_check
>         $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
> +       # move asm headers to /usr/include/<libc-machine>/asm to match the structure
> +       # used by Debian-based distros (to support multi-arch)
> +       libc_mach=$($CC -dumpmachine)
> +       mkdir $libc_headers_dir/usr/include/$libc_mach
> +       mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$libc_mach/
>  fi
>
>  # Install the maintainer scripts


I am not sure but,
I just worried about the backward compatibility...
Was this previously broken?

I guess debian is using own control file
instead of the one in upstream kernel.
So, this is almost a matter for developers, I think.

How did debian-base distros managed this before,
and will this introduce no breakage?

Ben,
Could you comment on this?


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-04  0:43 ` Masahiro Yamada
@ 2019-07-04 12:39   ` Cedric Hombourger
  2019-07-04 13:10   ` Ben Hutchings
  1 sibling, 0 replies; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-04 12:39 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: isar-users, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, Ben Hutchings, Riku Voipio

Hello Yamada-san

Thanks for your review of this patch. Answers below

On 7/4/2019 2:43 AM, Masahiro Yamada wrote:
> CCed a couple of people.
>
> On Mon, Jun 17, 2019 at 3:15 PM Cedric Hombourger
> <Cedric_Hombourger@mentor.com> wrote:
>> Debian-based distributions place libc header files in a machine
>> specific directory (/usr/include/<libc-machine>) instead of
>> /usr/include/asm to support installation of the linux-libc-dev
>> package from multiple architectures. Move headers installed by
>> "make headers_install" accordingly.
>>
>> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
>> Reviewed-by: Henning Schild <henning.schild@siemens.com>
>> ---
>>   scripts/package/builddeb | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
>> index b03dd56a4782..8f7afb3a84e9 100755
>> --- a/scripts/package/builddeb
>> +++ b/scripts/package/builddeb
>> @@ -132,6 +132,11 @@ fi
>>   if [ "$ARCH" != "um" ]; then
>>          $MAKE -f $srctree/Makefile headers_check
>>          $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
>> +       # move asm headers to /usr/include/<libc-machine>/asm to match the structure
>> +       # used by Debian-based distros (to support multi-arch)
>> +       libc_mach=$($CC -dumpmachine)
>> +       mkdir $libc_headers_dir/usr/include/$libc_mach
>> +       mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$libc_mach/
>>   fi
>>
>>   # Install the maintainer scripts
>
> I am not sure but,
> I just worried about the backward compatibility...

this patch is actually addressing a compatibility problem with 
multi-arch capable distros (all the major Debian-based distros that I 
know of are) where the currently generated libc headers packages is 
placing arch specific headers where all arch compilers installed on the 
system would find them

> Was this previously broken?

yes (as noted above) but would only be seen on systems with multi-arch 
packages / development tools installed

> I guess debian is using own control file
> instead of the one in upstream kernel.
> So, this is almost a matter for developers, I think.

Correct. Debian and some others use their own.

We (Mentor and Siemens) as well as other folks from the embedded 
community build embedded platforms using Debian as a base and recent 
kernels (so we can run Debian on e.g. recent Arm64 hardware designs). 
This is achieved by using Isar (https://github.com/ilbers/isar). The 
custom kernel recipe it provides uses builddeb since that feature is 
mainline. It also allows us to use custom kernels regardless of the 
Debian-based distro we use (Raspbian, Ubuntu, Debian, etc.)

> How did debian-base distros managed this before,
> and will this introduce no breakage?

We would expect desktop distros to continue using their own 
debian/{control,rules} files but would recommend to have the .deb 
produce by the kernel be better aligned with Debian so we can swap their 
"old" kernels with recent LTS or recent HEAD kernels.

Hope I was able to shed some light on our use-case / motivation.

> Ben,
> Could you comment on this?
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-04  0:43 ` Masahiro Yamada
  2019-07-04 12:39   ` Cedric Hombourger
@ 2019-07-04 13:10   ` Ben Hutchings
  2019-07-04 19:42     ` [PATCH v2] " Cedric Hombourger
  1 sibling, 1 reply; 15+ messages in thread
From: Ben Hutchings @ 2019-07-04 13:10 UTC (permalink / raw)
  To: Masahiro Yamada, Cedric Hombourger
  Cc: isar-users, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, Riku Voipio

[-- Attachment #1: Type: text/plain, Size: 3523 bytes --]

On Thu, 2019-07-04 at 09:43 +0900, Masahiro Yamada wrote:
> CCed a couple of people.
> 
> On Mon, Jun 17, 2019 at 3:15 PM Cedric Hombourger
> <Cedric_Hombourger@mentor.com> wrote:
> > Debian-based distributions place libc header files in a machine
> > specific directory (/usr/include/<libc-machine>) instead of
> > /usr/include/asm to support installation of the linux-libc-dev
> > package from multiple architectures. Move headers installed by
> > "make headers_install" accordingly.
> > 
> > Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> > Reviewed-by: Henning Schild <henning.schild@siemens.com>
> > ---
> >  scripts/package/builddeb | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> > index b03dd56a4782..8f7afb3a84e9 100755
> > --- a/scripts/package/builddeb
> > +++ b/scripts/package/builddeb
> > @@ -132,6 +132,11 @@ fi
> >  if [ "$ARCH" != "um" ]; then
> >         $MAKE -f $srctree/Makefile headers_check
> >         $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
> > +       # move asm headers to /usr/include/<libc-machine>/asm to match the structure
> > +       # used by Debian-based distros (to support multi-arch)
> > +       libc_mach=$($CC -dumpmachine)
> > +       mkdir $libc_headers_dir/usr/include/$libc_mach
> > +       mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$libc_mach/

This is wrong; the multiarch architecture tuple used in directory names
does not necessarily match the compiler's architecture tuple.  Firstly,
if you use a biarch compiler the compiler is only going to tell you the
default architecture.  Secondly, on i386 the minimum processor is i586
or i686 but the multiarch architecture tuple is still "i386-linux-gnu"
(and there might be other cases like this).

So, the correct command is:

    dpkg-architecture -a$debarch -qDEB_HOST_MULTIARCH

> >  fi
> > 
> >  # Install the maintainer scripts
> 
> I am not sure but,
> I just worried about the backward compatibility...
> Was this previously broken?

Debian has had multiarch support since Debian 7 "wheezy", and older
versions are no longer supported.  So I think this change is fine to
make unconditionally.

The current linux-libc-dev packages build by "make deb-pkg" are
"broken" in that multiple architectures can't be co-installed with each
other, whereas this genrally can be done with the linux-libc-dev
packages provided by Debian-based distributions.  However, co-
installation is only allowed if the version strings and contents of
common files in the packages are identical, and I don't know whether
that's going to be true for those generated by "make deb-pkg".

> I guess debian is using own control file
> instead of the one in upstream kernel.

We maintain multiple configurations, a meaningful changelog, tools
packages, etc.  So "make deb-pkg" is not used for official kernel
packages but we recommend it for custom kernels.

> So, this is almost a matter for developers, I think.
> 
> How did debian-base distros managed this before,
> and will this introduce no breakage?

On the Debian side a similar change was made in Debian 7 "wheezy".  In
Ubuntu I believe it was done earlier as they modified dpkg to support
multiarch before us.

> Ben,
> Could you comment on this?

Ben.

-- 
Ben Hutchings
Quantity is no substitute for quality, but it's the only one we've got.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-04 13:10   ` Ben Hutchings
@ 2019-07-04 19:42     ` Cedric Hombourger
  2019-07-04 19:49       ` Ben Hutchings
  0 siblings, 1 reply; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-04 19:42 UTC (permalink / raw)
  To: ben
  Cc: yamada.masahiro, isar-users, michal.lkml, linux-kbuild,
	linux-kernel, riku.voipio, Cedric Hombourger

Debian-based distributions place libc header files in a machine
specific directory (/usr/include/<libc-machine>) instead of
/usr/include/asm to support installation of the linux-libc-dev
package from multiple architectures. Move headers installed by
"make headers_install" accordingly using Debian's tuple from
dpkg-architecture.

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Reviewed-by: Henning Schild <henning.schild@siemens.com>
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
---
 scripts/package/builddeb | 8 ++++++++
 scripts/package/mkdebian | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index b03dd56a4782..15a034e18c37 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -132,6 +132,14 @@ fi
 if [ "$ARCH" != "um" ]; then
 	$MAKE -f $srctree/Makefile headers_check
 	$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
+	if [ -n "$debarch" ]; then
+		# move asm headers to /usr/include/<libc-machine>/asm to match the structure
+		# used by Debian-based distros (to support multi-arch) but only if ARCH was
+		# translated to Debian's (debarch) - this is done by mkdebian
+		host_arch=$(dpkg-architecture -a$debarch -qDEB_HOST_MULTIARCH)
+		mkdir $libc_headers_dir/usr/include/$host_arch
+		mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
+	fi
 fi
 
 # Install the maintainer scripts
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 8351584cb24e..8ebcb7d67fd2 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -212,11 +212,11 @@ cat <<EOF > debian/rules
 srctree ?= .
 
 build:
-	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
+	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
 	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
 
 binary-arch:
-	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
+	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
 	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
 
 clean:
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-04 19:42     ` [PATCH v2] " Cedric Hombourger
@ 2019-07-04 19:49       ` Ben Hutchings
  2019-07-04 20:28         ` Cedric Hombourger
  2019-07-04 20:50         ` [PATCH v3 0/1] builddeb: generate multi-arch friendly linux-libc-dev Cedric Hombourger
  0 siblings, 2 replies; 15+ messages in thread
From: Ben Hutchings @ 2019-07-04 19:49 UTC (permalink / raw)
  To: Cedric Hombourger
  Cc: yamada.masahiro, isar-users, michal.lkml, linux-kbuild,
	linux-kernel, riku.voipio

[-- Attachment #1: Type: text/plain, Size: 2597 bytes --]

On Thu, 2019-07-04 at 21:42 +0200, Cedric Hombourger wrote:
> Debian-based distributions place libc header files in a machine
> specific directory (/usr/include/<libc-machine>) instead of
> /usr/include/asm to support installation of the linux-libc-dev
> package from multiple architectures. Move headers installed by
> "make headers_install" accordingly using Debian's tuple from
> dpkg-architecture.
> 
> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> Reviewed-by: Henning Schild <henning.schild@siemens.com>
> Reviewed-by: Ben Hutchings <ben@decadent.org.uk>

I haven't reviewed this version of the patch.

And this doesn't make a multi-arch package; you will have to add a
field to the package's control file too.

Ben.

> ---
>  scripts/package/builddeb | 8 ++++++++
>  scripts/package/mkdebian | 4 ++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index b03dd56a4782..15a034e18c37 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -132,6 +132,14 @@ fi
>  if [ "$ARCH" != "um" ]; then
>  	$MAKE -f $srctree/Makefile headers_check
>  	$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
> +	if [ -n "$debarch" ]; then
> +		# move asm headers to /usr/include/<libc-machine>/asm to match the structure
> +		# used by Debian-based distros (to support multi-arch) but only if ARCH was
> +		# translated to Debian's (debarch) - this is done by mkdebian
> +		host_arch=$(dpkg-architecture -a$debarch -qDEB_HOST_MULTIARCH)
> +		mkdir $libc_headers_dir/usr/include/$host_arch
> +		mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
> +	fi
>  fi
>  
>  # Install the maintainer scripts
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index 8351584cb24e..8ebcb7d67fd2 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -212,11 +212,11 @@ cat <<EOF > debian/rules
>  srctree ?= .
>  
>  build:
> -	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
> +	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
>  	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
>  
>  binary-arch:
> -	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
> +	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
>  	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
>  
>  clean:
-- 
Ben Hutchings
Quantity is no substitute for quality, but it's the only one we've got.



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-04 19:49       ` Ben Hutchings
@ 2019-07-04 20:28         ` Cedric Hombourger
  2019-07-04 20:50         ` [PATCH v3 0/1] builddeb: generate multi-arch friendly linux-libc-dev Cedric Hombourger
  1 sibling, 0 replies; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-04 20:28 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: yamada.masahiro, isar-users, michal.lkml, linux-kbuild,
	linux-kernel, riku.voipio

Greetings,

On 7/4/2019 9:49 PM, Ben Hutchings wrote:
> On Thu, 2019-07-04 at 21:42 +0200, Cedric Hombourger wrote:
>> Debian-based distributions place libc header files in a machine
>> specific directory (/usr/include/<libc-machine>) instead of
>> /usr/include/asm to support installation of the linux-libc-dev
>> package from multiple architectures. Move headers installed by
>> "make headers_install" accordingly using Debian's tuple from
>> dpkg-architecture.
>>
>> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
>> Reviewed-by: Henning Schild <henning.schild@siemens.com>
>> Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
> I haven't reviewed this version of the patch.

Sorry about that. it was just an awkward way to note your contribution 
to this changeset (for the avoidance of doubt, your feedback is greatly 
appreciated). I'll remove this line for v3

> And this doesn't make a multi-arch package; you will have to add a
> field to the package's control file too.

Will do. Thanks!

Cedric

> Ben.
>
>> ---
>>   scripts/package/builddeb | 8 ++++++++
>>   scripts/package/mkdebian | 4 ++--
>>   2 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
>> index b03dd56a4782..15a034e18c37 100755
>> --- a/scripts/package/builddeb
>> +++ b/scripts/package/builddeb
>> @@ -132,6 +132,14 @@ fi
>>   if [ "$ARCH" != "um" ]; then
>>   	$MAKE -f $srctree/Makefile headers_check
>>   	$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
>> +	if [ -n "$debarch" ]; then
>> +		# move asm headers to /usr/include/<libc-machine>/asm to match the structure
>> +		# used by Debian-based distros (to support multi-arch) but only if ARCH was
>> +		# translated to Debian's (debarch) - this is done by mkdebian
>> +		host_arch=$(dpkg-architecture -a$debarch -qDEB_HOST_MULTIARCH)
>> +		mkdir $libc_headers_dir/usr/include/$host_arch
>> +		mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
>> +	fi
>>   fi
>>   
>>   # Install the maintainer scripts
>> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
>> index 8351584cb24e..8ebcb7d67fd2 100755
>> --- a/scripts/package/mkdebian
>> +++ b/scripts/package/mkdebian
>> @@ -212,11 +212,11 @@ cat <<EOF > debian/rules
>>   srctree ?= .
>>   
>>   build:
>> -	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
>> +	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
>>   	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
>>   
>>   binary-arch:
>> -	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
>> +	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
>>   	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
>>   
>>   clean:

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v3 0/1] builddeb: generate multi-arch friendly linux-libc-dev
  2019-07-04 19:49       ` Ben Hutchings
  2019-07-04 20:28         ` Cedric Hombourger
@ 2019-07-04 20:50         ` Cedric Hombourger
  2019-07-04 20:50           ` [PATCH v3 1/1] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
  1 sibling, 1 reply; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-04 20:50 UTC (permalink / raw)
  To: ben
  Cc: yamada.masahiro, isar-users, michal.lkml, linux-kbuild,
	linux-kernel, riku.voipio, Cedric Hombourger

Changes in v3:

 - add Multi-Arch: same to debian/control for linux-libc-dev

Changes in v2:

 - forward $debarch from mkdebian to builddeb
 - use dpkg-architecture -qDEB_HOST_MULTIARCH instead of $CC -dumpmachine

Cedric Hombourger (1):
  builddeb: generate multi-arch friendly linux-libc-dev package

 scripts/package/builddeb | 8 ++++++++
 scripts/package/mkdebian | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v3 1/1] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-04 20:50         ` [PATCH v3 0/1] builddeb: generate multi-arch friendly linux-libc-dev Cedric Hombourger
@ 2019-07-04 20:50           ` Cedric Hombourger
  2019-07-07  8:58             ` Masahiro Yamada
  0 siblings, 1 reply; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-04 20:50 UTC (permalink / raw)
  To: ben
  Cc: yamada.masahiro, isar-users, michal.lkml, linux-kbuild,
	linux-kernel, riku.voipio, Cedric Hombourger

Debian-based distributions place libc header files in a machine
specific directory (/usr/include/<libc-machine>) instead of
/usr/include/asm to support installation of the linux-libc-dev
package from multiple architectures. Move headers installed by
"make headers_install" accordingly using Debian's tuple from
dpkg-architecture.

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
---
 scripts/package/builddeb | 8 ++++++++
 scripts/package/mkdebian | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index b03dd56a4782..15a034e18c37 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -132,6 +132,14 @@ fi
 if [ "$ARCH" != "um" ]; then
 	$MAKE -f $srctree/Makefile headers_check
 	$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
+	if [ -n "$debarch" ]; then
+		# move asm headers to /usr/include/<libc-machine>/asm to match the structure
+		# used by Debian-based distros (to support multi-arch) but only if ARCH was
+		# translated to Debian's (debarch) - this is done by mkdebian
+		host_arch=$(dpkg-architecture -a$debarch -qDEB_HOST_MULTIARCH)
+		mkdir $libc_headers_dir/usr/include/$host_arch
+		mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
+	fi
 fi
 
 # Install the maintainer scripts
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 8351584cb24e..2d670ae2cabc 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -197,6 +197,7 @@ Architecture: $debarch
 Description: Linux support headers for userspace development
  This package provides userspaces headers from the Linux kernel.  These headers
  are used by the installed headers for GNU glibc and other system libraries.
+Multi-Arch: same
 
 Package: $dbg_packagename
 Section: debug
@@ -212,11 +213,11 @@ cat <<EOF > debian/rules
 srctree ?= .
 
 build:
-	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
+	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
 	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
 
 binary-arch:
-	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
+	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
 	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
 
 clean:
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/1] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-04 20:50           ` [PATCH v3 1/1] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
@ 2019-07-07  8:58             ` Masahiro Yamada
  2019-07-09  7:43               ` [PATCH v4 0/1] builddeb: generate multi-arch friendly linux-libc-dev Cedric Hombourger
  0 siblings, 1 reply; 15+ messages in thread
From: Masahiro Yamada @ 2019-07-07  8:58 UTC (permalink / raw)
  To: Cedric Hombourger
  Cc: Ben Hutchings, isar-users, Michal Marek,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	Riku Voipio

On Fri, Jul 5, 2019 at 5:50 AM Cedric Hombourger
<Cedric_Hombourger@mentor.com> wrote:
>
> Debian-based distributions place libc header files in a machine
> specific directory (/usr/include/<libc-machine>) instead of
> /usr/include/asm to support installation of the linux-libc-dev
> package from multiple architectures. Move headers installed by
> "make headers_install" accordingly using Debian's tuple from
> dpkg-architecture.
>
> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> ---
>  scripts/package/builddeb | 8 ++++++++
>  scripts/package/mkdebian | 5 +++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index b03dd56a4782..15a034e18c37 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -132,6 +132,14 @@ fi
>  if [ "$ARCH" != "um" ]; then
>         $MAKE -f $srctree/Makefile headers_check
>         $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
> +       if [ -n "$debarch" ]; then
> +               # move asm headers to /usr/include/<libc-machine>/asm to match the structure
> +               # used by Debian-based distros (to support multi-arch) but only if ARCH was
> +               # translated to Debian's (debarch) - this is done by mkdebian
> +               host_arch=$(dpkg-architecture -a$debarch -qDEB_HOST_MULTIARCH)
> +               mkdir $libc_headers_dir/usr/include/$host_arch
> +               mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
> +       fi
>  fi
>
>  # Install the maintainer scripts
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index 8351584cb24e..2d670ae2cabc 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -197,6 +197,7 @@ Architecture: $debarch
>  Description: Linux support headers for userspace development
>   This package provides userspaces headers from the Linux kernel.  These headers
>   are used by the installed headers for GNU glibc and other system libraries.
> +Multi-Arch: same
>
>  Package: $dbg_packagename
>  Section: debug
> @@ -212,11 +213,11 @@ cat <<EOF > debian/rules
>  srctree ?= .
>
>  build:
> -       \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
> +       \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
>         KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
>
>  binary-arch:
> -       \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
> +       \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} debarch=${debarch} \
>         KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg


Is there any smarter way (any command) to get debarch
from the builddeb script?

scripts/package/Makefile passes -a flag, like follows:

dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch)
$(DPKG_FLAGS) -b -nc -uc

So, debarch=${debarch} looks somewhat redundant to me.




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v4 0/1] builddeb: generate multi-arch friendly linux-libc-dev
  2019-07-07  8:58             ` Masahiro Yamada
@ 2019-07-09  7:43               ` Cedric Hombourger
  2019-07-09  7:43                 ` [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
  0 siblings, 1 reply; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-09  7:43 UTC (permalink / raw)
  To: yamada.masahiro
  Cc: ben, isar-users, michal.lkml, linux-kbuild, linux-kernel,
	riku.voipio, Cedric Hombourger

Changes in v4 (address comments from Masahiro Yamada)

 - Use arch from debian/arch and no longer forward it from mkdebian to
   builddep since it may be found there
 
Changes in v3 (address comments from Ben Hutchings)

 - add Multi-Arch: same to debian/control for linux-libc-dev
 - forward debarch from mkdebian to sub-processes (builddeb in particular)

Changes in v2 (address comments from Ben Hutchings)

 - forward $debarch from mkdebian to builddeb
 - use dpkg-architecture -qDEB_HOST_MULTIARCH instead of $CC -dumpmachine

Cedric Hombourger (1):
  builddeb: generate multi-arch friendly linux-libc-dev package

 scripts/package/builddeb | 8 ++++++++
 scripts/package/mkdebian | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-09  7:43               ` [PATCH v4 0/1] builddeb: generate multi-arch friendly linux-libc-dev Cedric Hombourger
@ 2019-07-09  7:43                 ` Cedric Hombourger
  2019-07-09 10:20                   ` Enrico Weigelt, metux IT consult
  2019-07-11 14:46                   ` Masahiro Yamada
  0 siblings, 2 replies; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-09  7:43 UTC (permalink / raw)
  To: yamada.masahiro
  Cc: ben, isar-users, michal.lkml, linux-kbuild, linux-kernel,
	riku.voipio, Cedric Hombourger

Debian-based distributions place libc header files in a machine
specific directory (/usr/include/<libc-machine>) instead of
/usr/include/asm to support installation of the linux-libc-dev
package from multiple architectures. Move headers installed by
"make headers_install" accordingly using Debian's tuple from
dpkg-architecture (stored in debian/arch).

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
---
 scripts/package/builddeb | 5 +++++
 scripts/package/mkdebian | 1 +
 2 files changed, 6 insertions(+)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index b03dd56a4782..d5d33bcba1fb 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -132,6 +132,11 @@ fi
 if [ "$ARCH" != "um" ]; then
 	$MAKE -f $srctree/Makefile headers_check
 	$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
+	# move asm headers to /usr/include/<libc-machine>/asm to match the structure
+	# used by Debian-based distros (to support multi-arch)
+	host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
+	mkdir $libc_headers_dir/usr/include/$host_arch
+	mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
 fi
 
 # Install the maintainer scripts
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 8351584cb24e..e0750b70453f 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -197,6 +197,7 @@ Architecture: $debarch
 Description: Linux support headers for userspace development
  This package provides userspaces headers from the Linux kernel.  These headers
  are used by the installed headers for GNU glibc and other system libraries.
+Multi-Arch: same
 
 Package: $dbg_packagename
 Section: debug
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-09  7:43                 ` [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
@ 2019-07-09 10:20                   ` Enrico Weigelt, metux IT consult
  2019-07-11 14:46                   ` Masahiro Yamada
  1 sibling, 0 replies; 15+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-07-09 10:20 UTC (permalink / raw)
  To: Cedric Hombourger, yamada.masahiro
  Cc: ben, isar-users, michal.lkml, linux-kbuild, linux-kernel, riku.voipio

On 09.07.19 09:43, Cedric Hombourger wrote:
> Debian-based distributions place libc header files in a machine
> specific directory (/usr/include/<libc-machine>) instead of
> /usr/include/asm to support installation of the linux-libc-dev
> package from multiple architectures. Move headers installed by
> "make headers_install" accordingly using Debian's tuple from
> dpkg-architecture (stored in debian/arch).

Is it correct the packages currently are not multiarch-compatible ?

If so, your patch would be another step towards completely replacing
the downstream's utterly complex build process :)

I'll give it some test cycles.

thx.

--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-09  7:43                 ` [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
  2019-07-09 10:20                   ` Enrico Weigelt, metux IT consult
@ 2019-07-11 14:46                   ` Masahiro Yamada
  2019-07-14  7:49                     ` Cedric Hombourger
  1 sibling, 1 reply; 15+ messages in thread
From: Masahiro Yamada @ 2019-07-11 14:46 UTC (permalink / raw)
  To: Cedric Hombourger
  Cc: Ben Hutchings, isar-users, Michal Marek,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	Riku Voipio

On Tue, Jul 9, 2019 at 4:44 PM Cedric Hombourger
<Cedric_Hombourger@mentor.com> wrote:
>
> Debian-based distributions place libc header files in a machine
> specific directory (/usr/include/<libc-machine>) instead of
> /usr/include/asm to support installation of the linux-libc-dev
> package from multiple architectures. Move headers installed by
> "make headers_install" accordingly using Debian's tuple from
> dpkg-architecture (stored in debian/arch).
>
> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> ---
>  scripts/package/builddeb | 5 +++++
>  scripts/package/mkdebian | 1 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index b03dd56a4782..d5d33bcba1fb 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -132,6 +132,11 @@ fi
>  if [ "$ARCH" != "um" ]; then
>         $MAKE -f $srctree/Makefile headers_check
>         $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
> +       # move asm headers to /usr/include/<libc-machine>/asm to match the structure
> +       # used by Debian-based distros (to support multi-arch)
> +       host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
> +       mkdir $libc_headers_dir/usr/include/$host_arch
> +       mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
>  fi


I just wondered whether there is something better than $(cat debian/arch),
but maybe not.

OK, I am ready to pick it up for 5.3-rc1.

With Ben's Ack, I would be able to proceed with more confident.





>  # Install the maintainer scripts
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index 8351584cb24e..e0750b70453f 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -197,6 +197,7 @@ Architecture: $debarch
>  Description: Linux support headers for userspace development
>   This package provides userspaces headers from the Linux kernel.  These headers
>   are used by the installed headers for GNU glibc and other system libraries.
> +Multi-Arch: same
>
>  Package: $dbg_packagename
>  Section: debug
> --
> 2.11.0
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package
  2019-07-11 14:46                   ` Masahiro Yamada
@ 2019-07-14  7:49                     ` Cedric Hombourger
  0 siblings, 0 replies; 15+ messages in thread
From: Cedric Hombourger @ 2019-07-14  7:49 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Ben Hutchings, isar-users, Michal Marek,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	Riku Voipio


On 7/11/2019 4:46 PM, Masahiro Yamada wrote:
> On Tue, Jul 9, 2019 at 4:44 PM Cedric Hombourger
> <Cedric_Hombourger@mentor.com> wrote:
>> Debian-based distributions place libc header files in a machine
>> specific directory (/usr/include/<libc-machine>) instead of
>> /usr/include/asm to support installation of the linux-libc-dev
>> package from multiple architectures. Move headers installed by
>> "make headers_install" accordingly using Debian's tuple from
>> dpkg-architecture (stored in debian/arch).
>>
>> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
>> ---
>>   scripts/package/builddeb | 5 +++++
>>   scripts/package/mkdebian | 1 +
>>   2 files changed, 6 insertions(+)
>>
>> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
>> index b03dd56a4782..d5d33bcba1fb 100755
>> --- a/scripts/package/builddeb
>> +++ b/scripts/package/builddeb
>> @@ -132,6 +132,11 @@ fi
>>   if [ "$ARCH" != "um" ]; then
>>          $MAKE -f $srctree/Makefile headers_check
>>          $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
>> +       # move asm headers to /usr/include/<libc-machine>/asm to match the structure
>> +       # used by Debian-based distros (to support multi-arch)
>> +       host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH)
>> +       mkdir $libc_headers_dir/usr/include/$host_arch
>> +       mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/
>>   fi
>
> I just wondered whether there is something better than $(cat debian/arch),
> but maybe not.
>
> OK, I am ready to pick it up for 5.3-rc1.
>
> With Ben's Ack, I would be able to proceed with more confident.

Great thank you. Let me know if I can help clear any remaining concerns 
you may have

>
>
>
>
>>   # Install the maintainer scripts
>> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
>> index 8351584cb24e..e0750b70453f 100755
>> --- a/scripts/package/mkdebian
>> +++ b/scripts/package/mkdebian
>> @@ -197,6 +197,7 @@ Architecture: $debarch
>>   Description: Linux support headers for userspace development
>>    This package provides userspaces headers from the Linux kernel.  These headers
>>    are used by the installed headers for GNU glibc and other system libraries.
>> +Multi-Arch: same
>>
>>   Package: $dbg_packagename
>>   Section: debug
>> --
>> 2.11.0
>>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-07-14  7:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17  6:14 [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
2019-07-04  0:43 ` Masahiro Yamada
2019-07-04 12:39   ` Cedric Hombourger
2019-07-04 13:10   ` Ben Hutchings
2019-07-04 19:42     ` [PATCH v2] " Cedric Hombourger
2019-07-04 19:49       ` Ben Hutchings
2019-07-04 20:28         ` Cedric Hombourger
2019-07-04 20:50         ` [PATCH v3 0/1] builddeb: generate multi-arch friendly linux-libc-dev Cedric Hombourger
2019-07-04 20:50           ` [PATCH v3 1/1] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
2019-07-07  8:58             ` Masahiro Yamada
2019-07-09  7:43               ` [PATCH v4 0/1] builddeb: generate multi-arch friendly linux-libc-dev Cedric Hombourger
2019-07-09  7:43                 ` [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package Cedric Hombourger
2019-07-09 10:20                   ` Enrico Weigelt, metux IT consult
2019-07-11 14:46                   ` Masahiro Yamada
2019-07-14  7:49                     ` Cedric Hombourger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).