From patchwork Mon Dec 11 18:47:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schmitz X-Patchwork-Id: 847166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UoQ70ymj"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ywX4r650Gz9s5L for ; Tue, 12 Dec 2017 05:47:24 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 13AE12FE23; Mon, 11 Dec 2017 18:47:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NGyMZloePQkL; Mon, 11 Dec 2017 18:47:20 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id BE290266A9; Mon, 11 Dec 2017 18:47:20 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 228F91BFA4B for ; Mon, 11 Dec 2017 18:47:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1A16387396 for ; Mon, 11 Dec 2017 18:47:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OlgkuJVEZlss for ; Mon, 11 Dec 2017 18:47:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 515E28738C for ; Mon, 11 Dec 2017 18:47:19 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id v105so18652401wrc.3 for ; Mon, 11 Dec 2017 10:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=rcv2E+FkcE4wnEmrylRwhT9FXdG1d8liKazfk+5BU8k=; b=UoQ70ymjtEmgjnuD+uosmgOcU3ie8KGaB37WLhSceYUyZrs/DsFoeyYdR5oO77kRZr O5GlGkT6xSpCy64e1KWvnakYLgyRCcZ6Zf3kGAuOje+k8W5OABC5XryDZbdBqH7xpk2D 4QDWaSBAfF4zXAB2GVgtgxjdfAnwZF7X4Lvkt3fh8sVhIu2DRlgRGNAGQpu8X41kU53w 216D+N457e6856HT6yU4uk6yeu+4/rpgW7H+2uaDEKRiyk5a55gXYmxBn6jLHyrDJbiX xwRLEVJSls1PjsFA7gh4m6DNpThbI+r+sodl9fke0rrXDYWOOC6k0eEY1zBmkLOfKeJM 8E2g== 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=rcv2E+FkcE4wnEmrylRwhT9FXdG1d8liKazfk+5BU8k=; b=BOAm/5kWxBPk1TrJT8RIfwunnSQ+LeOgWS2rnwDIUNY2CB/AjEqJbBn7tw4INGqx8Q 0vzXTASkR2uHfv5j/RPxtniRjcP3SqRcQjewuZOeJW14TUIyUBs0B1tCrlOTqYfCzu4W TTFzCP4RpvWAAmP/Db37tPG/twdC6pihfmN0GZpyG+hTtO/i+J7IMUiPC20L7RRfVrYq qJGaH7TcyTGs5U5Yo1SDu5NfzOeXkB79zKZIzoq+foxQG4iDbBDZugNQILvFjt6D/4pU unmIzbgVGFcC/p6KkAe8oYrYr0RwLboBBLwqSshPloKNsps9c0pPm/F+2K/tTfoGLb3q Iyyw== X-Gm-Message-State: AKGB3mKuvFvAF848sNIglWMM29c+HMzHW6nM0D8pHiLPt7LCJZCUC9Y4 6ir3a3U0qtICoQkd04sV+YVtf4g3 X-Google-Smtp-Source: ACJfBovXQ0gz1ICj/gPdxFYRKP9ft8DOhgOqxSLtzsA7mXeQuBPH6LxGvT7WUOFWZHUGBDY0I9as7Q== X-Received: by 10.223.166.51 with SMTP id k48mr1259734wrc.125.1513018037380; Mon, 11 Dec 2017 10:47:17 -0800 (PST) Received: from metis.ti.rwth-aachen.de (metis.ti.rwth-aachen.de. [134.130.35.68]) by smtp.gmail.com with ESMTPSA id q15sm17217200wra.91.2017.12.11.10.47.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Dec 2017 10:47:16 -0800 (PST) From: Johannes Schmitz To: buildroot@buildroot.org Date: Mon, 11 Dec 2017 19:47:08 +0100 Message-Id: <1513018028-18256-1-git-send-email-johannes.schmitz1@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [Buildroot] [PATCH 1/1] boot/uboot: add config option for uboot environment padding byte X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas.petazzoni@free-electrons.com, Johannes Schmitz , yann.morin.1998@free.fr MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Updated the help text for the size of the uboot environment. The size of the uboot environment, which is given in bytes, needs to be exactly correct in order to calculate the CRC checksum as expected and re-calculated by uboot during the target boot process. Otherwise the environment is ignored during boot due to CRC mismatch. Additionally, add the missing option to specify the padding byte which is used by the mkenvimage -p parameter. Signed-off-by: Johannes Schmitz Reviewed-by: "Yann E. MORIN" Reviewed-by: "Yann E. MORIN" Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
--- boot/uboot/Config.in | 13 +++++++++++-- boot/uboot/uboot.mk | 10 ++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in index 2829d2c..32e283a 100644 --- a/boot/uboot/Config.in +++ b/boot/uboot/Config.in @@ -413,8 +413,17 @@ config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE config BR2_TARGET_UBOOT_ENVIMAGE_SIZE string "Size of environment" help - Size of envronment, can be prefixed with 0x for hexadecimal - values. + Size of environment in bytes, can be prefixed with 0x for + hexadecimal values. Needs to match exactly for correct CRC + checksum calculation as re-calculated by uboot during each + target boot. If a CRC mismatch occurs during boot the + environment will be ignored. + +config BR2_TARGET_UBOOT_ENVIMAGE_PADDING_BYTE + hex "Padding byte" + default 0x00 + help + The byte used for padding at the end of the environment image. config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT bool "Environment has two copies" diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index 3917599..43fdde4 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -256,10 +256,12 @@ define UBOOT_INSTALL_IMAGES_CMDS ) $(if $(BR2_TARGET_UBOOT_ENVIMAGE), cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) | \ - $(HOST_DIR)/bin/mkenvimage -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \ - $(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \ - $(if $(filter BIG,$(BR2_ENDIAN)),-b) \ - -o $(BINARIES_DIR)/uboot-env.bin -) + $(HOST_DIR)/bin/mkenvimage \ + $(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \ + $(if $(filter BIG,$(BR2_ENDIAN)),-b) \ + -p $(BR2_TARGET_UBOOT_ENVIMAGE_PADDING_BYTE) \ + -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \ + -o $(BINARIES_DIR)/uboot-env.bin -) $(if $(BR2_TARGET_UBOOT_BOOT_SCRIPT), $(HOST_DIR)/bin/mkimage -C none -A $(MKIMAGE_ARCH) -T script \ -d $(call qstrip,$(BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE)) \