From patchwork Mon Mar 15 05:11:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1452992 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KSBbaA4N; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DzPhP1fkqz9sR4 for ; Mon, 15 Mar 2021 16:13:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B56382ACA; Mon, 15 Mar 2021 06:12:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KSBbaA4N"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D58582A7B; Mon, 15 Mar 2021 06:12:24 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9C69082A6F for ; Mon, 15 Mar 2021 06:12:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1036.google.com with SMTP id kr3-20020a17090b4903b02900c096fc01deso14079823pjb.4 for ; Sun, 14 Mar 2021 22:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r1YcxOCehSGFmS/7Zia8ydjIHFG/zQ84w4Nw1/q7R+o=; b=KSBbaA4NM3z3EZzTVAdycGnyqISb7hFK/TM2HbUjHaCdOSFBWkbzyT3237cKOK6DAn oIJEoa1TXfdcqOlkfvyVGKNN6RgZsOY4jKuIFEhmkoGFBGDjpqnjlWcMohN11xzfGBeJ x91LBpzFmAOaWQXf33GzOMRw0dRqucmOEVEig= 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:mime-version:content-transfer-encoding; bh=r1YcxOCehSGFmS/7Zia8ydjIHFG/zQ84w4Nw1/q7R+o=; b=DQ2GtXkFvm+/OPCTb6+egnFFcVYEQ3Y8zz3gRIX+fM9CCwx8WjUqxwOXioIvFdun+1 1W9jV6tIjyMUzO72vEoNPxOeTEkor9RBI1mDwR1bcajbnYlnylmpdyQm4xQwi7L3xuFF enPhCB4pa7/u5BiIj81Ve6m5mfa+WTtnwuTaYXyf6sLac2OprwGxyHlhfMae+FPLFquC BBif9F+ACweMT09zVp6u6NHKzpN365T+Dy94uIkTJK7yXh7jtboj9cWSK2S5mw+iSvMn 5gJT1Q/tvu9auYc+VZcisz8NBSIFRaHbgYpO4j6iUQ5frQKEybiEBGOyuky8GrE7B9fR VfdQ== X-Gm-Message-State: AOAM533k3Libr8Y4Z+BTJ+pvDpkyVFbk7HgGh0dA77sm1IYdCTl4JXh3 qxkpC+uwwUPWpdvWVxiHnilpJvxSzEbWHLlD X-Google-Smtp-Source: ABdhPJwXun4eW9g7XG6OashudUUggR9A33K5gZYl/4JlgKCpMI3Mloyq6bR8CV5C17U1ryyRuBxaxw== X-Received: by 2002:a17:90a:7a8b:: with SMTP id q11mr11060188pjf.215.1615785129843; Sun, 14 Mar 2021 22:12:09 -0700 (PDT) Received: from sjg1.roam.corp.google.com (85.72.69.111.dynamic.snap.net.nz. [111.69.72.85]) by smtp.gmail.com with ESMTPSA id r30sm11709817pgu.86.2021.03.14.22.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 22:12:09 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , AKASHI Takahiro , Alexandru Gagniuc , Andre Przywara , Atish Patra , Bin Meng , Heinrich Schuchardt , Joe Hershberger , Joel Stanley , Lihua Zhao , Marek Vasut , Masahiro Yamada , Michal Simek , Naoki Hayama , Philippe Reynes , Reuben Dowle , Robert Marko , Sebastian Reichel Subject: [PATCH 07/19] sandbox: image: Allow sandbox to load any image Date: Mon, 15 Mar 2021 18:11:12 +1300 Message-Id: <20210315051124.1940496-6-sjg@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315051124.1940496-1-sjg@chromium.org> References: <20210315051124.1940496-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Sandbox is special in that it is used for testing and it does not match any particular target architecture. Allow it to load an image from any architecture, so that 'bootm' can be used as needed. Signed-off-by: Simon Glass --- common/image-fit.c | 4 ++++ include/image.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/common/image-fit.c b/common/image-fit.c index 28b3d2b1911..2d0ece61815 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1512,6 +1512,10 @@ int fit_image_check_arch(const void *fit, int noffset, uint8_t arch) uint8_t image_arch; int aarch32_support = 0; + /* Let's assume that sandbox can load any architecture */ + if (IS_ENABLED(CONFIG_SANDBOX)) + return true; + if (IS_ENABLED(CONFIG_ARM64_SUPPORT_AARCH32)) aarch32_support = 1; diff --git a/include/image.h b/include/image.h index 138c83dd28d..bcd126d262d 100644 --- a/include/image.h +++ b/include/image.h @@ -886,6 +886,11 @@ static inline int image_check_type(const image_header_t *hdr, uint8_t type) } static inline int image_check_arch(const image_header_t *hdr, uint8_t arch) { +#ifndef USE_HOSTCC + /* Let's assume that sandbox can load any architecture */ + if (IS_ENABLED(CONFIG_SANDBOX)) + return true; +#endif return (image_get_arch(hdr) == arch) || (image_get_arch(hdr) == IH_ARCH_ARM && arch == IH_ARCH_ARM64); }