Skip to content

Commit 88303b6

Browse files
committed
linux-cachyos: Check that profile exists, if specified
Signed-off-by: Vasiliy Stelmachenok <[email protected]>
1 parent 05643df commit 88303b6

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

linux-cachyos/PKGBUILD

+12-5
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ _build_debug=${_build_debug-}
148148
# 1. Compile Kernel with _autofdo=y and _build_debug
149149
# 2. Boot the kernel in QEMU or on your system, see Workload
150150
# 3. Profile the kernel and convert the profile, see Generating the Profile for AutoFDO
151-
# 4. Put the profile into the sourcedir and name the profile "perf.afdo" (You can also change the name in _autofdo_profile_name)
151+
# 4. Put the profile into the sourcedir
152+
# 5. Run kernel build again with the _autofdo_profile_name path to profile specified
152153
_autofdo=${_autofdo-}
153154

154155
# Name for the AutoFDO profile
155-
_autofdo_profile_name=${_autofdo_profile_name-"perf.afdo"}
156+
_autofdo_profile_name=${_autofdo_profile_name-}
156157

157158

158159
# ATTENTION: Do not modify after this line
@@ -252,8 +253,14 @@ if [ -n "$_build_nvidia_open" ]; then
252253
fi
253254

254255
# Use generated AutoFDO Profile
255-
if [ -n "$_autofdo" ] && [ -e "$_autofdo_profile_name" ]; then
256-
source+=("$_autofdo_profile_name")
256+
if [ -n "$_autofdo" ]; then
257+
if [ -n "$_autofdo_profile_name" ]; then
258+
if [ -e "$_autofdo_profile_name" ]; then
259+
source+=("$_autofdo_profile_name")
260+
else
261+
_die "You have specified _autofdo_profile_name, but file it refers to doesn't exist."
262+
fi
263+
fi
257264
fi
258265

259266
## List of CachyOS schedulers
@@ -477,7 +484,7 @@ prepare() {
477484
scripts/config -e AUTOFDO_CLANG
478485
fi
479486

480-
if [ -n "$_autofdo" ] && [ -e "$_autofdo_profile_name" ]; then
487+
if [ -n "$_autofdo" ] && [ -e "$_autofdo_profile_name" ] && [ -n "$_autofdo_profile_name" ]; then
481488
echo "AutoFDO profile has been found..."
482489
BUILD_FLAGS+=(CLANG_AUTOFDO_PROFILE="${srcdir}/${_autofdo_profile_name}")
483490
fi

0 commit comments

Comments
 (0)