diff options
Diffstat (limited to 'init/initramfs.c')
-rw-r--r-- | init/initramfs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/init/initramfs.c b/init/initramfs.c index 619c1baf7701..9ee7b7810417 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
@@ -310,7 +310,8 @@ static int __init do_name(void) | |||
310 | if (wfd >= 0) { | 310 | if (wfd >= 0) { |
311 | sys_fchown(wfd, uid, gid); | 311 | sys_fchown(wfd, uid, gid); |
312 | sys_fchmod(wfd, mode); | 312 | sys_fchmod(wfd, mode); |
313 | sys_ftruncate(wfd, body_len); | 313 | if (body_len) |
314 | sys_ftruncate(wfd, body_len); | ||
314 | vcollected = kstrdup(collected, GFP_KERNEL); | 315 | vcollected = kstrdup(collected, GFP_KERNEL); |
315 | state = CopyFile; | 316 | state = CopyFile; |
316 | } | 317 | } |
@@ -515,6 +516,7 @@ skip: | |||
515 | initrd_end = 0; | 516 | initrd_end = 0; |
516 | } | 517 | } |
517 | 518 | ||
519 | #ifdef CONFIG_BLK_DEV_RAM | ||
518 | #define BUF_SIZE 1024 | 520 | #define BUF_SIZE 1024 |
519 | static void __init clean_rootfs(void) | 521 | static void __init clean_rootfs(void) |
520 | { | 522 | { |
@@ -561,6 +563,7 @@ static void __init clean_rootfs(void) | |||
561 | sys_close(fd); | 563 | sys_close(fd); |
562 | kfree(buf); | 564 | kfree(buf); |
563 | } | 565 | } |
566 | #endif | ||
564 | 567 | ||
565 | static int __init populate_rootfs(void) | 568 | static int __init populate_rootfs(void) |
566 | { | 569 | { |
@@ -571,11 +574,11 @@ static int __init populate_rootfs(void) | |||
571 | if (initrd_start) { | 574 | if (initrd_start) { |
572 | #ifdef CONFIG_BLK_DEV_RAM | 575 | #ifdef CONFIG_BLK_DEV_RAM |
573 | int fd; | 576 | int fd; |
574 | printk(KERN_INFO "checking if image is initramfs..."); | 577 | printk(KERN_INFO "checking if image is initramfs...\n"); |
575 | err = unpack_to_rootfs((char *)initrd_start, | 578 | err = unpack_to_rootfs((char *)initrd_start, |
576 | initrd_end - initrd_start); | 579 | initrd_end - initrd_start); |
577 | if (!err) { | 580 | if (!err) { |
578 | printk(" it is\n"); | 581 | printk(KERN_INFO "rootfs image is initramfs; unpacking...\n"); |
579 | free_initrd(); | 582 | free_initrd(); |
580 | return 0; | 583 | return 0; |
581 | } else { | 584 | } else { |
@@ -583,7 +586,8 @@ static int __init populate_rootfs(void) | |||
583 | unpack_to_rootfs(__initramfs_start, | 586 | unpack_to_rootfs(__initramfs_start, |
584 | __initramfs_end - __initramfs_start); | 587 | __initramfs_end - __initramfs_start); |
585 | } | 588 | } |
586 | printk("it isn't (%s); looks like an initrd\n", err); | 589 | printk(KERN_INFO "rootfs image is not initramfs (%s)" |
590 | "; looks like an initrd\n", err); | ||
587 | fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); | 591 | fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); |
588 | if (fd >= 0) { | 592 | if (fd >= 0) { |
589 | sys_write(fd, (char *)initrd_start, | 593 | sys_write(fd, (char *)initrd_start, |