[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc549efcd078fdefafc12442b08ae7ceaa197eb9.camel@mailbox.org>
Date: Thu, 24 Apr 2025 12:22:32 +0200
From: Philipp Stanner <phasta@...lbox.org>
To: Ard Biesheuvel <ardb+git@...gle.com>, linux-kernel@...r.kernel.org
Cc: x86@...nel.org, Ard Biesheuvel <ardb@...nel.org>, phasta@...nel.org
Subject: Re: [PATCH] x86/boot: Work around broken busybox truncate tool
Thank you very much for this fix :)
On Thu, 2025-04-24 at 12:19 +0200, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
>
> The GNU coreutils version of truncate, which is the original, accepts
> a
> % prefix for the -s size argument which means the file in question
> should be padded to a multiple of the given size. This is currently
> used
> to pad the setup block of bzImage to a multiple of 4k before
> appending
> the decompressor.
>
> busybux reimplements truncate but does not support this idiom, and
typo, busybox.
> therefore fails the build since commit
>
> 9c54baab4401 ("x86/boot: Drop CRC-32 checksum and the build tool
> that generates it")
Should this be marked as an official bug?
If so, I'd put this as a Fixes: tag below.
>
> Work around this by avoiding truncate altogether, and relying on dd
> to
> perform the padding.
>
> Reported-by: <phasta@...nel.org>
Tested-by: Philipp Stanner <phasta@...nel.org>
Thx,
P.
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
> ---
> I personally think using a busybox environment for building the
> kernel
> is a terrible idea, and does not satisfy the build tool requirements
> listed in the documentation. But apparently, it used to work and now
> it
> doesn't, and the workaround is rather straight-forward.
>
> IOW, I don't care whether this gets applied or not, so I will leave
> it
> to others to make the argument.
>
> arch/x86/boot/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
> index 81f55da81967..640fcac3af74 100644
> --- a/arch/x86/boot/Makefile
> +++ b/arch/x86/boot/Makefile
> @@ -59,7 +59,7 @@ KBUILD_CFLAGS += $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
> $(obj)/bzImage: asflags-y := $(SVGA_MODE)
>
> quiet_cmd_image = BUILD $@
> - cmd_image = cp $< $@; truncate -s %4K $@; cat
> $(obj)/vmlinux.bin >>$@
> + cmd_image = (dd if=$< bs=4k conv=sync status=none; cat
> $(filter-out $<,$(real-prereqs))) >$@
>
> $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin FORCE
> $(call if_changed,image)
Powered by blists - more mailing lists