Skip to content

Commit

Permalink
init: make initrd/initramfs decompression failure a KERN_EMERG event
Browse files Browse the repository at this point in the history
Impact: More consistent behaviour, avoid policy in the kernel

Upgrade/downgrade initrd/initramfs decompression failure from
inconsistently a panic or a KERN_ALERT message to a KERN_EMERG event.
It is, however, possible do design a system which can recover from
this (using the kernel builtin code and/or the internal initramfs),
which means this is policy, not a technical necessity.

A good way to handle this would be to have a panic-level=X option, to
force a panic on a printk above a certain level.  That is a separate
patch, however.

Signed-off-by: H. Peter Anvin <[email protected]>
  • Loading branch information
H. Peter Anvin committed Jan 14, 2009
1 parent 23a22d5 commit 73310a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion init/do_mounts_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
printk(KERN_NOTICE "RAMDISK: %s image found at block %d\n",
compress_name, start_block);
if (!*decompressor)
printk(KERN_CRIT "RAMDISK: %s decompressor not configured!\n",
printk(KERN_EMERG
"RAMDISK: %s decompressor not configured!\n",
compress_name);
nblocks = 0;
goto done;
Expand Down
11 changes: 7 additions & 4 deletions init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ static int __init populate_rootfs(void)
char *err = unpack_to_rootfs(__initramfs_start,
__initramfs_end - __initramfs_start, 0);
if (err)
panic(err);
panic(err); /* Failed to decompress INTERNAL initramfs */
if (initrd_start) {
#ifdef CONFIG_BLK_DEV_RAM
int fd;
Expand All @@ -554,9 +554,12 @@ static int __init populate_rootfs(void)
printk(KERN_INFO "Unpacking initramfs...");
err = unpack_to_rootfs((char *)initrd_start,
initrd_end - initrd_start, 0);
if (err)
panic(err);
printk(" done\n");
if (err) {
printk(" failed!\n");
printk(KERN_EMERG "%s\n", err);
} else {
printk(" done\n");
}
free_initrd();
#endif
}
Expand Down

0 comments on commit 73310a1

Please sign in to comment.