Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linuxManualConfig: install GDB scripts #221707

Merged
merged 4 commits into from
Mar 20, 2023
Merged

linuxManualConfig: install GDB scripts #221707

merged 4 commits into from
Mar 20, 2023

Commits on Mar 18, 2023

  1. linuxManualConfig: don't build inside source tree

    We can avoid the need to explicitly exclude it later if we just put it
    somewhere else to begin with.
    alyssais committed Mar 18, 2023
    Configuration menu
    Copy the full SHA
    d75cff2 View commit details
    Browse the repository at this point in the history

Commits on Mar 19, 2023

  1. linuxManualConfig: unpack directly into $dev

    linux is unusual in that we include its sources in an output.  There's
    no point unpacking into /build when we're going to copy the sources
    into $dev later.  Let's unpack directly into the final destination of
    the code, and save copying a whole kernel source tree (often across
    filesystems!).
    
    This also means that Kbuild knows the location of the sources, which
    will allow us to install the GDB scripts — some scripts are generated,
    and some are not, so the generated ones end up in the build directory,
    accompanied by symlinks to the non-generated ones in the source
    directory.
    alyssais committed Mar 19, 2023
    Configuration menu
    Copy the full SHA
    7de3f08 View commit details
    Browse the repository at this point in the history
  2. linuxManualConfig: use the default make target

    We've basically been reimplementing this — by default it contains
    vmlinux, dtbs (on applicable architectures), modules, and architecture
    specific stuff like $(KBUILD_IMAGE) and a couple of other
    miscellaneous files.
    alyssais committed Mar 19, 2023
    Configuration menu
    Copy the full SHA
    41f788b View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2023

  1. linuxManualConfig: install GDB scripts

    These are required to debug kernel modules.  Since we're now able to
    do that, there's another reason besides BTF to enable DEBUG_INFO, so
    I've done that for pre-BTF kernel modules as well here.
    
    For GDB to get configured correctly, vmlinux-gdb.py has to be two
    directories up from scripts/gdb, and vmlinux has to be next to
    vmlinux-gdb.py.  The least invasive way to satisfy these constraints
    is to make vmlinux a symlink, which GDB will resolve before looking
    for vmlinux-gdb.py.
    
    Tested both ways of getting the scripts into GDB that I know of:
    
    gdb /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/vmlinux \
        -iex 'add-auto-load-safe-path /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/lib/modules/6.1.19/build/vmlinux-gdb.py' \
        -ex 'lx-version' \
        -ex 'q'
    gdb /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/vmlinux \
        -ex 'source /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/lib/modules/6.1.19/build/vmlinux-gdb.py' \
        -ex 'lx-version' \
        -ex 'q'
    
    Also tested that the strip changes don't result in meaningful output
    size changes (there's some small variation due to BTF data not always
    coming out the same size, which is unrelated), and built every kernel
    I can on x86_64 to make sure I'm not relying on build system behaviour
    specific to newer kernels.
    alyssais committed Mar 20, 2023
    Configuration menu
    Copy the full SHA
    d57568f View commit details
    Browse the repository at this point in the history