From f54348bcae4bffedb200d1b66a1cbf46acf7efce Mon Sep 17 00:00:00 2001 From: Olivier Mauras Date: Mon, 2 Mar 2015 11:30:17 +0100 Subject: init: add support for rootfstype and rootflags boot options Add support for two new options in the cmdline. - rootfstype: Let's you specify the type of filesystem for the root fs - rootflags: Let's you specify mount options for the root fs - If specified, "ro" flag won't be added by default. This has primarily been setup to be able to boot Alpine guests from a 9P virtio share and make it easy to change mount options from libvirt/qemu --- initramfs-init.in | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/initramfs-init.in b/initramfs-init.in index d687e64..3d48f92 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -387,8 +387,8 @@ eval set -- `cat /proc/cmdline` myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm debug_init dma init_args keep_apk_new modules ovl_dev pkgs quiet root_size root - usbdelay ip alpine_repo apkovl alpine_start splash blacklist - overlaytmpfs" + rootfstype rootflags usbdelay ip alpine_repo apkovl alpine_start + splash blacklist overlaytmpfs" for opt; do case "$opt" in @@ -551,8 +551,20 @@ if [ -n "$KOPT_root" ]; then mount -t tmpfs root-tmpfs /media/root-rw mkdir -p /media/root-rw/work /media/root-rw/root mount -t overlay -o lowerdir=/media/root-ro,upperdir=/media/root-rw/root,workdir=/media/root-rw/work overlayfs $sysroot + elif [ -n $KOPT_rootfstype ]; then + if [ -n $KOPT_rootflags ]; then + rootflags="$KOPT_rootflags" + else + rootflags="ro" + fi + retry_mount -t $KOPT_rootfstype -o $rootflags $KOPT_root $sysroot 2>/dev/null else - retry_mount -o ro $KOPT_root $sysroot 2>/dev/null + if [ -n $KOPT_rootflags ]; then + rootflags="$KOPT_rootflags" + else + rootflags="ro" + fi + retry_mount -o $rootflags $KOPT_root $sysroot 2>/dev/null fi eend $? -- cgit v1.2.3