Received: by 10.223.164.202 with SMTP id h10csp2362352wrb; Sat, 18 Nov 2017 20:16:44 -0800 (PST) X-Google-Smtp-Source: AGs4zMbD/jUv7+kSjhaQmL988TmveB0TMH3TZ5iE1ep79Jqro2/gUW7IaajHN1JaN3elcabU22f+ X-Received: by 10.99.117.83 with SMTP id f19mr9414473pgn.255.1511065004506; Sat, 18 Nov 2017 20:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511065004; cv=none; d=google.com; s=arc-20160816; b=wWwbSOOH2jdBYpGv9DFO3DgwXvu14lTy3XNp3NS2VCqQteFNUwD/3lwe/cTWrqEtbx r0yIBXgrxZVzqgyDKw6GtvL0tczs9m2cCC/E2vL/pDV8Mjnu3+FWTMbbvPcYccaEXPIf hUSuHkUc/cAEr6AdUZq0HxZi3+6mV1drVwGQ/bPN8YO9Ehg9zakIj5FlHRz3XB1VWDih sbO0W1o/7KZL9xLJOIh0o7gG/Gpfh493xuG/sHrRzMwLf6Rq+Vq8iYSPTVaXXybawJql Y7D3MblRfTt3TfMlET0KWMqN1SF+bZoow4Pfrg1Ws25Pirgz3H8yvwuNV+dgVhNWCxh0 gopQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id :organization:subject:from:reply-to:to:arc-authentication-results; bh=Ll75EmQ7SaTiXibYrw6+Sh+FwQGwxsRrYbiZ95WSYG4=; b=edNemeyKZG4YCI1W0lVlDT0JOTTpcWg9DcuJgcrwQMsTOyOr5VZEn+zDUcOcMPe3pw Isyij6SbWwrTVJEocoVCkihoOyq4EkrAhtblZxyFuARXj4L8rvKneFZJYLwZj3cquVYu 9540/Z/KwWRF5e6x8kHArNlWfEaefTer68XpTgyzYizQ65M+QXgulDstNlqSe9kLNRUW o8wrogvVwVnYqm/5T5l9xQhW5Vwy98ymYhZ/sFoSibBiQOeOb9oJzR+phwoYcj/GAyFO WI4SRf33c5lAMgfnI7ke4vXTNJ2jjln04IMK7G4DXBhxlNN6UAGk7qRHL3aBW5dSpGDt 1V6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si6101017pff.160.2017.11.18.20.16.31; Sat, 18 Nov 2017 20:16:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424375AbdKRSFb (ORCPT + 92 others); Sat, 18 Nov 2017 13:05:31 -0500 Received: from v-smtpout1.han.skanova.net ([81.236.60.154]:57672 "EHLO v-smtpout1.han.skanova.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936471AbdKRSFX (ORCPT ); Sat, 18 Nov 2017 13:05:23 -0500 X-Greylist: delayed 361 seconds by postgrey-1.27 at vger.kernel.org; Sat, 18 Nov 2017 13:05:22 EST Received: from [10.175.196.237] ([37.123.169.62]) by cmsmtp with SMTP id G7Ogeqtx20ynOG7OgeCM60; Sat, 18 Nov 2017 18:59:18 +0100 To: LKML Reply-To: linux-kernel@emagii.com From: Ulf Samuelsson Subject: RFC: Copying Device Tree File into reserved area of VMLINUX before deployment Organization: eMagii Message-ID: <0b31e22b-202f-6fca-28f2-e16e6af6c6b7@emagii.com> Date: Sat, 18 Nov 2017 18:59:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfHvt4j7aRJKQ/8Pvd7WTzC2A6zn4dT2UVJSEy4sNV572Cuny1ZOaRviwaaZO9MsEV6nnShkj1Ccv/cJ5ti3xOg5+5QI7DrXZPir4TYxPpn2DdSJHhNqH GwCjhhNbEVoBmPuqte8WHD4BBIHcHqHA5LMfyWZTi5pIpc23O69ff8JTdSu5dugjl4ltkXyppyR4/A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I noticed when checking out the OpenWRT support for the board that they have a method to avoid having to pass the device tree address to the kernel, and can thus boot device tree based kernels with U-boots that does not support device trees. Is this something that would be considered useful for including in mainstream: BACKGROUND: Trying to load a yocto kernel into a MIPS target (MT7620A based), and the U-Boot is more than stupid. Does not support the "run" command as an example. They modified the U-Boot MAGIC Word to complicate things. The U-Boot is not configured to use device tree files. The board runs a 2.6 kernel right now. Several attempts by me a and others to rebuild U-Boot according to the H/W vendors source code and build instructions results in a bricked unit. Bricked units cannot be recovered. Not my choice of H/W, so I cannot change it. =================================================================== OPENWRT: I noticed when checking out the OpenWRT support for the board that they have a method to avoid having to pass the device tree address to the kernel, and can thus boot device tree based kernels with U-boots that does not support device trees. What they do is to reserve 16 kB of kernel space, and tag it with an ASCII string "OWRTDTB:". After the kernel and dtb is built, a utility "patch-dtb" will update the vmlinux binary, copying in the device tree file. =================================================================== It would be useful to me, and I could of course patch the mainstream kernel, but first I would like to check if this is of interest for mainstream. I envisage the support would look something like: ============ Kconfig. config MIPS select HAVE_IMAGE_DTB config HAVE_IMAGE_DTB bool if HAVE_IMAGE_DTB config IMAGE_DTB bool "Allocated space for DTB within image config DTB_SIZE int "DTB space (kB) config DTB_TAG string "DTB space tag" default "OWRTDTB:" endif ============ Some Makefile obj-$(CONFIG_INCLUDE_DTB) += image_dtb.o ============ image_dtb.S: .text .align 5 .ascii CONFIG_DTB_TAG EXPORT(__image_dtb) .fill DTB_SIZE * 1024 =================== arch/mips/xxx/of.c: #if defined(CONFIG_IMAGE_DTB) if () __dt_setup_arch(__dtb_start); else __dt_setup_arch(&__image_dtb); #else __dt_setup_arch(__dtb_start); #endif I imagine that if the support is enabled for a target, it should be possible to override it with a CMDLINE argument They do something similar for the CMDLINE; copying it into the vmlinux, to allow a smaller boot -- Best Regards Ulf Samuelsson From 1584732498757477981@xxx Wed Nov 22 02:44:42 +0000 2017 X-GM-THRID: 1584732498757477981 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread