[LEDE-DEV] mission impossible!! add ubifs
Daniel Golle
daniel at makrotopia.org
Mon Aug 22 22:31:48 PDT 2016
Hi Kenneth,
On Mon, Aug 22, 2016 at 11:48:21PM +0200, Kenneth johansson wrote:
> On 2016-08-22 22:12, Daniel Golle wrote:
> > Hi Kenneth,
> >
> > On Mon, Aug 22, 2016 at 09:54:46PM +0200, Kenneth Johansson wrote:
> > > so I'm on commit 2a170e40860034a9a5157306547c1a333be3845b and moving up to
> > > head is not really an option right now.
> > >
> > > what I want to do is change target mt7621 to generate a rootfs in ubifs, not
> > > ubi so no ubinize needed. In addition to this I want the kernel in uImage
> > > format included in the rootfs in /boot/. and same for the device tree. and
> > > it would be nice to have kernel uImage and dtb also in
> > > $(TOPDIR)/bin/ramips/.
> > Can you elaborate why you need/want uImage and DTB to be inside a
> > filesystem instead of appending the DTB to the Kernel and storing it
> > inside a UBI volume?
> Well the device tree is really intended to be part of the bootloader (BIOS)
> and not directly attached to the kernel. Also u-boot changes some parameters
> in the device tree so it really needs to have access to it directly. Also
> u-boot itself can use the device tree fot it's drivers but then it must be
> compiled into u-boot. Including it with the kernel was never the intended
> usecase.
>
> And I'm not particular excited about finding the device tree by searching
> for a string.
Nobody is. This method is being used because most (stock) bootloaders
don't support device-tree and FIT.
>
> > > sound like a 5 minute job but oh no I see no end in sight. Problem is that I
> > > do not understand what I need to do. To many macro expansions involved in
> > > the makefile.
> > >
> > > so far I changed.
> > > change the kernel code so that it takes the dtb from u-boot if it passes in
> > > the dtb to the kernel. Before it only used the dtb that is patched in. this
> > > works fine with the ramdisk image.
> > Great. Having U-Boot pass the DTB is a desirable feature indeed. And
> > parting ramips/mt7621 support to vanilla U-Boot would be amazing (but
> > supposedly also quite a lot of work).
> I have it working for serial port, nand flash and ethernet and do not intend
> to make more hardware work in u-boot. well I had to temporary init USB
> hardware as the driver in kernel did not set it up correctly and I have not
> had time to find out what it did wrong.
Just enable CONFIG_FIT and read about FIT support, that's really all
you need.
> >
> > If you already build U-Boot from source yourself, you could also use
> > a FIT image containing both, DTB and Kernel which is already much
> > cleaner than patching it into the kernel.
> Not interested as I described u-boot need access to the device tree
> directly.
It does if you use FIT. You don't need a filesystem for that.
> > This then allows U-Boot to e.g. pass the MAC address appropriately via
> > device-tree instead of the kernel reading it from the environment or
> > EEPROM partition.
> I have not looked into this yet. but I suspect we need to change both u-boot
> and the kernel to make this work.
You misunderstood. Things like those (passing the MAC address) are a
good argument for storing the device-tree-blob in a way that U-Boot
will be able to load, modify and pass it to the kernel (instead of
just appending it)
> >
> > > I added ubifs to FEATURES in target/linux/ramips/Makefile so that "make
> > > menuconfig" can select ubifs image. I also select the option that should
> > > include uImage and dtb in rootfs. this do not work. so I tried to fix it in
> > The option to include dtb and uimage in rootfs is fundamentally flawed
> > and broken. It was added at a time when proper support for generating
> > UBI images wasn't yet implemented in OpenWrt.
> > Maybe we should mark it as deprecated?
> no you should not. there is nothing broken about it. this is how grub works
> on PC you read the kernel directly out of the rootfs. It also used the flash
> a bit more efficiently. just a bit but there is a cost to create an ubi
> volume and as I said before the notion to combine DTB and kernel is wrong it
> is just a band aid when you have bootloader that do no understand device
> tree. Do not combine them.
GRUB on a PC is fundamentally different from headless embedded devices
which may even be upgraded over-the-air.
Also device-tree support on most embedded targets is still by far not
as mature as say ACPI or DMI. Support for new properties is still being
added to drivers and thus, device-tree and kernel need to be in-sync
(at least for now, this might be different in 10 years when hopefully
all new boards come with a device-tree-blob as a part of their
OpenFirmware-complaint bootloader -- yet, it still wouldn't need to be
stored in a filesystem even at that point).
> >
> >
> > > target/linux/ramips/image/Makefile. But what changes should I do ? It is
> > > really hard to understand what the correct change really is and so far all
> > > my testing results in more or less no change or some other error showing up.
> > >
> > > any suggestiongs ?? its fine to do it for master I'm sure I can backport it
> > > once I have the correct changes to target/linux/ramips/image/Makefile.
> > If you really, really need a boot-filesystem instead of a volume for
> > any reason which cannot be addressed otherwise (eg. Buffalo uses a
> > JFFS2-NAND boot partition in their bootloader which doesn't support
> > UBI at all), please explain and we shall find a solution.
> > Apart from that, just use UBI/NAND support in the way intended (ie.
> > have a plain volume for the kernel) and you won't have any problems,
> > I suppose...
> even this do not currently work. there is no UBI support of any kind for
> mt7621 and adding it was what I was asking about.
There are already devices using UBI on MT7621, just no method to flash
UBI using the 'factory'/stock method due to lacking UBI support in
the vendor-supplied U-Boot. UBI support is enabled on targets by
setting the 'nand' feature, see target/linux/ramips/mt7621/target.mk
You may also have a look at
target/linux/ramips/base-files/lib/upgrade/ubnt.sh for an example
(Ubiquiti EdgeRouter X) of how flashing a device without it's
bootloader supporting UBI -- I'm not saying this is ideal and your
world looks much easier
Cheers
Daniel
>
> >
> >
> > Cheers
> >
> >
> > Daniel
> >
> > _______________________________________________
> > Lede-dev mailing list
> > Lede-dev at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/lede-dev
>
>
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
More information about the Lede-dev
mailing list