~alpine/devel

8 3

[alpine-devel] Fw: [alpine-aports] [Patch] mkinitfs - Support for root_type and root_options

Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20150316113651.52ba616b@ncopa-desktop.alpinelinux.org>
Sender timestamp
1426502211
DKIM signature
missing
Download raw message
I am forwarding a patch for mkinitfs from alpine-aports mailing list
for discussion.

I agree that we want support mounting p9 as root file system from
initramfs.

I would like to avoid to introduce 2 new boot options: root_type and
root_options.

Questions:

Can we implement this without introducing new boot options?

If not, how does other distros handle this? Do they have other boot
options for it?

Are we happy with introducing root_type and root_options as boot
options?

I am open for ideas.

-nc

Begin forwarded message:

Date: Wed, 11 Mar 2015 17:34:33 +0200
From: Olivier Mauras <olivier@mauras.ch>
To: <alpine-aports@lists.alpinelinux.org>
Subject: Re: [alpine-aports] [Patch] mkinitfs - Support for root_type and root_options


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-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Olivier Mauras <olivier@mauras.ch>
Details
Message ID
<418ebc36905fc436a830d3d91870d204@core-hosting.net>
In-Reply-To
<20150316113651.52ba616b@ncopa-desktop.alpinelinux.org> (view parent)
Sender timestamp
1426508400
DKIM signature
missing
Download raw message
 

On 2015-03-16 12:36, Natanael Copa wrote: 

> I am forwarding a
patch for mkinitfs from alpine-aports mailing list
> for discussion.
>

> I agree that we want support mounting p9 as root file system from
>
initramfs.
> 
> I would like to avoid to introduce 2 new boot options:
root_type and
> root_options.
> 
> Questions:
> 
> Can we implement this
without introducing new boot options?
> 
> If not, how does other
distros handle this? Do they have other boot
> options for it?
> 
> Are
we happy with introducing root_type and root_options as boot
>
options?
> 
> I am open for ideas.
> 
> -nc
> 
> Begin forwarded
message:
> 
> Date: Wed, 11 Mar 2015 17:34:33 +0200
> From: Olivier
Mauras <olivier@mauras.ch>
> To: <alpine-aports@lists.alpinelinux.org>
>
Subject: Re: [alpine-aports] [Patch] mkinitfs - Support for root_type
and root_options
> 
> 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-devel+unsubscribe@lists.alpinelinux.org
> Help:
alpine-devel+help@lists.alpinelinux.org
> ---

FWIW, RHEL7 implements it
in dracut with "root=virtfs:9p_name"
I just felt that having the options
could be more useful - beyond 9p but i agree, is it needed ? - than
hardcoding 9p support :)

Olivier
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20150316161419.44a5f4a2@ncopa-desktop.alpinelinux.org>
In-Reply-To
<418ebc36905fc436a830d3d91870d204@core-hosting.net> (view parent)
Sender timestamp
1426518859
DKIM signature
missing
Download raw message
On Mon, 16 Mar 2015 14:20:00 +0200
Olivier Mauras <olivier@mauras.ch> wrote:

>  
> 
> On 2015-03-16 12:36, Natanael Copa wrote: 
> 
> > I am forwarding a
> patch for mkinitfs from alpine-aports mailing list
> > for discussion.
> >
> 
> > I agree that we want support mounting p9 as root file system from
> >
> initramfs.
> > 
> > I would like to avoid to introduce 2 new boot options:
> root_type and
> > root_options.
> > 
> > Questions:
> > 
> > Can we implement this
> without introducing new boot options?
> > 
> > If not, how does other
> distros handle this? Do they have other boot
> > options for it?
> > 
> > Are
> we happy with introducing root_type and root_options as boot
> >
> options?
> > 
> > I am open for ideas.
...
> FWIW, RHEL7 implements it
> in dracut with "root=virtfs:9p_name"

ok, this is an option we should consider.

