Configuring the Linux Kernel from MacOS

I use a beefy build server to do my Linux Kernel compiles. I use github workflows to do the compile in an unattended fashion. I don’t want to SSH into the server to run make menuconfig. What do I do?

I use a Macbook as my daily driver. It would be nice if I could generate the .config file on my laptop. But,.. there’s no way that would work, right? Right?

Turns out, it does. You just need to do the bare minimum hackery. It took me 2 minutes to figure out and do. Here it is:

  1. First, you’ll probably run into this error:
    ld: unknown option: --version
    ld: unknown linker
    scripts/Kconfig.include:56: Sorry, this linker is not supported.
    make[2]: *** [menuconfig] Error 1
    make[1]: *** [menuconfig] Error 2
    make: *** [__sub-make] Error 2
    Just remove the offending line (56) from scripts/Kconfig.include
    In this case, remove this:
    $(error-if,$(success,test -z "$(ld-info)"),Sorry$(comma) this linker is not supported.)
  2. Next, you’ll probably run into:
    init/Kconfig:53: syntax error
    init/Kconfig:52: invalid statement
    init/Kconfig:53: invalid statement
    init/Kconfig:61: syntax error
    init/Kconfig:60: invalid statement
    init/Kconfig:61: invalid statement
    make[2]: *** [menuconfig] Error 1
    make[1]: *** [menuconfig] Error 2
    make: *** [__sub-make] Error 2
    Just remove those lines also. In this case, remove these:
    default $(ld-version) if LD_IS_BFD
    default 0
  3. Now run make menuconfig and amazingly, it’ll work.

4 responses to “Configuring the Linux Kernel from MacOS”

  1. Sadly, this isnt workng for me. I deleted the lines 52, and 53, and tried deleting a bunch of other stuff too, but I always get the error:
    ld: unknown option: –version
    ld: unknown linker
    make[2]: *** [menuconfig] Segmentation fault: 11
    make[1]: *** [menuconfig] Error 2
    make: *** [__sub-make] Error 2

  2. Hello ! Some details aren’t in the tuto (if you want to do it yourself)
    – Run brew install findutils coreutils gnu-tar gnu-sed ncurses (you should already have make installed)
    – Add this line at the end of your bash profile : PATH=”/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:$PATH”
    – Run brew install nsabovic/linuxonmac/elf-header
    Then you should be at the same level as Ed

    • still not ok unfortunately


      $ make
      HOSTCC arch/x86/tools/relocs_32.o
      In file included from arch/x86/tools/relocs_32.c:2:
      arch/x86/tools/relocs.h:14:10: fatal error: ‘byteswap.h’ file not found
      1 error generated.
      make[1]: *** [scripts/ arch/x86/tools/relocs_32.o] Error 1
      make: *** [arch/x86/Makefile:219: archscripts] Error 2


  3. And, at the end, he forgot to make you remove 2 more lines :
    default $(ld-version) if LD_IS_BFD
    default 0

Leave a Reply

%d bloggers like this: