Re: [PATCH] kbuild: buildtar: Add arm support

From: Nathan Chancellor
Date: Wed Apr 10 2024 - 13:08:34 EST


Hi Calvin,

Thanks for the patch!

On Tue, Apr 09, 2024 at 10:17:07AM -0700, Calvin Owens wrote:
> Make 'make tar-pkg' and friends work on 32-bit arm.
>
> Signed-off-by: Calvin Owens <calvin@xxxxxxxxxx>

Technically speaking, buildtar works for 32-bit ARM right now (I use it
almost daily), this is just explicitly adding it to the supported list
to avoid the warning and putting zImage at vmlinuz-${KERNELRELEASE}
instead of vmlinux-kbuild-${KERNELRELEASE}, right?

That said, looks mostly fine to me, one comment below.

Before:

'./System.map' -> 'tar-install/boot/System.map-6.9.0-rc3-00023-g2c71fdf02a95'
'.config' -> 'tar-install/boot/config-6.9.0-rc3-00023-g2c71fdf02a95'
'./vmlinux' -> 'tar-install/boot/vmlinux-6.9.0-rc3-00023-g2c71fdf02a95'
'arch/arm/boot/zImage' -> 'tar-install/boot/vmlinux-kbuild-6.9.0-rc3-00023-g2c71fdf02a95'

** ** ** WARNING ** ** **

Your architecture did not define any architecture-dependent files
to be placed into the tarball. Please add those to scripts/package/buildtar ...

After:

'./System.map' -> 'tar-install/boot/System.map-6.9.0-rc3-00023-g2c71fdf02a95-dirty'
'.config' -> 'tar-install/boot/config-6.9.0-rc3-00023-g2c71fdf02a95-dirty'
'./vmlinux' -> 'tar-install/boot/vmlinux-6.9.0-rc3-00023-g2c71fdf02a95-dirty'
'./arch/arm/boot/zImage' -> 'tar-install/boot/vmlinuz-6.9.0-rc3-00023-g2c71fdf02a95-dirty'

and the location of zImage is the only thing that changes as expected.

> ---
> scripts/package/buildtar | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/scripts/package/buildtar b/scripts/package/buildtar
> index 72c91a1b832f..0939f9eabbf2 100755
> --- a/scripts/package/buildtar
> +++ b/scripts/package/buildtar
> @@ -101,6 +101,9 @@ case "${ARCH}" in
> fi
> done
> ;;
> + arm)
> + [ -f "${objtree}/arch/arm/boot/zImage" ] && cp -v -- "${objtree}/arch/arm/boot/zImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"

While it probably does not matter too much, it would be more proper to
make this

[ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"

as the current line does not work with CONFIG_XIP_KERNEL=y, since zImage
does not exist (KBUILD_IMAGE is arch/arm/boot/xipImage with this
configuration)

$ ls arch/arm/boot
compressed dts xipImage

resulting in buildtar failing because

[ -f "${objtree}/arch/arm/boot/zImage" ]

fails and is the last statement that runs in the script (and the tar
package is not really complete in this configuration anyways).

Prior to this change, the correct image would get placed into the
tarball.

'arch/arm/boot/xipImage' -> 'tar-install/boot/vmlinux-kbuild-6.9.0-rc3-00023-g2c71fdf02a95'

> + ;;
> *)
> [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
> echo "" >&2
> --
> 2.39.2
>

Cheers,
Nathan