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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED9C5C433F5 for ; Mon, 7 Feb 2022 23:04:03 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 805BA8306E; Tue, 8 Feb 2022 00:04:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="dwLOuSad"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BC5508306E; Tue, 8 Feb 2022 00:03:59 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 69EEF81DD6 for ; Tue, 8 Feb 2022 00:03:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E602F60B2D; Mon, 7 Feb 2022 23:03:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0470EC004E1; Mon, 7 Feb 2022 23:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644275034; bh=421TU8GpJJkGpUlHKwOE6eRg35SlF1nHmezYnCy1zJA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dwLOuSadg/QdsRO1XRVIQnMwvSjlZk7bozwNE4Xgr9GQfL93YwaHT9jy4/WYMAONW 6jyrvPDp/1QBxzDf9IaZ3rvrz8YP7XkW1NFHquNM9X4OSxDYYgiaCc4w8tprYCHlzC xwEO/RY7X/f4BK42UKlxjKy0qZdcqxx2y7/cHMZWJwp97SUc2Nc0xQvdosjuTl/2UM 9pcqWlV42o93w2zTcIvKvnFBUDZwhZmgAnmPho8kbmSqbtob1F6a61Ic8XQtPo4z4e eesemqSXMUyHgeukKl/lQGC5bFQQiSmNMwdb5jqCvYdP/GL5G+/VOEvV+RH7devW3l 1WVVe+1UOSk9A== Received: by pali.im (Postfix) id 1A9DD1034; Tue, 8 Feb 2022 00:03:51 +0100 (CET) Date: Tue, 8 Feb 2022 00:03:50 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Rogier Stam Cc: u-boot@lists.denx.de, sr@denx.de, Marek =?utf-8?B?QmVow7pu?= Subject: Re: [PATCH] U-Boot ENV in EXT4 support for Espressobin Message-ID: <20220207230350.qdzr7mvpixrhg3da@pali> References: <7dc41f20-1058-3c30-cd22-334b05733a7f@unrailed.org> <69c75dcd-c9e6-4869-b4de-f21e27e7e93e@unrailed.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <69c75dcd-c9e6-4869-b4de-f21e27e7e93e@unrailed.org> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Monday 07 February 2022 23:56:25 Rogier Stam wrote: > Hi > > Per Pali's comments adapted the patch. This one also includes the changes > necessary for storing ENV in FAT. I also added CONFIG_SCSI for both ext4 and > fat should anyone want to use SCSI instead of AHCI. > > Regards > > Rogier > > On 07-02-2022 09:11, Rogier Stam wrote: > > Hi > > > > I was attemting to boot from SATA on an Espressobin. As such I wanted to > > store the Environment in a SATA partition and not in the SPI flash. In > > order to get this running I had to make a few changes, as the original > > code assumes the Environment is always in SPI flash. Additionally I also > > had to force scsci_scan to ensure the AHCI disk / partitions could be > > found. > > > > Hope it will be considered to merge > > > > Regards > > > > Rogier Stam > > + Marek > From e2c1b825700b6356b8b0758dcbe8c3c64bd79805 Mon Sep 17 00:00:00 2001 > From: Rogier Stam > Date: Mon, 31 Jan 2022 23:06:19 +0100 > Subject: [PATCH] Fix Espressobin build for configs where ENV is not in SPI > > When storing the UBoot Environment in for example EXT4, > the U-Boot build is broken for several reasons: > 1. armada-385-turris-omnia-u-boot.dtsi will not allow > CONFIG_ENV_OFFSET and CONFIG_ENV_SIZE to be undefined > 2. armada-37xx/board.c ft_board_setup function does not > exist if CONFIG_ENV_IS_IN_SPI_FLASH is not defined > 3. When defining CONFIG_ENV_IS_IN_EXT4 and using AHCI > SCSI scan is not performed and hence the partition on > AHCI is not available when the environment is loaded. > 4. Same for CONFIG_ENV_IS_IN_FAT and using AHCI. SCSI > scan is not performed. > > This change fixes these 4 points so that the UBoot config > can be on a AHCI (SATA) drive partition instead of > enforced in SPI flash. > > Signed-off-by: Rogier Stam Reviewed-by: Pali Rohár > --- > arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi | 2 ++ > board/Marvell/mvebu_armada-37xx/board.c | 4 +++- > env/ext4.c | 5 +++++ > env/fat.c | 5 +++++ > 4 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi b/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi > index 3ff76c9..008787e 100644 > --- a/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi > +++ b/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi > @@ -38,6 +38,7 @@ > }; > }; > > +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH > &spi0 { > u-boot,dm-pre-reloc; > > @@ -56,6 +57,7 @@ > }; > }; > }; > +#endif > > &uart0 { > u-boot,dm-pre-reloc; > diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c > index d7b6eca..5bace0c 100644 > --- a/board/Marvell/mvebu_armada-37xx/board.c > +++ b/board/Marvell/mvebu_armada-37xx/board.c > @@ -328,9 +328,10 @@ int board_network_enable(struct mii_dev *bus) > return 0; > } > > -#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_ENV_IS_IN_SPI_FLASH) > +#ifdef CONFIG_OF_BOARD_SETUP > int ft_board_setup(void *blob, struct bd_info *bd) > { > +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH > int ret; > int spi_off; > int parts_off; > @@ -424,6 +425,7 @@ int ft_board_setup(void *blob, struct bd_info *bd) > return 0; > } > > +#endif > return 0; > } > #endif > diff --git a/env/ext4.c b/env/ext4.c > index 9f65afb..47e05a4 100644 > --- a/env/ext4.c > +++ b/env/ext4.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > #include > > DECLARE_GLOBAL_DATA_PTR; > @@ -146,6 +147,10 @@ static int env_ext4_load(void) > if (!strcmp(ifname, "mmc")) > mmc_initialize(NULL); > #endif > +#if defined(CONFIG_AHCI) || defined(CONFIG_SCSI) > + if (!strcmp(ifname, "scsi")) > + scsi_scan(true); > +#endif > > part = blk_get_device_part_str(ifname, dev_and_part, > &dev_desc, &info, 1); > diff --git a/env/fat.c b/env/fat.c > index fdccd6c..dbd6a13 100644 > --- a/env/fat.c > +++ b/env/fat.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -122,6 +123,10 @@ static int env_fat_load(void) > if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc")) > mmc_initialize(NULL); > #endif > +#if defined(CONFIG_AHCI) || defined(CONFIG_SCSI) > + if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "scsi")) > + scsi_scan(true); > +#endif > > part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE, > env_fat_device_and_part(), > -- > 2.7.4 >