* [PATCH 1/2] init-install.sh: Switch to using static device paths.
@ 2015-01-09 15:52 Drew Moseley
2015-01-09 15:52 ` [PATCH 2/2] init-install-efi.sh: " Drew Moseley
2015-01-12 2:05 ` [PATCH 1/2] init-install.sh: " ChenQi
0 siblings, 2 replies; 6+ messages in thread
From: Drew Moseley @ 2015-01-09 15:52 UTC (permalink / raw)
To: openembedded-core
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)"
+
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
}
_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/
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] init-install-efi.sh: Switch to using static device paths.
2015-01-09 15:52 [PATCH 1/2] init-install.sh: Switch to using static device paths Drew Moseley
@ 2015-01-09 15:52 ` Drew Moseley
2015-01-12 2:05 ` [PATCH 1/2] init-install.sh: " ChenQi
1 sibling, 0 replies; 6+ messages in thread
From: Drew Moseley @ 2015-01-09 15:52 UTC (permalink / raw)
To: openembedded-core
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-efi.sh | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 89d0750..4cfe6e0 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -153,6 +153,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)"
+
mkdir /tgt_root
mkdir /src_root
mkdir -p /boot
@@ -163,8 +169,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 vfat defaults 1 2" >> /tgt_root/etc/fstab
+ echo "$swap_static swap swap defaults 0 0" >> /tgt_root/etc/fstab
+ echo "$bootfs_static /boot vfat 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
@@ -195,7 +201,7 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
# Delete any root= strings
sed -i "s/ root=[^ ]*/ /" $GRUBCFG
# Add the root= and other standard boot options
- sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG
+ sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$rootfs_uuid rw $rootwait quiet @" $GRUBCFG
fi
if [ -d /run/media/$1/loader ]; then
@@ -211,7 +217,7 @@ if [ -d /run/media/$1/loader ]; then
# delete any root= strings
sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
# add the root= and other standard boot options
- sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
+ sed -i "s@options *@options root=PARTUUID=$rootfs_uuid rw $rootwait quiet @" $GUMMIBOOT_CFGS
fi
umount /tgt_root
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] init-install.sh: Switch to using static device paths.
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
2015-01-13 14:46 ` Moseley, Drew
1 sibling, 1 reply; 6+ messages in thread
From: ChenQi @ 2015-01-12 2:05 UTC (permalink / raw)
To: openembedded-core
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/
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] init-install.sh: Switch to using static device paths.
2015-01-12 2:05 ` [PATCH 1/2] init-install.sh: " ChenQi
@ 2015-01-13 14:46 ` Moseley, Drew
2015-01-14 3:37 ` ChenQi
0 siblings, 1 reply; 6+ messages in thread
From: Moseley, Drew @ 2015-01-13 14:46 UTC (permalink / raw)
To: ChenQi; +Cc: openembedded-core@lists.openembedded.org
> On Jan 11, 2015, at 9:05 PM, ChenQi <Qi.Chen@windriver.com> wrote:
>
> 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?
That's a good question. In my test systems (two VirtualBox configs and two AMD based PCs) it is always there. Taking a second look at my developer Ubuntu system it does not seem to have that field so maybe I'm just getting lucky on my test systems.
Anybody have a suggestion for a replacement?
>> 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.
>
Perhaps so but it does seem to be there on my VirtualBox systems. My Ubuntu host uses "root=UUID=blah" but that was't working for me at some point. I'll dig back into it and see what I can find.
Drew
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] init-install.sh: Switch to using static device paths.
2015-01-13 14:46 ` Moseley, Drew
@ 2015-01-14 3:37 ` ChenQi
2015-01-20 16:31 ` Moseley, Drew
0 siblings, 1 reply; 6+ messages in thread
From: ChenQi @ 2015-01-14 3:37 UTC (permalink / raw)
To: Moseley, Drew; +Cc: openembedded-core@lists.openembedded.org
On 01/13/2015 10:46 PM, Moseley, Drew wrote:
>> On Jan 11, 2015, at 9:05 PM, ChenQi <Qi.Chen@windriver.com> wrote:
>>
>> 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?
> That's a good question. In my test systems (two VirtualBox configs and two AMD based PCs) it is always there. Taking a second look at my developer Ubuntu system it does not seem to have that field so maybe I'm just getting lucky on my test systems.
>
> Anybody have a suggestion for a replacement?
We can use blkid command.
>
>>> 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.
>>
> Perhaps so but it does seem to be there on my VirtualBox systems. My Ubuntu host uses "root=UUID=blah" but that was't working for me at some point. I'll dig back into it and see what I can find.
>
> Drew
>
>
>
>
root=UUID=xxx has to be resolved by an initramfs because kernel itself
cannot handle it.
There's a patchset I sent half a year ago trying to solve this problem.
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/initramfs-uuid
This offers one solution, maybe an ugly one.
Best Regards,
Chen Qi
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] init-install.sh: Switch to using static device paths.
2015-01-14 3:37 ` ChenQi
@ 2015-01-20 16:31 ` Moseley, Drew
0 siblings, 0 replies; 6+ messages in thread
From: Moseley, Drew @ 2015-01-20 16:31 UTC (permalink / raw)
To: openembedded-core@lists.openembedded.org
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
On Jan 13, 2015, at 10:37 PM, ChenQi <Qi.Chen@windriver.com<mailto:Qi.Chen@windriver.com>> wrote:
- 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.
Perhaps so but it does seem to be there on my VirtualBox systems. My Ubuntu host uses "root=UUID=blah" but that was't working for me at some point. I'll dig back into it and see what I can find.
Drew
root=UUID=xxx has to be resolved by an initramfs because kernel itself cannot handle it.
There's a patchset I sent half a year ago trying to solve this problem.
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/initramfs-uuid
This offers one solution, maybe an ugly one.
Best Regards,
Chen Qi
Hmm. It seems that supporting static device paths with init-install.sh is a bit more tricky as PARTUUID is not supported and to use UUID requires a fairly heavyweight change to support initramfs.
For EFI though it seems that PARTUUID is usable. Does it make sense to submit the patch to init-install-efi.sh separately?
Drew
[-- Attachment #2: Type: text/html, Size: 7726 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-01-20 16:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 1/2] init-install.sh: " ChenQi
2015-01-13 14:46 ` Moseley, Drew
2015-01-14 3:37 ` ChenQi
2015-01-20 16:31 ` Moseley, Drew
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox