From c9613a0612e781e05225e38e69cdb90d82c7f897 Mon Sep 17 00:00:00 2001
From: Olivier Mauras <olivier@mauras.ch>
Date: Mon, 2 Mar 2015 11:30:17 +0100
Subject: [PATCH] Add support for two new options in the cmdline.
- root_type: Let's you specify the type of filesystem for the root fs
- root_options: 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 | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/initramfs-init.in b/initramfs-init.in
index fd3e510..8de2c7f 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"
+ root_type root_options usbdelay ip alpine_repo apkovl alpine_start
+ splash blacklist overlaytmpfs"
for opt; do
case "$opt" in
@@ -545,14 +545,26 @@ if [ -n "$KOPT_root" ]; then
start_$i
done
ebegin "Mounting root"
- if [ "$KOPT_overlaytmpfs" = "yes" ]; then
- mkdir -p /media/root-ro /media/root-rw
$sysroot/media/root-ro $sysroot/media/root-rw
- retry_mount -o ro $KOPT_root /media/root-ro 2>/dev/null
- 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
+ if [ "$KOPT_overlaytmpfs" = "yes" ]; then
+ mkdir -p /media/root-ro /media/root-rw $sysroot/media/root-ro
$sysroot/media/root-rw
+ retry_mount -o ro $KOPT_root /media/root-ro 2>/dev/null
+ 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_root_type ]; then
+ if [ -n $KOPT_root_options ]; then
+ root_options="$KOPT_root_options"
+ else
+ root_options="ro"
+ fi
+ retry_mount -t $KOPT_root_type -o $root_options
$KOPT_root $sysroot 2>/dev/null
else
- retry_mount -o ro $KOPT_root $sysroot 2>/dev/null
+ if [ -n $KOPT_root_options ]; then
+ root_options="$KOPT_root_options"
+ else
+ root_options="ro"
+ fi
+ retry_mount -o $root_options $KOPT_root $sysroot
2>/dev/null
fi
eend $?
--
1.7.11.7
--
In case the message would be scrambled, you can find the patch here:
http://git.mauras.ch/mkinitfs/patch/?id=c9613a0612e781e05225e38e69cdb90d82c7f897
Regards,
Olivier
---
Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org
Help: alpine-aports+help@lists.alpinelinux.org
---
On 2015-03-02 14:38, Olivier Mauras wrote:
> From c9613a0612e781e05225e38e69cdb90d82c7f897 Mon Sep 17 00:00:00
> 2001
> From: Olivier Mauras <olivier@mauras.ch>
> Date: Mon, 2 Mar 2015 11:30:17 +0100
> Subject: [PATCH] Add support for two new options in the cmdline.
> - root_type: Let's you specify the type of filesystem for the root fs
> - root_options: 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 | 30 +++++++++++++++++++++---------
> 1 file changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/initramfs-init.in b/initramfs-init.in
> index fd3e510..8de2c7f 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"
> + root_type root_options usbdelay ip alpine_repo apkovl alpine_start
> + splash blacklist overlaytmpfs"
>
> for opt; do
> case "$opt" in
> @@ -545,14 +545,26 @@ if [ -n "$KOPT_root" ]; then
> start_$i
> done
> ebegin "Mounting root"
> - if [ "$KOPT_overlaytmpfs" = "yes" ]; then
> - mkdir -p /media/root-ro /media/root-rw
> $sysroot/media/root-ro $sysroot/media/root-rw
> - retry_mount -o ro $KOPT_root /media/root-ro 2>/dev/null
> - 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
> + if [ "$KOPT_overlaytmpfs" = "yes" ]; then
> + mkdir -p /media/root-ro /media/root-rw $sysroot/media/root-ro
> $sysroot/media/root-rw
> + retry_mount -o ro $KOPT_root /media/root-ro 2>/dev/null
> + 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_root_type ]; then
> + if [ -n $KOPT_root_options ]; then
> + root_options="$KOPT_root_options"
> + else
> + root_options="ro"
> + fi
> + retry_mount -t $KOPT_root_type -o $root_options
> $KOPT_root $sysroot 2>/dev/null
> else
> - retry_mount -o ro $KOPT_root $sysroot 2>/dev/null
> + if [ -n $KOPT_root_options ]; then
> + root_options="$KOPT_root_options"
> + else
> + root_options="ro"
> + fi
> + retry_mount -o $root_options $KOPT_root $sysroot
> 2>/dev/null
> fi
>
> eend $?
> --
> 1.7.11.7
> --
>
> In case the message would be scrambled, you can find the patch here:
>
http://git.mauras.ch/mkinitfs/patch/?id=c9613a0612e781e05225e38e69cdb90d82c7f897
>
> Regards,
> Olivier
>
> ---
> Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org
> Help: alpine-aports+help@lists.alpinelinux.org
> ---
As per the discussion with ncopa on IRC, i redid the patch fixing the
tab issue
From e1d6dd700b01003f23725bb7143c7fa7a25b96fc Mon Sep 17 00:00:00 2001
From: Olivier Mauras <olivier@mauras.ch>
Date: Mon, 2 Mar 2015 11:30:17 +0100
Subject: Add support for two new options in the cmdline.
- root_type: Let's you specify the type of filesystem for the root fs
- root_options: 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
diff --git a/initramfs-init.in b/initramfs-init.in
index fd3e510..9c90406 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"
+ root_type root_options 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_root_type ]; then
+ if [ -n $KOPT_root_options ]; then
+ root_options="$KOPT_root_options"
+ else
+ root_options="ro"
+ fi
+ retry_mount -t $KOPT_root_type -o $root_options $KOPT_root $sysroot
2>/dev/null
else
- retry_mount -o ro $KOPT_root $sysroot 2>/dev/null
+ if [ -n $KOPT_root_options ]; then
+ root_options="$KOPT_root_options"
+ else
+ root_options="ro"
+ fi
+ retry_mount -o $root_options $KOPT_root $sysroot 2>/dev/null
fi
eend $?
--
cgit v0.10.1
---
Available here if scrambled:
http://git.mauras.ch/mkinitfs/patch/?id=e1d6dd700b01003f23725bb7143c7fa7a25b96fc
Regards,
Olivier
---
Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org
Help: alpine-aports+help@lists.alpinelinux.org
---