From patchwork Tue Aug 1 09:28:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 109124 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1267297qge; Tue, 1 Aug 2017 02:29:16 -0700 (PDT) X-Received: by 10.99.126.85 with SMTP id o21mr18210272pgn.262.1501579756872; Tue, 01 Aug 2017 02:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501579756; cv=none; d=google.com; s=arc-20160816; b=neLrBnMr5nKAywyqI6Vo2s3MQBHAM7jgzpjQluZ0VuluvAoUYn6i06PrpBCF6cbRSQ a1Ih0cuaxnma2R48mhxu2JHLjlbVbKTBfaW18p1doRq/dwNA3Fr+UCgwrbhm6naVJIY9 buJNN3Vs+KWLPtCu/hr6mRbedS0UjJBSoD6CoP1xwPwKBkhL0mAkayqa5RlkiwMAEXg9 Fvynj5DGwSdvJti3urkSdZqnYrIutWjM9y8AuGw/wnvoKnlaOGiQC8Lce7vvzAK4n/DC C4Thfc2uJwFwsrqUdT0GFzxMyZlhzsZSC+/yVx69cpBfjGXRN+eKRGjdljARL9hzBkMr 42/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=gNawY019tj10tRyL3l+PxuSFofCCwdI5yZbYQlnv3JQ=; b=f4MtK2WCsBr3kG//Uhskif+mzzbdobzYNHrmluJS76ReREWuFIQVqbxzWD5uHQ20km dqy5qePNC48DBNerjBUg/mRjbh6L/jSh525KCp4pI0tSCm+ln+RLoUv9bGpqb53EbOcj Griwv9vLpVwEFf1eC48h2G6CRB4aYYfEQoDj0sUtXkEFsdcrltmlnEN4FFcoXUKjxWJA n9JVntFQQqdNRpaKSG7+EA5iBgOPzwfiTeD8lF7qep1OxG/w3NZZF5Hvn7+OrjaxgHH3 mkYnPuii/ynZMIbF4QM+a1c4KDOodlTCn3eQMnk7gxihq+7jJIBl3ZGw8ZDeG4xmAZwf ogRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=bm7f9dM6; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id 11si17688035plb.284.2017.08.01.02.29.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 02:29:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=bm7f9dM6; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 083E421D2DCE6; Tue, 1 Aug 2017 02:27:07 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com [IPv6:2607:f8b0:400e:c00::231]) (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 08DFC21D2DCE1 for ; Tue, 1 Aug 2017 02:27:06 -0700 (PDT) Received: by mail-pf0-x231.google.com with SMTP id d67so5617611pfc.0 for ; Tue, 01 Aug 2017 02:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=zulPlsg/oxIJmwzbqpdfIKXMuGFRZqfCAT7fkIdyIEA=; b=bm7f9dM6KsVYldgRq+wtjbK9Sgrwb/F32y3gCxkCLnUI0M8KeT4iBS3D2bDkx8zfbr XlCXLU3XrsyHpNt67OqozYT0F9tdfKvVfaE9qjze5kZRbrN50+OZ6G+Cn1jhDWjzgHxb 7nGvzDZOFDXBM7NNezKbBW+wXd/bUaXD4bSHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zulPlsg/oxIJmwzbqpdfIKXMuGFRZqfCAT7fkIdyIEA=; b=OoluFwsCFgVAc+XySPfrICQMHWtbZfnxLV/YyKhkANeXzma8VCUZKo2BSAvqW/enX0 zhJhOGN01w2PSbA3v4r3gffxGyVUFVm5P9UmAYwDiynTBIFyxnah8skeFklCkIawu+r5 kxyT7L1pTlfaM4rl5tX959ucl6Lo8bvyPF5SKA2jQgBaQ0W4xKx+XEfVKVmah0Wa1ZQB E7NFxDV7lr/fdL2uKDHjFBs7VmHnNhDz64S1up6NXk+nRxd/EEjpghUGKvZKTbvLUEYp PRm+ireO0ad1ZYvSKFa/Wq8LDUdM7fhGeWMMSCk/2KXJoyot1z0dktvCKqrZYJA3yxq4 ZmpQ== X-Gm-Message-State: AIVw112URoIQ3M6l/QeQaNqymiug6FgXS3JSQ19tKDM1cgMcatKfnMF5 sUWQcoqH0Z2uDYxo X-Received: by 10.84.179.165 with SMTP id b34mr20655985plc.455.1501579754799; Tue, 01 Aug 2017 02:29:14 -0700 (PDT) Received: from localhost.localdomain ([113.53.228.63]) by smtp.gmail.com with ESMTPSA id i133sm20557070pgc.0.2017.08.01.02.29.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 02:29:14 -0700 (PDT) From: Jun Nie To: haojian.zhuang@linaro.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org Date: Tue, 1 Aug 2017 17:28:58 +0800 Message-Id: <1501579741-28866-1-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 Subject: [edk2] [PATCH v4 1/4] ArmPkg: Move IS_DEVICE_PATH_NODE for sharing 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: , Cc: jason.liu@linaro.org, shawn.guo@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Move IS_DEVICE_PATH_NODE into header to share it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jun Nie --- ArmPkg/Include/Library/BdsLib.h | 3 +++ ArmPkg/Library/BdsLib/BdsFilePath.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPkg/Include/Library/BdsLib.h b/ArmPkg/Include/Library/BdsLib.h index c58f47e..4528c2e 100644 --- a/ArmPkg/Include/Library/BdsLib.h +++ b/ArmPkg/Include/Library/BdsLib.h @@ -15,6 +15,9 @@ #ifndef __BDS_ENTRY_H__ #define __BDS_ENTRY_H__ +#define IS_DEVICE_PATH_NODE(node,type,subtype) \ + (((node)->Type == (type)) && ((node)->SubType == (subtype))) + /** This is defined by the UEFI specs, don't change it **/ diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c index f9d8c4c..41557bb 100644 --- a/ArmPkg/Library/BdsLib/BdsFilePath.c +++ b/ArmPkg/Library/BdsLib/BdsFilePath.c @@ -24,9 +24,6 @@ #include #include - -#define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype))) - /* Type and defines to set up the DHCP4 options */ typedef struct { From patchwork Tue Aug 1 09:28:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 109126 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1267390qge; Tue, 1 Aug 2017 02:29:22 -0700 (PDT) X-Received: by 10.84.241.135 with SMTP id b7mr20097489pll.107.1501579762870; Tue, 01 Aug 2017 02:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501579762; cv=none; d=google.com; s=arc-20160816; b=hrNZjAl3lCVjYl4uwPg/FXJTr9WjHV5LXUTGxKwSBhRYjxi4VyiV12njJoK+3myZaO T4WkEIQZ5UKlftfBbJwAmPmxgeMfPIiusLSKwM2x61Pjq1ipvgfVUusEJbdr4JKGJG7F 8f7CDPP3zlNQ2I39cyBEqycghPy4obI0NncQAU6RRgYbrFJDClWPvQxUAe7eJkexPsy7 fAJyub2OMzxJgnX8yUGWjdegMH+Mn1Ic8BUR4jdXgB1iM4ZT8KXyrouC3tEuFlzRt1zS nCH9zqtJuNjWp3BZ3fO2q9Ilfptgg4ssq3cAD/pRg4Xeoj/soCW0v4LyPkn/cPbpra1Q awjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=3YPlj8mLy2m7fHmxtApZWUR7q5MtGhwhU+u5SQLhiRk=; b=0PD4oECQ0kgjcGYrDFwHtazhnbUq2ztoYRam3K5ZxdmjkKxcQvEXYIsvBvzJLLsvUH GbQLY5gbpWQ8kzG9ZuC80NDun2ukF8nc+hLkMfyYzU4DyJOk1ulImoFGKnUMek2YfX4J AhT0/92xkB8y8fxPPaxxciuLKbnn3PGZBmPDhGUvafpsxqooHCWr6kpT89Z/5enMMyih N1ksazbPd0QM/wglCcSjf3TZ1DKF+XaGFg1NBGuO/0QTpRSYIoXeAEudPUVR7KP7h1O8 keTzBEDPgZgOGkQ7hT5Zge4BQl3daBizhc08pQjcePEHiL0sO9zcmITZHhvxHZB4ndM1 cTDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Cvjed1Mx; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id f67si17570732pfg.687.2017.08.01.02.29.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 02:29:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Cvjed1Mx; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4270021D2DCEA; Tue, 1 Aug 2017 02:27:13 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pg0-x236.google.com (mail-pg0-x236.google.com [IPv6:2607:f8b0:400e:c05::236]) (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 1CD2921D2DCE1 for ; Tue, 1 Aug 2017 02:27:12 -0700 (PDT) Received: by mail-pg0-x236.google.com with SMTP id y129so5691697pgy.4 for ; Tue, 01 Aug 2017 02:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LkZzp7UonXGbzptb7lKnCEW22T3OHQPNbLDY4LgoyWE=; b=Cvjed1MxZds/dTOTBUmEDnpL+RG/C5Ur5JAvnvGqsMNohZUd6e9FFXLzuPVLfJNlbr WEBOy7Fox3Nk1K7Q5q2gAn531wT+vdyjvdGKdTgtnDlBz9xAGcWdmErdGVIw+/JWjOnD wCqjZkZhrJZuG93QD0ETW2RUXU04cqYnlhH34= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LkZzp7UonXGbzptb7lKnCEW22T3OHQPNbLDY4LgoyWE=; b=fOBhM2ClB/d7yHTUnmsU/OvftJcJwfeiPJkC246Exj8JL82/cFCZ2kVueXrU6ejNYt lt0RV/yY50ID3bWkL5WKoPTgMTholIkzalXkxTk9HY29/gBzXDAuk8BuYV9P8AKM6HmK CXin1U9QaG2ZU4oweNFukBDZyVyGwrtQWDWP+kXzjAnxrzMZ4nLYj8bmQXJwCLfqothm zv7pLWBqWkAO6ZnfGIaV9SmML3xoMHbkhKK9y8GqJwiwRaAyomk089SRbIiYgp/ZvXtC 2+z8cipaA0oFmwLdoClkUxniahlwSv3K53ZH846ceffMK710m+tUyy7kw+kqaK0cnnyO FrIQ== X-Gm-Message-State: AIVw111/xG768ajiVpiUIiKro7vV14j2DozIQsvBDiWkhRKKnEcPTg+9 ilhgJdmlE7eIN+9i X-Received: by 10.98.60.220 with SMTP id b89mr18706867pfk.170.1501579760902; Tue, 01 Aug 2017 02:29:20 -0700 (PDT) Received: from localhost.localdomain ([113.53.228.63]) by smtp.gmail.com with ESMTPSA id i133sm20557070pgc.0.2017.08.01.02.29.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 02:29:20 -0700 (PDT) From: Jun Nie To: haojian.zhuang@linaro.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org Date: Tue, 1 Aug 2017 17:28:59 +0800 Message-Id: <1501579741-28866-2-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501579741-28866-1-git-send-email-jun.nie@linaro.org> References: <1501579741-28866-1-git-send-email-jun.nie@linaro.org> Subject: [edk2] [PATCH v4 2/4] EmbeddedPkg/AndroidFastboot: split android boot header 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: , Cc: jason.liu@linaro.org, shawn.guo@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Split android boot header definition to share code among different applications and libraries. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jun Nie --- .../Application/AndroidFastboot/AndroidBootImg.c | 35 +++------------ .../AndroidFastboot/AndroidFastbootApp.h | 1 + .../AndroidFastboot/Arm/BootAndroidBootImg.c | 2 +- EmbeddedPkg/Include/Library/AndroidBootImgLib.h | 50 ++++++++++++++++++++++ 4 files changed, 57 insertions(+), 31 deletions(-) create mode 100644 EmbeddedPkg/Include/Library/AndroidBootImgLib.h -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c index f3e770b..2f7f093 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c @@ -14,32 +14,6 @@ #include "AndroidFastbootApp.h" -#define BOOT_MAGIC "ANDROID!" -#define BOOT_MAGIC_LENGTH sizeof (BOOT_MAGIC) - 1 - -// Check Val (unsigned) is a power of 2 (has only one bit set) -#define IS_POWER_OF_2(Val) (Val != 0 && ((Val & (Val - 1)) == 0)) - -// No documentation for this really - sizes of fields has been determined -// empirically. -#pragma pack(1) -typedef struct { - CHAR8 BootMagic[BOOT_MAGIC_LENGTH]; - UINT32 KernelSize; - UINT32 KernelAddress; - UINT32 RamdiskSize; - UINT32 RamdiskAddress; - UINT32 SecondStageBootloaderSize; - UINT32 SecondStageBootloaderAddress; - UINT32 KernelTaggsAddress; - UINT32 PageSize; - UINT32 Reserved[2]; - CHAR8 ProductName[16]; - CHAR8 KernelArgs[BOOTIMG_KERNEL_ARGS_SIZE]; - UINT32 Id[32]; -} ANDROID_BOOTIMG_HEADER; -#pragma pack() - // Find the kernel and ramdisk in an Android boot.img. // return EFI_INVALID_PARAMTER if the boot.img is invalid (i.e. doesn't have the // right magic value), @@ -64,7 +38,8 @@ ParseAndroidBootImg ( Header = (ANDROID_BOOTIMG_HEADER *) BootImg; - if (AsciiStrnCmp (Header->BootMagic, BOOT_MAGIC, BOOT_MAGIC_LENGTH) != 0) { + if (AsciiStrnCmp ((CONST CHAR8 *)Header->BootMagic, ANDROID_BOOT_MAGIC, + ANDROID_BOOT_MAGIC_LENGTH) != 0) { return EFI_INVALID_PARAMETER; } @@ -72,7 +47,7 @@ ParseAndroidBootImg ( return EFI_NOT_FOUND; } - ASSERT (IS_POWER_OF_2 (Header->PageSize)); + ASSERT (IS_VALID_ANDROID_PAGE_SIZE (Header->PageSize)); *KernelSize = Header->KernelSize; *Kernel = BootImgBytePtr + Header->PageSize; @@ -84,8 +59,8 @@ ParseAndroidBootImg ( + ALIGN_VALUE (Header->KernelSize, Header->PageSize)); } - AsciiStrnCpyS (KernelArgs, BOOTIMG_KERNEL_ARGS_SIZE, Header->KernelArgs, - BOOTIMG_KERNEL_ARGS_SIZE); + AsciiStrnCpyS (KernelArgs, ANDROID_BOOTIMG_KERNEL_ARGS_SIZE, Header->KernelArgs, + ANDROID_BOOTIMG_KERNEL_ARGS_SIZE); return EFI_SUCCESS; } diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h index f62660f..e4c5aa3 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h @@ -15,6 +15,7 @@ #ifndef __ANDROID_FASTBOOT_APP_H__ #define __ANDROID_FASTBOOT_APP_H__ +#include #include #include #include diff --git a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c index f446cce..1d9024b 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c +++ b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c @@ -112,7 +112,7 @@ BootAndroidBootImg ( ) { EFI_STATUS Status; - CHAR8 KernelArgs[BOOTIMG_KERNEL_ARGS_SIZE]; + CHAR8 KernelArgs[ANDROID_BOOTIMG_KERNEL_ARGS_SIZE]; VOID *Kernel; UINTN KernelSize; VOID *Ramdisk; diff --git a/EmbeddedPkg/Include/Library/AndroidBootImgLib.h b/EmbeddedPkg/Include/Library/AndroidBootImgLib.h new file mode 100644 index 0000000..8116c7c --- /dev/null +++ b/EmbeddedPkg/Include/Library/AndroidBootImgLib.h @@ -0,0 +1,50 @@ +/** @file + + Copyright (c) 2013-2014, ARM Ltd. All rights reserved.
+ Copyright (c) 2017, Linaro. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __ABOOTIMG_H__ +#define __ABOOTIMG_H__ + +#include +#include +#include + +#include +#include + +#define ANDROID_BOOTIMG_KERNEL_ARGS_SIZE 512 + +#define ANDROID_BOOT_MAGIC "ANDROID!" +#define ANDROID_BOOT_MAGIC_LENGTH (sizeof (ANDROID_BOOT_MAGIC) - 1) + +/* https://android.googlesource.com/platform/system/core/+/master/mkbootimg/bootimg.h */ +typedef struct { + UINT8 BootMagic[ANDROID_BOOT_MAGIC_LENGTH]; + UINT32 KernelSize; + UINT32 KernelAddress; + UINT32 RamdiskSize; + UINT32 RamdiskAddress; + UINT32 SecondStageBootloaderSize; + UINT32 SecondStageBootloaderAddress; + UINT32 KernelTaggsAddress; + UINT32 PageSize; + UINT32 Reserved[2]; + CHAR8 ProductName[16]; + CHAR8 KernelArgs[ANDROID_BOOTIMG_KERNEL_ARGS_SIZE]; + UINT32 Id[32]; +} ANDROID_BOOTIMG_HEADER; + +/* Check Val (unsigned) is a power of 2 (has only one bit set) */ +#define IS_POWER_OF_2(Val) ((Val) != 0 && (((Val) & ((Val) - 1)) == 0)) +#endif /* __ABOOTIMG_H__ */ From patchwork Tue Aug 1 09:29:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 109127 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1267487qge; Tue, 1 Aug 2017 02:29:30 -0700 (PDT) X-Received: by 10.84.254.69 with SMTP id a5mr20515109pln.306.1501579770311; Tue, 01 Aug 2017 02:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501579770; cv=none; d=google.com; s=arc-20160816; b=wjmWVsJUKGYXyPBpR48gn0Wo93I6HrRaOnnQgDj8rUJ3t3/ierYluiQGMBK0WZwOa7 M8V0yPZJ8DcpwpxgaIvxyHZeEh+cegi6KvrKXuDS2LS5GoDv/zFQe88/dcEu5O/WI9C3 ko8K+hD7le7FpIokl4oFLDmtVUy6S/c5pENWjRUaqd5gIq4785LjQJGiIu+9KM1CK76h MihEKspxaXrdrC7v97Zn+ur5quVVzMsjTAyzP+NV4iw+emdnerx0djOpOTh5nK5jPesk lqWMBVAiaMU8Q8iJCB/4aX0Z0eHwnZOnKXKOTIlm/Jd7gxESD1o+WgtR+9cz/Xo9c8jC 2FZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=N7sa/9nuM/gHiT7e54yJMX5KfEAdnnNaWwmbSXcvwQc=; b=zknPrdZTo4p85Ie9aD7lwSwVKo2u0ck73eAcsA572NnYolW/j4XwoHy2zrXir7NNuJ jgr+gJqJ7phdzUVB0NuH5klA+19g9Qc5DsFPFhlJkLHIPoiR7c7oHkjWsSeMG/5RQNjb qbiEKlnmw9d50jcU9MgrV75AMRa7pAEZYeort+XZ/gOLHbdLOeE07t7mXXHnWi0YrLnS z1fucuga3XmLimF+yah8TP3TmLA6OV6roszlshDGlQOFj/io1dB8WR0hvuEIN8qsLuRt eRBmweIbvaavwKRK9kSDYgfowittWRw33rA+fm6dqVNjK/jniNeFXKbKb+RpDJAmVo5Q wgkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=R4Qm7SZ7; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id d25si3632999pgn.725.2017.08.01.02.29.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 02:29:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=R4Qm7SZ7; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7F38621D2DCE9; Tue, 1 Aug 2017 02:27:20 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pg0-x231.google.com (mail-pg0-x231.google.com [IPv6:2607:f8b0:400e:c05::231]) (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 9F61D21D2DCE1 for ; Tue, 1 Aug 2017 02:27:18 -0700 (PDT) Received: by mail-pg0-x231.google.com with SMTP id v189so5704785pgd.2 for ; Tue, 01 Aug 2017 02:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Qvtzhqgls1kk7JDYM1lRuhKv6bgU/F+ev/Ua+50oX+0=; b=R4Qm7SZ7BIrOF7kCFx6h04lUnLmtz392CkvqT6q3vlH+fMKMNm5AZPDxc7956ouhx/ Y4ROlxeXSZixuny51WTSoXdcq8I9mUU7ckhZZKxqwtKl6TrsycKH8N4aHzbWgJ5B4hzm YDJnxtLNCO+7UiPx2JCO1RErXzEifwCPn0mDg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Qvtzhqgls1kk7JDYM1lRuhKv6bgU/F+ev/Ua+50oX+0=; b=cW6a6B3M5tMbi35f7xU50t9aHHfABYehvRfNasQKY+PShuwQN1dKMHACGJajLWsQMs xZ5305PrsMQ9VqyaV/CCQxm1eX8cx37yw9comVTQn8h7TeFkthWFo56o5Dy6jvTz7yXU F/Io5xb6ixFidMOPVARHOmm8opLOuAbsOMsM6b4OjV2lmS+BW8tF8hopOpBkwFDWTrhO 9/K/r+p2Nn+2CJ2Ckw3uYwgstIYZyFU6Zcs1RMaUNKSXq3OcRYrV8oKRb+MjHKurKrPT VMSjOWRxpFEYBd3ZyrwS7/FZ1gvQNdCi9iP2wgxMga0j+yx0H7mHAsS+7vK9pGF0xSzu 4KKQ== X-Gm-Message-State: AIVw111AuxnT8CtPGokhqV+ZTz+sB3A67ZghpciebSfJBDBbbEct7q3Y CoWK/+NMFOzyfX9t X-Received: by 10.101.91.6 with SMTP id y6mr3096657pgq.88.1501579767199; Tue, 01 Aug 2017 02:29:27 -0700 (PDT) Received: from localhost.localdomain ([113.53.228.63]) by smtp.gmail.com with ESMTPSA id i133sm20557070pgc.0.2017.08.01.02.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 02:29:26 -0700 (PDT) From: Jun Nie To: haojian.zhuang@linaro.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org Date: Tue, 1 Aug 2017 17:29:00 +0800 Message-Id: <1501579741-28866-3-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501579741-28866-1-git-send-email-jun.nie@linaro.org> References: <1501579741-28866-1-git-send-email-jun.nie@linaro.org> Subject: [edk2] [PATCH v4 3/4] EmbeddedPkg/AndroidBoot: boot android kernel from storage 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: , Cc: jason.liu@linaro.org, shawn.guo@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Add an android kernel loader that could load kernel from storage device. This patch is derived from Haojian's code as below link. https://patches.linaro.org/patch/94683/ This android boot image BDS add addtitional cmdline/dtb/ramfs support besides kernel that is introduced by Android boot header. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jun Nie --- .../Application/AndroidBoot/AndroidBootApp.c | 140 +++++++ .../Application/AndroidBoot/AndroidBootApp.inf | 64 +++ EmbeddedPkg/Include/Library/AndroidBootImgLib.h | 17 + EmbeddedPkg/Include/Protocol/AndroidBootImg.h | 47 +++ .../Library/AndroidBootImgLib/AndroidBootImgLib.c | 444 +++++++++++++++++++++ .../AndroidBootImgLib/AndroidBootImgLib.inf | 48 +++ 6 files changed, 760 insertions(+) create mode 100644 EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.c create mode 100644 EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.inf create mode 100644 EmbeddedPkg/Include/Protocol/AndroidBootImg.h create mode 100644 EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c create mode 100644 EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.c b/EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.c new file mode 100644 index 0000000..5069819 --- /dev/null +++ b/EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.c @@ -0,0 +1,140 @@ +/** @file + + Copyright (c) 2013-2014, ARM Ltd. All rights reserved.
+ Copyright (c) 2017, Linaro. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Validate the node is media hard drive type */ +EFI_STATUS +ValidateAndroidMediaDevicePath ( + IN EFI_DEVICE_PATH *DevicePath + ) +{ + EFI_DEVICE_PATH_PROTOCOL *Node, *NextNode; + + NextNode = DevicePath; + while (NextNode != NULL) { + Node = NextNode; + if (IS_DEVICE_PATH_NODE (Node, MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP)) { + return EFI_SUCCESS; + } + NextNode = NextDevicePathNode (Node); + } + return EFI_INVALID_PARAMETER; +} + +EFI_STATUS +EFIAPI +AndroidBootAppEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + CHAR16 *BootPathStr; + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol; + EFI_DEVICE_PATH *DevicePath; + EFI_BLOCK_IO_PROTOCOL *BlockIo; + UINT32 MediaId, BlockSize; + VOID *Buffer; + EFI_HANDLE Handle; + UINTN BootImgSize; + + BootPathStr = (CHAR16 *)PcdGetPtr (PcdAndroidBootDevicePath); + ASSERT (BootPathStr != NULL); + Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, + (VOID **)&EfiDevicePathFromTextProtocol); + ASSERT_EFI_ERROR(Status); + DevicePath = (EFI_DEVICE_PATH *)EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (BootPathStr); + ASSERT (DevicePath != NULL); + + Status = ValidateAndroidMediaDevicePath (DevicePath); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, + &DevicePath, &Handle); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gBS->OpenProtocol ( + Handle, + &gEfiBlockIoProtocolGuid, + (VOID **) &BlockIo, + gImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Failed to get BlockIo: %r\n", Status)); + return Status; + } + + MediaId = BlockIo->Media->MediaId; + BlockSize = BlockIo->Media->BlockSize; + Buffer = AllocatePages (EFI_SIZE_TO_PAGES (sizeof(ANDROID_BOOTIMG_HEADER))); + if (Buffer == NULL) { + return EFI_BUFFER_TOO_SMALL; + } + /* Load header of boot.img */ + Status = BlockIo->ReadBlocks ( + BlockIo, + MediaId, + 0, + BlockSize, + Buffer + ); + Status = AndroidBootImgGetImgSize (Buffer, &BootImgSize); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Failed to get AndroidBootImg Size: %r\n", Status)); + return Status; + } + BootImgSize = ALIGN_VALUE (BootImgSize, BlockSize); + FreePages (Buffer, EFI_SIZE_TO_PAGES (sizeof(ANDROID_BOOTIMG_HEADER))); + + /* Both PartitionStart and PartitionSize are counted as block size. */ + Buffer = AllocatePages (EFI_SIZE_TO_PAGES (BootImgSize)); + if (Buffer == NULL) { + return EFI_BUFFER_TOO_SMALL; + } + + /* Load header of boot.img */ + Status = BlockIo->ReadBlocks ( + BlockIo, + MediaId, + 0, + BootImgSize, + Buffer + ); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Failed to read blocks: %r\n", Status)); + goto EXIT; + } + + Status = AndroidBootImgBoot (Buffer, BootImgSize); + +EXIT: + return Status; +} diff --git a/EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.inf b/EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.inf new file mode 100644 index 0000000..f1ee0bd --- /dev/null +++ b/EmbeddedPkg/Application/AndroidBoot/AndroidBootApp.inf @@ -0,0 +1,64 @@ +#/** @file +# +# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.
+# Copyright (c) 2017, Linaro. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +#**/ + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = AndroidBootApp + FILE_GUID = 3a738b36-b9c5-4763-abbd-6cbd4b25f9ff + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = AndroidBootAppEntryPoint + +[Sources.common] + AndroidBootApp.c + +[LibraryClasses] + AndroidBootImgLib + BaseLib + BaseMemoryLib + BdsLib + DebugLib + DevicePathLib + DxeServicesTableLib + FdtLib + MemoryAllocationLib + PcdLib + PrintLib + UefiApplicationEntryPoint + UefiBootServicesTableLib + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gAndroidFastbootPlatformProtocolGuid + gEfiBlockIoProtocolGuid + gEfiDevicePathFromTextProtocolGuid + gEfiSimpleTextOutProtocolGuid + gEfiSimpleTextInProtocolGuid + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[Packages.ARM, Packages.AARCH64] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[Guids] + gFdtTableGuid + +[Pcd] + gEmbeddedTokenSpaceGuid.PcdAndroidBootDevicePath diff --git a/EmbeddedPkg/Include/Library/AndroidBootImgLib.h b/EmbeddedPkg/Include/Library/AndroidBootImgLib.h index 8116c7c..29fb3f2 100644 --- a/EmbeddedPkg/Include/Library/AndroidBootImgLib.h +++ b/EmbeddedPkg/Include/Library/AndroidBootImgLib.h @@ -47,4 +47,21 @@ typedef struct { /* Check Val (unsigned) is a power of 2 (has only one bit set) */ #define IS_POWER_OF_2(Val) ((Val) != 0 && (((Val) & ((Val) - 1)) == 0)) +/* Android boot image page size is not specified, but it should be power of 2 + * and larger than boot header */ +#define IS_VALID_ANDROID_PAGE_SIZE(Val) \ + (IS_POWER_OF_2(Val) && (Val > sizeof(ANDROID_BOOTIMG_HEADER))) + +EFI_STATUS +AndroidBootImgGetImgSize ( + IN VOID *BootImg, + OUT UINTN *ImgSize + ); + +EFI_STATUS +AndroidBootImgBoot ( + IN VOID *Buffer, + IN UINTN BufferSize + ); + #endif /* __ABOOTIMG_H__ */ diff --git a/EmbeddedPkg/Include/Protocol/AndroidBootImg.h b/EmbeddedPkg/Include/Protocol/AndroidBootImg.h new file mode 100644 index 0000000..1c458d0 --- /dev/null +++ b/EmbeddedPkg/Include/Protocol/AndroidBootImg.h @@ -0,0 +1,47 @@ +/** @file + + Copyright (c) 2017, Linaro. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __ANDROID_BOOTIMG_PROTOCOL_H__ +#define __ANDROID_BOOTIMG_PROTOCOL_H__ + +// +// Protocol interface structure +// +typedef struct _ANDROID_BOOTIMG_PROTOCOL ANDROID_BOOTIMG_PROTOCOL; + +// +// Function Prototypes +// +typedef +EFI_STATUS +(EFIAPI *ANDROID_BOOTIMG_APPEND_KERNEL_ARGS) ( + IN CHAR16 *Args, + IN UINTN Size + ); + +typedef +EFI_STATUS +(EFIAPI *ANDROID_BOOTIMG_UPDATE_DTB) ( + IN EFI_PHYSICAL_ADDRESS OrigDtbBase; + OUT EFI_PHYSICAL_ADDRESS *NewDtbBase; + ); + +struct _ANDROID_BOOTIMG_PROTOCOL { + ANDROID_BOOTIMG_APPEND_KERNEL_ARGS AppendArgs; + ANDROID_BOOTIMG_UPDATE_DTB UpdateDtb; +}; + +extern EFI_GUID gAndroidBootImgProtocolGuid; + +#endif /* __ANDROID_BOOTIMG_PROTOCOL_H__ */ diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c new file mode 100644 index 0000000..c33a164 --- /dev/null +++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c @@ -0,0 +1,444 @@ +/** @file + + Copyright (c) 2013-2014, ARM Ltd. All rights reserved.
+ Copyright (c) 2017, Linaro. All rights reserved. + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define FDT_ADDITIONAL_ENTRIES_SIZE 0x400 + +typedef struct { + MEMMAP_DEVICE_PATH Node1; + EFI_DEVICE_PATH_PROTOCOL End; +} MEMORY_DEVICE_PATH; + +STATIC ANDROID_BOOTIMG_PROTOCOL *mAndroidBootImg; + +STATIC CONST MEMORY_DEVICE_PATH mMemoryDevicePathTemplate = +{ + { + { + HARDWARE_DEVICE_PATH, + HW_MEMMAP_DP, + { + (UINT8)(sizeof (MEMMAP_DEVICE_PATH)), + (UINT8)((sizeof (MEMMAP_DEVICE_PATH)) >> 8), + }, + }, // Header + 0, // StartingAddress (set at runtime) + 0 // EndingAddress (set at runtime) + }, // Node1 + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 } + } // End +}; + +EFI_STATUS +AndroidBootImgGetImgSize ( + IN VOID *BootImg, + OUT UINTN *ImgSize + ) +{ + ANDROID_BOOTIMG_HEADER *Header; + + Header = (ANDROID_BOOTIMG_HEADER *) BootImg; + + if (AsciiStrnCmp ((CONST CHAR8 *)Header->BootMagic, ANDROID_BOOT_MAGIC, + ANDROID_BOOT_MAGIC_LENGTH) != 0) { + return EFI_INVALID_PARAMETER; + } + + /* The page size is not specified, but it should be power of 2 at least */ + ASSERT (IS_VALID_ANDROID_PAGE_SIZE (Header->PageSize)); + + /* Get real size of abootimg */ + *ImgSize = ALIGN_VALUE (Header->KernelSize, Header->PageSize) + + ALIGN_VALUE (Header->RamdiskSize, Header->PageSize) + + ALIGN_VALUE (Header->SecondStageBootloaderSize, Header->PageSize) + + Header->PageSize; + return EFI_SUCCESS; +} + +EFI_STATUS +AndroidBootImgGetKernelInfo ( + IN VOID *BootImg, + OUT VOID **Kernel, + OUT UINTN *KernelSize + ) +{ + ANDROID_BOOTIMG_HEADER *Header; + + Header = (ANDROID_BOOTIMG_HEADER *) BootImg; + + if (AsciiStrnCmp ((CONST CHAR8 *)Header->BootMagic, ANDROID_BOOT_MAGIC, + ANDROID_BOOT_MAGIC_LENGTH) != 0) { + return EFI_INVALID_PARAMETER; + } + + if (Header->KernelSize == 0) { + return EFI_NOT_FOUND; + } + + ASSERT (IS_VALID_ANDROID_PAGE_SIZE (Header->PageSize)); + + *KernelSize = Header->KernelSize; + *Kernel = BootImg + Header->PageSize; + return EFI_SUCCESS; +} + +EFI_STATUS +AndroidBootImgGetRamdiskInfo ( + IN VOID *BootImg, + OUT VOID **Ramdisk, + OUT UINTN *RamdiskSize + ) +{ + ANDROID_BOOTIMG_HEADER *Header; + UINT8 *BootImgBytePtr; + + // Cast to UINT8 so we can do pointer arithmetic + BootImgBytePtr = (UINT8 *) BootImg; + + Header = (ANDROID_BOOTIMG_HEADER *) BootImg; + + if (AsciiStrnCmp ((CONST CHAR8 *)Header->BootMagic, ANDROID_BOOT_MAGIC, + ANDROID_BOOT_MAGIC_LENGTH) != 0) { + return EFI_INVALID_PARAMETER; + } + + ASSERT (IS_VALID_ANDROID_PAGE_SIZE (Header->PageSize)); + + *RamdiskSize = Header->RamdiskSize; + + if (Header->RamdiskSize != 0) { + *Ramdisk = (VOID *) (BootImgBytePtr + + Header->PageSize + + ALIGN_VALUE (Header->KernelSize, Header->PageSize)); + } + return EFI_SUCCESS; +} + +EFI_STATUS +AndroidBootImgGetSecondBootLoaderInfo ( + IN VOID *BootImg, + OUT VOID **Second, + OUT UINTN *SecondSize + ) +{ + ANDROID_BOOTIMG_HEADER *Header; + UINT8 *BootImgBytePtr; + + // Cast to UINT8 so we can do pointer arithmetic + BootImgBytePtr = (UINT8 *) BootImg; + + Header = (ANDROID_BOOTIMG_HEADER *) BootImg; + + if (AsciiStrnCmp ((CONST CHAR8 *)Header->BootMagic, ANDROID_BOOT_MAGIC, + ANDROID_BOOT_MAGIC_LENGTH) != 0) { + return EFI_INVALID_PARAMETER; + } + + ASSERT (IS_VALID_ANDROID_PAGE_SIZE (Header->PageSize)); + + *SecondSize = Header->SecondStageBootloaderSize; + + if (Header->SecondStageBootloaderSize != 0) { + *Second = (VOID *) (BootImgBytePtr + + Header->PageSize + + ALIGN_VALUE (Header->KernelSize, Header->PageSize) + + ALIGN_VALUE (Header->RamdiskSize, Header->PageSize)); + } + return EFI_SUCCESS; +} + +EFI_STATUS +AndroidBootImgGetKernelArgs ( + IN VOID *BootImg, + OUT CHAR8 *KernelArgs + ) +{ + ANDROID_BOOTIMG_HEADER *Header; + + Header = (ANDROID_BOOTIMG_HEADER *) BootImg; + AsciiStrnCpyS (KernelArgs, ANDROID_BOOTIMG_KERNEL_ARGS_SIZE, Header->KernelArgs, + ANDROID_BOOTIMG_KERNEL_ARGS_SIZE); + + return EFI_SUCCESS; +} + +EFI_STATUS +AndroidBootImgGetFdt ( + IN VOID *BootImg, + IN VOID **FdtBase + ) +{ + UINTN SecondLoaderSize; + EFI_STATUS Status; + + /* Check whether FDT is located in second boot region as some vendor do so, + * because second loader is never used as far as I know. */ + Status = AndroidBootImgGetSecondBootLoaderInfo ( + BootImg, + FdtBase, + &SecondLoaderSize + ); + return Status; +} + +EFI_STATUS +AndroidBootImgUpdateArgs ( + IN VOID *BootImg, + OUT VOID *KernelArgs + ) +{ + CHAR8 ImageKernelArgs[ANDROID_BOOTIMG_KERNEL_ARGS_SIZE]; + EFI_STATUS Status; + + // Get kernel arguments from Android boot image + Status = AndroidBootImgGetKernelArgs (BootImg, ImageKernelArgs); + if (EFI_ERROR (Status)) { + return Status; + } + AsciiStrToUnicodeStrS (ImageKernelArgs, KernelArgs, + ANDROID_BOOTIMG_KERNEL_ARGS_SIZE >> 1); + // Append platform kernel arguments + if(mAndroidBootImg->AppendArgs) { + Status = mAndroidBootImg->AppendArgs (KernelArgs, + ANDROID_BOOTIMG_KERNEL_ARGS_SIZE); + } + return Status; +} + +EFI_STATUS +AndroidBootImgLocateFdt ( + IN VOID *BootImg, + IN VOID **FdtBase + ) +{ + INTN Err; + EFI_STATUS Status; + + Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, FdtBase); + if (!EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + Status = AndroidBootImgGetFdt (BootImg, FdtBase); + if (EFI_ERROR (Status)) { + return Status; + } + Err = fdt_check_header (*FdtBase); + if (Err != 0) { + DEBUG ((DEBUG_ERROR, "ERROR: Device Tree header not valid (Err:%d)\n", + Err)); + return EFI_INVALID_PARAMETER; + } + return EFI_SUCCESS; +} + + +EFI_STATUS +AndroidBootImgUpdateFdt ( + IN VOID *BootImg, + IN VOID *FdtBase, + IN VOID *RamdiskData, + IN UINTN RamdiskSize + ) +{ + INTN Err, NewFdtSize, ChosenNode; + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS UpdatedFdtBase, NewFdtBase; + struct fdt_property *Property; + UINT64 RamdiskStart, RamdiskEnd; + int Len; + + NewFdtSize = (UINTN)fdt_totalsize (FdtBase) + + FDT_ADDITIONAL_ENTRIES_SIZE; + Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesData, + EFI_SIZE_TO_PAGES (NewFdtSize), &UpdatedFdtBase); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_WARN, "Warning: Failed to reallocate FDT, err %d.\n", + Status)); + return Status; + } + + // Load the Original FDT tree into the new region + Err = fdt_open_into(FdtBase, (VOID*)UpdatedFdtBase, NewFdtSize); + if (Err) { + DEBUG ((EFI_D_ERROR, "fdt_open_into(): %a\n", fdt_strerror (Err))); + Status = EFI_INVALID_PARAMETER; + goto Fdt_Exit; + } + + ChosenNode = fdt_subnode_offset ((const void *)UpdatedFdtBase, 0, "chosen"); + if (ChosenNode < 0) { + ChosenNode = fdt_add_subnode((void *)UpdatedFdtBase, 0, "chosen"); + if (ChosenNode < 0) { + DEBUG ((EFI_D_ERROR, "Failed to find chosen node in fdt!\n")); + goto Fdt_Exit; + } + } + Property = fdt_get_property_w((void *)UpdatedFdtBase, ChosenNode, + "linux,initrd-start", &Len); + if (NULL == Property && Len == -FDT_ERR_NOTFOUND) { + RamdiskStart = cpu_to_fdt64((UINT64)RamdiskData); + fdt_appendprop ((void *)UpdatedFdtBase, ChosenNode, + "linux,initrd-start", &RamdiskStart, sizeof (UINT64)); + } else if (Property != NULL) { + RamdiskStart = (UINT64)RamdiskData; + fdt_setprop_u64((void *)UpdatedFdtBase, ChosenNode, + "linux,initrd-start", (uint64_t)RamdiskStart); + } else { + DEBUG ((EFI_D_ERROR, "Failed to append fdt Property initrd-start\n", + fdt_strerror (Err))); + Status = EFI_INVALID_PARAMETER; + goto Fdt_Exit; + } + + Property = fdt_get_property_w((void *)UpdatedFdtBase, ChosenNode, + "linux,initrd-end", &Len); + if (NULL == Property && Len == -FDT_ERR_NOTFOUND) { + RamdiskEnd = cpu_to_fdt64((UINT64)(RamdiskData + RamdiskSize)); + fdt_appendprop ((void *)UpdatedFdtBase, ChosenNode, + "linux,initrd-end", &RamdiskEnd, sizeof (UINT64)); + } else if (Property != NULL) { + RamdiskEnd = (UINT64)(RamdiskData + RamdiskSize); + fdt_setprop_u64((void *)UpdatedFdtBase, ChosenNode, + "linux,initrd-end", (uint64_t)RamdiskEnd); + } else { + DEBUG ((EFI_D_ERROR, "Failed to append fdt Property initrd-end\n", + fdt_strerror (Err))); + Status = EFI_INVALID_PARAMETER; + goto Fdt_Exit; + } + + if ( mAndroidBootImg->UpdateDtb) { + Status = mAndroidBootImg->UpdateDtb (UpdatedFdtBase, &NewFdtBase); + if (EFI_ERROR (Status)) { + goto Fdt_Exit; + } + } + + Status = gBS->InstallConfigurationTable ( + &gFdtTableGuid, + (VOID *)(UINTN)NewFdtBase + ); + if (!EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + +Fdt_Exit: + gBS->FreePages (UpdatedFdtBase, EFI_SIZE_TO_PAGES (NewFdtSize)); + return Status; +} + +EFI_STATUS +AndroidBootImgBoot ( + IN VOID *Buffer, + IN UINTN BufferSize + ) +{ + EFI_STATUS Status; + VOID *Kernel; + UINTN KernelSize; + MEMORY_DEVICE_PATH KernelDevicePath; + EFI_HANDLE ImageHandle; + VOID *NewKernelArg; + EFI_LOADED_IMAGE_PROTOCOL *ImageInfo; + VOID *RamdiskData; + UINTN RamdiskSize; + IN VOID *FdtBase; + + Status = gBS->LocateProtocol (&gAndroidBootImgProtocolGuid, NULL, + (VOID **) &mAndroidBootImg); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = AndroidBootImgGetKernelInfo ( + Buffer, + &Kernel, + &KernelSize + ); + if (EFI_ERROR (Status)) { + return Status; + } + + NewKernelArg = AllocateZeroPool (ANDROID_BOOTIMG_KERNEL_ARGS_SIZE); + if (NewKernelArg == NULL) { + DEBUG ((DEBUG_ERROR, "Fail to allocate memory\n")); + return EFI_OUT_OF_RESOURCES; + } + + Status = AndroidBootImgUpdateArgs (Buffer, NewKernelArg); + if (EFI_ERROR (Status)) { + FreePool (NewKernelArg); + return Status; + } + + Status = AndroidBootImgGetRamdiskInfo ( + Buffer, + &RamdiskData, + &RamdiskSize + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = AndroidBootImgLocateFdt (Buffer, &FdtBase); + if (EFI_ERROR (Status)) { + FreePool (NewKernelArg); + return Status; + } + + Status = AndroidBootImgUpdateFdt (Buffer, FdtBase, RamdiskData, RamdiskSize); + if (EFI_ERROR (Status)) { + FreePool (NewKernelArg); + return Status; + } + + KernelDevicePath = mMemoryDevicePathTemplate; + + KernelDevicePath.Node1.StartingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) Kernel; + KernelDevicePath.Node1.EndingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) Kernel + + KernelSize; + + Status = gBS->LoadImage (TRUE, gImageHandle, + (EFI_DEVICE_PATH *)&KernelDevicePath, + (VOID*)(UINTN)Kernel, KernelSize, &ImageHandle); + + // Set kernel arguments + Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, + (VOID **) &ImageInfo); + ImageInfo->LoadOptions = NewKernelArg; + ImageInfo->LoadOptionsSize = StrLen (NewKernelArg) * sizeof (CHAR16); + + // Before calling the image, enable the Watchdog Timer for the 5 Minute period + gBS->SetWatchdogTimer (5 * 60, 0x10000, 0, NULL); + // Start the image + Status = gBS->StartImage (ImageHandle, NULL, NULL); + // Clear the Watchdog Timer if the image returns + gBS->SetWatchdogTimer (0, 0x10000, 0, NULL); + return EFI_SUCCESS; +} diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf new file mode 100644 index 0000000..c92bac0 --- /dev/null +++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf @@ -0,0 +1,48 @@ +#/** @file +# +# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.
+# Copyright (c) 2017, Linaro. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +#**/ + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = AndroidBootImgLib + FILE_GUID = ed3b8739-6fa7-4cb1-8aeb-2496f8fcaefa + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = AndroidBootImgLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + AndroidBootImgLib.c + +[LibraryClasses] + DebugLib + FdtLib + PrintLib + UefiBootServicesTableLib + UefiLib + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[Protocols] + gAndroidBootImgProtocolGuid + +[Guids] + gFdtTableGuid From patchwork Tue Aug 1 09:29:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 109129 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1267574qge; Tue, 1 Aug 2017 02:29:36 -0700 (PDT) X-Received: by 10.98.7.132 with SMTP id 4mr18861837pfh.216.1501579776335; Tue, 01 Aug 2017 02:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501579776; cv=none; d=google.com; s=arc-20160816; b=fmYVJKnlkZxDW45H1WPP5r5wenEvScXmbCxuuOzPhceg21jgjJsz0y3CxXVaF4QFKY u8t3+SRIF0/TH/VD8KoEGqoFCS9jDQjg8P1Dgf7mHxuKE4zFqtVVEzrI8nplktbyyj+Y 4UcM86Fen9Qxl0B8Tp9+gcBscS6EmWY1v6w3Mhp8tbOsGd6AXeqyH1TmqD8mS+zx0xln 1cbdE5mGw9eqYOLmF8dptxiqFWCO+MRbJBmpvlX93X1jw3/XuVG7hEFEadib9Vox/Sk6 Hj5h9LgFVewNCepsFwd0tro0VWp2SoYeJHcgpupUJb6EKHYCGmfocymhvwfdcpvsFODc sHDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Vcefc1RDjnTaYpIgeRSGTnlWn+FDDyS5Gk46OAAYD7o=; b=spWh+qd8V3lmbVuPYDr3X9MrOnjRfU0oSvm0ZpuL9wiCGIil7f/rySb2EMqFkw4c6L 6b84maUM4xvazeRWErwV9FeVyZsWLzZ96KYl0mKtPkmr1Ouo90mTsSYFwBOZImqR9X4Q 98WDIqSjeEq6bGbY/QizStf/iu21irqGnEN34fUrNubgr55NLmzlTGFKkXeAs54RCoTx BdkjxtlQTTikqZMxCbZsT+sza5mxXFKV3rGtexL3E63o7FOm+WVfYZttNimml8wS0kgy G9f8PCqElIzG0Sw0OWSWNXK6NRpdyuMRaFKrAOZ/d//G9cB0p7Grkce0bSqmKtK9mrBT 3+3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=fDflObib; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id o71si17505858pfo.40.2017.08.01.02.29.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 02:29:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=fDflObib; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B7B1521D2DCF0; Tue, 1 Aug 2017 02:27:26 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pg0-x22e.google.com (mail-pg0-x22e.google.com [IPv6:2607:f8b0:400e:c05::22e]) (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 B347E21D2DCE1 for ; Tue, 1 Aug 2017 02:27:24 -0700 (PDT) Received: by mail-pg0-x22e.google.com with SMTP id l64so5632641pge.5 for ; Tue, 01 Aug 2017 02:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r1Jqr4XP0Dk3Vq2ZLJSb9KyT9a+8rjX8BMNHNwxcegU=; b=fDflObibx4ORvU0+7w7hXWC+mwOzTlxcZvVtk1FE7Ed+UY0LXBSeg/VzZk1sYbXy9K Bjx7xU3kSu9aRAa4fApMrQGjAn7qL6r+l6twMIOW1EesbiIi9MvBrRDY7Xi7icJBBPKv 0eQyD5CVTNd/bQgS4IZLJQWLrFu5sb9PR5E1U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r1Jqr4XP0Dk3Vq2ZLJSb9KyT9a+8rjX8BMNHNwxcegU=; b=lNNP9fo7KzqwVUhnhwj+DSMGPbM7yddZB78i+Ko/fB4Xd7PKToqUiJiWrpfCl++qrY BOdLT4n1h/1l+qZQTbXGMJc0JQClee3J+4fnB4nDm0KS81eavweRgsS5R/lDtTBaZcIO SkSX6niEpbX6xfTOxSTtnUauvMpnQfPk4uBxm+keko++aGAEYHf/Q1rPSFUV7oUCG1F9 IhXuYQB7I0VvdRxBUNTJiVgb2qF7nRuLRNS1U7J367eyL5ZZtyL0oLzthik+FpWk0RqM RFbnaY/9R6zRcigaHqOBfCkNIitQztLto83PDLi/hwA+Gzs6bTo0+hax/qro388KitbD 3OnQ== X-Gm-Message-State: AIVw111pIKEVboibS5GCRqQVBMyKFYsRoBZdSgQyZX+ruujLsfAwI489 G1pSC9XNoHfgLq3k X-Received: by 10.101.70.15 with SMTP id v15mr18581511pgq.229.1501579773647; Tue, 01 Aug 2017 02:29:33 -0700 (PDT) Received: from localhost.localdomain ([113.53.228.63]) by smtp.gmail.com with ESMTPSA id i133sm20557070pgc.0.2017.08.01.02.29.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 02:29:32 -0700 (PDT) From: Jun Nie To: haojian.zhuang@linaro.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org Date: Tue, 1 Aug 2017 17:29:01 +0800 Message-Id: <1501579741-28866-4-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501579741-28866-1-git-send-email-jun.nie@linaro.org> References: <1501579741-28866-1-git-send-email-jun.nie@linaro.org> Subject: [edk2] [PATCH v4 4/4] EmbeddedPkg: add Android boot device path and guid 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: , Cc: jason.liu@linaro.org, shawn.guo@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The device path specifies where to load android boot image. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jun Nie --- EmbeddedPkg/EmbeddedPkg.dec | 2 ++ 1 file changed, 2 insertions(+) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 4cd528a..8ad2a84 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -80,6 +80,7 @@ gAndroidFastbootPlatformProtocolGuid = { 0x524685a0, 0x89a0, 0x11e3, {0x9d, 0x4d, 0xbf, 0xa9, 0xf6, 0xa4, 0x03, 0x08}} gUsbDeviceProtocolGuid = { 0x021bd2ca, 0x51d2, 0x11e3, {0x8e, 0x56, 0xb7, 0x54, 0x17, 0xc7, 0x0b, 0x44 }} gPlatformGpioProtocolGuid = { 0x52ce9845, 0x5af4, 0x43e2, {0xba, 0xfd, 0x23, 0x08, 0x12, 0x54, 0x7a, 0xc2 }} + gAndroidBootImgProtocolGuid = { 0x9859bb19, 0x407c, 0x4f8b, {0xbc, 0xe1, 0xf8, 0xda, 0x65, 0x65, 0xf4, 0xa5 }} [PcdsFeatureFlag.common] gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|FALSE|BOOLEAN|0x00000001 @@ -181,6 +182,7 @@ gEmbeddedTokenSpaceGuid.PcdAndroidFastbootUsbProductId|0xbeef|UINT32|0x00000023 gEmbeddedTokenSpaceGuid.PcdAndroidFastbootTcpPort|1234|UINT32|0x00000024 + gEmbeddedTokenSpaceGuid.PcdAndroidBootDevicePath|L""|VOID*|0x00000057 [PcdsFixedAtBuild.ARM] gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize|32|UINT8|0x00000010