From patchwork Mon Jun 20 14:31:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 1645534 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.a=rsa-sha256 header.s=google header.b=d/5VcOPZ; dkim-atps=neutral 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=) 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 (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LRXCv2JPnz9sFr for ; Tue, 21 Jun 2022 00:32:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AC259820E1; Mon, 20 Jun 2022 16:31:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="d/5VcOPZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9618981F8B; Mon, 20 Jun 2022 16:31:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) (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 8ED0581F8B for ; Mon, 20 Jun 2022 16:31:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf29.google.com with SMTP id n15so12091332qvh.12 for ; Mon, 20 Jun 2022 07:31:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=cYod8e1kV6CU7MYHNXw4VmtDdm2Yo5xkvYgf/1cXOy0=; b=d/5VcOPZZdEcRoayYXuH0EXazO6PhaAbqDZlixinORBw1lieLy72iWIkVi0VSqvPHk O4VJexUvTGQ7zVexRV4jYp+R6K7krOlR8H/WkvqqD2wLY2t2h7uExTbFFpqZIDosmd21 FR7RD6gxwGbuRzWn+lQo4bXidJDipqvR4/Rro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cYod8e1kV6CU7MYHNXw4VmtDdm2Yo5xkvYgf/1cXOy0=; b=2J+Sjav4GanQmVOnLamPYm2EuvedxzjDk82/HY1dIsSJY7/99IuZEyWzBvO9h9qXBL +LU3CRbVu6TS+Uw8mh9K53ZuE/jiWwvCwiEJFqdW+hnrTcvFJwf18dO9QRTMmmmpc0dW wTA/KbG112uFiHWkjbFmOiJwSmTwYSdRvCgSZtntX1K+438qeNpe6E7Qm7ynkvnX2eFh X9M0PkLLJfns1a/x1Nu5+2TF4Tp0xbu7RIFh2fW5mqLFIW2vXKSbDj7aTRQFkD0sCghR gmNBdphfcaVkPUAZg9k8TGZZt2fUbhAbjB/8uOG5V4m3RdyF0W2FKIp0Tu41xClSs1xo l9Sg== X-Gm-Message-State: AJIora9EUHjNB9VD1v9oZwz6FoPFUKjAwNYP0gtXNuVVzLBhlmWof2nL 01VEINTGQ1eXd7tvrw38zKdFMN6J2lxm6A== X-Google-Smtp-Source: AGRyM1uEA/vI5M27qFPRvvxB/nICF4nUlpFOVjmq85goG8T05OeOt4PDCGW/pdIJcC9LIs8+iJjzxg== X-Received: by 2002:a05:6214:f04:b0:464:4bd6:e322 with SMTP id gw4-20020a0562140f0400b004644bd6e322mr19430991qvb.28.1655735492968; Mon, 20 Jun 2022 07:31:32 -0700 (PDT) Received: from bill-the-cat.lan (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id fb11-20020a05622a480b00b00304fa21762csm10721039qtb.53.2022.06.20.07.31.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jun 2022 07:31:32 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Subject: [PATCH 3/3] doc: environment: Further expand on Image locations and provide example Date: Mon, 20 Jun 2022 10:31:29 -0400 Message-Id: <20220620143129.1772880-3-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220620143129.1772880-1-trini@konsulko.com> References: <20220620143129.1772880-1-trini@konsulko.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean Start by elaborating on what some of our constraints tend to be with image location values, and document where these external constraints come from. Provide a new subsection, an example based on the TI ARMv7 OMAP2PLUS families of chips, that gives sample values and explains why we use these particular values. This is based on what is in include/configs/ti_armv7_common.h as of fb3ad9bd923d ("TI: Add, use a DEFAULT_LINUX_BOOT_ENV environment string") as this contains just the values referenced in this document now and not some of the further additions that are less generic. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- doc/usage/environment.rst | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst index a9a4702632d2..f70ccd6a58ee 100644 --- a/doc/usage/environment.rst +++ b/doc/usage/environment.rst @@ -404,6 +404,42 @@ device tree blob fdtfile fdt_addr_r fdt_addr ramdisk ramdiskfile ramdisk_addr_r ramdisk_addr ================= ============== ================ ============== +When setting the RAM addresses for `kernel_addr_r`, `fdt_addr_r` and +`ramdisk_addr_r` there are several constraints to keep in mind. When booting +Linux, the `Booting ARM Linux`_ and `Booting AArch64 Linux`_ documents lay out +the requirements for booting all ARM platforms, including both alignment and +where within memory various things must be. These guidelines tend to also be +correct for other OSes and unless specifically contradicted by documentation +specific to another architecture, are good rules to follow for other +architectures as well. + +Example Image locations +^^^^^^^^^^^^^^^^^^^^^^^ + +If we take the Texas Instruments OMAP2PLUS family of ARMv7 processors as an +example for the above listed variables, we would do:: + + loadaddr=0x82000000 + kernel_addr_r=${loadaddr} + fdt_addr_r=0x88000000 + ramdisk_addr_r=0x88080000 + bootm_size=0x10000000 + +To explain this, we start by noting that DRAM starts at 0x80000000. A 32MiB +buffer from the start of memory as our default load address, and so where the +kernel would also be loaded to. This will hopefully allow for us to have the +whole of the compressed kernel image exist in memory above where the whole of +the decompressed kernel image will be, and allow for a quicker boot. Next, we +say that the device tree will be placed at 128MiB offset from the start of +memory. This is suggested by the kernel documment as it is exceedingly +unlikely to be overwritten by the kernel itself given other architectural +constraints. We then allow for the device tree to be up to 512KiB in size +before placing the ramdisk in memory. We then say that everything should be +within the first 256MiB of memory so that U-Boot can relocate things as needed +to ensure proper alignment. We pick 256MiB as our value here because we know +there are very few platforms on in this family with less memory. It could be +as high as 768MiB and still ensure that everything would be visible to the +kernel, but again we go with what we assume is the safest assumption. Automatically updated variables ------------------------------- @@ -472,3 +508,6 @@ Implementation -------------- See :doc:`../develop/environment` for internal development details. + +.. _`Booting ARM Linux`: https://www.kernel.org/doc/html/latest/arm/booting.html +.. _`Booting AArch64 Linux`: https://www.kernel.org/doc/html/latest/arm64/booting.html