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

makefile: Optimized the generation mechanism of kernel header files #536

Merged
merged 1 commit into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion builder/init_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
test -f .config || yes "" | sudo make oldconfig
yes "" | sudo make ARCH=${ARCH} CROSS_COMPILE=aarch64-linux-gnu- prepare V=0
yes "" | sudo make ARCH=${ARCH} CROSS_COMPILE=aarch64-linux-gnu- prepare V=0 > /dev/null
yes "" | sudo make prepare V=0 > /dev/null
ls -al /usr/src/linux-source-${kernel_ver}

clang --version
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func init() {
// when this action is called directly.
//rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
rootCmd.PersistentFlags().BoolVarP(&globalFlags.Debug, "debug", "d", false, "enable debug logging.(coming soon)")
rootCmd.PersistentFlags().Uint8VarP(&globalFlags.BtfMode, "btf", "b", 0, "enable BTF mode.(0:auto; 1:core; 2:non-core))")
rootCmd.PersistentFlags().Uint8VarP(&globalFlags.BtfMode, "btf", "b", 0, "enable BTF mode.(0:auto; 1:core; 2:non-core)")
rootCmd.PersistentFlags().BoolVar(&globalFlags.IsHex, "hex", false, "print byte strings as hex encoded strings")
rootCmd.PersistentFlags().IntVar(&globalFlags.mapSizeKB, "mapsize", 1024, "eBPF map size per CPU,for events buffer. default:1024 * PAGESIZE. (KB)")
rootCmd.PersistentFlags().Uint64VarP(&globalFlags.Pid, "pid", "p", defaultPid, "if pid is 0 then we target all pids")
Expand Down
10 changes: 5 additions & 5 deletions variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ endif
ifeq ($(TARGET_ARCH),aarch64)
LINUX_ARCH = arm64
GOARCH = arm64
AUTOGENCMD = ls -al kern/bpf/arm64/vmlinux.h
BPFHEADER += -I ./kern/bpf/arm64
BPFHEADER += -I ./kern/bpf/$(LINUX_ARCH)
AUTOGENCMD = ls -al kern/bpf/$(LINUX_ARCH)/vmlinux.h
# sh lib/libpcap/config.sub arm64-linux for ARCH value
LIBPCAP_ARCH = aarch64-unknown-linux-gnu
# Constant replacement is not supported in the current version because the bpf_probe_read_user function
Expand All @@ -161,8 +161,8 @@ else
# x86_64 default
LINUX_ARCH = x86
GOARCH = amd64
BPFHEADER += -I ./kern/bpf/x86
AUTOGENCMD = test -f kern/bpf/x86/vmlinux.h || $(CMD_BPFTOOL) btf dump file /sys/kernel/btf/vmlinux format c > kern/bpf/x86/vmlinux.h
BPFHEADER += -I ./kern/bpf/$(LINUX_ARCH)
AUTOGENCMD = test -f kern/bpf/$(LINUX_ARCH)/vmlinux.h || $(CMD_BPFTOOL) btf dump file /sys/kernel/btf/vmlinux format c > kern/bpf/$(LINUX_ARCH)/vmlinux.h
# sh lib/libpcap/config.sub amd64-linux or x86_64-linux for ARCH value
LIBPCAP_ARCH = x86_64-pc-linux-gnu
endif
Expand All @@ -171,7 +171,7 @@ endif
# include vpath
#
ifdef CROSS_ARCH
KERNEL_HEADER_GEN = yes "" | $(SUDO) make ARCH=$(LINUX_ARCH) CROSS_COMPILE=$(CMD_CC_PREFIX) prepare V=0
KERNEL_HEADER_GEN = test -e arch/$(LINUX_ARCH)/kernel/asm-offsets.s || yes "" | $(SUDO) make ARCH=$(LINUX_ARCH) CROSS_COMPILE=$(CMD_CC_PREFIX) prepare V=0
KERN_HEADERS = $(LINUX_SOURCE_PATH)
endif
KERN_RELEASE ?= $(UNAME_R)
Expand Down
Loading