[arch-releng] [PATCH] archiso_loop_mnt - cleaner boot from loopmounted iso file

Gerardo Exequiel Pozzi vmlinuz386 at gmail.com
Mon Jul 13 02:19:37 UTC 2015


On 07/12/2015 09:19 AM, Adam Purkrt wrote:
> On 07/12/2015 02:29 AM, Gerardo Exequiel Pozzi wrote:
>> On 07/11/2015 04:00 PM, Adam Purkrt wrote:
>>> I would like to suggest the patch below, to archiso_loop_mnt hook.
>>>
>>> Currently, when booting loopmounted iso file, it is necessary to
>>> specify not only img_dev and img_loop (which should be sufficient),
>>> but also archisolabel or archisodevice. With the patch, archisodevice
>>> is directly populated with the correct loop device, and it is not
>>> necessary to specify the label when booting from loopmounted iso,
>>> which makes for leaner and cleaner grub.cfg.
>>>
>>> The kernel command line in grub.cfg currently needed:
>>>
>>> linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201507
>>> img_dev=$imgdevpath img_loop=$isofile earlymodules=loop
>>>
>>> after the patch:
>>>
>>> linux (loop)/arch/boot/x86_64/vmlinuz img_dev=$imgdevpath
>>> img_loop=$isofile earlymodules=loop
>>>
>> You are right!
>>
>> Please also update the README.altbootmethods ;)
>>
>> PS: "earlymodules=loop": Is like a copy&paste hurricane from old age.
>> It was a temporal workaround (2011.08.19), but spread across all places.
>>
>> Thanks.
>>
> 
> It's good that "earlymodules=loop" is not necessary, thanks for pointing it out.
> 
> Updated the README.altbootmethods, using uuid over label. Overall the patch is:
> 
> diff --git a/archiso/initcpio/hooks/archiso_loop_mnt b/archiso/initcpio/hooks/archiso_loop_mnt
> index 46338e5..f95a47d 100644
> --- a/archiso/initcpio/hooks/archiso_loop_mnt
> +++ b/archiso/initcpio/hooks/archiso_loop_mnt
> @@ -18,7 +18,9 @@ archiso_loop_mount_handler () {
>          echo $(readlink -f ${img_dev}) >> /run/archiso/used_block_devices
>      fi
>  
> -    if ! _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then
> +    if _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then
> +        archisodevice="${_dev_loop}"
> +    else
>          echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'"
>          launch_interactive_shell
>      fi
> diff --git a/docs/README.altbootmethods b/docs/README.altbootmethods
> index 3c07e03..cbfada4 100644
> --- a/docs/README.altbootmethods
> +++ b/docs/README.altbootmethods
> @@ -25,20 +25,23 @@ Where:
>  
>  Note: Described method is for using with GRUB2.
>        GRUB2 is installed on target media and archlinux-<YYYY>.<MM>.<DD>-dual.iso
> -      is at path <TARGET-PATH> on disk <D> and partition <P>,
> -      where filesystem is labeled as <TARGET-FS-LABEL>.
> +      is at path <TARGET-PATH> on disk <D> and partition <P>.
>  
>  menuentry "Arch Linux (x86_64)" {
> +    set isopartition=hd<D>,<P>
>      set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso"
> -    loopback loop (hd<D>,<P>)$isofile
> -    linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile
> +    loopback loop ($isopartition)$isofile
> +    probe -u $isopartition --set=isouuid
> +    linux (loop)/arch/boot/x86_64/vmlinuz img_dev=/dev/disk/by-uuid/$isouuid img_loop=$isofile
>      initrd (loop)/arch/boot/x86_64/archiso.img
>  }
>  
>  menuentry "Arch Linux (i686)" {
> +    set isopartition=hd<D>,<P>
>      set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso"
> -    loopback loop (hd<D>,<P>)$isofile
> -    linux (loop)/arch/boot/i686/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile
> +    loopback loop ($isopartition)$isofile
> +    probe -u $isopartition --set=isouuid
> +    linux (loop)/arch/boot/i686/vmlinuz img_dev=/dev/disk/by-uuid/$isouuid img_loop=$isofile
>      initrd (loop)/arch/boot/i686/archiso.img
>  }
>  
> 
> 
> 
> 
> 
> One more thing - I would vote for deprecating "img_label" parameter and (sooner or later) removing it, i.e.
> 
> /archiso/initcpio/hooks/archiso_loop_mnt
> -    [[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}"
> 
> /docs/README.bootparams
> -* img_label=        Set the filesystem label where archiso-image.iso.
> -                    Default: (unset)
>  * img_dev=          Device where archiso-image.iso reside.
> -                    Default: (unset) or "/dev/disk/by-label/${img_label}"
> +                    Default: (unset)
> 
> since: 1) it is more reliable to refer to a partition by uuid
> 2) there is no "img_uuid" - and I don't think there should be, "img_dev=/dev/disk/by-uuid/[uuid]" is perfectly fine
> 3) it would be still possible to address by label using "img_dev=/dev/disk/by-label/[label]"
> 
> Not sure how much upheaval the abolition of img_label would cause, though.
> 

Please do one logic change at time.
Wheel, I never used loopback method other than just for test it per user
request when it was implemented.
Why remove img_label= it does look good for keep thing easy to
reference, sure archisolabel= can also be removed...



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/arch-releng/attachments/20150712/7dac9c6d/attachment.asc>


More information about the arch-releng mailing list