Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp814185ybv; Wed, 19 Feb 2020 09:45:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwkPJ7dmzwXzztThRPZ45okJMwmU2SCd1fSBLm7oyy79cGiPlxmuedSZ8xLS0uOUxZHqtXc X-Received: by 2002:a9d:7342:: with SMTP id l2mr20730729otk.98.1582134322583; Wed, 19 Feb 2020 09:45:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582134322; cv=none; d=google.com; s=arc-20160816; b=sGGTkETYVOLhn675XuhkyEEBcm/y642WDRmJbYbmwToljHK2XMTWwNXimqLEm1AFNS y2O9wWSNfZdQi4ddLCDD4eTkYqbDavwam30vmai9+umyx7+ZBcabIwi4TYGnJ4P2ANyV puHOHeOKbrNVbM3qGwU2dAz5mW4ssl/2n23kOzKCJDsT7kkCB2h7rewjs9edCesa7I9b ocmXM4YyW6NWFzfGJ/FL4kJfADOq4+oj87P9jzwiG5hoCTrAA3P1oCjjsSC5Y2EKJYbf CVAcwL/nKujOZly5PYm7uPfDfNFFn6HD/bx8WcKdQoQX9JQHh9Onv8yDzR37U1KUZs+J pkbA== 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:dkim-signature; bh=uPOumAcBRmkHJ4EJLjVwjyx0UkodYRqLQx2fcbRzjcU=; b=OvYDL4fr0BS6yrPhlcMlPEikAXRvxoON9DVARv965FkpPK7DN8w09UOYecgTGt47oh zKERQuWL8emBfhqlJbayUcyQ78r0Dh2rxhJaLCr+DICv1ZEzj+L5nqnGJvzHMiDK0KE+ FocM9+X4o7HqqOnV/TS1AooRAbCK9/lQKwu8+nxAjwllCYuVUTAMHJnV0aE3j4UfKbrX ESh5P6JlWnc0SpH2pIxC4sLah/AfGDN3XdZIDxhD2bBufeUVYI+2I7p+LQ+kqIRmHrVD heLxxILeqKVcMJAtBO3NI17R9qxmzy5B0sp2FyzhR3nuuwVL9Jj7yp/n4bl61H+GubiF KiaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="e5cq4mF/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g72si10435997oib.157.2020.02.19.09.45.11; Wed, 19 Feb 2020 09:45:22 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="e5cq4mF/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbgBSRor (ORCPT + 99 others); Wed, 19 Feb 2020 12:44:47 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:36550 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbgBSRoq (ORCPT ); Wed, 19 Feb 2020 12:44:46 -0500 Received: by mail-lf1-f66.google.com with SMTP id f24so813561lfh.3; Wed, 19 Feb 2020 09:44:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uPOumAcBRmkHJ4EJLjVwjyx0UkodYRqLQx2fcbRzjcU=; b=e5cq4mF/bFwQMZTp+Vg5gt8plzWasQB/r379lvjWCErASKW+BA24SB2zyRZyLc7oSZ eKHynbtTSgcyUJYqX+Jqk+hTx5l+o5ytfPRpvB8WPsPBQHThkSIWoujH9ARG2lEYmljh Sa5plISmGyfd5q9hLgFzpxQKAELhTv2KoKASuA+jpf+fzErpbrZ/BUx7QH1X6S8ZlOUA z6S+YwuBYuPsVwJ9Auuythr9wVH6piDHCcXCH+ECIltgt6y6HT9dxZARyfD4LqYNSPZ8 fSCHMfObm2ls8WuoqWT3eLjzLPLAp0P22mi/GAvLHFu7lzuvB88AQYdHT04Yfrvt4QH/ RPlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uPOumAcBRmkHJ4EJLjVwjyx0UkodYRqLQx2fcbRzjcU=; b=G5ouDUSr6vEQA41NgErXP1VhP0li4TOijwsliMr3ocroWYVecmLWW1tbHg1ZaQqKwa W7SUnZT/CevepzvPMlZ2FbMum52vDP+9S/0BP/f7LQhpTBRENY8WBsxQz3Mk2v7ktGZf nLTylRLWLCfFVophLOg1UvK353DUByf0ej1EZTt1zR60edoX3dBPkw6f0OhjfYErpDOp Gbi2GeJcou+oR0R9+laYpJrb8EzktuvV32+aJqMGFZQwHuYpoIwBfEXPca+DBXttiJlD jYMP5NkoBLkMx+MES7/xT/LKeBPDyza7ZO1tNkIaNgsaa7ifRg0XwARnkAXHwZwvOHWM 84Qw== X-Gm-Message-State: APjAAAX3a/lTZTXX+JpklliJ9nL3lTpTOKD3HrdpeJOsVB7Ei6WEXAmU 5FsrMIVJ170rR5K3KSjBUGl8h9ah X-Received: by 2002:a19:5e41:: with SMTP id z1mr14182445lfi.101.1582134283843; Wed, 19 Feb 2020 09:44:43 -0800 (PST) Received: from [192.168.2.145] (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.googlemail.com with ESMTPSA id s17sm254568ljo.18.2020.02.19.09.44.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Feb 2020 09:44:43 -0800 (PST) Subject: Re: [PATCH v1] partitions/efi: Add 'gpt_sector' kernel cmdline parameter To: Stephen Warren , Christoph Hellwig 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: Dmitry Osipenko Message-ID: <0c0d0cff-7b20-f777-8724-0d2b07e60e3d@gmail.com> Date: Wed, 19 Feb 2020 20:44:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 19.02.2020 19:59, Stephen Warren пишет: > 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? The backup GPT not always presents in the standard location. For example Tegra30 ASUS Google Nexus 7 has a backup GPT in the proper location and this is what KMSG prints: [ 1.722888] Primary GPT is invalid, using alternate GPT. [ 1.723076] mmcblk1: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 But this doesn't work for Tegra20 Acer A500 and (IIRC) Tegra30 Ouya because both primary and backup GPTs are invalid at the standard locations.