Set Rootflags at Debian Embedded Devices


When running debian on embedded devices like the ts119 flash-linux is used to flash the kernel and an initrd image to the devices flash memory. At some devices the kernel command line is statically defined by the manufacturer.

root@ts:~#cat /proc/cmdline
console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=32768

Therefore three isn't the possibility to set root device and flags with the kernel command line. Another way is to define them within the initial ram disk using the initramfs-tools. This is what flash-kernel does for the root partition with /usr/share/initramfs-tools/hooks/flash_kernel_set_root. It sets the ROOT variable at conf/param.conf which is sourced before the final root partition is mounted.


To set or override the rootflags the variable ROOTFLAGS is set in conf/param.conf at the initrd. Therefore a hook is added at /etc/initramfs-tools/hooks/:


ROOT_MOUNT_OPTIONS="-o defaults,noatime"

prereqs() {
	echo "$PREREQ"

case $1 in
	exit 0

. /usr/share/initramfs-tools/hook-functions
echo "ROOTFLAGS=\"$ROOT_MOUNT_OPTIONS\"" >> $DESTDIR/conf/param.conf

Be aware that your device won't boot with incorrect configurations. You may want to check the generated initrd.img and have a look the manpages of flash-kernel and initramfs-tools.