> I just felt that having the options
> could be more useful - beyond 9p but i agree, is it needed ? - than
> hardcoding 9p support :)

we have root_size for tmpfs root which would correspond to
root_options="-s ..."

I agree it would be nice to avoid hardcoding every supported root type.

anyone know what debian, ubuntu, arch and gentoo does for 9p as root?

If the majority use root=virtfs:9p_name then we should maybe follow
that.

> 
> Olivier 
>  


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Isaac Dunham <ibid.ag@gmail.com>
Details
Message ID
<20150316173947.GB13750@newbook>
In-Reply-To
<20150316161419.44a5f4a2@ncopa-desktop.alpinelinux.org> (view parent)
Sender timestamp
1426527588
DKIM signature
missing
Download raw message
On Mon, Mar 16, 2015 at 04:14:19PM +0100, Natanael Copa wrote:
> On Mon, 16 Mar 2015 14:20:00 +0200
> Olivier Mauras <olivier@mauras.ch> wrote:
> 
> >  
> > 
> > On 2015-03-16 12:36, Natanael Copa wrote: 
> > 
> > > I am forwarding a
> > patch for mkinitfs from alpine-aports mailing list
> > > for discussion.
> > >
> > 
> > > I agree that we want support mounting p9 as root file system from
> > > initramfs.
> > > 
> > > I would like to avoid to introduce 2 new boot options:
> > root_type and
> > > root_options.
> > > 
> > > Questions:
> > > 
> > > Can we implement this
> > without introducing new boot options?
> > > 
> > > If not, how does other
> > distros handle this? Do they have other boot
> > > options for it?

> > FWIW, RHEL7 implements it
> > in dracut with "root=virtfs:9p_name"
> 
> ok, this is an option we should consider.
> 
> > I just felt that having the options
> > could be more useful - beyond 9p but i agree, is it needed ? - than
> > hardcoding 9p support :)
> 
> we have root_size for tmpfs root which would correspond to
> root_options="-s ..."
> 
> I agree it would be nice to avoid hardcoding every supported root type.
> 
> anyone know what debian, ubuntu, arch and gentoo does for 9p as root?
> 
> If the majority use root=virtfs:9p_name then we should maybe follow
> that.

Here's something about adding 9p support to an initramfs applicable to
Debian, if I understand correctly [1]:

