mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Colin Guthrie <colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org>
To: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 4/6] rootfs-block: Support lilo style device numbers.
Date: Thu, 24 Jan 2013 12:30:08 +0000	[thread overview]
Message-ID: <51012950.1060507@mageia.org> (raw)
In-Reply-To: <51011D9C.4080901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

'Twas brillig, and Harald Hoyer at 24/01/13 11:40 did gyre and gimble:
> Am 23.01.2013 21:15, schrieb Colin Guthrie:
>> Lilo supplies root=900 rather than root=/dev/md0. Similarly it would say root=801 rather
>> than root=/dev/sda1.
>>
>> This patch simply interprets that number and creates appropriate udev rules
>> to create the /dev/root symlink as needed.
>> ---
>>  modules.d/95rootfs-block/block-genrules.sh | 11 ++++++++++-
>>  modules.d/95rootfs-block/parse-block.sh    |  4 ++++
>>  2 files changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
>> index 7f894ee..161183e 100755
>> --- a/modules.d/95rootfs-block/block-genrules.sh
>> +++ b/modules.d/95rootfs-block/block-genrules.sh
>> @@ -2,7 +2,16 @@
>>  # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
>>  # ex: ts=8 sw=4 sts=4 et filetype=sh
>>  
>> -if [ "${root%%:*}" = "block" ]; then
>> +if [ -n "$rootdevnum" ]; then
>> +    major=$(( 0x$rootdevnum / 256 ))
>> +    minor=$(( 0x$rootdevnum - ( $major * 256 ) ))
>> +    {
>> +        printf 'ACTION=="add|change", ENV{MAJOR}=="%d", ENV{MINOR}=="%d", SYMLINK+="root"\n' \
>> +            $major $minor
>> +    } >> /etc/udev/rules.d/99-root.rules
>> +
>> +    wait_for_dev /dev/root
>> +elif [ "${root%%:*}" = "block" ]; then
>>      {
>>          printf 'KERNEL=="%s", SYMLINK+="root"\n' \
>>              ${root#block:/dev/}
>> diff --git a/modules.d/95rootfs-block/parse-block.sh b/modules.d/95rootfs-block/parse-block.sh
>> index 3745352..9efc51f 100755
>> --- a/modules.d/95rootfs-block/parse-block.sh
>> +++ b/modules.d/95rootfs-block/parse-block.sh
>> @@ -19,4 +19,8 @@ case "$root" in
>>      /dev/*)
>>          root="block:${root}"
>>          rootok=1 ;;
>> +    [1-9][0-9][0-9])
>> +        rootdevnum=$root
>> +        root=block:/dev/root
> 
> I would do just:
> 
> major=$(( 0x$root / 256 ))
> minor=$(( 0x$root - ( $major * 256 ) ))
> root=/dev/block/$major:$minor

Hmm, indeed, that does seem simpler :)

Of course this whole scheme is generally stupid anyway (majors have not
been limited to 256 for years), but meh.

Col
-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

  parent reply	other threads:[~2013-01-24 12:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 20:15 Various patches applied on Mageia that might be good for upstream Colin Guthrie
     [not found] ` <1358972106-2395-1-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org>
2013-01-23 20:15   ` [PATCH 1/6] dm/md: Only include UUIDs once in the command line Colin Guthrie
     [not found]     ` <1358972106-2395-2-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org>
2013-01-24 11:26       ` Harald Hoyer
2013-01-23 20:15   ` [PATCH 2/6] lvm: Ensure LVM is initialised in non-hostonly mode Colin Guthrie
     [not found]     ` <1358972106-2395-3-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org>
2013-01-24 11:32       ` Harald Hoyer
     [not found]         ` <51011BB2.3010409-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-01-24 11:40           ` Colin Guthrie
2013-01-23 20:15   ` [PATCH 3/6] resume: Ensure we remove the timout job when we find the resume device Colin Guthrie
2013-01-23 20:15   ` [PATCH 4/6] rootfs-block: Support lilo style device numbers Colin Guthrie
     [not found]     ` <1358972106-2395-5-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org>
2013-01-24 11:40       ` Harald Hoyer
     [not found]         ` <51011D9C.4080901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-01-24 12:30           ` Colin Guthrie [this message]
2013-01-23 20:15   ` [PATCH 5/6] i18n: Run console_init prior to udev startup Colin Guthrie
     [not found]     ` <1358972106-2395-6-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org>
2013-01-24 12:03       ` Harald Hoyer
2013-01-23 20:15   ` [PATCH 6/6] kernel-modules: Add ehci support for kernel 3.8+ Colin Guthrie
     [not found]     ` <1358972106-2395-7-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org>
2013-02-13 16:42       ` Harald Hoyer

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=51012950.1060507@mageia.org \
    --to=colin-odjjhxpcy38dnm+yrofe0a@public.gmane.org \
    --cc=harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.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