def all_arch_srcarch_pairs():
    """
    Generates all valid (ARCH, SRCARCH) tuples for the kernel, corresponding to
    different architectures. SRCARCH holds the arch/ subdirectory.
    """
    for srcarch in os.listdir("arch"):
        # Each subdirectory of arch/ containing a Kconfig file corresponds to
        # an architecture
        if os.path.exists(os.path.join("arch", srcarch, "Kconfig")):
            yield (srcarch, srcarch)

    # Some architectures define additional ARCH settings with ARCH != SRCARCH
    # (search for "Additional ARCH settings for" in the top-level Makefile)

    yield ("i386", "x86")
    yield ("x86_64", "x86")

    yield ("sparc32", "sparc")
    yield ("sparc64", "sparc")

    yield ("sh64", "sh")

    yield ("um", "um")
Generates all valid (ARCH, SRCARCH) tuples for the kernel, corresponding to
    different architectures. SRCARCH holds the arch/ subdirectory.