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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D0CC34056 for ; Wed, 19 Feb 2020 17:05:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2517224656 for ; Wed, 19 Feb 2020 17:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726826AbgBSRF3 (ORCPT ); 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?