Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AD14C4338F for ; Mon, 2 Aug 2021 00:58:53 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24E3861050 for ; Mon, 2 Aug 2021 00:58:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 24E3861050 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8EF4833B2; Mon, 2 Aug 2021 02:57:33 +0200 (CEST) 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="dJ/lPZKU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1F1FE833B9; Mon, 2 Aug 2021 02:57:30 +0200 (CEST) Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) (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 2B69D833A1 for ; Mon, 2 Aug 2021 02:57:21 +0200 (CEST) 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-oo1-xc2d.google.com with SMTP id b25-20020a4ac2990000b0290263aab95660so4028641ooq.13 for ; Sun, 01 Aug 2021 17:57:21 -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=aYOH1y07T7CASZjLwfpluYKNOZ5v+TITUQj95K1Eo8g=; b=dJ/lPZKU7W2H7Z/mgr8EXTJOI3sXLaIj5MRkV3yMhMbZpTa8aN7ELueUJNMAHAmup7 ikdsrM+L+yFaaQWvGFlB23xRelWv5UpBjfOgzlhTXMoYaxYKXb+2Z0yGWtehQpW2kN7w PpFMI8aDG70TYltf6z5UgtFAeOkyNPl2ioLSk= 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=aYOH1y07T7CASZjLwfpluYKNOZ5v+TITUQj95K1Eo8g=; b=T2dfjAaFgdxI1uPs7yVkZIqNjPKIJFucz02qBykR7zOQK6O9mHgi6SZt55l8no/4Su SWbKNr7jG8MsM89S9ETsNk9Wmh3imcLQxFdBI9Sye53jVC7IRlxcFYRrPEcV95jCK7Tm 4KgWl9aRRyOrBFI/ot4fql/w4/wvWMGB+69KpIZqh0VV4nsDw6oKEidHi9WrTuJ/tA3p EEPysMJfX/xftrCFb5vLhBc9OYqnB4fk0Q3qpOFmRzYdNMAEGmMT42EgHiFchtbCUmr2 2yadY/MckyFdqjqthO6x6RuPHYFdiatSgPY8mTnSeldlG4mvkFLxVRJJPYkWL+WdLKWV zggw== X-Gm-Message-State: AOAM5337Tv2E7Cw1Mj5oVsplf7EE/vnazdkzPL4Xu6JNJxlKCbmCTc5Q kDD7JpOs5GmE7Rxw2YiP2UfJDiYOYKJW+PRx X-Google-Smtp-Source: ABdhPJyqhSuM+gjAufYKIHc/CLm2MqMGKgb6u93pFejCJsfiz5dnwZVfXV5mP0b1vBPySXH3oVRsng== X-Received: by 2002:a4a:8f13:: with SMTP id e19mr8994802ool.39.1627865839919; Sun, 01 Aug 2021 17:57:19 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id a8sm1496182oiw.52.2021.08.01.17.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Aug 2021 17:57:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Tom Rini , Simon Glass Subject: [PATCH v2 3/3] doc: Add a note about why devicetree is used Date: Sun, 1 Aug 2021 18:57:12 -0600 Message-Id: <20210802005713.2268145-3-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.554.ge1b32706d8-goog In-Reply-To: <20210802005713.2268145-1-sjg@chromium.org> References: <20210802005713.2268145-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.103.2 at phobos.denx.de X-Virus-Status: Clean This question comes up every now and then with people coming from Linux. Add some notes about it so we can point to it in the mailing list. Signed-off-by: Simon Glass --- Changes in v2: - Updates based on suggestions from Heinrich doc/develop/devicetree/control.rst | 2 ++ doc/develop/devicetree/intro.rst | 40 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/doc/develop/devicetree/control.rst b/doc/develop/devicetree/control.rst index 9f2c21034d0..b33e2a7ead6 100644 --- a/doc/develop/devicetree/control.rst +++ b/doc/develop/devicetree/control.rst @@ -152,6 +152,8 @@ ways: $ make DEVICE_TREE= +.. _dttweaks: + Adding tweaks for U-Boot ------------------------ diff --git a/doc/develop/devicetree/intro.rst b/doc/develop/devicetree/intro.rst index 344851327c7..36e8cc0d440 100644 --- a/doc/develop/devicetree/intro.rst +++ b/doc/develop/devicetree/intro.rst @@ -2,3 +2,43 @@ Devicetree Introduction ======================= + +U-Boot uses a devicetree for configuration. This includes the devices used by +the board, the format of the image created with binman, which UART to use for +the console, public keys used for secure boot and many other things. + +See :doc:`control` for more information. + +Why does U-Boot put in the devicetree? +---------------------------------------------- + +This question comes up a lot with people new to U-Boot, particular those coming +from Linux who are used to quite strict rules about what can go into the +devicetree. + +U-Boot uses the same devicetree as Linux but adds more things necessary for the +bootloader environment (see :ref:`dttweaks`). + +U-Boot does not have a user space to provide policy and configuration. It cannot +do what Linux does and run programs and look up filesystems to figure out how to +boot. So configuration and runtime information goes into the devicetree in +U-Boot. + +Of course it is possible to: + +- add tables into the rodata section of the U-Boot binary +- append some info to the end of U-Boot in a different format +- modify the linker script to bring in a file with some info in it +- put things in ACPI tables +- link in a UEFI hand-off block structure and put things in there + +but *please don't*. In general, devicetree is the sane place to hold U-Boot's +configuration. + +So, please, do NOT ask why U-Boot puts in the devicetree. It is the only +place it can go. It is a highly suitable data structure for just about anything +that U-Boot needs to know at runtime. + +Note, it is possible to use platdata directly so drivers avoid devicetreee in +SPL. But of-platdata is the modern way of avoiding devicetree overhead, so +please use that instead. -- 2.32.0.554.ge1b32706d8-goog