Add the 9p modules to the host initramfs (that's the easiest way albeit not the cleanest, to have an initrd with the needed modules): 
printf '%s\n' 9p 9pnet 9pnet_virtio | sudo tee -a /etc/initramfs-tools/modules
sudo update-initramfs -u 

qemu -kernel "/boot/vmlinuz-$(uname -r)" \
   -initrd "/boot/initrd.img-$(uname -r)" \
   -fsdev local,id=r,path=/,security_model=none \
   -device virtio-9p-pci,fsdev=r,mount_tag=r \
   -nographic \
   -append 'root=r ro rootfstype=9p rootflags=trans=virtio console=ttyS0 init=/bin/sh'

[1] http://unix.stackexchange.com/questions/90423/can-virtfs-9p-be-used-as-root-file-system




---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20150316210825.12739794@ncopa-laptop>
In-Reply-To
<20150316173947.GB13750@newbook> (view parent)
Sender timestamp
1426536505
DKIM signature
missing
Download raw message
On Mon, 16 Mar 2015 17:39:48 +0000
Isaac Dunham <ibid.ag@gmail.com> wrote:

> On Mon, Mar 16, 2015 at 04:14:19PM +0100, Natanael Copa wrote:
> > On Mon, 16 Mar 2015 14:20:00 +0200
> > Olivier Mauras <olivier@mauras.ch> wrote:
> > 
> > >  
> > > 
> > > On 2015-03-16 12:36, Natanael Copa wrote: 
> > > 
> > > > I am forwarding a
> > > patch for mkinitfs from alpine-aports mailing list
> > > > for discussion.
> > > >
> > > 
> > > > I agree that we want support mounting p9 as root file system from
> > > > initramfs.
> > > > 
> > > > I would like to avoid to introduce 2 new boot options:
> > > root_type and
> > > > root_options.
> > > > 
> > > > Questions:
> > > > 
> > > > Can we implement this
> > > without introducing new boot options?
> > > > 
> > > > If not, how does other
> > > distros handle this? Do they have other boot
> > > > options for it?
> 
> > > FWIW, RHEL7 implements it
> > > in dracut with "root=virtfs:9p_name"
> > 
> > ok, this is an option we should consider.
> > 
> > > I just felt that having the options
> > > could be more useful - beyond 9p but i agree, is it needed ? - than
> > > hardcoding 9p support :)
> > 
> > we have root_size for tmpfs root which would correspond to
> > root_options="-s ..."
> > 
> > I agree it would be nice to avoid hardcoding every supported root type.
> > 
> > anyone know what debian, ubuntu, arch and gentoo does for 9p as root?
> > 
> > If the majority use root=virtfs:9p_name then we should maybe follow
> > that.
> 
> Here's something about adding 9p support to an initramfs applicable to
> Debian, if I understand correctly [1]:
> 
> Add the 9p modules to the host initramfs (that's the easiest way albeit not the cleanest, to have an initrd with the needed modules): 
> printf '%s\n' 9p 9pnet 9pnet_virtio | sudo tee -a /etc/initramfs-tools/modules
> sudo update-initramfs -u 
> 
> qemu -kernel "/boot/vmlinuz-$(uname -r)" \
>    -initrd "/boot/initrd.img-$(uname -r)" \
>    -fsdev local,id=r,path=/,security_model=none \
>    -device virtio-9p-pci,fsdev=r,mount_tag=r \
>    -nographic \
>    -append 'root=r ro rootfstype=9p rootflags=trans=virtio console=ttyS0 init=/bin/sh'

so, rootfstype and rootflags. I think we can use those instead of
root_type and root_options?

Thank you very much!

> 
> [1] http://unix.stackexchange.com/questions/90423/can-virtfs-9p-be-used-as-root-file-system
> 
> 



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Olivier Mauras <olivier@mauras.ch>
Details
Message ID
<1426537858.30008.0.camel@tiptop.internal>
In-Reply-To
<20150316210825.12739794@ncopa-laptop> (view parent)
Sender timestamp
1426537858
DKIM signature
missing
Download raw message

On Mon, 2015-03-16 at 21:08 +0100, Natanael Copa wrote:
> On Mon, 16 Mar 2015 17:39:48 +0000
> Isaac Dunham <ibid.ag@gmail.com> wrote:
> 
> > On Mon, Mar 16, 2015 at 04:14:19PM +0100, Natanael Copa wrote:
> > > On Mon, 16 Mar 2015 14:20:00 +0200
> > > Olivier Mauras <olivier@mauras.ch> wrote:
> > > 
> > > >  
> > > > 
> > > > On 2015-03-16 12:36, Natanael Copa wrote: 
> > > > 
> > > > > I am forwarding a
> > > > patch for mkinitfs from alpine-aports mailing list
> > > > > for discussion.
> > > > >
> > > > 
> > > > > I agree that we want support mounting p9 as root file system from
> > > > > initramfs.
> > > > > 
> > > > > I would like to avoid to introduce 2 new boot options:
> > > > root_type and
> > > > > root_options.
> > > > > 
> > > > > Questions:
> > > > > 
> > > > > Can we implement this
> > > > without introducing new boot options?
> > > > > 
> > > > > If not, how does other
> > > > distros handle this? Do they have other boot
> > > > > options for it?
> > 
> > > > FWIW, RHEL7 implements it
> > > > in dracut with "root=virtfs:9p_name"
> > > 
> > > ok, this is an option we should consider.
> > > 
> > > > I just felt that having the options
> > > > could be more useful - beyond 9p but i agree, is it needed ? - than
> > > > hardcoding 9p support :)
> > > 
> > > we have root_size for tmpfs root which would correspond to
> > > root_options="-s ..."
> > > 
> > > I agree it would be nice to avoid hardcoding every supported root type.
> > > 
> > > anyone know what debian, ubuntu, arch and gentoo does for 9p as root?
> > > 
> > > If the majority use root=virtfs:9p_name then we should maybe follow
> > > that.
> > 
> > Here's something about adding 9p support to an initramfs applicable to
> > Debian, if I understand correctly [1]:
> > 
> > Add the 9p modules to the host initramfs (that's the easiest way albeit not the cleanest, to have an initrd with the needed modules): 
> > printf '%s\n' 9p 9pnet 9pnet_virtio | sudo tee -a /etc/initramfs-tools/modules
> > sudo update-initramfs -u 
> > 
> > qemu -kernel "/boot/vmlinuz-$(uname -r)" \
> >    -initrd "/boot/initrd.img-$(uname -r)" \
> >    -fsdev local,id=r,path=/,security_model=none \
> >    -device virtio-9p-pci,fsdev=r,mount_tag=r \
> >    -nographic \
> >    -append 'root=r ro rootfstype=9p rootflags=trans=virtio console=ttyS0 init=/bin/sh'
> 
> so, rootfstype and rootflags. I think we can use those instead of
> root_type and root_options?
> 
> Thank you very much!
> 
> > 
> > [1] http://unix.stackexchange.com/questions/90423/can-virtfs-9p-be-used-as-root-file-system
> > 
> > 
> 
> 
> 
> ---
> Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
> Help:         alpine-devel+help@lists.alpinelinux.org
> ---

Want me to fix the patch with these ?
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20150316221858.058b9c6c@ncopa-laptop>
In-Reply-To
<1426537858.30008.0.camel@tiptop.internal> (view parent)
Sender timestamp
1426540738
DKIM signature
missing
Download raw message
On Mon, 16 Mar 2015 21:30:58 +0100
Olivier Mauras <olivier@mauras.ch> wrote:

> 
> 
> On Mon, 2015-03-16 at 21:08 +0100, Natanael Copa wrote:
> > On Mon, 16 Mar 2015 17:39:48 +0000
> > Isaac Dunham <ibid.ag@gmail.com> wrote:
> > 
> > > On Mon, Mar 16, 2015 at 04:14:19PM +0100, Natanael Copa wrote:
> > > > On Mon, 16 Mar 2015 14:20:00 +0200
> > > > Olivier Mauras <olivier@mauras.ch> wrote:
> > > > 
> > > > >  
> > > > > 
> > > > > On 2015-03-16 12:36, Natanael Copa wrote: 
> > > > > 
> > > > > > I am forwarding a
> > > > > patch for mkinitfs from alpine-aports mailing list
> > > > > > for discussion.
> > > > > >
> > > > > 
> > > > > > I agree that we want support mounting p9 as root file system from
> > > > > > initramfs.
> > > > > > 
> > > > > > I would like to avoid to introduce 2 new boot options:
> > > > > root_type and
> > > > > > root_options.
> > > > > > 
> > > > > > Questions:
> > > > > > 
> > > > > > Can we implement this
> > > > > without introducing new boot options?
> > > > > > 
> > > > > > If not, how does other
> > > > > distros handle this? Do they have other boot
> > > > > > options for it?
> > > 
> > > > > FWIW, RHEL7 implements it
> > > > > in dracut with "root=virtfs:9p_name"
> > > > 
> > > > ok, this is an option we should consider.
> > > > 
> > > > > I just felt that having the options
> > > > > could be more useful - beyond 9p but i agree, is it needed ? - than
> > > > > hardcoding 9p support :)
> > > > 
> > > > we have root_size for tmpfs root which would correspond to
> > > > root_options="-s ..."
> > > > 
> > > > I agree it would be nice to avoid hardcoding every supported root type.
> > > > 
> > > > anyone know what debian, ubuntu, arch and gentoo does for 9p as root?
> > > > 
> > > > If the majority use root=virtfs:9p_name then we should maybe follow
> > > > that.
> > > 
> > > Here's something about adding 9p support to an initramfs applicable to
> > > Debian, if I understand correctly [1]:
> > > 
> > > Add the 9p modules to the host initramfs (that's the easiest way albeit not the cleanest, to have an initrd with the needed modules): 
> > > printf '%s\n' 9p 9pnet 9pnet_virtio | sudo tee -a /etc/initramfs-tools/modules
> > > sudo update-initramfs -u 
> > > 
> > > qemu -kernel "/boot/vmlinuz-$(uname -r)" \
> > >    -initrd "/boot/initrd.img-$(uname -r)" \
> > >    -fsdev local,id=r,path=/,security_model=none \
> > >    -device virtio-9p-pci,fsdev=r,mount_tag=r \
> > >    -nographic \
> > >    -append 'root=r ro rootfstype=9p rootflags=trans=virtio console=ttyS0 init=/bin/sh'
> > 
> > so, rootfstype and rootflags. I think we can use those instead of
> > root_type and root_options?
> > 
> > Thank you very much!
> > 
> > > 
> > > [1] http://unix.stackexchange.com/questions/90423/can-virtfs-9p-be-used-as-root-file-system
> > > 
> > > 
> > 
> > 
> > 
> > ---
> > Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
> > Help:         alpine-devel+help@lists.alpinelinux.org
> > ---
> 
> Want me to fix the patch with these ?

Would be nice. thanks

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---

[alpine-devel] Re: [Patch] mkinitfs - Support for rootfstype and rootflags

Olivier Mauras <olivier@mauras.ch>
Details
Message ID
<8b211b9bb16c66629d70a8c0a21ba33e@core-hosting.net>
In-Reply-To
<20150316210825.12739794@ncopa-laptop> (view parent)
Sender timestamp
1426574186
DKIM signature
missing
Download raw message
Please find the update patch below:

 From acda031c6cc79f427b90d4395b95b3472b6c587d 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.
  - 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

diff --git a/initramfs-init.in b/initramfs-init.in
index fd3e510..10116f9 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 v0.10.1
---
Direct link if needed 
http://git.mauras.ch/mkinitfs/patch/?id=acda031c6cc79f427b90d4395b95b3472b6c587d



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---

Re: [alpine-devel] Re: [Patch] mkinitfs - Support for rootfstype and rootflags

Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20150408143813.38fbae92@ncopa-desktop.alpinelinux.org>
In-Reply-To
<8b211b9bb16c66629d70a8c0a21ba33e@core-hosting.net> (view parent)
Sender timestamp
1428496693
DKIM signature
missing
Download raw message
Patch: +4 -2
On Tue, 17 Mar 2015 08:36:26 +0200
Olivier Mauras <olivier@mauras.ch> wrote:

> Please find the update patch below:
> 
>  From acda031c6cc79f427b90d4395b95b3472b6c587d 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.
>   - 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
> 
> diff --git a/initramfs-init.in b/initramfs-init.in
> index fd3e510..10116f9 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 $?

Sorry for late answer.
To avoid if/else spagetti i suggest this instead, which should do exactly the same:
diff --git a/initramfs-init.in b/initramfs-init.in
index d687e64..42ee63f 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -388,7 +388,7 @@ 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"
       overlaytmpfs rootfstype rootflags"

for opt; do
       case "$opt" in
@@ -552,7 +552,9 @@ if [ -n "$KOPT_root" ]; then
               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
       else
               retry_mount -o ro $KOPT_root $sysroot 2>/dev/null
               retry_mount ${KOPT_rootfstype:+-t} ${KOPT_rootfstype} \
                       -o ${KOPT_rootflags:-ro} \
                       $KOPT_root $sysroot 2>/dev/null
       fi

       eend $?


Do you think you could test it?

While at it i think I will replace the root_size boot opt with the new
rootflags.

nc



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)