From patchwork Mon Jul 30 07:35:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 1253481 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6AC7DDF24C for ; Mon, 30 Jul 2012 07:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752022Ab2G3Hf5 (ORCPT ); Mon, 30 Jul 2012 03:35:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51780 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751113Ab2G3Hf4 (ORCPT ); Mon, 30 Jul 2012 03:35:56 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 7D41DA2FB8; Mon, 30 Jul 2012 09:35:55 +0200 (CEST) From: Thomas Renninger Organization: SUSE Products GmbH To: linux-omap@vger.kernel.org Subject: Passing device tree via intitrd Date: Mon, 30 Jul 2012 09:35:51 +0200 User-Agent: KMail/1.13.6 (Linux/2.6.37.6-0.11-desktop; KDE/4.6.0; x86_64; ; ) Cc: arnd@arndb.de, "H. Peter Anvin" MIME-Version: 1.0 X-Length: 3422 X-UID: 247 Message-Id: <201207300935.51426.trenn@suse.de> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Hello, I recently posted a patch to be able to pass data to the kernel and make use of it really early. Use-cases are currently: "Pass modified ACPI tables and make use of these instead of BIOS provided ones" and (nothing has been done there yet): "Pass CPU microcode updates and flash it really early" This is done by an uncompressed cpio (initrd can consist of one or more glued cpio archives, compressed or uncompressed). I've been told that on ARM this feature might get convenient to pass a flattened device tree via initrd. These are my posts on lkml: https://lkml.org/lkml/2012/7/18/165 Early initrd file overwrite and ACPI table override making use of it [PATCH 1/2] init: Introduce early initrd files through uncompressed cpio passing [PATCH 2/2] ACPI: Override arbitrary ACPI tables via initrd for debugging The interesting part for ARM is the first patch. Enabling this feature on ARM could then be (with the first patch slightly modified using HAVE_EARLY_INITRD) as easy as below. The code setup_arch() in arch/arm/kernel/setup.c would at least need some shifting. But I guess it should be possible to get an arch independent unified format (via uncompressed, glued cpio) how to pass early data via initrd to the kernel? Unfortunately X86 might need the cpio scanning even earlier (before initrd_start is valid). The same seem to be the case for ARM? I put the scanning, right after initrd_start got valid, for my purposes that's early enough. Looks like in the end architectures may need special handling early, but it's certainly a good idea to provide a kernel wide mechanism to pass data to the kernel early (via uncompressed cpio). Thanks for comments, Thomas ARM: Enable early initrd file access feature This would allow passing an uncompressed cpio initrd glued to the initrd and accessing it early. The files can be accessed as soon as arm_memblock_init() (which sets up initrd_start) got called. This patch is only to show how arch independent the early initrd feature is and to ask whether this would be useful for ARM (or other archs): --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a91009c..db48897 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -45,6 +45,7 @@ config ARM select GENERIC_SMP_IDLE_THREAD select KTIME_SCALAR select GENERIC_CLOCKEVENTS_BROADCAST if SMP + select HAVE_EARLY_INITRD help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index f54d592..5abc675 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -363,6 +363,8 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) /* Now convert initrd to virtual addresses */ initrd_start = __phys_to_virt(phys_initrd_start); initrd_end = initrd_start + phys_initrd_size; + early_initrd_find_cpio_data((void *)initrd_start, + initrd_end - initrd_start); } #endif