[OS-BUILD PATCH 13/20] Makefile: add kabi targets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

Makefile: add kabi targets

Add make wrappers on redhat/kabi/{diff,update}-kabi and
redhat/kabi/symtypes:

 - dist-kabi-update updates the stablelist checksums

 - dist-symtype-diff diffs the current state against a reference
   stored in the stablelist

 - dist-kabi-image-NODE and dist-kabi-preimage-NODE dump the
   image or preimage for a symtypes node (where NODE is either
   an exported symbol, or a node representing a type, e.g.,
   s#kobject).

A helper target called dist-assert-cross-tools is added to ensure
that cross compilation toolchain is available prior to execution
to ensure correct results.

Signed-off-by: Čestmír Kalina <ckalina@xxxxxxxxxx>
Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -350,6 +350,82 @@ ifeq ($(FORCE),)
 	fi
 endif
 
+KABI_SUPPORTED_ARCHS ?= $(patsubst kabi_%,%,$(notdir $(wildcard kabi/kabi-module/*)))
+export KABI_CROSS_COMPILE_PREFIX ?= /usr/bin/
+export KABI_CROSS_COMPILE_SUFFIX ?= -linux-gnu-
+KABI_CROSS_COMPILE = $(patsubst %,$(KABI_CROSS_COMPILE_PREFIX)%$(KABI_CROSS_COMPILE_SUFFIX),$(filter-out $(CURARCH),$(KABI_SUPPORTED_ARCHS)))
+
+ifeq ($(ARCH),$(CURARCH))
+dist-assert-cross-tools: # no dependencies when we're building for native arch
+else
+dist-assert-cross-tools: $(patsubst %,%gcc,$(KABI_CROSS_COMPILE))
+endif
+
+$(KABI_CROSS_COMPILE_PREFIX)%$(KABI_CROSS_COMPILE_SUFFIX)gcc:
+	@echo "ERROR: couldn't find cross compilation toolchain (looking for: $@)" >&2
+	@echo "       override KABI_CROSS_COMPILE_PREFIX to set path (currently $(KABI_CROSS_COMPILE_PREFIX))" >&2
+	@echo "       override KABI_CROSS_COMPILE_SUFFIX to set suffix (currently $(KABI_CROSS_COMPILE_SUFFIX))" >&2
+	@exit 1
+
+
+ifeq ($(ARCH),)
+dist-kabi-index: ARCH=$(CURARCH)
+endif
+dist-kabi-index:
+	: > $(REDHAT)/kabi/kabi-module/kabi_$(ARCH)/.index.json
+	for sym in $$(find $(REDHAT)/kabi/kabi-module/kabi_$(ARCH)/ -type f -not -name "*.*" \
+	                  -exec basename {} \;); do \
+		$(REDHAT)/kabi/symtypes index \
+			$(REDHAT)/kabi/kabi-module/kabi_$(ARCH)/.$$(basename $$sym) \
+			-o $(REDHAT)/kabi/kabi-module/kabi_$(ARCH)/.index.json || : ; \
+	done
+
+ifeq ($(ARCH),)
+dist-kabi-image-%: ARCH=$(CURARCH)
+endif
+dist-kabi-image-%: NODE = $(patsubst dist-kabi-image-%,%,$@)
+dist-kabi-image-%: dist-kabi-index
+	$(REDHAT)/kabi/symtypes image -s $(NODE) -t $(REDHAT)/kabi/kabi-module/kabi_$(ARCH)/.index.json
+
+ifeq ($(ARCH),)
+dist-kabi-preimage-%: ARCH=$(CURARCH)
+endif
+dist-kabi-preimage-%: NODE = $(patsubst dist-kabi-preimage-%,%,$@)
+dist-kabi-preimage-%: dist-kabi-index
+	@node="$(NODE)"; \
+	if [ "${node:1:1}" = "#" ]; then \
+		$(REDHAT)/kabi/symtypes preimage -s '$(NODE)' -t $(REDHAT)/kabi/kabi-module/kabi_$(ARCH)/.index.json; \
+	else \
+		for prefix in {E,e,s,t,u}; do \
+		$(REDHAT)/kabi/symtypes preimage -S -s "$$prefix#$(NODE)" -t $(REDHAT)/kabi/kabi-module/kabi_$(ARCH)/.index.json || :; \
+		done; \
+	fi
+
+dist-symtype-diff: KABI_TOOL = $(REDHAT)/kabi/diff-kabi
+dist-symtype-diff: dist-assert-cross-tools dist-assert-tree-clean dist-configs dist-symtype-shared
+
+dist-kabi-update: KABI_TOOL = $(REDHAT)/kabi/update-kabi
+dist-kabi-update: dist-assert-cross-tools dist-assert-tree-clean dist-configs dist-symtype-shared
+
+dist-symtype-shared:
+	@declare -a _ARGS; \
+	declare -a _ARCHS; \
+	for symbol in $${SYMBOL:-}; do \
+		_ARGS=("$${_ARGS[@]}" -s "$$symbol"); \
+	done; \
+	if [ -n "$${SRC:-}" ]; then \
+		_ARGS=("$${_ARGS[@]}" $$SRC); \
+	fi; \
+	if [ -n "$${ARCH:-}" ]; then \
+		$(KABI_TOOL) -a $(ARCH) $${_ARGS[@]}; \
+	else \
+		cnt=1; \
+		for arch in $(KABI_SUPPORTED_ARCHS); do \
+			$(KABI_TOOL) -a $$arch $${_ARGS[@]} || : ; \
+			let cnt++; \
+		done; \
+	fi
+
 dist-check-kabi: dist-kabi
 	@if [ ! -e $(_OUTPUT)/Module.symvers ]; then \
 		echo "ERROR: You must compile the kernel and modules first";\
@@ -814,6 +890,8 @@ dist-full-help:
 	@echo  '  dist-kabi-dw-base   - Generate the base dataset for kABI DWARF-based check.'
 	@echo  '  dist-kabi-dw-check  - Run DWARF-based kABI comparison of current binaries'
 	@echo  '                        with the base dataset.'
+	@echo  '  dist-kabi-update    - Update kabi stablelist checksums.'
+	@echo  '  dist-symtype-diff   - Diff kabi stablelist and current kernel.'
 
 	@echo  ''
 	@echo  'Configuration targets:'

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2021
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux