Skip to content
  • Ronald G. Minnich's avatar
    x86/setup: Add an initrdmem= option to specify initrd physical address · 694cfd87
    Ronald G. Minnich authored
    
    
    Add the initrdmem option:
    
      initrdmem=ss[KMG],nn[KMG]
    
    which is used to specify the physical address of the initrd, almost
    always an address in FLASH. Also add code for x86 to use the existing
    phys_init_start and phys_init_size variables in the kernel.
    
    This is useful in cases where a kernel and an initrd is placed in FLASH,
    but there is no firmware file system structure in the FLASH.
    
    One such situation occurs when unused FLASH space on UEFI systems has
    been reclaimed by, e.g., taking it from the Management Engine. For
    example, on many systems, the ME is given half the FLASH part; not only
    is 2.75M of an 8M part unused; but 10.75M of a 16M part is unused. This
    space can be used to contain an initrd, but need to tell Linux where it
    is.
    
    This space is "raw": due to, e.g., UEFI limitations: it can not be added
    to UEFI firmware volumes without rebuilding UEFI from source or writing
    a UEFI device driver. It can be referenced only as a physical address
    and size.
    
    At the same time, if a kernel can be "netbooted" or loaded from GRUB or
    syslinux, the option of not using the physical address specification
    should be available.
    
    Then, it is easy to boot the kernel and provide an initrd; or boot the
    the kernel and let it use the initrd in FLASH. In practice, this has
    proven to be very helpful when integrating Linux into FLASH on x86.
    
    Hence, the most flexible and convenient path is to enable the initrdmem
    command line option in a way that it is the last choice tried.
    
    For example, on the DigitalLoggers Atomic Pi, an image into FLASH can be
    burnt in with a built-in command line which includes:
    
      initrdmem=0xff968000,0x200000
    
    which specifies a location and size.
    
     [ bp: Massage commit message, make it passive. ]
    
    [akpm@linux-foundation.org: coding style fixes]
    Signed-off-by: default avatarRonald G. Minnich <rminnich@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Reviewed-by: default avatarH. Peter Anvin (Intel) <hpa@zytor.com>
    Link: http://lkml.kernel.org/r/CAP6exYLK11rhreX=6QPyDQmW7wPHsKNEFtXE47pjx41xS6O7-A@mail.gmail.com
    Link: https://lkml.kernel.org/r/20200426011021.1cskg0AGd%akpm@linux-foundation.org
    694cfd87