2019-06-17 06:16:15

by Cedric Hombourger

[permalink] [raw]
Subject: [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package

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 <[email protected]>
Reviewed-by: Henning Schild <[email protected]>
---
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


2019-07-04 00:44:32

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package

CCed a couple of people.

On Mon, Jun 17, 2019 at 3:15 PM Cedric Hombourger
<[email protected]> 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 <[email protected]>
> Reviewed-by: Henning Schild <[email protected]>
> ---
> 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

2019-07-04 12:39:56

by Cedric Hombourger

[permalink] [raw]
Subject: Re: [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package

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
> <[email protected]> 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 <[email protected]>
>> Reviewed-by: Henning Schild <[email protected]>
>> ---
>> 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?
>
>

2019-07-04 13:10:52

by Ben Hutchings

[permalink] [raw]
Subject: Re: [PATCH] builddeb: generate multi-arch friendly linux-libc-dev package

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
> <[email protected]> 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 <[email protected]>
> > Reviewed-by: Henning Schild <[email protected]>
> > ---
> > 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.


Attachments:
signature.asc (849.00 B)
This is a digitally signed message part

2019-07-04 19:43:19

by Cedric Hombourger

[permalink] [raw]
Subject: [PATCH v2] builddeb: generate multi-arch friendly linux-libc-dev package

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 <[email protected]>
Reviewed-by: Henning Schild <[email protected]>
Reviewed-by: Ben Hutchings <[email protected]>
---
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

2019-07-04 20:16:05

by Ben Hutchings

[permalink] [raw]
Subject: Re: [PATCH v2] builddeb: generate multi-arch friendly linux-libc-dev package

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 <[email protected]>
> Reviewed-by: Henning Schild <[email protected]>
> Reviewed-by: Ben Hutchings <[email protected]>

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.



Attachments:
signature.asc (849.00 B)
This is a digitally signed message part

2019-07-04 20:45:40

by Cedric Hombourger

[permalink] [raw]
Subject: Re: [PATCH v2] builddeb: generate multi-arch friendly linux-libc-dev package

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 <[email protected]>
>> Reviewed-by: Henning Schild <[email protected]>
>> Reviewed-by: Ben Hutchings <[email protected]>
> 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:

2019-07-04 20:51:39

by Cedric Hombourger

[permalink] [raw]
Subject: [PATCH v3 0/1] builddeb: generate multi-arch friendly linux-libc-dev

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

2019-07-04 20:52:52

by Cedric Hombourger

[permalink] [raw]
Subject: [PATCH v3 1/1] builddeb: generate multi-arch friendly linux-libc-dev package

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 <[email protected]>
---
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

2019-07-07 09:01:50

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] builddeb: generate multi-arch friendly linux-libc-dev package

On Fri, Jul 5, 2019 at 5:50 AM Cedric Hombourger
<[email protected]> 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 <[email protected]>
> ---
> 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

2019-07-09 07:51:02

by Cedric Hombourger

[permalink] [raw]
Subject: [PATCH v4 0/1] builddeb: generate multi-arch friendly linux-libc-dev

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

2019-07-09 07:52:16

by Cedric Hombourger

[permalink] [raw]
Subject: [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package

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 <[email protected]>
---
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

Subject: Re: [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package

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
[email protected] -- +49-151-27565287

2019-07-11 14:59:11

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package

On Tue, Jul 9, 2019 at 4:44 PM Cedric Hombourger
<[email protected]> 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 <[email protected]>
> ---
> 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

2019-07-14 07:53:30

by Cedric Hombourger

[permalink] [raw]
Subject: Re: [PATCH v4] builddeb: generate multi-arch friendly linux-libc-dev package


On 7/11/2019 4:46 PM, Masahiro Yamada wrote:
> On Tue, Jul 9, 2019 at 4:44 PM Cedric Hombourger
> <[email protected]> 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 <[email protected]>
>> ---
>> 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
>>
>