Skip to content

Commit ff6c923

Browse files
committed
openrisc: Add support for external initrd images
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 <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent d0b7213 commit ff6c923

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

arch/openrisc/kernel/setup.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,15 @@ void __init setup_arch(char **cmdline_p)
292292
init_mm.brk = (unsigned long)_end;
293293

294294
#ifdef CONFIG_BLK_DEV_INITRD
295-
initrd_start = (unsigned long)&__initrd_start;
296-
initrd_end = (unsigned long)&__initrd_end;
297295
if (initrd_start == initrd_end) {
296+
printk(KERN_INFO "Initial ramdisk not found\n");
298297
initrd_start = 0;
299298
initrd_end = 0;
299+
} else {
300+
printk(KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n",
301+
(void *)(initrd_start), initrd_end - initrd_start);
302+
initrd_below_start_ok = 1;
300303
}
301-
initrd_below_start_ok = 1;
302304
#endif
303305

304306
/* setup memblock allocator */

arch/openrisc/kernel/vmlinux.lds.S

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,6 @@ SECTIONS
9696

9797
__init_end = .;
9898

99-
. = ALIGN(PAGE_SIZE);
100-
.initrd : AT(ADDR(.initrd) - LOAD_OFFSET)
101-
{
102-
__initrd_start = .;
103-
*(.initrd)
104-
__initrd_end = .;
105-
FILL (0);
106-
. = ALIGN (PAGE_SIZE);
107-
}
108-
109-
__vmlinux_end = .; /* last address of the physical file */
110-
11199
BSS_SECTION(0, 0, 0x20)
112100

113101
_end = .;

0 commit comments

Comments
 (0)