Openembedded Core Discussions
 help / color / mirror / Atom feed
From: ChenQi <Qi.Chen@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/2] init-install.sh: Switch to using static device paths.
Date: Mon, 12 Jan 2015 10:05:08 +0800	[thread overview]
Message-ID: <54B32BD4.3080209@windriver.com> (raw)
In-Reply-To: <1420818765-28571-1-git-send-email-drew_moseley@mentor.com>

On 01/09/2015 11:52 PM, Drew Moseley wrote:
> Use static device paths for mounting from /dev/disk/<blah> in
> case the device ordering changes.
>
> Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
> ---
>   meta/recipes-core/initrdscripts/files/init-install.sh | 14 ++++++++++----
>   1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
> index fb537ee..f924418 100644
> --- a/meta/recipes-core/initrdscripts/files/init-install.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-install.sh
> @@ -156,6 +156,12 @@ mkfs.ext3 $rootfs
>   echo "Formatting swap partition...($swap)"
>   mkswap $swap
>   
> +# Determine the static device paths
> +sync; udevadm settle
> +bootfs_static="$(udevadm info --query=property --name=$bootfs | grep DEVLINKS= | cut -d= -f2 | cut -d\  -f1)"
> +swap_static="$(udevadm info --query=property --name=$swap | grep DEVLINKS= | cut -d= -f2 | cut -d\  -f1)"
> +rootfs_uuid="$(udevadm info --query=property --name=$rootfs | grep ID_PART_ENTRY_UUID | cut -d= -f2)"
> +

Would ID_PART_ENTRY_UUID be always there?

>   mkdir /tgt_root
>   mkdir /src_root
>   mkdir -p /boot
> @@ -166,8 +172,8 @@ mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
>   echo "Copying rootfs files..."
>   cp -a /src_root/* /tgt_root
>   if [ -d /tgt_root/etc/ ] ; then
> -    echo "$swap                swap             swap       defaults              0  0" >> /tgt_root/etc/fstab
> -    echo "$bootfs              /boot            ext3       defaults              1  2" >> /tgt_root/etc/fstab
> +    echo "$swap_static                swap             swap       defaults              0  0" >> /tgt_root/etc/fstab
> +    echo "$bootfs_static              /boot            ext3       defaults              1  2" >> /tgt_root/etc/fstab
>       # We dont want udev to mount our root device while we're booting...
>       if [ -d /tgt_root/etc/udev/ ] ; then
>   	echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist
> @@ -186,7 +192,7 @@ if [ -f /etc/grub.d/00_header ] ; then
>       cat >$GRUBCFG <<_EOF
>   menuentry "Linux" {
>       set root=(hd0,1)
> -    linux /vmlinuz root=$rootfs $rootwait rw $5 $3 $4 quiet
> +    linux /vmlinuz root=PARTUUID=$rootfs_uuid $rootwait rw $5 $3 $4 quiet

I thought PARTUUID is for GPT only.

Regards,
Chen Qi

>   }
>   _EOF
>       chmod 0444 $GRUBCFG
> @@ -201,7 +207,7 @@ if [ ! -f /boot/grub/grub.cfg ] ; then
>       echo "timeout 30" >> /boot/grub/menu.lst
>       echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst
>       echo "root  (hd0,0)" >> /boot/grub/menu.lst
> -    echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
> +    echo "kernel /vmlinuz root=PARTUUID=$rootfs_uuid rw $3 $4 quiet" >> /boot/grub/menu.lst
>   fi
>   
>   cp /run/media/$1/vmlinuz /boot/



  parent reply	other threads:[~2015-01-12  2:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 15:52 [PATCH 1/2] init-install.sh: Switch to using static device paths Drew Moseley
2015-01-09 15:52 ` [PATCH 2/2] init-install-efi.sh: " Drew Moseley
2015-01-12  2:05 ` ChenQi [this message]
2015-01-13 14:46   ` [PATCH 1/2] init-install.sh: " Moseley, Drew
2015-01-14  3:37     ` ChenQi
2015-01-20 16:31       ` Moseley, Drew

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=54B32BD4.3080209@windriver.com \
    --to=qi.chen@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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