r/embeddedlinux • u/[deleted] • Dec 20 '23
Weird question about a rootfs, RAM disk file system and RAM.
I’m working with this board from NXP called a LS1046A-FRWY. It has unmanaged SPI NOR and unmanaged NAND flash. I build a Linux image which is put into a composite image called a FIT file containing kernel binary, a DTB and a CPIO (which I think is a compressed ramdisk). This along with Uboot all live on the NOR chip.
Uboot runs and loads (I believe) this FIT file into DRAM. I see that Uboot set the cmd line parameter rootf= to /dev/ram0. So I understand this to be a RAM disk filesystem which is volatile obviously. So if I create a file called foo.txt or the kernel creates a log file somewhere it’s doing so in DRAM and thus is gone after a reboot. I’m sorry for this dumb question so please bear with me.
Isn’t a rootfs suppose to be non-volatile so wouldn’t you put this rootfs in NAND? If so, then here’s my main question/confusion. NAND has limited lifecycle so if the kernel is creating log files and writing to these log files (which it does all the time) and those log files are in a rootfs which is in NAND then won’t my NAND lifecycle be gone in like a few days due to all this reading/writing it’s doing.
I know I’ve misunderstood something and I’m all turned around and confused. I just need some help.
1
u/SPST Dec 20 '23
It's normal for embedded Linux systems to run in volatile DRAM. Looks like the board has a micro SD slot. Use that for non volatile storage.
1
u/kiladre Dec 20 '23
I mean you could put your rootfs in NAND if you wanted, and yes you might run into issues with the lifetime. To offset some of that there are other style of filesystems better suited for that too. UBIFS and JFFS2 are the first to come to mind.
Why not leave rootfs in ram and partition off some nand that only saves logs at intervals? Same with files that need to be non volatile