hello, guys i developed a mini webapp to run on a small card with openwrt backfire (they are far behind with this version but for what i have to do it is perfect). I have tested the app and everything and now i need to create a package to install it at the compile time of openwrt.
The application uses a sqlite3 database that in tests i loaded into memory (/ tmp) and some js/css libraries that I loaded into the / www folder. My problem is in writing and reading the database. Having manually loaded the db in the temporary folder everything works but how can i package the application and load the db into memory at each system start, that is, how should I manage everything, do you have any advice? i have little experience about this, moreover i would like to avoid using file system also in writing such as jffs2 to avoid the wear of the flash memory for too many operations that i would do on the database but i am open to any valid solution.
Writing?
A read/write sqlite3 database on a squashfs filesystem?
Squashfs is a compressed read-only file system for Linux.
You can compress and write the whole database into squashfs at once, but you can't later update/write any individual item in it.
What are you trying to accomplish regarding writing?
Based on that "operations that I would do on the database", I think that squashfs in unsuitable for you.
Actually, evaluating the thing better, i would use the database only to save some configurations, so the write operations are minimal and for reading there is no limit with the spi flash memory.
Yes, you are perfectly right!
What do you advise me to do if i change the file system to jffs2 for example? are there any better locations to put the database?
What i was wondering however is where the configuration files are saved, by default even if the file system is squashfs the manufacturer releases the card with a small webapp that has settings and the status is kept even after reboot if you change the parameters.
I imagine that the read-only + write.. part is supported in this case by mini_fo, which to date has been supplanted by OverlayFS (cit wiki .. . Used to merge two filesystems, one read-only and the other writable...) right?
How can i compile this type of configuration? i tried to compile and flash the image generated having also selected jffs2 as support * firmware-jffs2-64k.bin rather than firmware-squashfs.bin but it does not start.
the read-only part is mtd2=mtd3+mtd4 (firmware = kernel + rootfs)
the read-write part is the mtd5 (rwfs)
But I have no idea if you device has overlayfs compiled in. You should look into the sources of that device in order to fully see things.
Or you might try mounting the rwfs separately.
It is possible that the manufacturer does not use overlayfs at all, but stores settings etc. directly into the separate rwfs without combining it to rootfs.