Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3349203ybt; Sat, 4 Jul 2020 14:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoQHpUZzJG4d+PPIMuWhb730apFck9UyiQU6X/dkZ/PoqAcGNMnHRTZr6nJ6Q0Uxdm8rLg X-Received: by 2002:a17:906:a055:: with SMTP id bg21mr33298387ejb.516.1593897269880; Sat, 04 Jul 2020 14:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593897269; cv=none; d=google.com; s=arc-20160816; b=fQO8oBRUbZq0WnJn75f25tpY4X5CwHcxTNWQWb3VwYBQc14C7x+c5DmEJ0iZk/HdMr XgOw86ziep0OX/wJeJq9pWo4qwVjwq9Ps01NtIUsbvxli0n0Uy+pS3LZx9tkmA9i6veH OsnALQ4DR0FBGYEhK1cHwO5UOKD7GpEXudUxL9NegO8gSnPFm4gu2Q1Y5WxsOpbE1R9K p2+sRRrRWhw//gdK73l6M6mt0priqHaUGZVI2KxITDNZR0nTJ1odHVaZ0vXAOtZ77lxa SYozebx5Yunb3XQYChRnpmjzt+nJq/nJR8n9E/rk5OrgfBHBk/LL3Ns0DDNNPuiSy9ew 4YTg== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=J6EJlawjImDE63imtxxJcgcytWPaMqFso/hm17V2M4g=; b=Kf4RKPyVwQnZ6Hv7uswghRb9I4JxjpDG6Y19IKNYvLJjLkLCfzE9Gz5KLerrCHzLxG CoolUP/EW/KW4lbUVds7gswAAxiB5JvuBhe89lQ6BGs+TWeeXkxx1Bbj7wTKGqGnY94G 2DJaZ4N/R89IyBEcn04yi4hWvQZIHU5oOP0M8wo8pGnceM27qfoTJia5TJxrOj6K0wgo rqyncd8fBf7EgBM8MVzPtDQOjMOxqIxnDH9qTr+3H1xGHwV40TBqrHM5x/1kwKY7Tsts ElNk/NIoJ20tcx79276gUdP36pxxK30UTYGNNAUa2XueN3mMHeiLeOzFjD2TyJz9sFiu kfnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=otua9GyR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a22si11753424edn.364.2020.07.04.14.14.07; Sat, 04 Jul 2020 14:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=otua9GyR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727882AbgGDVLs (ORCPT + 99 others); Sat, 4 Jul 2020 17:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726895AbgGDVLr (ORCPT ); Sat, 4 Jul 2020 17:11:47 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB03C061794 for ; Sat, 4 Jul 2020 14:11:47 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id d10so13846847pls.5 for ; Sat, 04 Jul 2020 14:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=J6EJlawjImDE63imtxxJcgcytWPaMqFso/hm17V2M4g=; b=otua9GyRB3AOXdss6qXm7gsiZ44Nja4IiddEnzSevFVuPTBUx7L8uQlwWyWBpnzk6L i5UNY+Mko6Cb8M3jivPN4n9GOK28L3NkBHQtimB1C+MkqZ1rI+KUjSjLToDG9HkVLHjc nzX8n0SegZufIB5fEfYkOPQkJ2Y6YcbYgwHNKTk/kyBQx64d3b1+4E/yXeHy56mgrtUF pjKMbgAYXVFfevwciWSsb1CIJZBk+y9W37avzqOVnpkao2et3K7JbsvtURmf/6Fq+wfB DscczvyMGhhLixNFzWO33bwbGxYDSt2B2A0ysQAEJv8qi68qHpBRimFkC+PnSz4CfUnT hMjw== 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:mime-version :content-transfer-encoding; bh=J6EJlawjImDE63imtxxJcgcytWPaMqFso/hm17V2M4g=; b=UM0WLY1TGKt6sX9H1SO+lRbyCWpqZvamX5JyDaFA7For9ldyWNXDMEuC4wZGJP+Im1 X3xc14FBu/dgAzmTOxUex5jYsD/KcDCshCc9VS2uKp/4rj8DMEc59tPIWG/8A/ppuTPY 4HQ2J0RJeDjlfT5zEzfqVPrah9f3U2XEJlS/PBJMiqpzCbSHfFGplXNLbrTZb99IsNjW GzQ0Y2hJdQxQcVB3ZqdugnvCqUYCrKzzrUao10GgGPZFCbPa7wMjCEYOlEdMpShnyDoj uMuEa77vzJgbWATO1FanlzivIZww8k80CRSzzuBHzxRDjKq1xaIv1lMOyBJNMg3CmNsu 75Og== X-Gm-Message-State: AOAM5315Er6BJlfTpwGZQaFljVlx69xzEU4SCRe+bafOl/Yx/CEwrNdZ S8Lju7t1v8+VI8aDM1wFZ+ybd7HF+t8= X-Received: by 2002:a17:902:7b89:: with SMTP id w9mr24274087pll.175.1593897106786; Sat, 04 Jul 2020 14:11:46 -0700 (PDT) Received: from localhost (g2.222-224-226.ppp.wakwak.ne.jp. [222.224.226.2]) by smtp.gmail.com with ESMTPSA id t1sm14905119pje.55.2020.07.04.14.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 14:11:46 -0700 (PDT) From: Stafford Horne To: LKML Cc: Stafford Horne , Mateusz Holenko , Jonas Bonn , Stefan Kristiansson , Mike Rapoport , Greg Kroah-Hartman , Arvind Sankar , Andrew Morton , Borislav Petkov , Heiko Carstens , Kees Cook , Geert Uytterhoeven , openrisc@lists.librecores.org Subject: [PATCH] openrisc: Add support for external initrd images Date: Sun, 5 Jul 2020 06:11:34 +0900 Message-Id: <20200704211136.601768-1-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In OpenRISC we set the initrd_start and initrd_end based on the symbols we setup in vmlinux.lds.S. However, this is not needed if we use the generic linker description in INIT_DATA_SECTION. Removing our own initrd setup reduces code, but also the generic code supports loading external initrd images. A bootloader can load a rootfs image into memory and we can configure devicetree to load it with: chosen { bootargs = "earlycon"; stdout-path = "uart0:115200"; linux,initrd-start = < 0x08000100 >; linux,initrd-end = < 0x08200000 >; }; Reported-by: Mateusz Holenko Signed-off-by: Stafford Horne --- arch/openrisc/kernel/setup.c | 8 +++++--- arch/openrisc/kernel/vmlinux.lds.S | 12 ------------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c index 8aa438e1f51f..b18e775f8be3 100644 --- a/arch/openrisc/kernel/setup.c +++ b/arch/openrisc/kernel/setup.c @@ -292,13 +292,15 @@ void __init setup_arch(char **cmdline_p) init_mm.brk = (unsigned long)_end; #ifdef CONFIG_BLK_DEV_INITRD - initrd_start = (unsigned long)&__initrd_start; - initrd_end = (unsigned long)&__initrd_end; if (initrd_start == initrd_end) { + printk(KERN_INFO "Initial ramdisk not found\n"); initrd_start = 0; initrd_end = 0; + } else { + printk(KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n", + (void *)(initrd_start), initrd_end - initrd_start); + initrd_below_start_ok = 1; } - initrd_below_start_ok = 1; #endif /* setup memblock allocator */ diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S index 60449fd7f16f..22fbc5fb24b3 100644 --- a/arch/openrisc/kernel/vmlinux.lds.S +++ b/arch/openrisc/kernel/vmlinux.lds.S @@ -96,18 +96,6 @@ SECTIONS __init_end = .; - . = ALIGN(PAGE_SIZE); - .initrd : AT(ADDR(.initrd) - LOAD_OFFSET) - { - __initrd_start = .; - *(.initrd) - __initrd_end = .; - FILL (0); - . = ALIGN (PAGE_SIZE); - } - - __vmlinux_end = .; /* last address of the physical file */ - BSS_SECTION(0, 0, 0x20) _end = .; -- 2.26.2