From patchwork Sat Feb 6 16:57:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437029 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; 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=AFMsbWW4; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4DXz4d1ccnz9sVw for ; Sun, 7 Feb 2021 03:58:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 491C482483; Sat, 6 Feb 2021 17:57:55 +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="AFMsbWW4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B174A82653; Sat, 6 Feb 2021 17:57:48 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (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 5A7298006D for ; Sat, 6 Feb 2021 17:57:44 +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-il1-x131.google.com with SMTP id e7so8821113ile.7 for ; Sat, 06 Feb 2021 08:57:44 -0800 (PST) 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=1nTIRKC9yifQKwURdpQd1F62NHV9Skjn7RNcRRiiDiU=; b=AFMsbWW4IDBH/Z+rbEpJQyAHljupqaZuJEMm8vCs4+dFiBfB+piqK6aIct6zI9Xz7J vpj/7TIdA4ECZJqb7tx0jDQPHBM84jt8qllLja6YoH6EUHeozo2riIJ5aTpr/zvFXvFz uY3Q7t4HSbKv2iw4sRXAx0isg1SVQRfb55bLY= 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=1nTIRKC9yifQKwURdpQd1F62NHV9Skjn7RNcRRiiDiU=; b=QShGW9BrBPwggQEuYV2MaTSq2zvfXGx/wE0eGHBHQfJifcabas2m85sgWD7fFLKs7h Q0RzUbifZAS96N7lolGREqb2QjkEtY0EnwwN1on029UnRFnVW1zk57qUmRaN8BSXM/5r dZm1j6zRDzWUFLV70UcXCXcIgM3bwQzvz7jkpILWHKU6M85rTr/kDIeq/xhsKPfzeBKP qpMaav8ZcwMifhTnggQO68yok9Pi/LkUjLJUnhJu+nBod05ahrbioeEDOekO7RxSa+sR enc3LzTMT9mejfB2cNJRz1jFdaJAzsmmFGuVfYO4piNYHTzQT2pAIf2aWUypZ1uMywKs CgQA== X-Gm-Message-State: AOAM533XQpoIyRnNaUFtBbrRGchOy6xSjQccOA62rA24LYkU7/s8xk/G YLa7iT+bgtQNvkNrJTekMsifs18EMvkRvCgV X-Google-Smtp-Source: ABdhPJz+zwlGAFaqGbOKvqoFaX8Y48jh3ODW3eKYrfRN7O5Lb/NJI61tYOlYDUvlvwHHU2YE6LRD5A== X-Received: by 2002:a05:6e02:1545:: with SMTP id j5mr8647631ilu.296.1612630662896; Sat, 06 Feb 2021 08:57:42 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:42 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v4 1/9] spl: Drop duplicate 'Jumping to U-Boot' message Date: Sat, 6 Feb 2021 09:57:27 -0700 Message-Id: <20210206165736.3491584-2-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean This is printed twice but we only need one message, since there is very little processing in between them. Drop the second one, since all branches of the switch() already have output. Update the U-Boot message to include the phase being jumped to. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Show phase only for IH_OS_U_BOOT, drop the last debug() common/spl/spl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index cdd7b05f279..42004506446 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -693,7 +693,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #endif switch (spl_image.os) { case IH_OS_U_BOOT: - debug("Jumping to U-Boot\n"); + debug("Jumping to %s...\n", spl_phase_name(spl_next_phase())); break; #if CONFIG_IS_ENABLED(ATF) case IH_OS_ARM_TRUSTED_FIRMWARE: @@ -740,7 +740,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2) debug("Failed to stash bootstage: err=%d\n", ret); #endif - debug("loaded - jumping to %s...\n", spl_phase_name(spl_next_phase())); spl_board_prepare_for_boot(); jump_to_image_no_args(&spl_image); } From patchwork Sat Feb 6 16:57:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437031 X-Patchwork-Delegate: trini@ti.com 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=Rx3vjKM0; 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 4DXz5247kYz9sS8 for ; Sun, 7 Feb 2021 03:58:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 395D68269C; Sat, 6 Feb 2021 17:58:04 +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="Rx3vjKM0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 115958268A; Sat, 6 Feb 2021 17:57:54 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (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 42DA180404 for ; Sat, 6 Feb 2021 17:57:45 +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-io1-xd33.google.com with SMTP id u8so10535314ior.13 for ; Sat, 06 Feb 2021 08:57:45 -0800 (PST) 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=Xnp+Wnb7NTFMp9pBm5ok6jpz559hDoS7nWDpzwBKGGk=; b=Rx3vjKM0SJsyBh/D9igapY8j85TeElj7MIHAPU2QnategjtEdR8OJk+/72sGBCEQD5 unt9uwy5Ve12C4DACAgXfVl90HYwvMDNBUfpJdvae3gxVHnK/Cztji6h/F2HA5ZBIjP9 Cu7vfMVZ41x9bngtr8JftgNCh4p5jTIANkBck= 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=Xnp+Wnb7NTFMp9pBm5ok6jpz559hDoS7nWDpzwBKGGk=; b=f7faShKB9n6lmtFkAHQ6YA0mnF9oznLF+mmWpF+XK9wfcgzQtcY4DHG5oeytmghDCr SHmuOQTCP4MQHRwouivGr7W8Rf9NKJK//c9amrP6Vp+rwJn6a0RrC+6vm7q7PfUZdR3F FI+vVsneg5g2Ov/m8t9L7Dsp9Nbe2R3AMJQCB8M6mrP2YR1DwonwCZ17NqY4RsqeBTaS UqG6UNWCmnG8xC+FztjkWguIxjrXlLboTIXQYEQ26sdAn9V5EgHH5O3Ip75cdZccBxsS nFug6pjWS+tOrQyCDvpsxA/htfjIeJoIE3VglIl2R3hEL5vySEkhuSk3zA1F5TcsF3Qb OO3A== X-Gm-Message-State: AOAM530ykXKMrcuTuY8GRdDGjNNvVGRi/OFxpxFPh2TzLVoFqsLyB44B jhvo6qRCkyyBG6WYWjzNEuVw+iakOuHsVK0a X-Google-Smtp-Source: ABdhPJx9h5Um2f8imzd+20DZr4lRQAuQHlsqJ2YVblPo57VHxjPYWSbmw02fZ4nBC09giAoiaK4H+w== X-Received: by 2002:a05:6602:2c52:: with SMTP id x18mr9135129iov.5.1612630663815; Sat, 06 Feb 2021 08:57:43 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:43 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v4 2/9] binman: Indicate how to make binman verbose Date: Sat, 6 Feb 2021 09:57:28 -0700 Message-Id: <20210206165736.3491584-3-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean Add notes about how to make binman produce verbose logging when building. Add a comment on how to do this. Signed-off-by: Simon Glass --- (no changes since v1) Makefile | 1 + tools/binman/README | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ebbedb1fb1a..2917af20ecd 100644 --- a/Makefile +++ b/Makefile @@ -1330,6 +1330,7 @@ u-boot.ldr: u-boot # binman # --------------------------------------------------------------------------- # Use 'make BINMAN_DEBUG=1' to enable debugging +# Use 'make BINMAN_VERBOSE=3' to set vebosity level default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE)) quiet_cmd_binman = BINMAN $@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ diff --git a/tools/binman/README b/tools/binman/README index a00c9026163..45f0a0c2cd3 100644 --- a/tools/binman/README +++ b/tools/binman/README @@ -637,7 +637,8 @@ Logging Binman normally operates silently unless there is an error, in which case it just displays the error. The -D/--debug option can be used to create a full -backtrace when errors occur. +backtrace when errors occur. You can use BINMAN_DEBUG=1 when building to select +this. Internally binman logs some output while it is running. This can be displayed by increasing the -v/--verbosity from the default of 1: @@ -649,6 +650,7 @@ by increasing the -v/--verbosity from the default of 1: 4: detailed information about each operation 5: debug (all output) +You can use BINMAN_VERBOSE=5 (for example) when building to select this. Hashing Entries --------------- From patchwork Sat Feb 6 16:57:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437032 X-Patchwork-Delegate: trini@ti.com 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=bjcfUcpr; 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 4DXz5F49ZDz9sW0 for ; Sun, 7 Feb 2021 03:58:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D7436826A6; Sat, 6 Feb 2021 17:58:07 +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="bjcfUcpr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E88C28268D; Sat, 6 Feb 2021 17:57:52 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 24896806C5 for ; Sat, 6 Feb 2021 17:57:46 +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-il1-x12b.google.com with SMTP id p15so8831358ilq.8 for ; Sat, 06 Feb 2021 08:57:46 -0800 (PST) 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=92ABeB1WH5fzrh9hYLAIfGdBgbZcB3St91br4SoCgj4=; b=bjcfUcprF4oeo91i1UuW6gUsKEAxgCusERNWCtTXCTTjhgikfBjvAPJ5u1j5DahiqS L+oX8swFxRFLqnURFpGBJh/lvahFf9MI+nlNE0pTrHmFzTDQ082abHCeub+VGOu1kyrY F4KnKEyBZwNqG2xKa6QH2aqOMzGX8ONso7t58= 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=92ABeB1WH5fzrh9hYLAIfGdBgbZcB3St91br4SoCgj4=; b=i0bFEMb2+vK4qMx2RrRgZ8VvYo4I/gpCECGmhkRIoXPxFAcs0GKhApHGOTVrMCQCvk /FPh6j6Y1a5fOXePMaiNjjksB02QnxiPCaajC6ZUlg928PxC7aEMdUiUZSRyYVQzL65N bhoXfHgVS4SuT9asHuDrg6DwB3u0zz23SYy/tK+ELlXRhlu9eAsb4nPkHddUCC81YQ5v jvozcDhZ78qsO0FRkvfcn7Td0vBMaEED0Ruj4gWPQkRKPrXSRz0D8o/CxGBB5CIOsWhy qQncXrJNrZxeSH6f3yWOab1sPPeqaRPeBMKizPPhUUuPfIxkPBr5J1eq92jGm2YQEWBo oqTg== X-Gm-Message-State: AOAM533g5c8w3FyBcvCOxNS70KZHzQKFjAJWlkDQKnm3a5KUD2n0vy5S yBJuuESdAb90UfbARBPOpSxFCiRQTZiyxOo4 X-Google-Smtp-Source: ABdhPJzox8QvYRsBAQ0owXuMbrfhwBuHuKEj/MbhOaBt/ru9mcpSFECbXOo/s83ICyOaXBv9mTF/xw== X-Received: by 2002:a05:6e02:1343:: with SMTP id k3mr8779989ilr.102.1612630664689; Sat, 06 Feb 2021 08:57:44 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:44 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v4 3/9] doc: describe the md command Date: Sat, 6 Feb 2021 09:57:29 -0700 Message-Id: <20210206165736.3491584-4-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean Provide a man-page for the md command. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Add new patch to describe the md command doc/Makefile | 1 - doc/usage/index.rst | 1 + doc/usage/md.rst | 96 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 doc/usage/md.rst diff --git a/doc/Makefile b/doc/Makefile index a686d4728ec..683e4b56099 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -56,7 +56,6 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4) PYTHONDONTWRITEBYTECODE=1 \ BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \ $(SPHINXBUILD) \ - -W \ -b $2 \ -c $(abspath $(srctree)/$(src)) \ -d $(abspath $(BUILDDIR)/.doctrees/$3) \ diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 5754958d7e4..8f302c26688 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -26,6 +26,7 @@ Shell commands load loady mbr + md pstore sbi true diff --git a/doc/usage/md.rst b/doc/usage/md.rst new file mode 100644 index 00000000000..3951b0d58f5 --- /dev/null +++ b/doc/usage/md.rst @@ -0,0 +1,96 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +md command +========== + +Synopis +------- + +:: + + md
[] [] + +Description +----------- + +The md command is used to dump the contents of memory. It uses a standard +format that includes the address, hex data and ASCII display. It supports +various data sizes and uses the endianness of the target. + +The specified data_size and length become the defaults for future memory +commands commands. + +address + start address to display + +data_size + size of each value to display (defaults to .l): + + ========= =================== + data_size Output size + ========= =================== + .b byte + .w word (16 bits) + .l long (32 bits) + .q quadword (64 bits) + ========= =================== + +length + number of values to dump. Defaults to 40 (0d64). Note that this is not + the same as the number of bytes, unless .b is used. + + +Example +------- + +:: + + => md 10000 + 00010000: 00010000 00000000 f0f30f00 00005596 .............U.. + 00010010: 10011010 00000000 10011010 00000000 ................ + 00010020: 10011050 00000000 b96d4cd8 00007fff P........Lm..... + 00010030: 00000000 00000000 f0f30f18 00005596 .............U.. + 00010040: 10011040 00000000 10011040 00000000 @.......@....... + 00010050: b96d4cd8 00007fff 10011020 00000000 .Lm..... ....... + 00010060: 00000003 000000c3 00000000 00000000 ................ + 00010070: 00000000 00000000 f0e892f3 00005596 .............U.. + 00010080: 00000000 000000a1 00000000 00000000 ................ + 00010090: 00000000 00000000 f0e38aa6 00005596 .............U.. + 000100a0: 00000000 000000a6 00000022 00000000 ........"....... + 000100b0: 00000001 00000000 f0e38aa1 00005596 .............U.. + 000100c0: 00000000 000000be 00000000 00000000 ................ + 000100d0: 00000000 00000000 00000000 00000000 ................ + 000100e0: 00000000 00000000 00000000 00000000 ................ + 000100f0: 00000000 00000000 00000000 00000000 ................ + => md.b 10000 + 00010000: 00 00 01 00 00 00 00 00 00 0f f3 f0 96 55 00 00 .............U.. + 00010010: 10 10 01 10 00 00 00 00 10 10 01 10 00 00 00 00 ................ + 00010020: 50 10 01 10 00 00 00 00 d8 4c 6d b9 ff 7f 00 00 P........Lm..... + 00010030: 00 00 00 00 00 00 00 00 18 0f f3 f0 96 55 00 00 .............U.. + => md.b 10000 10 + 00010000: 00 00 01 00 00 00 00 00 00 0f f3 f0 96 55 00 00 .............U.. + => + 00010010: 10 10 01 10 00 00 00 00 10 10 01 10 00 00 00 00 ................ + => + 00010020: 50 10 01 10 00 00 00 00 d8 4c 6d b9 ff 7f 00 00 P........Lm..... + => + => md.q 10000 + 00010000: 0000000000010000 00005596f0f30f00 .............U.. + 00010010: 0000000010011010 0000000010011010 ................ + 00010020: 0000000010011050 00007fffb96d4cd8 P........Lm..... + 00010030: 0000000000000000 00005596f0f30f18 .............U.. + 00010040: 0000000010011040 0000000010011040 @.......@....... + 00010050: 00007fffb96d4cd8 0000000010011020 .Lm..... ....... + 00010060: 000000c300000003 0000000000000000 ................ + 00010070: 0000000000000000 00005596f0e892f3 .............U.. + +The empty commands cause a 'repeat', so that md shows the next available data +in the same format as before. + + +Return value +------------ + +The return value $? is always 0 (true). + + From patchwork Sat Feb 6 16:57:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437030 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; 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=iX7aP68m; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4DXz4q5w41z9sS8 for ; Sun, 7 Feb 2021 03:58:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BED3E8268A; Sat, 6 Feb 2021 17:57:59 +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="iX7aP68m"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A937E82699; Sat, 6 Feb 2021 17:57:53 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 025A18263B for ; Sat, 6 Feb 2021 17:57:47 +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-il1-x136.google.com with SMTP id o7so4326625ils.2 for ; Sat, 06 Feb 2021 08:57:46 -0800 (PST) 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=efbu56xxlp8GfP7JgrDnBJak6wCbpf2p+Os4LlgPzT8=; b=iX7aP68mglhMTLAKXOHHKOfUF6FvWzXzFLXNjh+67cFmxqdz4N0zDF+906OE5KT6vt 91GYO2ZuouVd4xPMv42O/PsHrrPiGvtK8kdctlsK9TsBXXXE0litiyrxpW07zqaBKZIl JF3pBoY75c4ob9miMaBXdkpIQT8o8jMSRZeYY= 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=efbu56xxlp8GfP7JgrDnBJak6wCbpf2p+Os4LlgPzT8=; b=g8R8wHVmW80YuzkuTzvrXp+6Ct2kQ5ifmQj72K7loIdSLn/MGK797vCdjWq4b3x0Lm 4zHmFiIX1+T2rGXfBAn9UwXctCKyuWt0e67RTSEXeitqmv+Ave/24dP+ETlveJAMweYk 0aKD3IBph1xxDZK00ThX1YXVeoouw7bD8a2u0+AQg/J09Nx6NkJ9VLgKpGvpDsiFz4tI 1I6i6SYoxchxciEA6B6jI38tC3dK4VMDlyP3Yjy13/4tXFubhGq4oMmFHGwnAWGN9lnD 9C4cp9hj3S2k6x0v7qsEvhd3ETo6rWDufco7v+Tq2yt4QHF1S2X7N4QG2HOt8C01wzU+ iADA== X-Gm-Message-State: AOAM532F/ET/ZaixYcY4efykIhW9k+FIJ3PrvUU2w8k6DOz0DMt9IfL/ EicwHOzcz/GxhJx1KGssaL2KWclz84/Uh19y X-Google-Smtp-Source: ABdhPJyrvepXw0g7FlZmQNB+S+8aOJyQsLq6sxHuyOri4wOGkoFGu+BU8h4k6kYKhUwnTjO7SnYPmw== X-Received: by 2002:a92:d146:: with SMTP id t6mr8808807ilg.272.1612630665662; Sat, 06 Feb 2021 08:57:45 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:45 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v4 4/9] doc: Add a note about producing 'md.b' output using hexdump Date: Sat, 6 Feb 2021 09:57:30 -0700 Message-Id: <20210206165736.3491584-5-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean Comparing a hex dump on the U-Boot command line with the contents of a file on the host system is fairly easy and convenient to do manually if it is small. But the format used hexdump by default differs from that shown by U-Boot. Add a note about how to make them the same. (For large dumps, writing the data to the network with tftpput, or to a USB stick with ext4save is easiest.) Signed-off-by: Simon Glass --- Changes in v4: - Indicate that hd does not show the offset correctly - Add an xxd + sed example too Changes in v3: - Add this to the docs for the md command doc/usage/md.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/usage/md.rst b/doc/usage/md.rst index 3951b0d58f5..4c1073ea354 100644 --- a/doc/usage/md.rst +++ b/doc/usage/md.rst @@ -39,6 +39,16 @@ length number of values to dump. Defaults to 40 (0d64). Note that this is not the same as the number of bytes, unless .b is used. +Note that the format of 'md.b' can be emulated from linux with:: + + # This works but requires using sed to get the extra spaces + # is the address, is the filename + xxd -o -g1 |sed 's/ / /' >bad + + # This uses a single tool but the offset always starts at 0 + # is the filename + hexdump -v -e '"%08.8_ax: " 16/1 "%02x " " "' -e '16/1 "%_p" "\n" ' + Example ------- From patchwork Sat Feb 6 16:57:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437034 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; 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=U0YnqR9O; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4DXz5g0Q7Rz9sS8 for ; Sun, 7 Feb 2021 03:59:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0CF3B82656; Sat, 6 Feb 2021 17:58:15 +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="U0YnqR9O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0F2F1806C5; Sat, 6 Feb 2021 17:57:55 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 000C882483 for ; Sat, 6 Feb 2021 17:57:47 +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-il1-x129.google.com with SMTP id o7so4326663ils.2 for ; Sat, 06 Feb 2021 08:57:47 -0800 (PST) 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=EBWqiU5g7TszJwN/JKm9cotbYEXsYFyMNc+8DPDmGgs=; b=U0YnqR9OS9wWHA1uid2QaxQXkkP5P6ZfwbCb9Atv2O2BXtwS4wB8gmG/MLspzhp+mC BQ0eYowStB4KZD0X22gGyUTf1qIGueGDOA1tHpj/lwKcUqKkHhQuQaHoVLkoqmNal7XP +9IoN6ZYsS9uiBF/vHtwO7vzvnHlQYlnghqQA= 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=EBWqiU5g7TszJwN/JKm9cotbYEXsYFyMNc+8DPDmGgs=; b=sJluNsgm0qsIZ+pXvkxYmGkbTUaO1/yjPpHPV95M0HfD8JsKOCz89SxPPGHSgqdHju 4gqa2BnGiy/g3tmgqhbok4uLTLkEGngycsprB2ZN9pgVncpJmTMBQGJ+EyUnDi3Gx0bS 0R17K9BBm6wbptSL5QYBSg7oAWfbKkykn4LQWyeyrqOIUzNmYahkhrAZlSmDLudmWxGr zzHwWuI5VSWT2/UeFEifccqtZJChz7y6SEl45Wxu3G9CbUyTainRJ0uCjRzoM5Kxafpq yNu2uZ4gMCda1kH+VqReDtp990ZXCaMImmTmBb52pMgeCcctRzezPUDrG/qJciENlMMc I/Kg== X-Gm-Message-State: AOAM531LX7ieYIZojqLvnZ+DVJkt0jF4ik2YEYr9pPipKZQwZEIE/6c/ R6QySbdL9sNPv5yawYAtri5SfRShoeX7Msoq X-Google-Smtp-Source: ABdhPJxA++sWgtIH29LtbePo+1beS3RH25g/KCIm/ARG1KijynCvc6YMaUySiKeP16l59jDYYZ736g== X-Received: by 2002:a92:c26a:: with SMTP id h10mr1439751ild.234.1612630666528; Sat, 06 Feb 2021 08:57:46 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:46 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Stefan Bosch Subject: [PATCH v4 5/9] s5p4418_nanopi2: Drop dead code Date: Sat, 6 Feb 2021 09:57:31 -0700 Message-Id: <20210206095728.v4.5.I4bf120bb55dcad092750cccf064b4fd333e0efa9@changeid> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean This code is still using the old command typedef. It was not noticed since this file is not currently built. It is using a non-existent option in the Makefile. Drop this file since it is not needed for correct operation. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Drop the file instead of fixing it up arch/arm/mach-nexell/Makefile | 1 - arch/arm/mach-nexell/cmd_boot_linux.c | 144 -------------------------- 2 files changed, 145 deletions(-) delete mode 100644 arch/arm/mach-nexell/cmd_boot_linux.c diff --git a/arch/arm/mach-nexell/Makefile b/arch/arm/mach-nexell/Makefile index 10b3963ed10..dda16dbb8e6 100644 --- a/arch/arm/mach-nexell/Makefile +++ b/arch/arm/mach-nexell/Makefile @@ -10,4 +10,3 @@ obj-y += nx_gpio.o obj-y += tieoff.o obj-$(CONFIG_ARCH_S5P4418) += reg-call.o obj-$(CONFIG_ARCH_S5P4418) += nx_sec_reg.o -obj-$(CONFIG_CMD_BOOTL) += cmd_boot_linux.o diff --git a/arch/arm/mach-nexell/cmd_boot_linux.c b/arch/arm/mach-nexell/cmd_boot_linux.c deleted file mode 100644 index f2dedfe1625..00000000000 --- a/arch/arm/mach-nexell/cmd_boot_linux.c +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2016 nexell - * jhkim - */ - -#include -#include -#include -#include -#include -#include -#include - -#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_CLI_FRAMEWORK) - -DECLARE_GLOBAL_DATA_PTR; - -static bootm_headers_t linux_images; - -static void boot_go_set_os(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[], - bootm_headers_t *images) -{ - char * const img_addr = argv[0]; - - images->os.type = IH_TYPE_KERNEL; - images->os.comp = IH_COMP_NONE; - images->os.os = IH_OS_LINUX; - images->os.load = simple_strtoul(img_addr, NULL, 16); - images->ep = images->os.load; -#if defined(CONFIG_ARM) - images->os.arch = IH_ARCH_ARM; -#elif defined(CONFIG_ARM64) - images->os.arch = IH_ARCH_ARM64; -#else - #error "Not support architecture ..." -#endif - if (!IS_ENABLED(CONFIG_OF_LIBFDT) && !IS_ENABLED(CONFIG_SPL_BUILD)) { - /* set DTB address for linux kernel */ - if (argc > 2) { - unsigned long ft_addr; - - ft_addr = simple_strtol(argv[2], NULL, 16); - images->ft_addr = (char *)ft_addr; - - /* - * if not defined IMAGE_ENABLE_OF_LIBFDT, - * must be set to fdt address - */ - if (!IMAGE_ENABLE_OF_LIBFDT) - gd->bd->bi_boot_params = ft_addr; - - debug("## set ft:%08lx and boot params:%08lx [control of:%s]" - "...\n", ft_addr, gd->bd->bi_boot_params, - IMAGE_ENABLE_OF_LIBFDT ? "on" : "off"); - } - } -} - -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_LMB) -static void boot_start_lmb(bootm_headers_t *images) -{ - ulong mem_start; - phys_size_t mem_size; - - lmb_init(&images->lmb); - - mem_start = getenv_bootm_low(); - mem_size = getenv_bootm_size(); - - lmb_add(&images->lmb, (phys_addr_t)mem_start, mem_size); - - arch_lmb_reserve(&images->lmb); - board_lmb_reserve(&images->lmb); -} -#else -#define lmb_reserve(lmb, base, size) -static inline void boot_start_lmb(bootm_headers_t *images) { } -#endif - -int do_boot_linux(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - boot_os_fn *boot_fn; - bootm_headers_t *images = &linux_images; - int flags; - int ret; - - boot_start_lmb(images); - - flags = BOOTM_STATE_START; - - argc--; argv++; - boot_go_set_os(cmdtp, flag, argc, argv, images); - - if (IS_ENABLED(CONFIG_OF_LIBFDT)) { - /* find flattened device tree */ - ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, images, - &images->ft_addr, &images->ft_len); - if (ret) { - puts("Could not find a valid device tree\n"); - return 1; - } - set_working_fdt_addr((ulong)images->ft_addr); - } - - if (!IS_ENABLED(CONFIG_OF_LIBFDT)) - flags |= BOOTM_STATE_OS_GO; - - boot_fn = do_bootm_linux; - ret = boot_fn(flags, argc, argv, images); - - if (ret == BOOTM_ERR_UNIMPLEMENTED) - show_boot_progress(BOOTSTAGE_ID_DECOMP_UNIMPL); - else if (ret == BOOTM_ERR_RESET) - do_reset(cmdtp, flag, argc, argv); - - return ret; -} - -U_BOOT_CMD(bootl, CONFIG_SYS_MAXARGS, 1, do_boot_linux, - "boot linux image from memory", - "[addr [arg ...]]\n - boot linux image stored in memory\n" - "\tuse a '-' for the DTB address\n" -); -#endif - -#if defined(CONFIG_CMD_BOOTD) && !defined(CONFIG_CMD_BOOTM) -int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - return run_command(env_get("bootcmd"), flag); -} - -U_BOOT_CMD(boot, 1, 1, do_bootd, - "boot default, i.e., run 'bootcmd'", - "" -); - -/* keep old command name "bootd" for backward compatibility */ -U_BOOT_CMD(bootd, 1, 1, do_bootd, - "boot default, i.e., run 'bootcmd'", - "" -); -#endif From patchwork Sat Feb 6 16:57:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437033 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; 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=gvHpDexu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4DXz5S47sVz9sS8 for ; Sun, 7 Feb 2021 03:58:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F79D826E2; Sat, 6 Feb 2021 17:58: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=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="gvHpDexu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8DD8D82687; Sat, 6 Feb 2021 17:57:54 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 DD6178006D for ; Sat, 6 Feb 2021 17:57:48 +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-il1-x129.google.com with SMTP id e1so8886609ilu.0 for ; Sat, 06 Feb 2021 08:57:48 -0800 (PST) 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=yuJVs+gpbpTk6i7Qv1CgCFhnC2TSOegKa9ykXRSu5f8=; b=gvHpDexufogwDCyC+zCY07DHnQBVlykC1cTMYQpJWafDqVf05zcblgR1JN8Fiz/hQL c59OL3+Q0po2bd5pjolx6X/OsB1ido+Plyl3Ku3ixOwD496JQiveUTXRXsCBTFsbalkV eR5ks92If+cd9k4w8Cv4sHLWmpYGyfWyrhA90= 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=yuJVs+gpbpTk6i7Qv1CgCFhnC2TSOegKa9ykXRSu5f8=; b=lPmVeBhOmBjk7xDD61/Iu7CI80a1EVUKr+IjJtn/V9QE9rFu0i4ZEvjdpwyJ02AGAy K4QQVLsDKEUOcHjfQKRNpjDclOMvi4cIEcIxgrDuN44jtIdqMirLfWG4ropvkd6NO2Kd LsqlaPsEPdxclPso+d8lFCAmwap7a5FNJjN+47Y3k/kEtDVs0GoqbQJPE3VOB7MJh2vK B0NDzLOejwN6CrlJpUiCIpEtIu8Wdi/IrtzMOk1MM+ieujniBmlUBgMRa0H9i8HLyiQF NKi0HJp6SOBTAUdCSAt32i4d5/i4O1/X92sVc/ngqzORgch3LeOb29200yUOwspMwMry ckoA== X-Gm-Message-State: AOAM532kHBfKTIhvY4b9/Us6O40+iL42NfWPuJLQy8NUJXDlZHhtkrgy pW73zP4Uc2r5BqYqnhuBXm/bDVqvEzifbAvB X-Google-Smtp-Source: ABdhPJwHcISxCCv+c6mQ8vsJ3ZexiIHIzPl+yn6xmJXcs17oEyvSIlWPKD3ttMCnIvl7ier/DcxjjQ== X-Received: by 2002:a92:d612:: with SMTP id w18mr8715447ilm.175.1612630667478; Sat, 06 Feb 2021 08:57:47 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:47 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt Subject: [PATCH v4 6/9] sandbox: Add os_realloc() Date: Sat, 6 Feb 2021 09:57:32 -0700 Message-Id: <20210206165736.3491584-6-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean We provide os_malloc() and os_free() but not os_realloc(). Add this, following the usual semantics. Also update os_malloc() to behave correctly when passed a zero size. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- (no changes since v3) Changes in v3: - Add comments as to why we have os_malloc() and os_realloc() Changes in v2: - Add new patch to add os_realloc() arch/sandbox/cpu/os.c | 48 +++++++++++++++++++++++++++++++++++++++++++ include/os.h | 12 ++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 3d8af0a52bb..d23aad318be 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -267,11 +267,18 @@ void os_tty_raw(int fd, bool allow_sigs) signal(SIGINT, os_sigint_handler); } +/* + * Provide our own malloc so we don't use space in the sandbox ram_buf for + * allocations that are internal to sandbox, or need to be done before U-Boot's + * malloc() is ready. + */ void *os_malloc(size_t length) { int page_size = getpagesize(); struct os_mem_hdr *hdr; + if (!length) + return NULL; /* * Use an address that is hopefully available to us so that pointers * to this memory are fairly obvious. If we end up with a different @@ -298,6 +305,47 @@ void os_free(void *ptr) } } +/* These macros are from kernel.h but not accessible in this file */ +#define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a) - 1) +#define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) + +/* + * Provide our own malloc so we don't use space in the sandbox ram_buf for + * allocations that are internal to sandbox, or need to be done before U-Boot's + * malloc() is ready. + */ +void *os_realloc(void *ptr, size_t length) +{ + int page_size = getpagesize(); + struct os_mem_hdr *hdr; + void *new_ptr; + + /* Reallocating a NULL pointer is just an alloc */ + if (!ptr) + return os_malloc(length); + + /* Changing a length to 0 is just a free */ + if (length) { + os_free(ptr); + return NULL; + } + + /* + * If the new size is the same number of pages as the old, nothing to + * do. There isn't much point in shrinking things + */ + hdr = ptr - page_size; + if (ALIGN(length, page_size) <= ALIGN(hdr->length, page_size)) + return ptr; + + /* We have to grow it, so allocate something new */ + new_ptr = os_malloc(length); + memcpy(new_ptr, ptr, hdr->length); + os_free(ptr); + + return new_ptr; +} + void os_usleep(unsigned long usec) { usleep(usec); diff --git a/include/os.h b/include/os.h index 65bcb232cab..fd010cfee83 100644 --- a/include/os.h +++ b/include/os.h @@ -114,7 +114,7 @@ void os_fd_restore(void); * os_malloc() - aquires some memory from the underlying os. * * @length: Number of bytes to be allocated - * Return: Pointer to length bytes or NULL on error + * Return: Pointer to length bytes or NULL if @length is 0 or on error */ void *os_malloc(size_t length); @@ -127,6 +127,16 @@ void *os_malloc(size_t length); */ void os_free(void *ptr); +/** + * os_realloc() - reallocate memory + * + * This follows the semantics of realloc(), so can perform an os_malloc() or + * os_free() depending on @ptr and @length. + * + * Return: Pointer to reallocated memory or NULL if @length is 0 + */ +void *os_realloc(void *ptr, size_t length); + /** * os_usleep() - access to the usleep function of the os * From patchwork Sat Feb 6 16:57:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437036 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; 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=NQazKM3D; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4DXz645cgjz9sS8 for ; Sun, 7 Feb 2021 03:59:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C7DF28270D; Sat, 6 Feb 2021 17:58:18 +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="NQazKM3D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F3348268D; Sat, 6 Feb 2021 17:57:59 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 D512E8000F for ; Sat, 6 Feb 2021 17:57:49 +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-il1-x12c.google.com with SMTP id o7so4326711ils.2 for ; Sat, 06 Feb 2021 08:57:49 -0800 (PST) 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=raZ96y8mSC3x8BgHEfwW/vCzLq4KsQezu8Cpdv3Q3ck=; b=NQazKM3D3fpTYnxsCQqKw5gEuc3umyOvDUjTQKXvXitJ04PLH98u0HF6fHVMUTj4Ty OGZBqJAu0ZMR+Fh+CIUly8eDd3A58+rR74/m3KTynN1U7Zk1NgJskuMHs+mPKiklvDCA 3f+GUjvAPgckPVlPHDxnKpBaSrOzcNITnpq3s= 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=raZ96y8mSC3x8BgHEfwW/vCzLq4KsQezu8Cpdv3Q3ck=; b=FmFwfmeOUV0NxqfVngE9oh9zz5VyN12lQfW1zjJRvuB/llgf/3819aZQuVjue1sPuE 7FpAIK+FGc8hItsZGq2xm58V3D5atCo+MOCaKGNATF9quyLgtBq1z8jy992LTlU4zTWa hQTXgEOMVRI6iRxLCP7snq3l+5WItu+rY2C+h+EO3xDAaE0DOurEMltPp4jq+ko2uQOf HQJkF2nPlXn/hwTscYtjWzQtPtJH+f8+YZ/0MBvjphB7RoDWUY5Fs7y0NGL5nVNSkbOo 5I+lwPcJyVUCUvgtQyqaTV3SI932K8tJGlq//UL94yRVzWBS/tbZrjSTgf4RtqDp37zY F/ig== X-Gm-Message-State: AOAM532OoMHPCbHx+Rm+YhAVUnJd2gN6idbAeHMJQkq+BaoxUTz+v1SK g+wnC9LAE2TN+HOmRJHWiIc2d5PuIZD90KbL X-Google-Smtp-Source: ABdhPJzdWz2RdHhHFkKlTx6YCAv/OhyJQ4A8QdcRJelcFZZw89r3WJ4MV5fL7676OaUXxhTtb/lIvw== X-Received: by 2002:a05:6e02:e51:: with SMTP id l17mr8057187ilk.199.1612630668418; Sat, 06 Feb 2021 08:57:48 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:47 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v4 7/9] sandbox: Avoid using malloc() for system state Date: Sat, 6 Feb 2021 09:57:33 -0700 Message-Id: <20210206095728.v4.7.I8f45b8640fe93b61c6e24cac4d70c193bccaf192@changeid> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean This state is not accessible to the running U-Boot but at present it is allocated in the emulated SDRAM. This doesn't seem very useful. Adjust it to allocate from the OS instead. The RAM buffer is currently not freed, but should be, so add that into state_uninit(). Update the comment for os_free() to indicate that NULL is a valid parameter value. Note that the strdup() in spl_board_load_image() is changed as well, since strdup() allocates memory in the RAM buffer. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Drop unnecessary check before calling os_free() - Update the comment for os_free() - Also free the RAM buffer - Convert the rest of the allocations in os.c, etc. arch/sandbox/cpu/os.c | 24 ++++++++++++------------ arch/sandbox/cpu/spl.c | 10 +++++++--- arch/sandbox/cpu/start.c | 12 +++++++----- arch/sandbox/cpu/state.c | 18 +++++++++--------- include/os.h | 3 ++- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index d23aad318be..f5000e64966 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -153,7 +153,7 @@ int os_read_file(const char *fname, void **bufp, int *sizep) printf("Cannot seek to start of file '%s'\n", fname); goto err; } - *bufp = malloc(size); + *bufp = os_malloc(size); if (!*bufp) { printf("Not enough memory to read file '%s'\n", fname); ret = -ENOMEM; @@ -391,8 +391,8 @@ int os_parse_args(struct sandbox_state *state, int argc, char *argv[]) state->argv = argv; /* dynamically construct the arguments to the system getopt_long */ - short_opts = malloc(sizeof(*short_opts) * num_options * 2 + 1); - long_opts = malloc(sizeof(*long_opts) * (num_options + 1)); + short_opts = os_malloc(sizeof(*short_opts) * num_options * 2 + 1); + long_opts = os_malloc(sizeof(*long_opts) * (num_options + 1)); if (!short_opts || !long_opts) return 1; @@ -471,7 +471,7 @@ void os_dirent_free(struct os_dirent_node *node) while (node) { next = node->next; - free(node); + os_free(node); node = next; } } @@ -496,7 +496,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) /* Create a buffer upfront, with typically sufficient size */ dirlen = strlen(dirname) + 2; len = dirlen + 256; - fname = malloc(len); + fname = os_malloc(len); if (!fname) { ret = -ENOMEM; goto done; @@ -509,7 +509,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) ret = errno; break; } - next = malloc(sizeof(*node) + strlen(entry->d_name) + 1); + next = os_malloc(sizeof(*node) + strlen(entry->d_name) + 1); if (!next) { os_dirent_free(head); ret = -ENOMEM; @@ -518,10 +518,10 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) if (dirlen + strlen(entry->d_name) > len) { len = dirlen + strlen(entry->d_name); old_fname = fname; - fname = realloc(fname, len); + fname = os_realloc(fname, len); if (!fname) { - free(old_fname); - free(next); + os_free(old_fname); + os_free(next); os_dirent_free(head); ret = -ENOMEM; goto done; @@ -555,7 +555,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) done: closedir(dir); - free(fname); + os_free(fname); return ret; } @@ -672,7 +672,7 @@ static int add_args(char ***argvp, char *add_args[], int count) for (argc = 0; (*argvp)[argc]; argc++) ; - argv = malloc((argc + count + 1) * sizeof(char *)); + argv = os_malloc((argc + count + 1) * sizeof(char *)); if (!argv) { printf("Out of memory for %d argv\n", count); return -ENOMEM; @@ -755,7 +755,7 @@ static int os_jump_to_file(const char *fname) os_exit(2); err = execv(fname, argv); - free(argv); + os_free(argv); if (err) { perror("Unable to run image"); printf("Image filename '%s'\n", fname); diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c index 9a77da15619..197b98c9828 100644 --- a/arch/sandbox/cpu/spl.c +++ b/arch/sandbox/cpu/spl.c @@ -42,10 +42,14 @@ static int spl_board_load_image(struct spl_image_info *spl_image, return ret; } - /* Set up spl_image to boot from jump_to_image_no_args() */ - spl_image->arg = strdup(fname); + /* + * Set up spl_image to boot from jump_to_image_no_args(). Allocate this + * outsdide the RAM buffer (i.e. don't use strdup()). + */ + spl_image->arg = os_malloc(strlen(fname) + 1); if (!spl_image->arg) - return log_msg_ret("Setup exec filename", -ENOMEM); + return log_msg_ret("exec", -ENOMEM); + strcpy(spl_image->arg, fname); return 0; } diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 25425809747..295f36c0bda 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -87,7 +87,7 @@ int sandbox_early_getopt_check(void) /* Sort the options */ size = sizeof(*sorted_opt) * num_options; - sorted_opt = malloc(size); + sorted_opt = os_malloc(size); if (!sorted_opt) { printf("No memory to sort options\n"); os_exit(1); @@ -187,7 +187,7 @@ static int sandbox_cmdline_cb_default_fdt(struct sandbox_state *state, int len; len = strlen(state->argv[0]) + strlen(fmt) + 1; - fname = malloc(len); + fname = os_malloc(len); if (!fname) return -ENOMEM; snprintf(fname, len, fmt, state->argv[0]); @@ -207,7 +207,7 @@ static int sandbox_cmdline_cb_test_fdt(struct sandbox_state *state, int len; len = strlen(state->argv[0]) + strlen(fmt) + 1; - fname = malloc(len); + fname = os_malloc(len); if (!fname) return -ENOMEM; strcpy(fname, state->argv[0]); @@ -435,16 +435,18 @@ int main(int argc, char *argv[]) { struct sandbox_state *state; gd_t data; + int size; int ret; /* * Copy argv[] so that we can pass the arguments in the original * sequence when resetting the sandbox. */ - os_argv = calloc(argc + 1, sizeof(char *)); + size = sizeof(char *) * (argc + 1); + os_argv = os_malloc(size); if (!os_argv) os_exit(1); - memcpy(os_argv, argv, sizeof(char *) * (argc + 1)); + memcpy(os_argv, argv, size); memset(&data, '\0', sizeof(data)); gd = &data; diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index b2901b7a8ca..4ffaf163789 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -29,17 +29,17 @@ static int state_ensure_space(int extra_size) return 0; size = used + extra_size; - buf = malloc(size); + buf = os_malloc(size); if (!buf) return -ENOMEM; ret = fdt_open_into(blob, buf, size); if (ret) { - free(buf); + os_free(buf); return -EIO; } - free(blob); + os_free(blob); state->state_fdt = buf; return 0; } @@ -55,7 +55,7 @@ static int state_read_file(struct sandbox_state *state, const char *fname) printf("Cannot find sandbox state file '%s'\n", fname); return -ENOENT; } - state->state_fdt = malloc(size); + state->state_fdt = os_malloc(size); if (!state->state_fdt) { puts("No memory to read sandbox state\n"); return -ENOMEM; @@ -77,7 +77,7 @@ static int state_read_file(struct sandbox_state *state, const char *fname) err_read: os_close(fd); err_open: - free(state->state_fdt); + os_free(state->state_fdt); state->state_fdt = NULL; return ret; @@ -244,7 +244,7 @@ int sandbox_write_state(struct sandbox_state *state, const char *fname) /* Create a state FDT if we don't have one */ if (!state->state_fdt) { size = 0x4000; - state->state_fdt = malloc(size); + state->state_fdt = os_malloc(size); if (!state->state_fdt) { puts("No memory to create FDT\n"); return -ENOMEM; @@ -302,7 +302,7 @@ int sandbox_write_state(struct sandbox_state *state, const char *fname) err_write: os_close(fd); err_create: - free(state->state_fdt); + os_free(state->state_fdt); return ret; } @@ -419,8 +419,8 @@ int state_uninit(void) if (state->jumped_fname) os_unlink(state->jumped_fname); - if (state->state_fdt) - free(state->state_fdt); + os_free(state->state_fdt); + os_free(state->ram_buf); memset(state, '\0', sizeof(*state)); return 0; diff --git a/include/os.h b/include/os.h index fd010cfee83..d2a4afeca0f 100644 --- a/include/os.h +++ b/include/os.h @@ -123,7 +123,8 @@ void *os_malloc(size_t length); * * This returns the memory to the OS. * - * @ptr: Pointer to memory block to free + * @ptr: Pointer to memory block to free. If this is NULL then this + * function does nothing */ void os_free(void *ptr); From patchwork Sat Feb 6 16:57:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437037 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; 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=URpP/McA; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4DXz6G069xz9sVw for ; Sun, 7 Feb 2021 03:59:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D53382731; Sat, 6 Feb 2021 17:58:22 +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="URpP/McA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4DD9582686; Sat, 6 Feb 2021 17:57:58 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 B0CC682653 for ; Sat, 6 Feb 2021 17:57:50 +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-il1-x12e.google.com with SMTP id y17so8808372ili.12 for ; Sat, 06 Feb 2021 08:57:50 -0800 (PST) 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=wpWQqsZkrdHlVXqt29yrXDdO9q1+WtCPxjKWmDRUKYw=; b=URpP/McAunmg7GfXSTooDClcWzxAW/j5tMbwgQfV9xECM2NHHdUtTWJWbM6umiGeJP /63IrAgap17j5xovqODde4y0TM8bY2Qy/DZKLNlAbEI4+NlxbO8mVgAmZKkq3hrNq59U aNyWepk7ra2tF65z94GulQtvuk5eTc0/yjUbo= 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=wpWQqsZkrdHlVXqt29yrXDdO9q1+WtCPxjKWmDRUKYw=; b=HhgGm0pjQOX3EZQSgOgPoww0L+ypMbjbcmGpO0gU51/eb9buoNt/vnD0eSgE7Fwf51 4IxJlQbcWJGqbUU5FYGGXTx4UgzDfuv98+CQFL1fllebV/7PaNpNFt1XAahFwUUi/fd3 rd4iert4Giffd2a3X1x11UisilpUa9xTP63L5puhawkyUHOTA5jMDvH5E/MisO4pEQ7R XMHBGrPdv5l7ayJV1MS19I4mRRkGumoUO8XZTzs+vmL4p9JLUR4cXWV9CV+gAAcLiz0R uK33gCYFK7B1oGVxD1VK9xxqc+Pvudyx+YLB/PjS6PGs7Wz02qf9G/BzIF+qkQO+fD7U 9aqA== X-Gm-Message-State: AOAM530nzJSM3jML9+CwVZRA7wIudwMB5DEsHWWrfCsK67PXcPTxBk8f u1qMHZ/su5F59QDGlr5nCHlsCCVy9UZ3I9La X-Google-Smtp-Source: ABdhPJzNQYZXFt48NmyGBmpxOO7xotMuYRnsqXhmPR26O7HH7DS+hQAvPO5O6VpjRnY7WKRkkxW6xw== X-Received: by 2002:a05:6e02:1845:: with SMTP id b5mr8906991ilv.11.1612630669347; Sat, 06 Feb 2021 08:57:49 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:48 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v4 8/9] sandbox: Write out bloblist when exiting Date: Sat, 6 Feb 2021 09:57:34 -0700 Message-Id: <20210206165736.3491584-7-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean Sandbox provides a way to write out its emulated memory on exit. This makes it possible to pass a bloblist from one phase (e.g. SPL) to the next. However the bloblist is not closed off, so the checksum is generally invalid. Fix this by finishing up the bloblist before writing the memory file. Signed-off-by: Simon Glass --- Changes in v4: - Fix 'existing' typo arch/sandbox/cpu/state.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 4ffaf163789..f63cfd38ee4 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -398,8 +399,12 @@ int state_uninit(void) { int err; + log_info("Writing sandbox state\n"); state = &main_state; + /* Finish the bloblist, so that it is correct before writing memory */ + bloblist_finish(); + if (state->write_ram_buf) { err = os_write_ram_buf(state->ram_buf_fname); if (err) { From patchwork Sat Feb 6 16:57:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1437035 X-Patchwork-Delegate: trini@ti.com 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=85.214.62.61; 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=V3ammLC/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4DXz5t3KGPz9sS8 for ; Sun, 7 Feb 2021 03:59:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 78E29826D4; Sat, 6 Feb 2021 17:58:17 +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="V3ammLC/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA1C08269C; Sat, 6 Feb 2021 17:57:57 +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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 8752A82686 for ; Sat, 6 Feb 2021 17:57:51 +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-il1-x12d.google.com with SMTP id y15so8827441ilj.11 for ; Sat, 06 Feb 2021 08:57:51 -0800 (PST) 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=+rbYU9EmMXZWcMOZvF2PZC53HNay4C7q1yZd3eXwaDU=; b=V3ammLC/fJ1fGXDrtu5wBGJfQ6lGe4Zqz08joe6yxnJK3RWNbiYz3PlxvS060laU/z VJKdPGVNtCwNjF+f7r3IwT0LMLVLVpUbJnUNLxTmh9R2HWOQpa48ZgPreZ7/X28TNoz4 D9kI2th96ZP81pa2uPbQWCkg3mG9thyyE/xHk= 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=+rbYU9EmMXZWcMOZvF2PZC53HNay4C7q1yZd3eXwaDU=; b=mkZDKnuQfwo7VwKkCU4RolWr9IcwrU+fZZWxlNk4z/W8DKfY1bEbNDNjoJKhdXsoxs B08kRoptmdaQSafT9L32EOzj0otwAf52U0UMAaF2grdd5+PKXB6QI5RfIgmvsiKUbndi fZms+I7pHzG7Yudd4pxhPaDOqspOB3/tvHa7zUB7xXchksXlMFMaHO6BU3H5gZEqangs 9U6IbP1uG1fwutaMN8rAR4cJxPjj/UZsQwrVePZH6koA8jVuFR4xSolAxuwPtptRrXr8 tRfot5UyQSSAUjqR/YVA05wV+MbawrWYx+ITMv7TMCKU4g0LYbNuVSl062qPwCtEr6so AMLQ== X-Gm-Message-State: AOAM532ic+6xhGRuDKxJ5aNvgOK3TN+5EtZTSTNmrWcpe6asFbqWbhZ2 210rmdrwIjUkFzcuwvKu1rUYwFj5RmLoQm0f X-Google-Smtp-Source: ABdhPJz+/nz/RCSocULt43+UItAab3T8K5PVjIl9mQY/jfyvKKClZJnjdcCfDYbtcj4f6dafz1VBzA== X-Received: by 2002:a05:6e02:b4d:: with SMTP id f13mr8635649ilu.138.1612630670230; Sat, 06 Feb 2021 08:57:50 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 11sm5886102ilq.88.2021.02.06.08.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Feb 2021 08:57:49 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v4 9/9] bootm: Fix duplicate debugging in bootm_process_cmdline() Date: Sat, 6 Feb 2021 09:57:35 -0700 Message-Id: <20210206095728.v4.9.I09042143f90134809dba84ba6d676284eaabb87e@changeid> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210206165736.3491584-1-sjg@chromium.org> References: <20210206165736.3491584-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.3 at phobos.denx.de X-Virus-Status: Clean These two returns use the same string so are not distinguishable with LOG_ERROR_RETURN. Fix it. Signed-off-by: Simon Glass --- (no changes since v1) common/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/bootm.c b/common/bootm.c index 8298693900d..48a5b04cd7a 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -585,7 +585,7 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags) if (IS_ENABLED(CONFIG_BOOTARGS_SUBST) && (flags & BOOTM_CL_SUBST)) { ret = process_subst(buf, maxlen); if (ret) - return log_msg_ret("silent", ret); + return log_msg_ret("subst", ret); } return 0;