Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1121083lqm; Thu, 2 May 2024 06:05:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwRDJmjCihnQzY+xe52zcrHvCc9pozfzPaLe7UNjI0Mw87hhrZCeJEkVm5LUZpsWSL2WZqb6Yj8Kxi0VaImPSJEWeyn3U+Q3vU3MPjeg== X-Google-Smtp-Source: AGHT+IGyhU/dNJeSebmjMyNf5KKQnwN/L+XWcWVTS9dX/F4u6phkqJumngyJLr+ojAhWyWA6bW4h X-Received: by 2002:a05:620a:2590:b0:790:8e96:7816 with SMTP id x16-20020a05620a259000b007908e967816mr2749254qko.61.1714655136225; Thu, 02 May 2024 06:05:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714655136; cv=pass; d=google.com; s=arc-20160816; b=DT2hv/hSqNacL2o7BbnPw1QXzINmx7BFBhEHTKssDL7ifuatTX6SrSBC/YZzOj3cjh QDyUC902ofIZwpLcLagcauI9j+lunHGJWiFgX1n/Hw1iWFg7PxiKXC0v+XJBI1EWozbv jHXPtgfXbm41IhP3b/pt389OVm4RZkYkT8xElSJ8Uctwz3kTOiMS1LHfLXml8UZo5QZZ tPEucKGk6HQ+oZxGbfWoInHu3NmQ7B+uPuf3vJ6GvlHTMbIJo9mQtQz20EAqXGz+ssad zaAogLuVWF/ThWgLByJZicMvdCRzIXrSR0FZm22CAlwrQPKs8ncRSXslM6OORNxyhmig sEsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=yrua0FHuilBaOCi9/C2SfFDGTDuD/t9FPshwugwizK8=; fh=SRtvFWwd+sqGPgfv/ookb9ELYHrjZNQNTpXISbxKi88=; b=jgmTsrlm2MOSra0yq0sUjEofMvY0cEJZwflRNMJv3EeIh6xF8GvJgkmZytgO0/MLCl O+U8Qv/eI5mPwKX3cRrnu49OOHrqhbmXdv90E3bEd5arq6tsfpyg2gy0Ay3CKGLzA/+q 64rVfyUyZ4e8n++8cuCZwom3Th9WA6cW3GY4Zds2TL81ia0m8DgIFtKhWJ4UmDidHBhl 48DNmjNyQMTsce244yoAHqzNH5Ueuoww9mqoGcGaI0ENrVxwJ2v6u7rAQOCu2NLLoDT2 zU/gOVY8qCWF2rCmIcbcvSJ0SKZIfNib5O3dzGEDymdCoHby3gAPTH4a9Nrwtj9b1xI2 CjuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uUuICBZx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h20-20020a05620a401400b0078ede275213si914380qko.720.2024.05.02.06.05.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 06:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uUuICBZx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E53FE1C21E65 for ; Thu, 2 May 2024 13:05:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B4DB83CC3; Thu, 2 May 2024 13:05:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uUuICBZx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29937FBF6; Thu, 2 May 2024 13:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714655128; cv=none; b=T4FXuiyovOrW/CnmqWDByAaDgSq4cAcJO/O9JaIaevxR3fH71/PylhLwqO7BZu723X4gnf9gIi//9bcov0LHH+WABnEDvJSxkw3MP/ZOaS600eD9TYr/VYC3fAQVvu7VlXrcTuZ5J58HlCxM9mol+mm15KqKF8FS3KlwH9O4htc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714655128; c=relaxed/simple; bh=24lhDhrKAOqjfxQn9uac6QTJAcaey1HgCcl8HaFLLV8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=us1xg5088myX9zHKbJ2g1KCaH33ZTUh2M8FSl1r4PnFp3GqXzCOFiYgXncsdnUM1d06SpKbkIudd7q2LNgNYMltd4aQ1ZWZSmypwz3buTVuCieBzByZXJoXsR9kQMJgMylpFjhCE8uU8rAi+2JWopKlrvmGI8mUVR8HLFD+xZ68= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uUuICBZx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5387CC32789; Thu, 2 May 2024 13:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714655127; bh=24lhDhrKAOqjfxQn9uac6QTJAcaey1HgCcl8HaFLLV8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=uUuICBZxZoRJ2T5E7+i0z1uoqU1iDOOYGEp3aKBvHqOyXQn//s575HJ7V7nMBiTXj uwZkkGPyTJMRVqzO72riV04TJkb0vyZwvO5hDZV5toCxU4l+cTt0M2/sZToimHIeKE cnHx3ReCk27nrQDWoBEMBFMcloouhnsPav4uZeESD1wTqPkcipv0VUE39vAT0Wq3fU zRuCGr91QgRh4YUcripfcFiXBJo7VhuXBjSMDIRE3NXnVMPIXIE0pyPykN+sur8gSR It5Sn7o6ba1x7oK4tWI0/5k9edigsAFYmM/niSXUSAbks2xELwUFER3uiQSMpwe6u8 d3fk5mVQagj8A== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Emil Renner Berthing , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Paul Walmsley , Palmer Dabbelt , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Nick Terrell Subject: Re: [PATCH v1 1/3] riscv: make image compression configurable In-Reply-To: <20240502111613.1380453-2-emil.renner.berthing@canonical.com> References: <20240502111613.1380453-1-emil.renner.berthing@canonical.com> <20240502111613.1380453-2-emil.renner.berthing@canonical.com> Date: Thu, 02 May 2024 15:05:24 +0200 Message-ID: <87ttjgcqjv.fsf@all.your.base.are.belong.to.us> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Emil Renner Berthing writes: > Previously the build process would always set KBUILD_IMAGE to the > uncompressed Image file (unless XIP_KERNEL or EFI_ZBOOT was enabled) and > unconditionally compress it into Image.gz. However there are already > build targets for Image.bz2, Image.lz4, Image.lzma, Image.lzo and > Image.zstd, so let's make use of those, make the compression method > configurable and set KBUILD_IMAGE accordingly so that targets like > 'make install' and 'make bindeb-pkg' will use the chosen image. > > Signed-off-by: Emil Renner Berthing > --- > arch/riscv/Kconfig | 7 +++++++ > arch/riscv/Makefile | 43 ++++++++++++++++++++------------------ > arch/riscv/boot/install.sh | 9 +++++--- > 3 files changed, 36 insertions(+), 23 deletions(-) > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index be09c8836d56..6c092d1ea7db 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -138,6 +138,13 @@ config RISCV > select HAVE_GCC_PLUGINS > select HAVE_GENERIC_VDSO if MMU && 64BIT > select HAVE_IRQ_TIME_ACCOUNTING > + select HAVE_KERNEL_BZIP2 if !XIP_KERNEL && !EFI_ZBOOT > + select HAVE_KERNEL_GZIP if !XIP_KERNEL && !EFI_ZBOOT > + select HAVE_KERNEL_LZ4 if !XIP_KERNEL && !EFI_ZBOOT > + select HAVE_KERNEL_LZMA if !XIP_KERNEL && !EFI_ZBOOT > + select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT > + select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT > + select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT > select HAVE_KPROBES if !XIP_KERNEL > select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL > select HAVE_KRETPROBES if !XIP_KERNEL > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile > index 5b3115a19852..29be676415d6 100644 > --- a/arch/riscv/Makefile > +++ b/arch/riscv/Makefile > @@ -129,11 +129,27 @@ endif > CHECKFLAGS +=3D -D__riscv -D__riscv_xlen=3D$(BITS) >=20=20 > # Default target when executing plain make > -boot :=3D arch/riscv/boot > +boot :=3D arch/riscv/boot > ifeq ($(CONFIG_XIP_KERNEL),y) > KBUILD_IMAGE :=3D $(boot)/xipImage > +else ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy) > +KBUILD_IMAGE :=3D $(boot)/loader.bin > +else ifeq ($(CONFIG_EFI_ZBOOT),y) > +KBUILD_IMAGE :=3D $(boot)/vmlinuz.efi > +else ifeq ($(CONFIG_KERNEL_GZIP),y) > +KBUILD_IMAGE :=3D $(boot)/Image.gz > +else ifeq ($(CONFIG_KERNEL_BZIP2),y) > +KBUILD_IMAGE :=3D $(boot)/Image.bz2 > +else ifeq ($(CONFIG_KERNEL_LZ4),y) > +KBUILD_IMAGE :=3D $(boot)/Image.lz4 > +else ifeq ($(CONFIG_KERNEL_LZMA),y) > +KBUILD_IMAGE :=3D $(boot)/Image.lzma > +else ifeq ($(CONFIG_KERNEL_LZO),y) > +KBUILD_IMAGE :=3D $(boot)/Image.lzo > +else ifeq ($(CONFIG_KERNEL_ZSTD),y) > +KBUILD_IMAGE :=3D $(boot)/Image.zst > else > -KBUILD_IMAGE :=3D $(boot)/Image.gz > +KBUILD_IMAGE :=3D $(boot)/Image > endif Really a nit/change if you want, but maybe doing something like arch/s390/boot/Makefile does is easier to read: diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 024482c68835..70f08e9999b4 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -128,6 +128,14 @@ endif # arch specific predefines for sparse CHECKFLAGS +=3D -D__riscv -D__riscv_xlen=3D$(BITS) =20 +suffix-$(CONFIG_KERNEL_GZIP) :=3D .gz +suffix-$(CONFIG_KERNEL_BZIP2) :=3D .bz2 +suffix-$(CONFIG_KERNEL_LZ4) :=3D .lz4 +suffix-$(CONFIG_KERNEL_LZMA) :=3D .lzma +suffix-$(CONFIG_KERNEL_LZO) :=3D .lzo +suffix-$(CONFIG_KERNEL_XZ) :=3D .xz +suffix-$(CONFIG_KERNEL_ZSTD) :=3D .zst + # Default target when executing plain make boot :=3D arch/riscv/boot ifeq ($(CONFIG_XIP_KERNEL),y) @@ -136,20 +144,8 @@ else ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN)= ,yy) KBUILD_IMAGE :=3D $(boot)/loader.bin else ifeq ($(CONFIG_EFI_ZBOOT),y) KBUILD_IMAGE :=3D $(boot)/vmlinuz.efi -else ifeq ($(CONFIG_KERNEL_GZIP),y) -KBUILD_IMAGE :=3D $(boot)/Image.gz -else ifeq ($(CONFIG_KERNEL_BZIP2),y) -KBUILD_IMAGE :=3D $(boot)/Image.bz2 -else ifeq ($(CONFIG_KERNEL_LZ4),y) -KBUILD_IMAGE :=3D $(boot)/Image.lz4 -else ifeq ($(CONFIG_KERNEL_LZMA),y) -KBUILD_IMAGE :=3D $(boot)/Image.lzma -else ifeq ($(CONFIG_KERNEL_LZO),y) -KBUILD_IMAGE :=3D $(boot)/Image.lzo -else ifeq ($(CONFIG_KERNEL_ZSTD),y) -KBUILD_IMAGE :=3D $(boot)/Image.zst else -KBUILD_IMAGE :=3D $(boot)/Image +KBUILD_IMAGE :=3D $(boot)/Image$(suffix-y) endif Bj=C3=B6rn