From patchwork Wed Oct 10 22:23:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 10635381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A1CA17E3 for ; Wed, 10 Oct 2018 22:23:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B8D22890E for ; Wed, 10 Oct 2018 22:23:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89C362AD56; Wed, 10 Oct 2018 22:23:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F32E02AD53 for ; Wed, 10 Oct 2018 22:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725969AbeJKFrx (ORCPT ); Thu, 11 Oct 2018 01:47:53 -0400 Received: from mail.skyhub.de ([5.9.137.197]:34070 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725968AbeJKFrw (ORCPT ); Thu, 11 Oct 2018 01:47:52 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LMuHKKZiHjwZ; Thu, 11 Oct 2018 00:23:40 +0200 (CEST) Received: from zn.tnic (p200300EC2BCA7500329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bca:7500:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id F2F771EC0104; Thu, 11 Oct 2018 00:23:39 +0200 (CEST) From: Borislav Petkov To: LKML Cc: Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org Subject: [PATCH] kbuild: Fail the build early when no lz4 present Date: Thu, 11 Oct 2018 00:23:33 +0200 Message-Id: <20181010222333.17794-1-bp@alien8.de> X-Mailer: git-send-email 2.19.0.271.gfe8321ec057f MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Borislav Petkov When building randconfigs, the build fails at kernel compression stage due to missing lz4 on the system but CONFIG_KERNEL_LZ4 has been selected by randconfig. The result looks somethins like this: (cat arch/x86/boot/compressed/vmlinux.bin arch/x86/boot/compressed/vmlinux.relocs | lz4c -l -c1 stdin stdout && printf \334\141\301\001) > arch/x86/boot/compressed/vmlinux.bin.lz4 || (rm -f arch/x86/boot/compressed/vmlinux.bin.lz4 ; false) /bin/sh: 1: lz4c: not found make[2]: *** [arch/x86/boot/compressed/Makefile:143: arch/x86/boot/compressed/vmlinux.bin.lz4] Error 1 make[1]: *** [arch/x86/boot/Makefile:112: arch/x86/boot/compressed/vmlinux] Error 2 make: *** [arch/x86/Makefile:290: bzImage] Error 2 Fail the build much earlier by checking for lz4c presence before doing anything else. Signed-off-by: Borislav Petkov Cc: Masahiro Yamada Cc: Michal Marek Cc: linux-kbuild@vger.kernel.org --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index a0c32de80482..f91de649234b 100644 --- a/Makefile +++ b/Makefile @@ -788,6 +788,12 @@ KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections LDFLAGS_vmlinux += --gc-sections endif +ifdef CONFIG_KERNEL_LZ4 +ifeq ($(CONFIG_SHELL which lz4c),) +$(error "lz4 tool not found on this system but CONFIG_KERNEL_LZ4 enabled") +endif +endif + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)