aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Mauras <olivier@mauras.ch>2015-03-02 11:30:17 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2015-04-08 14:03:59 +0200
commitf54348bcae4bffedb200d1b66a1cbf46acf7efce (patch)
tree06c42a424805ab5c45de94242a67a42d7b377360
parent0591f1aff8a9c86455ebd7eb6d78c6f83f0b7b4a (diff)
downloadmkinitfs-f54348bcae4bffedb200d1b66a1cbf46acf7efce.tar.bz2
mkinitfs-f54348bcae4bffedb200d1b66a1cbf46acf7efce.tar.xz
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
-rwxr-xr-xinitramfs-init.in18
1 files 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 $?