Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "André Draszik" <git@andred.net>
To: Oleksii Konoplitskyi <okonopli@cisco.com>,
	 openembedded-core@lists.openembedded.org,
	xe-linux-external@cisco.com
Subject: Re: [PATCH] core-image-minimal-initramfs: prepare initramfs for NFS boot
Date: Tue, 03 Apr 2018 15:23:41 +0100	[thread overview]
Message-ID: <1522765421.26897.51.camel@andred.net> (raw)
In-Reply-To: <052b3c4d-084c-9434-e47d-b68c068cd958@cisco.com>

Thanks!

On Fri, 2018-03-16 at 20:20 +0200, Oleksii Konoplitskyi wrote:
> Taking into account your recommendations, module should have the next 
> content:
> 
> nfsrootfs_enabled() {
>      [ -z ${bootparam_nfsroot+x} ] && return 1
>      return 0
> }
> 
> nfsrootfs_run() {
>      nfs_mount_point=$(echo $bootparam_nfsroot | cut -d ',' -f 1)
>      nfs_mount_params=$(echo $bootparam_nfsroot | cut -d ',' -f 2)
> 
>      mount -t nfs ${nfs_mount_point} -o nolock,${nfs_server_params} 
> $ROOTFS_DIR
> }

Actually, this is missing various things, according to
linux/Documentation/filesystems/nfs/nfsroot.txt

nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]

* The server-ip is optional (and would be taken from the ip= option in
  that case)
* there can be more than one nfs-option (which is probably more important
  to fix)
* it ignores the 'ro' or rootflags=ro option

Maybe something like this (completely untested):

nfsrootfs_run() {
    local nfs_opts
    local location
    local flags

    nfs_opts=""
    if [ "${bootparam_nfsroot#*,}" != "${bootparam_nfsroot}" ] ; then
        nfs_opts="-o ${bootparam_nfsroot#*,}"
    fi
    location="${bootparam_nfsroot%%,*}"
    if [ "${location#*:}" = "${location}" ]; then
        # server-ip not given
        location=${ROOTSERVER}:${location}
    fi

    flags="-o nolock"
    if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
        if [  -n "$bootparam_rootflags" ]; then
            bootparam_rootflags="$bootparam_rootflags,"
        fi
        bootparam_rootflags="${bootparam_rootflags}ro"
    fi
    if [ -n "$bootparam_rootflags" ]; then
        flags="$flags -o$bootparam_rootflags"
    fi

    mount -t nfs ${flags} ${nfs_opts} ${location} ${ROOTFS_DIR}
}

? Just need to get at $ROOTSERVER now, or at least issue a warning that it
should be given on the command line.


> What module is responsible for network configuration and network driver 
> loading?

I'd say IP should be separate, as you can then also easily add DHCP or
zeroconf. It's not really related to nfsroot (except for the ROOTSERVER
bit).
Network driver loading should definitely be a machine specific thing...

> Should it be separate custom module in initramfs-framework not related 
> to upstream?
> 
> Best regards,
> Oleksii


Cheers,
Andre'



  reply	other threads:[~2018-04-03 14:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 14:33 [PATCH] core-image-minimal-initramfs: prepare initramfs for NFS boot Oleksii Konoplitskyi
2018-03-12 16:59 ` André Draszik
2018-03-16 18:20   ` Oleksii Konoplitskyi
2018-04-03 14:23     ` André Draszik [this message]
2018-04-18  9:55       ` Oleksii Konoplitskyi
2018-04-18  9:57       ` Oleksii Konoplitskyi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1522765421.26897.51.camel@andred.net \
    --to=git@andred.net \
    --cc=okonopli@cisco.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=xe-linux-external@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox