Subject: canonize the bootpath
To: None <port-macppc@netbsd.org>
From: Daniel Lamblin <daniell@trillian.beachbash.net>
List: port-macppc
Date: 04/01/2003 00:47:05
Is there some way i could change the formatting of my bootfile and still
have it work, plus get the root device to be detected?
Also, I read the man page on kernel options (for building) but didn't see
the one aluded to which sets a default root device.  Could someone tell me
what should be written in the config file to define a root dev of wd0a?

Acording to ticket 20260 there's a suggestion for how to
get the boot path to tell the kernel where the root device is.

This is one I'm really hoping should be worked out for 1.6.1

I tried this method, being as it seemed to make sense... well okay, I have
no idead why they whole function is so long but... I tried it.

And it did not change the behavior. [which is to ask for the root
partition/device]

My boot path is something kinda crazy (on an 8500) and looks like:
pci1/ACARD,6260/disk@2,/netbsd

Notice that there's 2 commas and no leading slash (it wouldn't work with
one since pci1 is an alias to /bandit/something  I guess I could use that
if need be, idealy though anything legal should work.

my root device turns out to be wd0a


The area with the CHANGED CODE is: [arch/macppc/macppc/autoconf.c]
        if (p != NULL && strchr(p, '@') == NULL) {
                /* Append it. */
                if ((p = strrchr(last, '@')) != NULL)
                        strcat(cbootpath, p);
        }

        if ((p = strrchr(cbootpath, ':')) != NULL) {
                *p++ = 0;
                /* booted_partition = *p - '0';         XXX correct? */
        }

        /* XXX Does this belong here, or device_register()? */
        if ((p = strrchr(cbootpath, '/')) != NULL)
                if ((p = strrchr(p + 1, ',')) != NULL)
                        *p = '\0';
}

it was originally:
        if (p != NULL && strchr(p, '@') == NULL) {
                /* Append it. */
                if ((p = strrchr(last, '@')) != NULL)
                        strcat(cbootpath, p);
        }

        if ((p = strrchr(cbootpath, ':')) != NULL) {
                *p++ = 0;
                /* booted_partition = *p - '0';         XXX correct? */
        }

        /* XXX Does this belong here, or device_register()? */
        if ((p = strrchr(cbootpath, ',')) != NULL)
                *p = 0;
}


I'm sure something else must be changed.