From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3309C3DA59 for ; Mon, 15 Jul 2024 12:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oM9D4hMQVS6bw2G11do2r9/ppa6gO+sAbGbns0UuvZQ=; b=jZ9HGtLU59f2eSS6ggRsQRCV7r Av/qz4UlNk/0+7y1C1E/AG8bxkk4+mzJbI7MY2ygAEFRevBa57ohp2LW+efYTaxDvKoB1ZuAn39rt Kh7Z+NDJNifa7OP0ucShd6eHeHzlbr9MiEENO6HAdoOKBkNIIonRXudOlmj6yEieoocHVanhnhjO3 SENXxrVQ1HjI24PXPmcPR0o3M+qHmuFri/kFlRMHssKgUllBgJmcR0G8eoydVDvjlXkjbBT6MbOkP 6T8dGea17U+jUXTF+a4S0eqRkAuTj0/qvRqdF1zgEVs9Y7BaqRcm+Z11gEkA0p1xYqFfCFtfbDBFN jiM6Lc5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTKWw-00000006xho-2cbG; Mon, 15 Jul 2024 12:10:10 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTKWd-00000006xfG-0t7R for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 12:09:52 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 09CA1DA7; Mon, 15 Jul 2024 05:10:15 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 298643F73F; Mon, 15 Jul 2024 05:09:49 -0700 (PDT) Date: Mon, 15 Jul 2024 13:09:43 +0100 From: Mark Rutland To: Akos Denke Cc: linux-arm-kernel@lists.infradead.org Subject: Re: [boot-wrapper-aarch64 PATCH] configure: Do not force kernel-dir as a mandatory input Message-ID: References: <20240523114931.2093222-1-akos.denke@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240523114931.2093222-1-akos.denke@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_050951_363240_ACBD616F X-CRM114-Status: GOOD ( 34.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Thu, May 23, 2024 at 01:49:31PM +0200, Akos Denke wrote: > kernel-dir was required to fulfill the real dependencies: > * kernel image > * dtc > * dtb > > There are already checks for all of these real dependencies, so passing > the `--with-kernel-dir` does not need to be mandatory, in the case these > dependencies are provided separately. > > An autoconf `--with-kernel-image` argument was added which allows to > specify the image with its exact location. > The `dtc` can be already provided via the PATH variable, whilst we > already have a `--with-dtb` argument to pass a specific `dtb` file. > These facts together deprecates the mandatoriness of kernel-dir and > allows to provide any arbitrary kernel image, with dtb, dtc and > initramfs, without a need for an assumed kernel directory structure. > > This makes the boot-wrapper building easier for prebuilt kernels, where > we do not control the directory structure of the kernel artifacts. > > Signed-off-by: Akos Denke > --- > configure.ac | 21 ++++++++++++--------- > 1 file changed, 12 insertions(+), 9 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 9e3b722..768506f 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -27,14 +27,18 @@ AS_IF([test "x$BOOTWRAPPER_ES" = x32 -a "x$KERNEL_ES" != x32], > > # Allow a user to pass --with-kernel-dir > AC_ARG_WITH([kernel-dir], > - AS_HELP_STRING([--with-kernel-dir], [specify the root Linux kernel build directory (required)]), > - AC_SUBST([KERN_DIR], [$withval]), > - AC_MSG_ERROR([No kernel directory specified. Use --with-kernel-dir])) > + AS_HELP_STRING([--with-kernel-dir], [specify the root Linux kernel build directory]), > + AC_SUBST([KERN_DIR], [$withval])) > AS_IF([test "x$KERNEL_ES" = x32], > [KERN_IMAGE=$KERN_DIR/arch/arm/boot/zImage], > [KERN_IMAGE=$KERN_DIR/arch/arm64/boot/Image]) > KERN_DTB=$KERN_DIR/arch/arm64/boot/dts/arm/fvp-base-revc.dtb > > +# Allow a user to pass a specific kernel image file > +AC_ARG_WITH([kernel-image], > + AS_HELP_STRING([--with-kernel-image], [specify kernel image]), > + AC_SUBST([KERN_IMAGE], [$withval])) > + > # Allow the user to override the default DTB > AC_ARG_WITH([dtb], > AS_HELP_STRING([--with-dtb], [Specify a particular DTB to use]), > @@ -52,11 +56,6 @@ AS_IF([test "x$X_IMAGE" == "x"], [], > AC_SUBST([XEN_IMAGE], [$X_IMAGE]) > AM_CONDITIONAL([XEN], [test "x$X_IMAGE" != "x"]) > > -# Ensure that the user has provided us with a sane kernel dir. > -if ! test -d $KERN_DIR; then > - AC_MSG_ERROR([Could not find Linux kernel dir: $KERN_DIR.]) > -fi With this gone, if the user doesn't pass '--with-kernel-dir', the defaults for KERN_IMAGE and KERN_DTB end up being absolute paths: /arch/arm64/boot/Image (or /arch/arm/boot/zImage) /arch/arm64/boot/dts/arm/fvp-base-revc.dtb It would be nice if there could be an error message when: * Neither '--with-kernel-dir' nor '--with-kernel-image' are specified. * Neither '--with-kernel-dir' nor '--with-dtb' are specified. > - > AC_MSG_CHECKING([whether DTB file exists]) > if ! test -f $KERN_DTB; then > AC_MSG_RESULT([no]) > @@ -126,7 +125,7 @@ AC_PROG_SED > AC_PROG_LN_S > AC_PATH_PROG([DTC], dtc, error, [$PATH$PATH_SEPARATOR$KERN_DIR/scripts/dtc]) > if test "x$DTC" = "xerror"; then > - AC_MSG_ERROR([cannot find the device tree compiler (dtc)]) > + AC_MSG_ERROR([cannot find the device tree compiler (dtc). Use --with-kernel-dir or put dtc on the PATH]) > fi > AC_CHECK_TOOL(LD, ld) This looks good. > > @@ -139,8 +138,12 @@ echo "" > echo " Boot wrapper configuration" > echo " ==========================" > echo "" > +if test "x${KERN_DIR}" != "x"; then > echo " Linux kernel build dir: ${KERN_DIR}" > +fi I'f prefer if we make this unconditional: echo " Linux kernel build dir: ${KERN_DIR:-NONE}" ... since that'll make unintentional absence of the option a bit more obvious, and easier to debug. I've tried to fix that up as below; could you please check that this works for you? Mark. ---->8---- >From f9ad9d640a06fdc2c2ca85d977131b8a504d045d Mon Sep 17 00:00:00 2001 From: Akos Denke Date: Thu, 23 May 2024 13:49:31 +0200 Subject: [PATCH] configure: make --with-kernel-dir optional Currently it is mandatory to specify the kernel directory via --with-kernel-dir, and this is used to generate default paths for the kernel image, dtb, and dtc. All of these paths can all be provided by the user, e.g. the kernel image path can be provided by --with-kernel-image, and an alternative dtc can be added to $PATH. When all of these are provided by the user, there's no real need for the kernel directory. Drop the requirement for --with-kernel-dir when other paths are provided explicitly. This makes it easier to use the boot-wrapper with prebuilt kernels, where we do not control the directory structure of the kernel artifacts. Signed-off-by: Akos Denke Reviewed-by: Andre Przywara Signed-off-by: Mark Rutland [Mark: simplify commit message, rework option parsing, always log kernel dir] Link: https://lore.kernel.org/r/20240523114931.2093222-1-akos.denke@arm.com --- configure.ac | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 9e3b722..ce41dae 100644 --- a/configure.ac +++ b/configure.ac @@ -27,18 +27,33 @@ AS_IF([test "x$BOOTWRAPPER_ES" = x32 -a "x$KERNEL_ES" != x32], # Allow a user to pass --with-kernel-dir AC_ARG_WITH([kernel-dir], - AS_HELP_STRING([--with-kernel-dir], [specify the root Linux kernel build directory (required)]), + AS_HELP_STRING([--with-kernel-dir], [specify the root Linux kernel build directory]), AC_SUBST([KERN_DIR], [$withval]), - AC_MSG_ERROR([No kernel directory specified. Use --with-kernel-dir])) -AS_IF([test "x$KERNEL_ES" = x32], - [KERN_IMAGE=$KERN_DIR/arch/arm/boot/zImage], - [KERN_IMAGE=$KERN_DIR/arch/arm64/boot/Image]) -KERN_DTB=$KERN_DIR/arch/arm64/boot/dts/arm/fvp-base-revc.dtb + AC_MSG_NOTICE([Kernel dir not specified]) +) + +# Allow a user to pass a specific kernel image file +AC_ARG_WITH([kernel-image], + AS_HELP_STRING([--with-kernel-image], [specify kernel image]), + AC_SUBST([KERN_IMAGE], [$withval]), + AS_IF([test "x$KERN_DIR" != "x"], + AS_IF([test "x$KERNEL_ES" = x32], + [KERN_IMAGE=$KERN_DIR/arch/arm/boot/zImage], + [KERN_IMAGE=$KERN_DIR/arch/arm64/boot/Image] + ), + AC_MSG_ERROR([No kernel image specified. Use --with-kernel-image or --with-kernel-dir]) + ) +) # Allow the user to override the default DTB AC_ARG_WITH([dtb], AS_HELP_STRING([--with-dtb], [Specify a particular DTB to use]), - [KERN_DTB="$withval"]) + [KERN_DTB="$withval"], + AS_IF([test "x$KERN_DIR" != "x"], + [KERN_DTB=$KERN_DIR/arch/arm64/boot/dts/arm/fvp-base-revc.dtb], + AC_MSG_ERROR([No DTB specified. Use --with-dtb or --with-kernel-dir]) + ) +) AC_ARG_WITH([xen], AS_HELP_STRING([--with-xen], [Compile for Xen, and specify a particular Xen to use]), @@ -52,11 +67,6 @@ AS_IF([test "x$X_IMAGE" == "x"], [], AC_SUBST([XEN_IMAGE], [$X_IMAGE]) AM_CONDITIONAL([XEN], [test "x$X_IMAGE" != "x"]) -# Ensure that the user has provided us with a sane kernel dir. -if ! test -d $KERN_DIR; then - AC_MSG_ERROR([Could not find Linux kernel dir: $KERN_DIR.]) -fi - AC_MSG_CHECKING([whether DTB file exists]) if ! test -f $KERN_DTB; then AC_MSG_RESULT([no]) @@ -126,7 +136,7 @@ AC_PROG_SED AC_PROG_LN_S AC_PATH_PROG([DTC], dtc, error, [$PATH$PATH_SEPARATOR$KERN_DIR/scripts/dtc]) if test "x$DTC" = "xerror"; then - AC_MSG_ERROR([cannot find the device tree compiler (dtc)]) + AC_MSG_ERROR([cannot find the device tree compiler (dtc). Use --with-kernel-dir or put dtc on the PATH]) fi AC_CHECK_TOOL(LD, ld) @@ -139,8 +149,10 @@ echo "" echo " Boot wrapper configuration" echo " ==========================" echo "" -echo " Linux kernel build dir: ${KERN_DIR}" +echo " Linux kernel build dir: ${KERN_DIR:-NONE}" +echo " Linux kernel image: ${KERN_IMAGE}" echo " Device tree blob: ${KERN_DTB}" +echo " Device tree compiler: ${DTC}" echo " Linux kernel command line: ${CMDLINE}" echo " Embedded initrd: ${FILESYSTEM:-NONE}" echo " Use PSCI? ${USE_PSCI}" -- 2.30.2