Skip to content

Commit 4a8e0ad

Browse files
committed
add rule to make perf
1 parent 37fd898 commit 4a8e0ad

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

kernel/makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ blobby_kernel:
9191
touch $(KERNEL_EXTRACTED)
9292
touch $(KERNEL_PATCHED)
9393

94+
95+
#TODO: package perf/linux-tools
96+
.PHONY: perf
97+
perf: $(PRAWNOS_KERNEL_BUILT)
98+
$(PRAWNOS_KERNEL_SCRIPTS_PERF) $(KVER) $(KERNEL_RESOURCES) $(PRAWNOS_KERNEL_BUILD) $(PRAWNOS_INITRAMFS_IMAGE) $(TARGET)
99+
94100
### REAL RULES
95101

96102
$(KERNEL_ATH9K_FIRMWARES):

scripts/BuildScripts/BuildCommon.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ PRAWNOS_KERNEL_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/KernelScripts
121121
PRAWNOS_KERNEL_SCRIPTS_BUILD := $(PRAWNOS_KERNEL_SCRIPTS)/buildKernel.sh
122122
PRAWNOS_KERNEL_SCRIPTS_MENUCONFIG := $(PRAWNOS_KERNEL_SCRIPTS)/crossMenuConfig.sh
123123
PRAWNOS_KERNEL_SCRIPTS_PATCH := $(PRAWNOS_KERNEL_SCRIPTS)/patchKernel.sh
124+
PRAWNOS_KERNEL_SCRIPTS_PERF := $(PRAWNOS_KERNEL_SCRIPTS)/buildPerf.sh
124125
PRAWNOS_KERNEL_SCRIPTS_BUILD_ATH9K := $(PRAWNOS_KERNEL_SCRIPTS)/buildAth9k.sh
125126
PRAWNOS_KERNEL_SCRIPTS_UPDATE_DEB_FILES := $(PRAWNOS_KERNEL_SCRIPTS)/updateKernelDebfiles.sh
126127

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -e
5+
6+
# build perf for the PrawnOS linux kernel
7+
8+
9+
# This file is part of PrawnOS (https://www.prawnos.com)
10+
# Copyright (c) 2020 Hal Emmerich <[email protected]>
11+
12+
# PrawnOS is free software: you can redistribute it and/or modify
13+
# it under the terms of the GNU General Public License version 2
14+
# as published by the Free Software Foundation.
15+
16+
# PrawnOS is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
21+
# You should have received a copy of the GNU General Public License
22+
# along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
23+
24+
if [ -z "$1" ]
25+
then
26+
echo "No kernel version supplied"
27+
exit 1
28+
fi
29+
if [ -z "$2" ]
30+
then
31+
echo "No resources directory"
32+
exit 1
33+
fi
34+
if [ -z "$3" ]
35+
then
36+
echo "No build directory supplied"
37+
exit 1
38+
fi
39+
if [ -z "$4" ]
40+
then
41+
echo "No PrawnOS initramfs supplied"
42+
exit 1
43+
fi
44+
if [ -z "$" ]
45+
then
46+
echo "No PrawnOS target arch supplied"
47+
exit 1
48+
fi
49+
50+
51+
KVER=$1
52+
RESOURCES=$2
53+
BUILD_DIR=$3
54+
INITRAMFS=$4
55+
TARGET=$5
56+
57+
#assumes the kernel is already built, so we don't have to worry about janitorial work
58+
59+
60+
cd $BUILD_DIR
61+
62+
sudo apt install libzstd-dev libelf-dev systemtap-sdt-dev libssl-dev libslang2-dev libperl-dev python-dev liblzma-dev libcap-dev libnuma-dev libbabeltrace-dev libbabeltrace-ctf-dev flex bison libiberty-dev binutils-dev libunwind-dev libdw-dev
63+
64+
ARCH_ARMHF=armhf
65+
ARCH_ARM64=arm64
66+
67+
#this arch nonsense is obnoxious.
68+
# armhf is just "arm" to the kernel
69+
# arm64 is just arm64
70+
if [ "$TARGET" == "$ARCH_ARMHF" ]; then
71+
CROSS_COMPILER=arm-none-eabi-
72+
# kernel doesn't differentiate between arm and armhf
73+
KERNEL_ARCH=arm
74+
elif [ "$TARGET" == "$ARCH_ARM64" ]; then
75+
CROSS_COMPILER=aarch64-linux-gnu-
76+
KERNEL_ARCH=$ARCH_ARM64
77+
else
78+
echo "no valid target arch specified"
79+
exit 1
80+
fi
81+
82+
cd tools/perf/
83+
make -j $(($(nproc) +1)) CROSS_COMPILE=$CROSS_COMPILER ARCH=$KERNEL_ARCH
84+
85+
#TODO: for packaging, we can use make -C tools/ perf_install prefix=/usr/

0 commit comments

Comments
 (0)