Commit ff7f3efb9abf986f4ecd8793a9593f7ca4d6431a

Authored by Chris Metcalf
1 parent a937536b86

tile: expect new initramfs name from hypervisor file system

The current Tilera boot infrastructure now provides the initramfs
to Linux as a Tilera-hypervisor file named "initramfs", rather than
"initramfs.cpio.gz", as before.  (This makes it reasonable to use
other compression techniques than gzip on the file without having to
worry about the name causing confusion.)  Adapt to use the new name,
but also fall back to checking for the old name.

Cc'ing to stable so that older kernels will remain compatible with
newer Tilera boot infrastructure.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Cc: stable@vger.kernel.org

Showing 1 changed file with 12 additions and 13 deletions Side-by-side Diff

arch/tile/kernel/setup.c
... ... @@ -1004,15 +1004,8 @@
1004 1004  
1005 1005 #ifdef CONFIG_BLK_DEV_INITRD
1006 1006  
1007   -/*
1008   - * Note that the kernel can potentially support other compression
1009   - * techniques than gz, though we don't do so by default. If we ever
1010   - * decide to do so we can either look for other filename extensions,
1011   - * or just allow a file with this name to be compressed with an
1012   - * arbitrary compressor (somewhat counterintuitively).
1013   - */
1014 1007 static int __initdata set_initramfs_file;
1015   -static char __initdata initramfs_file[128] = "initramfs.cpio.gz";
  1008 +static char __initdata initramfs_file[128] = "initramfs";
1016 1009  
1017 1010 static int __init setup_initramfs_file(char *str)
1018 1011 {
... ... @@ -1026,9 +1019,9 @@
1026 1019 early_param("initramfs_file", setup_initramfs_file);
1027 1020  
1028 1021 /*
1029   - * We look for an "initramfs.cpio.gz" file in the hvfs.
1030   - * If there is one, we allocate some memory for it and it will be
1031   - * unpacked to the initramfs.
  1022 + * We look for a file called "initramfs" in the hvfs. If there is one, we
  1023 + * allocate some memory for it and it will be unpacked to the initramfs.
  1024 + * If it's compressed, the initd code will uncompress it first.
1032 1025 */
1033 1026 static void __init load_hv_initrd(void)
1034 1027 {
1035 1028  
... ... @@ -1038,10 +1031,16 @@
1038 1031  
1039 1032 fd = hv_fs_findfile((HV_VirtAddr) initramfs_file);
1040 1033 if (fd == HV_ENOENT) {
1041   - if (set_initramfs_file)
  1034 + if (set_initramfs_file) {
1042 1035 pr_warning("No such hvfs initramfs file '%s'\n",
1043 1036 initramfs_file);
1044   - return;
  1037 + return;
  1038 + } else {
  1039 + /* Try old backwards-compatible name. */
  1040 + fd = hv_fs_findfile((HV_VirtAddr)"initramfs.cpio.gz");
  1041 + if (fd == HV_ENOENT)
  1042 + return;
  1043 + }
1045 1044 }
1046 1045 BUG_ON(fd < 0);
1047 1046 stat = hv_fs_fstat(fd);