home: hub: mkinitfs

Download patch

ref: f54348bcae4bffedb200d1b66a1cbf46acf7efce
parent: 0591f1aff8a9c86455ebd7eb6d78c6f83f0b7b4a
author: Olivier Mauras <olivier@mauras.ch>
date: Mon Mar 2 05:30:17 CST 2015

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

--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -387,8 +387,8 @@
 
 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 @@
 		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 $?