Skip to contentSkip to conversation

riscv: Do not overwrite initrd_start and initrd_end

PATCH In review Guenter Roeck 3 participants 3 messages Aug 29, 2018 – Aug 31, 2018 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 riscv: Do not overwrite initrd_start and initrd_end

setup_initrd() overwrites initrd_start and initrd_end if __initramfs_size is larger than 0, which is always true even if there is no embedded initramfs. This prevents booting qemu with "-initrd" parameter. Overwriting initrd_start and initrd_end is not necessary since __initramfs_start and __initramfs_size are used directly in populate_rootfs() to load the built-in initramfs, so just drop that code.

---
v2: Instead of dropping setup_initrd() entirely, only stop
overwriting initrd_start and initrd_end. Adjust explanation accordingly.

 arch/riscv/kernel/setup.c | 7 -------
 1 file changed, 7 deletions(-)
arch/riscv/kernel/setup.c +0 -7
index db20dc630e7e..aee603123030 100644
@@ -85,15 +85,8 @@ atomic_t hart_lottery;
 #ifdef CONFIG_BLK_DEV_INITRD
 static void __init setup_initrd(void)
 {
-	extern char __initramfs_start[];
-	extern unsigned long __initramfs_size;
 	unsigned long size;
 
-	if (__initramfs_size > 0) {
-		initrd_start = (unsigned long)(&__initramfs_start);
-		initrd_end = initrd_start + __initramfs_size;
-	}
-
 	if (initrd_start >= initrd_end) {
 		printk(KERN_INFO "initrd not found or empty");
 		goto disable;
Signature · 1 line
2.7.4
#1 lore raw

Hi Guenter,

Quoted 5 lines · Guenter Roeck

setup_initrd() overwrites initrd_start and initrd_end if __initramfs_size is larger than 0, which is always true even if there is no embedded initramfs. This prevents booting qemu with "-initrd" parameter. Overwriting initrd_start and initrd_end is not necessary since __initramfs_start and __initramfs_size are used directly in

... since commit df52092f3c977885 ("fastboot: remove duplicate unpack_to_rootfs()")...

To avoid -stable backporting this beyond v2.6.30 ;-)

Quoted 4 lines

populate_rootfs() to load the built-in initramfs, so just drop that code.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Reviewed-by on v2 1/1
#2 lore raw
In reply to Guenter Roeck
Quoted 9 lines · Guenter Roeck

setup_initrd() overwrites initrd_start and initrd_end if __initramfs_size is larger than 0, which is always true even if there is no embedded initramfs. This prevents booting qemu with "-initrd" parameter. Overwriting initrd_start and initrd_end is not necessary since __initramfs_start and __initramfs_size are used directly in populate_rootfs() to load the built-in initramfs, so just drop that code.

Looks good,