[Bug 195525] New: Carambola2 (or any ar71xx devices) don't parse uboot arguments and environment variables

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Nov 30 12:28:33 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195525

            Bug ID: 195525
           Summary: Carambola2 (or any ar71xx devices) don't parse uboot
                    arguments and environment variables
           Product: Base System
           Version: 10.1-RELEASE
          Hardware: mips
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: bugs at andrewmcdonnell.net

I have a carambola2 which I build FreeBSD using freebsd-wifi-build.
The kernel fails to read the uboot environment, producing the following errors:

    argv is invalid
    envp is invalid

I tracked this down to sys/mips/.atheros/ar71xx_machdep.c and the following
code fragment:

    /*
     * Until some more sensible abstractions for uboot/redboot
     * environment handling, we have to make this a compile-time
     * hack.  The existing code handles the uboot environment
     * very incorrectly so we should just ignore initialising
     * the relevant pointers.
     */
#ifndef    AR71XX_ENV_UBOOT
    argc = a0;
    argv = (char**)a1;
    envp = (char**)a2;


For the Carambola2, those registers are in fact accurate and should not be
#ifdef'd out.  However, the variables are in fact an array of strings of
"name=value" not pairs of strings "name", "value", so to fix this for my own
case I had to extend the code that parses them later in the file.

Notwithstanding the comment regards 'more sensible abstractions', I have a
patch that makes the variables work (for the carambola2, at least)

https://github.com/pastcompute/freebsd/commit/9d06660cb53ff4c07048aaab0b086e612f5f155f

However, I suspect you may wish to restrict this fix to _just_ the carambola2
board, lest it break other peoples systems.  Any advice on how to filter a
fragment of code to a specific kernel configuration would be appreciated, as I
am mostly experienced with hacking other systems kernels...

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list