Add pahole during build

add pahole add-on during build to
allow kernel with BPF/BTF enabled
to be built. no need to install pahole
since we only need it during build.

the procedure to prepare pahole tar ball:

download pahole from [0]
untar it and download libbpf from [1]
and untar libbpf

then:

rm pahole-1.25/lib/bpf
mv libbpf-1.3.0 to pahole-1.25/lib/
cd pahole-1.25/lib/
mv libbpf-1.3.0 bpf
cd ../../
tar -czcf pahole-1.25.tar.gz pahole-1.25

mv pahole-1.25.tar.gz ipfire-2.x/cache
b2sum ipfire-2.x/cache/pahole-1.25.tar.gz

Note cmake without optimization -O2 in
lfs/pahole result in _FORTIFY_SOURCE requires
optimzation error since ipfire glibc built
with --enable-fortify-source

this also avoid the hack in [2]

[0]https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-1.25.tar.gz
[1]https://github.com/libbpf/libbpf/archive/refs/tags/v1.3.0.tar.gz
[2]https://community.ipfire.org/t/how-to-customize-config-kernel-kernel-config-x86-64-ipfire/11100/8

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
Vincent Li
2024-02-26 03:06:41 +00:00
parent fc0c2fe6da
commit 5de4e5e9e9
2 changed files with 79 additions and 0 deletions

78
lfs/pahole Normal file
View File

@@ -0,0 +1,78 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007-2023 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
###############################################################################
# Definitions
###############################################################################
include Config
VER = 1.25
THISAPP = pahole-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
###############################################################################
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_BLAKE2 = dc608dc6b689b3f243cd7349b83e4d6f7b641f99c8c182920a05c4fec396390ae3d3349d65d50724d1c9ee1eab2748b2d6fb05f59231f28c538c9a545ae63c09
install : $(TARGET)
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :$(patsubst %,$(DIR_DL)/%,$(objects))
b2 : $(subst %,%_BLAKE2,$(objects))
###############################################################################
# Downloading, checking, b2sum
###############################################################################
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
@$(CHECK)
$(patsubst %,$(DIR_DL)/%,$(objects)) :
@$(LOAD)
$(subst %,%_BLAKE2,$(objects)) :
@$(B2SUM)
###############################################################################
# Installation Details
###############################################################################
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && mkdir build
cd $(DIR_APP)/build && cmake -D__LIB=lib -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2" ..
cd $(DIR_APP)/build && make && make install
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -1128,6 +1128,7 @@ buildipfire() {
lfsmake2 iproute2
lfsmake2 screen
lfsmake2 elfutils
lfsmake2 pahole
lfsmake2 expat
lfsmake2 libconfig
lfsmake2 curl