• V
    block2mtd.c: Make kernel boot command line arguments work (try 4) · c4e7fb31
    Ville Herva 提交于
    Trying to pass kernel command line arguments to block2mtd at boot-time does
    not work currently. block2mtd_setup() is called so early that kmalloc()
    fails nevermind being able to do open_bdev_excl() (which requires rootfs to
    be mounted. This patch only saves the option string at the early boot stage,
    and parses them later when block2mtd_init() is called. If open_bdev_excl()
    fails, open_by_devnum(name_to_dev_t()) is tried instead, which makes it
    possible to initialize the driver before rootfs has been mounted. Also gets
    rid of the superfluous parse_name() that only checks if name is longer than
    80 chars and copies it to a string that is not kfreed.
    
    With this patch, I can boot statically compiled block2mtd, and mount jffs2
    as rootfs (without modules or initrd), with lilo config like this:
    
       root=/dev/mtdblock0
       append="rootfstype=jffs2 block2mtd.block2mtd=/dev/hdc2,65536"
    
    (Note that rootfstype=jffs2 is required, since the kernel only tries
    filesystems without "nodev" attribute by default, and jffs is "nodev").
    
    Compared to first version of this patch, this one does not copy the
    parameters to the global buffer if init has already been called, and the
    global array is marked as __initdata.
    
    Compared to the second version of this patch, module build is fixed.
    
    Compared to the third version of this patch, statically compiled block2mtd
    driver with no boot-time parameter no longer gives spurious error 'cannot
    open device ""'
    Signed-off-by: NVille Herva <vherva@vianova.fi>
    Acked-by: NJörn Engel <joern@wohnheim.fh-wedel.de>
    Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
    c4e7fb31
block2mtd.c 11.9 KB