[OpenWrt-Devel] [PATCH v2 0/2] kernel: add kmod-ubi and kmod-fs-ubifs

Ralph Sennhauser ralph.sennhauser at gmail.com
Fri Aug 26 12:02:42 EDT 2016

On Fri, 26 Aug 2016 17:34:19 +0200
Daniel Golle <daniel at makrotopia.org> wrote:

> Hi Ralph,
> On Fri, Aug 26, 2016 at 04:13:53PM +0200, Ralph Sennhauser wrote:
> > Hi Daniel,
> > 
> > On Fri, 26 Aug 2016 15:05:58 +0200
> > Daniel Golle <daniel at makrotopia.org> wrote:
> >   
> > > Hi Ralph,
> > > 
> > > the use of global variable ROOT_DEV is not guarded properly in the
> > > patch auto-creating a ubiblock though this code needs to be
> > > prevented from running when built as a module.
> > > Please try rebuilding with the patch attached, if it resolves the
> > > issue I'll commit a proper fix for that on LEDE's source.git
> > >   
> > 
> > thanks for looking into it that fast, will give the patch a try
> > later today and report back.
> > 
> > May I ask you why you do no handle setting ROOT_DEV in
> > init/do_mounts instead of ubi/block? It isn't immediately obvious
> > to me.  
> Yes, it would be easy to trigger the creation of the ubiblock device
> in do_mounts, and that'd be nice because it could then also be based
> on the root= kernel cmdline parameter, which would make transparently
> mounting ubifs or ubiblock(squashfs) possible without having to change
> the cmdline (or a fixed convention like what's currently implemented).
> However, ubiblock_create doesn't give the callee any information
> on the created block device. The usual thing is that it hotplug-hooks
> in userspace create the device node /dev/ubiblockX_Y.
> However, this doesn't happen before hotplug events are processed, thus
> the easiest (and without API modification only) way in terms of
> knowing the minor/major numbers of the created block device was to
> set ROOT_DEV inside of of ubiblock_create(). This is far from
> beautiful and to make it better the next thing on my agenda is to
> suggest changes to driver/mtd/ubi/block.c in the kernel which would
> either allow the callee to know the major/minor number of the created
> device or pass have a variant ubiblock_create_root() which also sets

Thanks for the explanation.

Tested the patch and still can't build for x86. Dropping just
493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch is enough to get
past modpost.

NB, config_enabled is about to be replaced by the IS_ENABLED family of

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list