Skip to content

Build failure: linux (powerpc) #224694

Closed

Description

@alyssais

Building powerpc kernels (I only tested pkgsCross.powernv, but examination of the kernel source code suggests to me that 32-bit powerpc, and well as big-endian 64-bit will be the same) is broken since #221707. This happens because on powerpc, the kernel target we install is vmlinux, rather than any derivative of it like zImage. The kernel build system will strip when creating such a derivative image, but because we install vmlinux directly, we get an unstripped image. This means the kernel contains references to its build directory, which since that PR will be the $dev output.

AIUI, 64-bit POWER boots via kexec, and a zImage is a self-extracting kernel ELF image, so hopefully the fix would just be to switch the kernel target for powerpc to zImage, and things will work again, and POWER users will get smaller kernel images as a bonus.

I'm not sure about 32-bit PowerPC, but this kernel documentation might be helpful.

If we can't use an *Image target for any powerpc targets, there is also a target called vmlinux.strip that we could fall back to, but let's take the opportunity to evaluate whether anything else is more suitable first, when we're changing this stuff anyway.

Apart from powerpc, the only target we have that uses vmlinux as its kernel target is a MIPS machine called the Fuloong 2.0. I don't know how it boots.

Activity

  1. added
    0.kind: build failure
    on Apr 4, 2023
  2. ghost
    self-assigned this
    on Apr 4, 2023
  3. added
    6.topic: exotic
    on Apr 4, 2023
  4. vkleen commented on Apr 4, 2023

    @vkleen
    Contributor

    For reference, I managed to get a working kernel derivation for Power9 with

    kernelPackages = pkgs.linuxKernel.packageAliases.linux_latest.extend
        (final: prev: lib.optionalAttrs pkgs.stdenv.hostPlatform.isPower64 {
          kernel = lib.makeOverridable
            (args:
              let
                kernel = prev.kernel.override args;
              in
              kernel.overrideAttrs (o: {
                buildFlags = o.buildFlags ++ [ "modules" "zImage" ];
                installFlags = o.installFlags ++ [ "KBUILD_IMAGE=$(boot)/zImage" ];
                installTargets = [ "install" ];
                postFixup = (o.postFixup or "") + ''
                  strip -s $out/zImage
                '';
                inherit (kernel) passthru;
              }))
            { };
        });
    

    Just setting building a zImage without fully stripping it afterwards wasn't enough. There still was a reference to $dev in the debug info somewhere.

  5. alyssais commented on Apr 4, 2023

    @alyssais
    MemberAuthor

    Yep, very plausible that there are other references as well. We had some of those for x86 and RISC-V, although that specific issue didn't apply to other architectures.

  6. alyssais commented on May 23, 2023

    @alyssais
    MemberAuthor

    Edit: I meant to post this here.

  7. ghost closed this as completedin 2458c94on Jul 20, 2023
  8. ghost reopened this on Jul 20, 2023
  9. ghost closed this as completedon Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: build failure6.topic: exotic

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions