summaryrefslogtreecommitdiffstats
path: root/debian/rules.d
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:49:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:49:59 +0000
commit01997497f915e8f79871f3f2acb55ac465051d24 (patch)
tree1ce1afd7246e1014199e15cbf854bf7924458e5d /debian/rules.d
parentAdding upstream version 6.1.76. (diff)
downloadlinux-01997497f915e8f79871f3f2acb55ac465051d24.tar.xz
linux-01997497f915e8f79871f3f2acb55ac465051d24.zip
Adding debian version 6.1.76-1.debian/6.1.76-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/rules.d')
-rw-r--r--debian/rules.d/Makefile.inc60
-rw-r--r--debian/rules.d/arch/powerpc/boot/Makefile18
-rw-r--r--debian/rules.d/certs/Makefile7
-rw-r--r--debian/rules.d/scripts/Makefile48
-rw-r--r--debian/rules.d/scripts/basic/Makefile4
-rw-r--r--debian/rules.d/scripts/genksyms/Makefile16
-rw-r--r--debian/rules.d/scripts/kconfig/Makefile16
-rw-r--r--debian/rules.d/scripts/mod/Makefile22
-rw-r--r--debian/rules.d/scripts/mod/Makefile.real23
-rw-r--r--debian/rules.d/scripts/mod/elfconfig.h7
-rwxr-xr-xdebian/rules.d/scripts/mod/gendef.py20
-rw-r--r--debian/rules.d/scripts/mod/modpost.c136
-rw-r--r--debian/rules.d/scripts/mod/real-lsb-32/elfconfig.h4
-rw-r--r--debian/rules.d/scripts/mod/real-lsb-32/types.h3
-rw-r--r--debian/rules.d/scripts/mod/real-lsb-64/elfconfig.h4
-rw-r--r--debian/rules.d/scripts/mod/real-lsb-64/types.h3
-rw-r--r--debian/rules.d/scripts/mod/real-msb-32/elfconfig.h4
-rw-r--r--debian/rules.d/scripts/mod/real-msb-32/types.h3
-rw-r--r--debian/rules.d/scripts/mod/real-msb-64/elfconfig.h4
-rw-r--r--debian/rules.d/scripts/mod/real-msb-64/types.h3
-rw-r--r--debian/rules.d/scripts/mod/types.h12
-rw-r--r--debian/rules.d/tools/bpf/bpftool/Makefile27
-rw-r--r--debian/rules.d/tools/hv/Makefile17
-rw-r--r--debian/rules.d/tools/objtool/Makefile11
-rw-r--r--debian/rules.d/tools/perf/Makefile75
-rw-r--r--debian/rules.d/tools/power/cpupower/Makefile26
-rw-r--r--debian/rules.d/tools/power/x86/Makefile5
-rw-r--r--debian/rules.d/tools/power/x86/turbostat/Makefile9
-rw-r--r--debian/rules.d/tools/power/x86/x86_energy_perf_policy/Makefile7
-rw-r--r--debian/rules.d/tools/tracing/rtla/Makefile17
-rw-r--r--debian/rules.d/tools/usb/usbip/Makefile31
31 files changed, 642 insertions, 0 deletions
diff --git a/debian/rules.d/Makefile.inc b/debian/rules.d/Makefile.inc
new file mode 100644
index 000000000..55eae14f8
--- /dev/null
+++ b/debian/rules.d/Makefile.inc
@@ -0,0 +1,60 @@
+# Normalise OUTDIR to avoid triggering rebuilds
+override OUTDIR := $(patsubst ./%,%,$(OUTDIR))
+
+VPATH = $(top_rulesdir)/$(OUTDIR) $(top_srcdir)/$(OUTDIR)
+
+SHELL = /bin/sh -e
+
+CC = $(CROSS_COMPILE)gcc
+CXX = $(CROSS_COMPILE)g++
+PKG_CONFIG = $(CROSS_COMPILE)pkg-config
+CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -Wall
+CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) \
+ -I$(top_srcdir)/$(OUTDIR) \
+ -I$(top_srcdir)/debian/build/build-tools/$(OUTDIR) \
+ -isystem $(top_srcdir)/debian/build/build-tools/include
+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) -Wall
+LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+
+installdir ?= $(prefix)/$(OUTDIR)
+
+all: all-local all-recursive
+clean: clean-recursive
+install: install-local install-recursive
+
+%-recursive:
+ +@list='$(SUBDIRS)'; \
+ for subdir in $$list; do \
+ echo "Making $* in $$subdir"; \
+ mkdir -p $$subdir; \
+ $(MAKE) -C $$subdir -f $(top_rulesdir)/$(OUTDIR)/$$subdir/Makefile OUTDIR=$(OUTDIR)/$$subdir $*; \
+ done
+
+all-local: $(PROGS)
+
+install-local: install-local-progs install-local-scripts install-local-data
+
+install-local-progs: $(PROGS)
+ @for p in $^; do \
+ echo " install -m755 '$$p' '$(DESTDIR)/$(installdir)'"; \
+ install -D -m755 "$$p" "$(DESTDIR)/$(installdir)/$$(basename $$p)"; \
+ done
+
+SCRIPTS_REAL = $(wildcard $(addprefix $(top_srcdir)/$(OUTDIR)/,$(SCRIPTS)))
+
+install-local-scripts: $(SCRIPTS_REAL)
+ @for p in $^; do \
+ echo " install -m755 '$$p' '$(DESTDIR)/$(installdir)'"; \
+ install -D -m755 \
+ -s --strip-program $(top_srcdir)/debian/bin/fix-shebang \
+ "$$p" "$(DESTDIR)/$(installdir)/$$(basename $$p)"; \
+ done
+
+DATA_REAL = $(wildcard $(addprefix $(top_srcdir)/$(OUTDIR)/,$(DATA)))
+
+install-local-data: $(DATA_REAL)
+ @for p in $^; do \
+ echo " install -m644 '$$p' '$(DESTDIR)/$(installdir)'"; \
+ install -D -m644 "$$p" "$(DESTDIR)/$(installdir)/$$(basename $$p)"; \
+ done
+
diff --git a/debian/rules.d/arch/powerpc/boot/Makefile b/debian/rules.d/arch/powerpc/boot/Makefile
new file mode 100644
index 000000000..9dc418f26
--- /dev/null
+++ b/debian/rules.d/arch/powerpc/boot/Makefile
@@ -0,0 +1,18 @@
+PROGS = \
+ addnote \
+ hack-coff \
+ mktree
+
+SCRIPTS = \
+ wrapper
+
+include $(top_rulesdir)/Makefile.inc
+
+CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+
+# gcc for ppc64 currently seems to be treating -I like -isystem, and
+# since arch/powerpc/boot has substitute versions of some standard
+# headers for use at boot time, they are also included in these tools.
+# In this case there is actually no need to use the -I option, so
+# filter it out.
+CPPFLAGS := $(filter-out -I%,$(CPPFLAGS))
diff --git a/debian/rules.d/certs/Makefile b/debian/rules.d/certs/Makefile
new file mode 100644
index 000000000..7ff7baeba
--- /dev/null
+++ b/debian/rules.d/certs/Makefile
@@ -0,0 +1,7 @@
+PROGS = \
+ extract-cert
+
+include $(top_rulesdir)/Makefile.inc
+
+CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+extract-cert: LDLIBS += -lcrypto
diff --git a/debian/rules.d/scripts/Makefile b/debian/rules.d/scripts/Makefile
new file mode 100644
index 000000000..bbfe9c0d1
--- /dev/null
+++ b/debian/rules.d/scripts/Makefile
@@ -0,0 +1,48 @@
+PROGS = \
+ bin2c \
+ kallsyms \
+ recordmcount \
+ sign-file \
+ unifdef
+
+DATA = \
+ Kbuild.include \
+ Makefile.* \
+ mkversion \
+ module-common.lds \
+ subarch.include
+
+SCRIPTS = \
+ checkincludes.pl \
+ check-local-export \
+ checkstack.pl \
+ checkversion.pl \
+ depmod.sh \
+ gcc-*.sh \
+ gen_initramfs_list.sh \
+ headers_install.sh \
+ kernel-doc \
+ ld-version.sh \
+ Lindent \
+ makelst \
+ mksysmap \
+ mkuboot.sh \
+ modules-check.sh \
+ namespace.pl \
+ pahole-flags.sh \
+ pahole-version.sh \
+ patch-kernel \
+ recordmcount.pl \
+ setlocalversion \
+ ver_linux
+
+SUBDIRS = \
+ basic \
+ genksyms \
+ kconfig \
+ mod
+
+include $(top_rulesdir)/Makefile.inc
+
+CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+sign-file: LDLIBS += -lcrypto
diff --git a/debian/rules.d/scripts/basic/Makefile b/debian/rules.d/scripts/basic/Makefile
new file mode 100644
index 000000000..127f53fa8
--- /dev/null
+++ b/debian/rules.d/scripts/basic/Makefile
@@ -0,0 +1,4 @@
+PROGS = \
+ fixdep
+
+include $(top_rulesdir)/Makefile.inc
diff --git a/debian/rules.d/scripts/genksyms/Makefile b/debian/rules.d/scripts/genksyms/Makefile
new file mode 100644
index 000000000..88524563f
--- /dev/null
+++ b/debian/rules.d/scripts/genksyms/Makefile
@@ -0,0 +1,16 @@
+PROGS = genksyms
+
+include $(top_rulesdir)/Makefile.inc
+
+genksyms: genksyms.o parse.tab.o lex.lex.o
+
+lex.lex.o: keywords.c parse.tab.h
+
+parse.tab.c: parse.y
+ $(YACC) -o$@ -t -l $<
+
+parse.tab.h: parse.y
+ $(YACC) -o/dev/null --defines=$@ -t -l $<
+
+lex.lex.c: lex.l
+ $(LEX) -o$@ -L $<
diff --git a/debian/rules.d/scripts/kconfig/Makefile b/debian/rules.d/scripts/kconfig/Makefile
new file mode 100644
index 000000000..c9ad2aaf9
--- /dev/null
+++ b/debian/rules.d/scripts/kconfig/Makefile
@@ -0,0 +1,16 @@
+PROGS = conf
+
+include $(top_rulesdir)/Makefile.inc
+
+conf: conf.o confdata.o expr.o lexer.lex.o menu.o parser.tab.o preprocess.o symbol.o util.o
+
+lexer.lex.o: parser.tab.h
+
+%.lex.c: %.l
+ flex -o$@ -L $<
+
+%.tab.c: %.y
+ bison -o$@ -t -l $<
+
+%.tab.h: %.y
+ bison -o/dev/null --defines=$@ -t -l $<
diff --git a/debian/rules.d/scripts/mod/Makefile b/debian/rules.d/scripts/mod/Makefile
new file mode 100644
index 000000000..6ebade2bc
--- /dev/null
+++ b/debian/rules.d/scripts/mod/Makefile
@@ -0,0 +1,22 @@
+PROGS = \
+ modpost \
+ modpost.real-lsb-32 \
+ modpost.real-lsb-64 \
+ modpost.real-msb-32 \
+ modpost.real-msb-64
+
+include $(top_rulesdir)/Makefile.inc
+
+wrapperdir = $(top_rulesdir)/$(OUTDIR)
+
+modpost.real-%:
+ $(MAKE) -f $(wrapperdir)/Makefile.real TYPE=$* SOURCEDIR=$(top_srcdir)/scripts/mod
+
+%: %.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+modpost-opts.h: $(top_srcdir)/scripts/mod/modpost.c
+ $(wrapperdir)/gendef.py $< > $@
+
+modpost.o: modpost.c modpost-opts.h
+ $(CC) $(CFLAGS) $(CPPFLAGS) -I $(CURDIR) -c -o $@ $<
diff --git a/debian/rules.d/scripts/mod/Makefile.real b/debian/rules.d/scripts/mod/Makefile.real
new file mode 100644
index 000000000..6d56ff6ae
--- /dev/null
+++ b/debian/rules.d/scripts/mod/Makefile.real
@@ -0,0 +1,23 @@
+PROGS = modpost.real-$(TYPE)
+
+include $(top_rulesdir)/Makefile.inc
+
+wrapperdir = $(top_rulesdir)/$(OUTDIR)
+CFLAGS += -I $(CURDIR)/real-$(TYPE) -I $(wrapperdir)/real-$(TYPE)
+
+modpost.real-$(TYPE): file2alias.real-$(TYPE).o modpost.real-$(TYPE).o sumversion.real-$(TYPE).o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+%.real-$(TYPE).o: $(SOURCEDIR)/%.c real-$(TYPE)/devicetable-offsets.h
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+real-$(TYPE)/devicetable-offsets.s: $(SOURCEDIR)/devicetable-offsets.c
+ mkdir -p real-$(TYPE)
+ $(CC) -include $(wrapperdir)/real-$(TYPE)/types.h $(CFLAGS) $(CPPFLAGS) -nostdinc -I$(top_srcdir)/include -S -o $@ $<
+
+real-$(TYPE)/devicetable-offsets.h: real-$(TYPE)/devicetable-offsets.s
+ echo >$@ "#define __DEVICEVTABLE_OFFSETS_H__"
+ sed -ne "s:^[[:space:]]*\.ascii[[:space:]]*\"\(.*\)\".*:\1:; \
+ /^->/{s:->#\(.*\):/* \1 */:; \
+ s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:->::; p;}" $< >>$@
diff --git a/debian/rules.d/scripts/mod/elfconfig.h b/debian/rules.d/scripts/mod/elfconfig.h
new file mode 100644
index 000000000..8c90ea600
--- /dev/null
+++ b/debian/rules.d/scripts/mod/elfconfig.h
@@ -0,0 +1,7 @@
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define HOST_ELFDATA ELFDATA2LSB
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define HOST_ELFDATA ELFDATA2MSB
+#endif
diff --git a/debian/rules.d/scripts/mod/gendef.py b/debian/rules.d/scripts/mod/gendef.py
new file mode 100755
index 000000000..55d3fc60e
--- /dev/null
+++ b/debian/rules.d/scripts/mod/gendef.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python3
+import re
+import sys
+
+for line in open(sys.argv[1]):
+ match = re.search(r'getopt\(argc, argv, "([\w:]*?)"\)', line)
+ if match:
+ options = match.group(1)
+ break
+else:
+ raise RuntimeError
+
+print('#define GETOPT_OPTIONS "%s"' % options)
+
+print('#define GETOPT_CASE', end=' ')
+for c in options:
+ if c == ':' or c == 'T':
+ continue
+ print("case '%c':" % c, end=' ')
+print()
diff --git a/debian/rules.d/scripts/mod/modpost.c b/debian/rules.d/scripts/mod/modpost.c
new file mode 100644
index 000000000..d574957ae
--- /dev/null
+++ b/debian/rules.d/scripts/mod/modpost.c
@@ -0,0 +1,136 @@
+#include <elf.h>
+#include <errno.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "modpost-opts.h"
+
+int main (int argc, char *argv[])
+{
+ char const *data, *class;
+ char *list_name = NULL;
+ char *name = NULL;
+ char prog[1024];
+ unsigned char ei[EI_NIDENT];
+ int opt;
+ FILE *file;
+
+ while ((opt = getopt (argc, argv, GETOPT_OPTIONS)) != -1)
+ {
+ switch(opt)
+ {
+ GETOPT_CASE
+ break;
+ case 'T':
+ list_name = optarg;
+ break;
+ default:
+ return EXIT_FAILURE;
+ }
+ }
+
+ if (optind != argc)
+ {
+ name = argv[optind];
+ }
+ else if (list_name)
+ {
+ size_t name_len;
+ int is_stdin = strcmp (list_name, "-") == 0;
+
+ /* Read first line of list file */
+ if (is_stdin)
+ {
+ file = stdin;
+ setvbuf(stdin, NULL, _IONBF, 0); /* don't over-read */
+ }
+ else
+ {
+ file = fopen (list_name, "r");
+ if (!file)
+ {
+ fprintf (stderr, "Can't open \"%s\"\n", list_name);
+ return EXIT_FAILURE;
+ }
+ }
+ if (getline (&name, &name_len, file) < 0)
+ {
+ if (errno)
+ {
+ fprintf (stderr, "Can't read \"%s\"\n", list_name);
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ /* Empty list */
+ return EXIT_SUCCESS;
+ }
+ }
+ if (!is_stdin)
+ fclose(file);
+
+ /* Remove new-line */
+ name [strcspn (name, "\n")] = 0;
+
+ /* If this came from stdin, we need to add the first name to the
+ * arguments, because the upstream modpost can't read it again.
+ */
+ if (is_stdin)
+ {
+ char **new_argv = malloc (sizeof(*argv) * (argc + 2));
+ memcpy(new_argv, argv, sizeof(*argv) * argc);
+ new_argv [argc] = name;
+ new_argv [argc + 1] = NULL;
+ argv = new_argv;
+ }
+ }
+ else
+ {
+ /* Empty list */
+ return EXIT_SUCCESS;
+ }
+
+ if (!(file = fopen (name, "r")))
+ {
+ fprintf (stderr, "Can't open \"%s\"\n", name);
+ return EXIT_FAILURE;
+ }
+
+ if (fread (ei, 1, EI_NIDENT, file) != EI_NIDENT)
+ {
+ fprintf (stderr, "Error: input truncated\n");
+ return EXIT_FAILURE;
+ }
+
+ if (memcmp (ei, ELFMAG, SELFMAG) != 0)
+ {
+ fprintf (stderr, "Error: not ELF\n");
+ return EXIT_FAILURE;
+ }
+ switch (ei[EI_DATA]) {
+ case ELFDATA2LSB:
+ data = "lsb";
+ break;
+ case ELFDATA2MSB:
+ data = "msb";
+ break;
+ default:
+ return EXIT_FAILURE;
+ }
+ switch (ei[EI_CLASS]) {
+ case ELFCLASS32:
+ class = "32";
+ break;
+ case ELFCLASS64:
+ class = "64";
+ break;
+ default:
+ return EXIT_FAILURE;
+ }
+ snprintf (prog, sizeof prog, "%s.real-%s-%s", argv[0], data, class);
+
+ return execv (prog, argv);
+}
diff --git a/debian/rules.d/scripts/mod/real-lsb-32/elfconfig.h b/debian/rules.d/scripts/mod/real-lsb-32/elfconfig.h
new file mode 100644
index 000000000..1f7a7321a
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-lsb-32/elfconfig.h
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS32
+#define KERNEL_ELFDATA ELFDATA2LSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
diff --git a/debian/rules.d/scripts/mod/real-lsb-32/types.h b/debian/rules.d/scripts/mod/real-lsb-32/types.h
new file mode 100644
index 000000000..bad6dcccd
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-lsb-32/types.h
@@ -0,0 +1,3 @@
+#include "../types.h"
+typedef __u32 kernel_ulong_t;
+#define BITS_PER_LONG 32
diff --git a/debian/rules.d/scripts/mod/real-lsb-64/elfconfig.h b/debian/rules.d/scripts/mod/real-lsb-64/elfconfig.h
new file mode 100644
index 000000000..e6f519fcc
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-lsb-64/elfconfig.h
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS64
+#define KERNEL_ELFDATA ELFDATA2LSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
diff --git a/debian/rules.d/scripts/mod/real-lsb-64/types.h b/debian/rules.d/scripts/mod/real-lsb-64/types.h
new file mode 100644
index 000000000..8d7b87591
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-lsb-64/types.h
@@ -0,0 +1,3 @@
+#include "../types.h"
+typedef __u64 __attribute__((aligned(8))) kernel_ulong_t;
+#define BITS_PER_LONG 64
diff --git a/debian/rules.d/scripts/mod/real-msb-32/elfconfig.h b/debian/rules.d/scripts/mod/real-msb-32/elfconfig.h
new file mode 100644
index 000000000..a9ae561ab
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-msb-32/elfconfig.h
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS32
+#define KERNEL_ELFDATA ELFDATA2MSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
diff --git a/debian/rules.d/scripts/mod/real-msb-32/types.h b/debian/rules.d/scripts/mod/real-msb-32/types.h
new file mode 100644
index 000000000..bad6dcccd
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-msb-32/types.h
@@ -0,0 +1,3 @@
+#include "../types.h"
+typedef __u32 kernel_ulong_t;
+#define BITS_PER_LONG 32
diff --git a/debian/rules.d/scripts/mod/real-msb-64/elfconfig.h b/debian/rules.d/scripts/mod/real-msb-64/elfconfig.h
new file mode 100644
index 000000000..844d22f5c
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-msb-64/elfconfig.h
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS64
+#define KERNEL_ELFDATA ELFDATA2MSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
diff --git a/debian/rules.d/scripts/mod/real-msb-64/types.h b/debian/rules.d/scripts/mod/real-msb-64/types.h
new file mode 100644
index 000000000..8d7b87591
--- /dev/null
+++ b/debian/rules.d/scripts/mod/real-msb-64/types.h
@@ -0,0 +1,3 @@
+#include "../types.h"
+typedef __u64 __attribute__((aligned(8))) kernel_ulong_t;
+#define BITS_PER_LONG 64
diff --git a/debian/rules.d/scripts/mod/types.h b/debian/rules.d/scripts/mod/types.h
new file mode 100644
index 000000000..bba382183
--- /dev/null
+++ b/debian/rules.d/scripts/mod/types.h
@@ -0,0 +1,12 @@
+/* Minimal definitions for mod_devicetable.h and devicetable-offsets.c */
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned int __u32;
+typedef unsigned long long __u64;
+typedef struct {
+ __u8 b[16];
+} guid_t;
+typedef guid_t uuid_le;
+typedef unsigned char uuid_t[16];
+#define UUID_STRING_LEN 36
+#define offsetof(a,b) __builtin_offsetof(a,b)
diff --git a/debian/rules.d/tools/bpf/bpftool/Makefile b/debian/rules.d/tools/bpf/bpftool/Makefile
new file mode 100644
index 000000000..17c27c104
--- /dev/null
+++ b/debian/rules.d/tools/bpf/bpftool/Makefile
@@ -0,0 +1,27 @@
+include $(top_rulesdir)/Makefile.inc
+
+MAKE_BPFTOOL := +$(MAKE) -C $(top_srcdir)/$(OUTDIR) O=$(CURDIR)
+MAKE_BPFTOOL += prefix=/usr
+MAKE_BPFTOOL += mandir=/usr/share/man
+MAKE_BPFTOOL += V=1
+MAKE_BPFTOOL += ARCH=$(KERNEL_ARCH)
+MAKE_BPFTOOL += EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)'
+MAKE_BPFTOOL += EXTRA_LDFLAGS='$(LDFLAGS)'
+
+# dynamically linking with libbfd is not allowed in Debian
+MAKE_BPFTOOL += feature-libbfd=0 feature-libbfd-liberty=0 feature-libbfd-liberty-z=0
+
+all:
+ $(MAKE_BPFTOOL)
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ $(MAKE_BPFTOOL) doc
+endif
+# Check that bpftool wasn't linked with libbfd
+ type ldd
+ ! ldd $(CURDIR)/bpftool | grep -E '\blibbfd'
+
+install:
+ $(MAKE_BPFTOOL) install
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ $(MAKE_BPFTOOL) doc-install
+endif
diff --git a/debian/rules.d/tools/hv/Makefile b/debian/rules.d/tools/hv/Makefile
new file mode 100644
index 000000000..5f00f5513
--- /dev/null
+++ b/debian/rules.d/tools/hv/Makefile
@@ -0,0 +1,17 @@
+ifeq ($(filter i386 amd64 x32 arm64,$(DEB_HOST_ARCH)),)
+
+# Build nothing
+include $(top_rulesdir)/Makefile.inc
+
+else
+
+PROGS = \
+ hv_fcopy_daemon \
+ hv_kvp_daemon \
+ hv_vss_daemon
+
+installdir = /usr/sbin
+
+include $(top_rulesdir)/Makefile.inc
+
+endif
diff --git a/debian/rules.d/tools/objtool/Makefile b/debian/rules.d/tools/objtool/Makefile
new file mode 100644
index 000000000..e2bb8c865
--- /dev/null
+++ b/debian/rules.d/tools/objtool/Makefile
@@ -0,0 +1,11 @@
+include $(top_rulesdir)/Makefile.inc
+
+all:
+# For now, only supported target architecture is x86. Later we'll need to build
+# for multiple targets and add a wrapper, same as for modpost.
+# objtool explicitly sets CC and LD to be native tools; we need to override
+# this on the command line to make cross-builds work.
+ $(MAKE) -C $(top_srcdir)/tools/objtool O=$(CURDIR) HOSTARCH=$(KERNEL_ARCH) ARCH=x86 CC=$(CC) LD=$(CROSS_COMPILE)ld V=1 EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)'
+
+install:
+ install -D -m755 objtool $(DESTDIR)/$(installdir)/objtool
diff --git a/debian/rules.d/tools/perf/Makefile b/debian/rules.d/tools/perf/Makefile
new file mode 100644
index 000000000..58c60c1dc
--- /dev/null
+++ b/debian/rules.d/tools/perf/Makefile
@@ -0,0 +1,75 @@
+include $(top_rulesdir)/Makefile.inc
+
+MAKE_PERF := $(MAKE) O=$(CURDIR) prefix=/usr V=1 VF=1 ARCH=$(KERNEL_ARCH) WERROR=0 EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)'
+
+# Disable Gtk UI until it's more usable
+MAKE_PERF += NO_GTK2=1
+
+# Do not build the unversioned jvmti library
+MAKE_PERF += feature-jvmti=0
+
+MAKE_PERF += perfexecdir=lib/perf-core plugindir=/usr/lib/traceevent/plugins tipdir=share/doc/linux-perf perf_include_dir=include/perf perf_examples_dir=share/doc/linux-perf/examples
+
+# perf can link against libbfd if available, but the result is
+# undistributable as they are licenced under GPL v2 and v3+
+# respectively. Override detection of libbfd.
+MAKE_PERF += NO_LIBBFD=1
+
+# perf can link against libdebuginfod if available, but the result is
+# undistributable for the same reason. Override detection of
+# libdebuginfod.
+MAKE_PERF += NO_LIBDEBUGINFOD=1
+
+# perf can link against libcrypto if available, but the result is
+# undistributable as GPL v2 and Apache 2.0 are not compatible without
+# an explicit exception. Override detection of libcrypto.
+MAKE_PERF += NO_LIBCRYPTO=1
+
+# perf only links against libopencsd (coresight) if specifically enabled
+MAKE_PERF += CORESIGHT=1
+
+# Currently babeltrace support for `perf data' is not automatically detected.
+MAKE_PERF += LIBBABELTRACE=1
+
+# Build with asciidoctor, not asciidoc
+MAKE_PERF += USE_ASCIIDOCTOR=1
+
+# Build with Python 3, not Python 2
+MAKE_PERF += PYTHON=/usr/bin/python3
+
+# Ensure the right options are picked up for libperl and libpython
+export PERL5LIB=/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config
+MAKE_PERF += PYTHON_CONFIG=$(CROSS_COMPILE)python3-config
+
+# Explicitly set DEBUG=0. This is the default for perf itself, but
+# it's not passed down to libapi and it uses the wrong compiler
+# options unless it's explicitly set.
+MAKE_PERF += DEBUG=0
+
+all:
+# perf changes some default directories depending on whether DESTDIR is
+# set. We must define it even when building to avoid a rebuild when we
+# run 'make install'.
+ +$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf all DESTDIR=dummy
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ +$(MAKE_PERF) -C $(top_srcdir)/tools/perf/Documentation man
+endif
+# Check that perf didn't get linked against incompatibly-licensed libraries
+ type ldd
+ ! ldd $(CURDIR)/perf | grep -E '\blib(bfd|crypto|debuginfod)'
+# Check that it includes cplus_demangle from libiberty
+ grep cplus_demangle $(CURDIR)/perf
+
+install:
+ +$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf install install-python_ext
+# Don't install a 'trace' alias yet:
+# - We need a wrapper for it anyway, so there's little point adding a
+# versioned link
+# - It doesn't work out-of-the-box as non-root (it depends on debugfs),
+# so it's less widely useful than strace
+# - 'perf trace' doesn't take much more typing
+ rm -f $(DESTDIR)/usr/bin/trace
+ mkdir -p $(DESTDIR)/usr/share/bash-completion/
+ mv $(DESTDIR)/etc/bash_completion.d \
+ $(DESTDIR)/usr/share/bash-completion/completions
+ rmdir --ignore-fail-on-non-empty $(DESTDIR)/etc
diff --git a/debian/rules.d/tools/power/cpupower/Makefile b/debian/rules.d/tools/power/cpupower/Makefile
new file mode 100644
index 000000000..e4bd5202d
--- /dev/null
+++ b/debian/rules.d/tools/power/cpupower/Makefile
@@ -0,0 +1,26 @@
+include $(top_rulesdir)/Makefile.inc
+
+MAKE_CPUPOWER := CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) O=$(CURDIR) CPUFREQ_BENCH=false V=true mandir=/usr/share/man
+
+MAKE_CPUPOWER += DEBUG=$(if $(filter noopt,$(DEB_BUILD_OPTIONS)),true,)
+
+# Don't strip binaries here; let dh_strip determine what to do
+MAKE_CPUPOWER += STRIP=true
+
+MAKE_CPUPOWER += CROSS='$(CROSS_COMPILE)'
+
+MAKE_CPUPOWER += PACKAGE_BUGREPORT='Debian\ \(reportbug\ linux-cpupower\)'
+
+MAKE_CPUPOWER += libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
+
+all:
+ +$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower
+
+install:
+ +$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower install DESTDIR=$(DESTDIR)
+ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ rm -rf $(DESTDIR)/usr/share/man
+endif
+
+clean:
+ +$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower clean
diff --git a/debian/rules.d/tools/power/x86/Makefile b/debian/rules.d/tools/power/x86/Makefile
new file mode 100644
index 000000000..2b9d7735c
--- /dev/null
+++ b/debian/rules.d/tools/power/x86/Makefile
@@ -0,0 +1,5 @@
+SUBDIRS = \
+ turbostat \
+ x86_energy_perf_policy
+
+include $(top_rulesdir)/Makefile.inc
diff --git a/debian/rules.d/tools/power/x86/turbostat/Makefile b/debian/rules.d/tools/power/x86/turbostat/Makefile
new file mode 100644
index 000000000..eb5124d3a
--- /dev/null
+++ b/debian/rules.d/tools/power/x86/turbostat/Makefile
@@ -0,0 +1,9 @@
+PROGS = turbostat
+
+installdir = /usr/sbin
+
+include $(top_rulesdir)/Makefile.inc
+
+CPPFLAGS += -I"$(top_srcdir)/tools/include" -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"' -DINTEL_FAMILY_HEADER='"$(top_srcdir)/arch/x86/include/asm/intel-family.h"'
+
+LDLIBS += -lcap -lrt
diff --git a/debian/rules.d/tools/power/x86/x86_energy_perf_policy/Makefile b/debian/rules.d/tools/power/x86/x86_energy_perf_policy/Makefile
new file mode 100644
index 000000000..b9ec56c89
--- /dev/null
+++ b/debian/rules.d/tools/power/x86/x86_energy_perf_policy/Makefile
@@ -0,0 +1,7 @@
+PROGS = x86_energy_perf_policy
+
+installdir = /usr/sbin
+
+include $(top_rulesdir)/Makefile.inc
+
+CPPFLAGS += -I"$(top_srcdir)/tools/include" -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"'
diff --git a/debian/rules.d/tools/tracing/rtla/Makefile b/debian/rules.d/tools/tracing/rtla/Makefile
new file mode 100644
index 000000000..9dd1cfd41
--- /dev/null
+++ b/debian/rules.d/tools/tracing/rtla/Makefile
@@ -0,0 +1,17 @@
+include $(top_rulesdir)/Makefile.inc
+
+all:
+# Out-of-tree build is not supported, so copy source to the build dir
+ echo '$(UPSTREAMVERSION)' >VERSION
+ rsync -a $(top_srcdir)/tools/tracing/rtla/ .
+ rsync -a $(top_srcdir)/Documentation/tools/rtla/ Documentation/
+ $(MAKE) EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)' EXTRA_LDFLAGS='$(LDFLAGS)' PKG_CONFIG='$(PKG_CONFIG)'
+
+install:
+ $(MAKE) install
+ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ rm -rf $(DESTDIR)/usr/share/man
+endif
+
+clean:
+ rm -rf *
diff --git a/debian/rules.d/tools/usb/usbip/Makefile b/debian/rules.d/tools/usb/usbip/Makefile
new file mode 100644
index 000000000..5a2cbdb5d
--- /dev/null
+++ b/debian/rules.d/tools/usb/usbip/Makefile
@@ -0,0 +1,31 @@
+srcdir := $(top_srcdir)/tools/usb/usbip
+
+# Make sure we don't override top_srcdir in the sub-make. 'unexport
+# top_srcdir' is *not* sufficient; nor is adding 'MAKEFLAGS=' to the
+# sub-make command line.
+unexport MAKEFLAGS
+
+all: export CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
+all: export CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) \
+ -isystem $(top_srcdir)/debian/build/build-tools/include
+all: export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+all:
+ rsync -a $(srcdir)/ .
+ ./autogen.sh
+ ./configure \
+ --prefix=/usr \
+ --with-tcp-wrappers \
+ --with-usbids-dir=/usr/share/misc \
+ --disable-shared \
+ --disable-static \
+ --host=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ $(MAKE) V=1
+
+install:
+ $(MAKE) V=1 install
+ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+ rm -rf $(DESTDIR)/usr/share/man
+endif
+
+clean:
+ rm -rf *