• ZhaoLong Wang's avatar
    ubi: fastmap: Add fastmap control support for module parameter · 7af73882
    ZhaoLong Wang authored
    The UBI driver can use the IOCTL to disable the fastmap after the
    mainline 669d2044 ("ubi: fastmap: Add fastmap control support
    for 'UBI_IOCATT' ioctl"). To destroy the fastmap on a old image,
    we need to reattach the device in user space.
    
    However, if the UBI driver build in kernel and the UBI volume is
    the root partition, the UBI device cannot be reattached in user
    space. To disable fastmap in this case, the UBI must provide the
    kernel cmdline parameters to disable fastmap during attach.
    
    This patch add 'enable_fm' as 5th module init parameter of mtd=xx to
    control fastmap enable or not. When the value is 0, fastmap will not
    create and existed fastmap will destroyed for the given ubi device.
    Default value is 0.
    
    To enable or disable fastmap during module loading, fm_autoconvert
    must be set to non-zero.
    
    +-----------------+---------------+---------------------------+
    |        \        |  enable_fm=0  |  enable_fm=1              |
    +-----------------+---------------+---------------------------+
    |fm_autoconvert=Y |  disable fm   |  enable fm                |
    +---------------------------------+---------------------------+
    |fm_autoconvert=N |  disable fm   | Enable fastmap if fastmap |
    |                 |               | exists on the old image   |
    +-------------------------------------------------------------+
    
    Example:
      # - Attach mtd1 to ubi1, disable fastmap, mtd2 to ubi2, enable
          fastmap.
      # modprobe ubi mtd=1,0,0,1,0 mtd=2,0,0,2,1 fm_autoconvert=1
    
      # - If 5th parameter is not specified, the value is 0, fastmap is
          disable
      # modprobe ubi mtd=1 fm_autoconvert=1
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216623Signed-off-by: default avatarZhaoLong Wang <wangzhaolong1@huawei.com>
    Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
    7af73882
build.c 43.4 KB