Project

General

Profile

Actions

Feature #40

closed

Run time file system image needs to mount /tmp to ram disk

Added by Hammel about 14 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Category:
root file system
Target version:
Start date:
18 Oct 2010
Due date:
% Done:

100%

Estimated time:
Severity:
Critical

Description

The init scripts need to create ram disks for /tmp and possibly other writeable directories, with some mechanism added that allows caching writes until absolutely necessary. This will reduce writes to the flash card so it lasts longer.

A list of what directories and/or files that need to be placed on the ram disk should be made.

Actions #1

Updated by Hammel about 14 years ago

We can review how Angstrom is doing it or look at the Arago project (http://arago-project.org/wiki/index.php/Main_Page).

Actions #2

Updated by Hammel about 14 years ago

The validation images use the Arago root filesystem. This rootfs has a number of directories and files symlinked to /var/volatile, which is mounted as a ramdisk by /etc/fstab. The directories and files need to be created at boot time so there is a script called from the rcS.d directory (S37populate-volatile.sh, which is actually /etc/init.d/populate-volatile.sh) that runs the script /etc/volatile.cache. This is what creates the directories and files on the ram disk.

The rootfs is created with the files and directories that will be on the ramdisk as symlinks to them. For example, /etc/resolv.conf is a symlink to /var/run/resolv.conf. /var/run is a symlink to /var/volatile/run which does not exist in the rootfs but gets created at boot time in the ramdisk. /var/run/resolv.conf must also, therefore, be created at boot time. Both are created with the /etc/volatile.cache script.

This mechanism is pretty straight forward and can be used by BeagleBox. The only question is: does the rcS.d script get run when you set inittab's default to runlevel 5? It seems it must, but I'm not quite certain how it does yet. Maybe rcS always gets run.

Note that I found a minor bug in the Arago version: /etc/volatile.cache has two identical entries for creating /var/run/resolv.conf.

The fstab, populate-volatile.sh and volatile.cache files are attached, for reference.

Actions #3

Updated by Hammel about 14 years ago

Integrated volatile script and configuration from Angstrom (slightly modified) but it doesn't work because the rootfs has symlinks in place already for the things volatile wants to handle, mostly under /var. So what I want to do is run a post-configuration script in Buildroot (CONFIG_BR2_ROOTFS_POST_BUILD_SCRIPT) that removes the symlinks in /var and removes /var/lib from the tree before it is stuffed into an image file. Then the volatile script can be run at boot time.

Alternatively I could create the appropriate symlinks in the build itself and skip the volatile script. The script is more flexible but also potentially error prone.

Even after all this is accomplished I need to recreate /tmp/fontconfig at boot time because that directory goes in a tmpfs so can't be created till boot time, but the directory must exist for some reason (something in the Buildroot build - probably related to X.org utilities - creates it).

Actions #4

Updated by Hammel about 14 years ago

This has been implemented in the build today but can't be tested till tonight.

Actions #5

Updated by Hammel about 14 years ago

Force rootfs writes to tmpfs via /var/volatile.
Fixed inittab to operate in the proper order (top to bottom).
Fixed shadow file and added passwd file so getty would work on serial
port for root login with no passwd.
Fixed rcS script to work properly on boot.
Added rc1 script to perform tasks rcS was failing at but inittab would
allow in a subsequent boot script.
Renamed populate_volatile.sh to volatile in init.d directory.
Added input script (00_core) for volatile init script.
Added initial syslog.conf but it's not properly configured yet.
Fixed fstab to only mount what we really want at this time.

Actions

Also available in: Atom PDF