From patchwork Wed Oct 10 06:32:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 981713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42VPRh5lSHz9sBk for ; Wed, 10 Oct 2018 17:33:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="tmHdqa+T"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="vQOFb2zu"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42VPRh45m6zF27J for ; Wed, 10 Oct 2018 17:33:04 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="tmHdqa+T"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="vQOFb2zu"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mendozajonas.com (client-ip=66.111.4.27; helo=out3-smtp.messagingengine.com; envelope-from=sam@mendozajonas.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="tmHdqa+T"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="vQOFb2zu"; dkim-atps=neutral Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42VPRT4s8vzF1fF for ; Wed, 10 Oct 2018 17:32:53 +1100 (AEDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 7F3E921F31; Wed, 10 Oct 2018 02:32:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 10 Oct 2018 02:32:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=fm1; bh=Tg9T8dVDHN8uf H9K3xs8082oygkBX4zV/3S8NdZdRgs=; b=tmHdqa+TvHGrooZB7IrenImzCZfIm ZCU1dClQ+xQjYjxwbzN4FH8FXWLIxC/KQIdz1KtIcULNYPhxbKScVLnOUSkmftOj W8Zn6kEJz8CxNewM2OvKXovCipKp8wX5pFw6uoYXcpELxJx92GtEXPlikvSI+ZOI bJAqHDh30l07/Wo7v+0QSCnYtKxo96mlgrVVYCZgq7OF2xXHHpvfCWq+BN9QXCOf MHXy3E7/YG0uwFhRlM6SwBwVTLIRJAUnNRwlQFE3URqAMoTn7vrWXhbziAe6y1e9 YREOwRQ8RpHkVqQ87A5uHO67T2ZrA8ATF0NzfvyMhOohnhbjZvc2CwMcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Tg9T8dVDHN8ufH9K3 xs8082oygkBX4zV/3S8NdZdRgs=; b=vQOFb2zueCWpObulIpBkXDjs4JHJ3O6Nx pqVMaPpEjOnPqMpsuf73pt50DR8UYmBAHpoou+9a6BwqvjntOXgGhSxsxXAQ78L5 64pDqbTd7EklpI73aHRZ2EeLOYlr+aF493M1GVASmzBt8FiOJbQqhDUf+GQDA4dJ FxqMCMY8y6vye/FNE2x5hFdFIr4knn/GSpRRliPN/9pPiRUe3gHXFWq74jq6fNqT TcQXtFE99lh4tNyQV7xmKAAluCtnEbzI5DnPz6Nsla9WyAqL5shQqW0UPVB3i1cz W4WslO2dkokdiV1xtrdGuak3+jgQ5wzQXGuZcu0/2TKgIFXxF10Hg== X-ME-Sender: X-ME-Proxy: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id DE958E454F; Wed, 10 Oct 2018 02:32:48 -0400 (EDT) From: Samuel Mendoza-Jonas To: skiboot@lists.ozlabs.org Date: Wed, 10 Oct 2018 17:32:40 +1100 Message-Id: <20181010063240.32331-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Subject: [Skiboot] [PATCH] core/flash: Ignore prefix when comparing versions. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The Skiboot version can include a "skiboot-" prefix if built with something like Buildroot. The property being compared against won't include this so ignore it. Signed-off-by: Samuel Mendoza-Jonas Reviewed-by: Vasant Hegde --- core/flash.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/flash.c b/core/flash.c index 8e7b90e6..b4bf5516 100644 --- a/core/flash.c +++ b/core/flash.c @@ -160,6 +160,7 @@ static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data) char *prop; int version_len, i; int len = strlen(data); + const char *skiboot_version; const char * version_str[] = {"open-power", "buildroot", "skiboot", "hostboot-binaries", "hostboot", "linux", "petitboot", "occ", "capp-ucode", "sbe", @@ -213,9 +214,22 @@ static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data) prop = data + version_len + 1; dt_add_property_string(fw_version, version_str[i], prop); - if (strncmp(version_str[i], "skiboot", strlen("skiboot")) == 0) - if (strncmp(prop, version, strlen(version)) != 0) + /* Sanity check against what Skiboot thinks its version is. */ + if (strncmp(version_str[i], "skiboot", + strlen("skiboot")) == 0) { + /* + * If Skiboot was built with Buildroot its version may + * include a 'skiboot-' prefix; ignore it. + */ + if (strncmp(version, "skiboot-", + strlen("skiboot-")) == 0) + skiboot_version = version + strlen("skiboot-"); + else + skiboot_version = version; + if (strncmp(prop, skiboot_version, + strlen(skiboot_version)) != 0) prlog(PR_WARNING, "WARNING! Skiboot version does not match VERSION partition!\n"); + } } }