From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 475572034D833 for ; Tue, 7 Nov 2017 06:19:34 -0800 (PST) Received: by mail-pf0-x244.google.com with SMTP id t188so10424242pfd.10 for ; Tue, 07 Nov 2017 06:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=reply-to:to:from:subject:message-id:date:user-agent :content-language:content-transfer-encoding:mime-version; bh=ESnCWEl12B0HDP+RR/vIrFU1T3PWLxBVJUX/64JhfOs=; b=ehxOykCy3q0J2CQRw4+2rQEieWekglr1kfrTZsOoeCNKjNZNS6SiKy8QjYaefwvST7 878K5lKyvfSzjhkC2XuOMOCKReGpskoklD1QOZnPr9NTc2irjOxPgYUjWg2GyLnGElZ7 efTbhnbWsMMzHmM5p5a7LoW9C6DNhLANmuc0A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:to:from:subject:message-id:date :user-agent:content-language:content-transfer-encoding:mime-version; bh=ESnCWEl12B0HDP+RR/vIrFU1T3PWLxBVJUX/64JhfOs=; b=FWbBi/Rsm9R1oQs4DoAmHTpC+YKoiiRf5a2+C4tCHW+d16dSU1NGSnJ2xtP5xOJypR PQmWpwIvVTfK0FeGiq43y2ymWOfdIYAYakshxAoD7UK8ewH9qZRiZBUswfwvoNC0fXMJ F2/0dNDEv/xySYEt34Pd9CgjU8jGpBoEyy47ZbHlxKJJ0UU+lq92t3zMyi8deLegVDHc p9orechgwKBi7OlHyO2vmGjK6LBQmrv6BGIMUSfJ6voRnieHrwHTBpNtpit0RmYKHaWj F+lams4feMgB3rLCjaqeqClardGjAcnfEMRNiL2Fuvhc7sngs/LTun9IYkQfhRKh4WPP hGfQ== X-Gm-Message-State: AMCzsaVp0GzRkJaTsKQYWgq2PsCNR0XGUIoMQ4Az36XLzCHgztrZOshR M9D/6vpsTRN7wygca1VE7xrxCxegpwk= X-Google-Smtp-Source: ABhQp+TfExFGIXF8Gk5kpTmuJzfbTK/g1GYBgj1lIKKAKGUrGpXjOx8UQyd8JhiHyhs0rdNbDPCRyw== X-Received: by 10.99.114.92 with SMTP id c28mr19052023pgn.342.1510064612981; Tue, 07 Nov 2017 06:23:32 -0800 (PST) Received: from CY1PR15MB0730.namprd15.prod.outlook.com ([132.245.253.237]) by smtp.gmail.com with ESMTPSA id l10sm3243404pgr.85.2017.11.07.06.23.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Nov 2017 06:23:32 -0800 (PST) Received: from [192.168.9.22] (10.170.176.33) by CY1PR15MB0730.namprd15.prod.outlook.com (10.169.21.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13 via Mailbox Transport; Tue, 7 Nov 2017 14:02:44 +0000 Reply-To: haojian.zhuang@linaro.org To: "edk2-devel@lists.01.org" , Fathi Boudra , Leif Lindholm , phcoder@gmail.com, okuji@enbug.org From: Haojian Zhuang Message-ID: <5efb001e-f292-9f22-edae-a617147749c6@linaro.org> Date: Tue, 7 Nov 2017 22:02:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 X-MS-Exchange-Organization-Network-Message-Id: 05fc85b7-cf78-4048-296c-08d525e83915 X-MS-Exchange-Organization-AuthSource: CY1PR15MB0730.namprd15.prod.outlook.com X-MS-Exchange-Organization-AuthAs: Anonymous X-TMN: [b/8fGLLPt8gAX+plKZDfCzozO8Ts6Cmf] X-MS-Exchange-Organization-MessageDirectionality: Originating MIME-Version: 1.0 Subject: GRUB issue on device priority X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2017 14:19:34 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi all, It seems there's a device priority issue in GRUB. All block io handles are linked into the list in edk2, and GRUB could fetch it. Then GRUB creates its own ascending on HD priority. add_device(): for (p = devices; *p; p = &((*p)->next)) { ret = grub_efi_compare_device_paths (grub_efi_find_last_device_path ((*p->device_path), grub_efi_find_last_device_path->device_path)); if (ret == 0) { ret = grub_efi_compare_device_paths ((*p)->device_path, d->device_path); } if (ret == 0) { return; } else if (ret > 0) { break; } } ... In the HiKey platform, I prepared the same driver for both eMMC and SD. So the device paths are in below. SD: /HardwareVendor(0d51905b-b77e-452a-a2c0-eca0 cc8d514a)[9: 00 e0 23 f7 00 00 00 00 00 ]/UnknownMessaging(1a)/EndEntire eMMC: /HardwareVendor(0d51905b-b77e-452a-a2c0-eca0 cc8d514a)[9: 00 d0 23 f7 00 00 00 00 00 ]/UnknownMessaging(1d)/Ctrl(0)/EndEntire #define MSG_SD_DP 0x1A #define MSG_EMMC_DP 0x1D In the second level, the device paths are different. And GRUB resort the sequence by ascending order (with above code). So SD device always gets higher priority than eMMC device. If we always use installer to install OS, it may not an issue. Since installer could create grub.cfg by itself. But it imports another issue on lacking of persistent variable storage. And we need to deploy system without installer on embedded device. How to fix the priority issue? Fix in GRUB or something else? Best Regards Haojian