I don't know how specific my idea is, but I couldn't find anyone with the same doubt. I was thinking if it's possible to flash all my LEDE's .bin system into a miniSD card, making the router boot into my system if the miniSD card is inserted, if not it would boot into the stock firmware. Would it take to much effort? I'm still kinda new to building systens and routers, tho I've already my custom build ready and working.
My project uses the ZBT WE826 with 16Mb of flash memory, and I would like more space for my applications, the ideal situation would be flashing all my custom system into the miniSD and making it bootable from there, so I would only need to copy the my system images through the SD cards making it more easily and portable when dealing with multiple ZBT routers. Is my idea possible? Or I should just stick with extroot?
That would be possible, just everything but easy (LEDE doesn't have the necessary infrastructure for that so far) and not really any more portable.
The generic approach would be via kexec, which would require a normal small LEDE installation on flash, with storage drivers and kexec. Once LEDE has booted up, a procd initscript would mount a small partition from sdhc containing the kernel/ initramfs and boot into that kernel via kexec (and its initramfs would take care of mounting the final system. For this to work you'd have to 'invent' your own sdhc format and prepare the target environment accordingly (example, first a small partition with kernel, initramfs and dtb, second partition for the rootfs, third rootfs_data for the overlay).
- check if kexec actually works on ramips/ mt7620 (it's supposed to work on mips, but reality often differs from theory)
- assemble your sdhc card by hand (see above), that will require quite some hacking.
- write a procd script to check for the sdhc card (use some kind of flag to positively identify a compatible card) and then automate the kexec invocation.
- integrate all that into LEDE (write the Makefile code to generate the sdhc image)
- make it a little more generic, uci/ luci integration, packaging etc.
If your vendor u-boot supports booting from sdhc (or if you can replace it by a version supporting it), this might be simpler (or harder, due to the lack of an example implementation) - but the usual routing platforms usually don't support this (your luck would be better on SBC platforms).
You probably won't win much in terms of portability with either of these approaches - and unless you're planning to actually merge your changes into upstream LEDE or to use it on more than your own 1, 2, 3, 5 or ten (similar) routers, it's most likely not worth the effort to implement (and to maintain your patchset out-of-tree for longer).
Wow that's quite a work for me right now. I will adapt my project to do with the extroot.
I really appreciate your detailed answer but given my limited knowledge right now I will do it with the extroot guides. Big Thanks \o/