Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp780514ybv; Wed, 19 Feb 2020 09:06:02 -0800 (PST) X-Google-Smtp-Source: APXvYqx9cXym+bvXgU4eEKjVi5PEvoVJwCA6JXSR5yWoZiQlOWFp8r5ztzVVP1Re6l7zluTTSEE+ X-Received: by 2002:a54:4e96:: with SMTP id c22mr5542199oiy.110.1582131962564; Wed, 19 Feb 2020 09:06:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582131962; cv=none; d=google.com; s=arc-20160816; b=nbZU+iMs7JDrRqqbH88o7JqcWPm8kiKak85Z+k1wAGHOpBMrUQ1GM1MwR8G+VEAjdL Gm01oZy9fyLMhBTh4jxT8sDEdEnjSDth7xs+r2khh8PAsU0E52YpfjQuwiVCW1o6NHy9 MlPM+P6P5E1q1J/Xs5p7SzJ/S/d87QgmnLu/LmVLNEDCXFoG4qATmKSRne8r36qPYOrl /FC/dcOVh16YyV5i57DBrgGg1mxXlFvpf9JaW8gjOPcj7vRun4F7zsXvPxGAN9aLJTZk McufYLI4H4z3s91C47+B/k7NjfxPrMm+RxXpQAIRWvPDPj4+QM/4XGp5OqtQQ4uCJaT6 rGvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=LGyUz6Pu11OunuiIU2Lhf/TDvr85qTaMa/s6DipyefI=; b=oRC8+L8/DGkjCM9B39aCbFOkCpHukVg+PZqAXwLPg/9CTuHXCDXH6nJtzvnMEudSza 1w7HT86EYV7hJQDHxCZke6Co45Py+e/2E8v6q7adcODhcv8uDSEEuJh4nsYarZvOFOx2 v0hIFknBJ9ZG/wj97cqWhdJqG7jH4tGc94Bmbf0bBEDRXWoiR0WkQf6TLGz3WtERHbOC BItozBmqEUvhGSJFQprzInoPQ2own4BZI83+EeccIFa9GYcE5SMZr2Ibu64/Z8/fLtGb 6258K+cD7wIoalIYkXDS/J9gItcvq9srFkKAFcRpLytKEhPb4uiOBVKO1VHouDDfVaoS R3PQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si160005otk.196.2020.02.19.09.05.48; Wed, 19 Feb 2020 09:06:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726817AbgBSRF3 (ORCPT + 99 others); Wed, 19 Feb 2020 12:05:29 -0500 Received: from avon.wwwdotorg.org ([104.237.132.123]:33014 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbgBSRF3 (ORCPT ); Wed, 19 Feb 2020 12:05:29 -0500 X-Greylist: delayed 331 seconds by postgrey-1.27 at vger.kernel.org; Wed, 19 Feb 2020 12:05:28 EST Received: from [10.20.204.51] (unknown [216.228.112.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPSA id 7C4F21C092D; Wed, 19 Feb 2020 09:59:55 -0700 (MST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.1 at avon.wwwdotorg.org Subject: Re: [PATCH v1] partitions/efi: Add 'gpt_sector' kernel cmdline parameter To: Christoph Hellwig , Dmitry Osipenko Cc: Jens Axboe , Davidlohr Bueso , Colin Cross , Thierry Reding , Jonathan Hunter , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , David Heidelberg , Peter Geis , linux-efi@vger.kernel.org, linux-tegra@vger.kernel.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200219162339.16192-1-digetx@gmail.com> <20200219162738.GA10644@infradead.org> From: Stephen Warren Message-ID: Date: Wed, 19 Feb 2020 09:59:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200219162738.GA10644@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/19/20 9:27 AM, Christoph Hellwig wrote: > On Wed, Feb 19, 2020 at 07:23:39PM +0300, Dmitry Osipenko wrote: >> The gpt_sector= causes the GPT partition search to look at the >> specified sector for a valid GPT header if the GPT is not found at the >> beginning or the end of block device. >> >> In particular this is needed for NVIDIA Tegra consumer-grade Android >> devices in order to make them usable with the upstream kernel because >> these devices use a proprietary / closed-source partition table format >> for the EMMC and it's impossible to change the partition's format. Luckily >> there is a GPT table in addition to the proprietary table, which is placed >> in uncommon location of the EMMC storage and bootloader passes the >> location to kernel using "gpt gpt_sector=" cmdline parameters. >> >> This patch is based on the original work done by Colin Cross for the >> downstream Android kernel. > > I don't think a magic command line is the way to go. The best would be > to reverse-engineer the proprietary partition table format. If that is > too hard we can at least key off the odd GPT location based of it's > magic number. I thought that the backup GPT was always present in the standard location; it's just the primary GPT that's in an odd location. So, this kernel parameter just forces the kernel to look first for the primary GPT in the unusual location, thus avoiding an error message when that's not there, and the system falls back to the backup GPT. Or, do I misremember the layout, or the kernel's behaviour if primary GPT is missing?