Skip to contentSkip to conversation

: typo in init/initramfs.c

PATCH In review Al Boldi 2 participants 4 messages Dec 6, 2006 – Dec 11, 2006

lore
Share & tools
lore

Al Boldi

author
#0 lore raw

PATCH 1/1 : typo in init/initramfs.c

Quoted 4 lines · Jean-Paul Saman

In populate_rootfs() the printk on line 554. It says "Unpacking initramfs..", which is confusing because if that line is reached the code has already decided that the image is an initrd image.

Are you sure?

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM

Quoted 11 lines

The printk is thus
wrong in stating that it is unpacking an "initramfs". It should says "initrd" instead. The attached patch corrects this typo.

init/initramfs.c +0 -0
index d28c109..f6020db 100644
@@ -551,7 +551,7 @@ #ifdef CONFIG_BLK_DEV_RAM

This is where initramfs is discerned from initrd, as both are available.

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM · line 553

Quoted 3 lines
init/initramfs.c +0 -0
                        free_initrd();
                }
 #else

Otherwise it's initramfs only.

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM

Quoted 7 lines
init/initramfs.c +1 -2
-               printk(KERN_INFO "Unpacking initramfs...");
+              printk(KERN_INFO "Unpacking initrd...");
                err = unpack_to_rootfs((char *)initrd_start,
                        initrd_end - initrd_start, 0);
                if (err)
 
-

Thanks!

--
Al

#1 lore raw

[email protected] wrote on 06-12-2006 19:17:27:

Quoted 4 lines
Quoted 3 lines · Jean-Paul Saman

In populate_rootfs() the printk on line 554. It says "Unpacking initramfs..", which is confusing because if that line is reached the

code

Quoted 3 lines
Quoted 1 line

has already decided that the image is an initrd image.

Are you sure?

Yes.

Quoted 15 lines

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM

Quoted 12 lines

The printk is thus
wrong in stating that it is unpacking an "initramfs". It should says "initrd" instead. The attached patch corrects this typo.

init/initramfs.c +0 -0
index d28c109..f6020db 100644
@@ -551,7 +551,7 @@ #ifdef CONFIG_BLK_DEV_RAM

This is where initramfs is discerned from initrd, as both are available.

Quoted 5 lines

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM · line 553

Quoted 3 lines
init/initramfs.c +0 -0
                        free_initrd();
                }
 #else

Otherwise it's initramfs only.

No otherwise it falls under CONFIG_BLK_DEV_INITRD and it that suggests it must be a initrd, not a initramfs as the original printk() suggests.

Quoted 8 lines

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM

Quoted 8 lines
init/initramfs.c +1 -2
-               printk(KERN_INFO "Unpacking initramfs...");
+              printk(KERN_INFO "Unpacking initrd...");
                err = unpack_to_rootfs((char *)initrd_start,
                        initrd_end - initrd_start, 0);
                if (err)
 
-

Kind greetings,

Jean-Paul Saman

NXP Semiconductors CTO/RTG DesignIP

author
#2 lore raw
Quoted 9 lines · Jean-Paul Saman

[email protected] wrote on 06-12-2006 19:17:27:

Quoted 6 lines
Quoted 3 lines · Jean-Paul Saman

In populate_rootfs() the printk on line 554. It says "Unpacking initramfs..", which is confusing because if that line is reached the code has already decided that the image is an initrd image.

Are you sure?

Yes.

Are you really sure?

Quoted 14 lines
Quoted 14 lines

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM

Quoted 11 lines

The printk is thus
wrong in stating that it is unpacking an "initramfs". It should says "initrd" instead. The attached patch corrects this typo.

init/initramfs.c +0 -0
index d28c109..f6020db 100644
@@ -551,7 +551,7 @@ #ifdef CONFIG_BLK_DEV_RAM

This is where initramfs is discerned from initrd, as both are available.

Quoted 8 lines
Quoted 5 lines

init/initramfs.c #ifdef CONFIG_BLK_DEV_RAM · line 553

Quoted 3 lines
init/initramfs.c +0 -0
                        free_initrd();
                }
 #else

Otherwise it's initramfs only.

No otherwise it falls under CONFIG_BLK_DEV_INITRD and it that suggests it must be a initrd, not a initramfs as the original printk() suggests.

This is what 2.6.19 says:

=========================

#ifdef CONFIG_BLK_DEV_INITRD
	if (initrd_start) {
#ifdef CONFIG_BLK_DEV_RAM
		int fd;
		printk(KERN_INFO "checking if image is initramfs...");
		err = unpack_to_rootfs((char *)initrd_start,
			initrd_end - initrd_start, 1);
		if (!err) {
			printk(" it is\n");
			unpack_to_rootfs((char *)initrd_start,
				initrd_end - initrd_start, 0);
			free_initrd();
			return;
		}
		printk("it isn't (%s); looks like an initrd\n", err);
		fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700);
		if (fd >= 0) {
			sys_write(fd, (char *)initrd_start,
					initrd_end - initrd_start);
			sys_close(fd);
			free_initrd();
		}
#else // <=== of #ifdef CONFIG_BLK_DEV_RAM
		printk(KERN_INFO "Unpacking initramfs...");
		err = unpack_to_rootfs((char *)initrd_start,
			initrd_end - initrd_start, 0);
		if (err)
			panic(err);
		printk(" done\n");
		free_initrd();
#endif // <=== of #ifdef CONFIG_BLK_DEV_RAM
	}

#endif // <=== of #ifdef CONFIG_BLK_DEV_INITRD
=========================

Maybe you're getting confused with the dual intitrd naming-convention. InitRD used to mean InitRamDisk only, now it means InitRamFS and InitRamDisk #ifdef CONFIG_BLK_DEV_RAM, else it means InitRamFS only.

But still, it's rather refreshing to see you so convinced.

Thanks!

--
Al

#3 lore raw

[email protected] wrote on 08-12-2006 14:58:24:

Quoted 5 lines
Quoted 4 lines · Jean-Paul Saman

[email protected] wrote on 06-12-2006 19:17:27:

Quoted 3 lines
Quoted 2 lines · Jean-Paul Saman

In populate_rootfs() the printk on line 554. It says "Unpacking initramfs..", which is confusing because if that line is reached

the

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

code has already decided that the image is an initrd image.

Are you sure?

Yes.

Are you really sure?

Not anymore ;-)

Quoted 2 lines

Maybe you're getting confused with the dual intitrd naming-convention. InitRD used to mean InitRamDisk only, now it means InitRamFS and

InitRamDisk

Quoted 1 line

#ifdef CONFIG_BLK_DEV_RAM, else it means InitRamFS only.

Well, I am confused. Reading drivers/block/Kconfig again and again I came to the conclusion that I've been misinterpreted what it said. The way the code is written is counter-intuitive, using INITRD for initramfs and initrd made my head go spinning.

Quoted 1 line

But still, it's rather refreshing to see you so convinced.

Thanks for your kind words.

Kind greetings,

Jean-Paul Saman

NXP Semiconductors CTO/RTG DesignIP