Skip to content

Commit abdb27f

Browse files
committed
adjust build process
1 parent b878b8e commit abdb27f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ ARG REGISTRY="docker.io"
22
ARG TARGET="latest"
33
FROM ${REGISTRY}/rehosting/embedded-toolchains:${TARGET}
44

5+
RUN apt-get update && apt-get install -y pkg-config
6+
57
# Get panda for kernelinfo_gdb. Definitely a bit overkill to pull the whole repo
68
RUN mkdir /extract_kernelinfo && \
79
wget https://raw.githubusercontent.com/panda-re/panda-ng/refs/heads/main/plugins/osi_linux/utils/kernelinfo_gdb/extract_kernelinfo.py -O /extract_kernelinfo/extract_kernelinfo.py && \

_in_container_build.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ get_cc() {
6464
}
6565

6666
for VERSION in $VERSIONS; do
67+
make -C /app/linux/$VERSION mrproper
6768
for TARGET in $TARGETS; do
6869
BUILD_TARGETS="vmlinux"
6970
if [ $TARGET == "armel" ]; then
@@ -144,9 +145,37 @@ for TARGET in $TARGETS; do
144145

145146
# Build modules to ensure Module.symvers is generated
146147
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET $VERSION) O=/tmp/build/${VERSION}/${TARGET}/ modules -j$(nproc)
148+
149+
# Prepare and completely clean the output directory for perf
150+
PERF_OUTDIR="/tmp/build/${VERSION}/${TARGET}/tools/perf/"
151+
rm -rf "$PERF_OUTDIR"
152+
mkdir -p "$PERF_OUTDIR"
147153

154+
# Build perf utility statically
155+
make -C /app/linux/$VERSION/tools/perf \
156+
ARCH=${short_arch} \
157+
CROSS_COMPILE=$(get_cc $TARGET $VERSION) \
158+
OUTPUT="$PERF_OUTDIR" \
159+
LDFLAGS="-static" \
160+
WERROR=0 \
161+
EXTRA_CFLAGS="-Wno-error -fcommon -D__always_inline=inline -Wno-redundant-decls -Wno-format-truncation -Wno-format-overflow -Wno-array-bounds" \
162+
HOSTCFLAGS="-Wno-error" \
163+
NO_LIBELF=1 NO_LIBUNWIND=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 \
164+
NO_LIBBIONIC=1 NO_LIBPYTHON=1 NO_LIBPERL=1 NO_SLANG=1 NO_LZMA=1 \
165+
NO_ZLIB=1 NO_LIBBPF=1 NO_JVMTI=1 NO_LIBCRYPTO=1 NO_LIBZSTD=1 \
166+
NO_LIBTRACEEVENT=1 NO_AUXTRACE=1 NO_CORESIGHT=1 \
167+
-j$(nproc) || echo "Warning: Failed to build perf for $TARGET ($VERSION)"
148168
mkdir -p /kernels/$VERSION
149169

170+
# Copy perf to delivery directory
171+
PERF_SRC="${PERF_OUTDIR}perf"
172+
if [ -f "$PERF_SRC" ]; then
173+
cp "$PERF_SRC" "/kernels/$VERSION/perf.${TARGET}"
174+
if ! $NO_STRIP; then
175+
$(get_cc $TARGET $VERSION)strip "/kernels/$VERSION/perf.${TARGET}" || true
176+
fi
177+
fi
178+
150179
# Copy only the required boot artifact per architecture
151180
BOOT_SRC=""
152181
BOOT_DST=""

0 commit comments

Comments
 (0)