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

Fixed xnu python dependency #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
63 changes: 63 additions & 0 deletions patches/xnu.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/libkern/kxld/tests/loadtest.py b/libkern/kxld/tests/loadtest.py
index ce7a95d9..4e82af4d 100755
--- a/libkern/kxld/tests/loadtest.py
+++ b/libkern/kxld/tests/loadtest.py
@@ -26,7 +26,7 @@
# @APPLE_OSREFERENCE_LICENSE_HEADER_END@
##

-#!/usr/bin/env python
+#!/usr/bin/env python3

import sys
from subprocess import call, Popen, PIPE
diff --git a/san/tools/generate_dynamic_blacklist.py b/san/tools/generate_dynamic_blacklist.py
index 2b155c9a..20d963c2 100755
--- a/san/tools/generate_dynamic_blacklist.py
+++ b/san/tools/generate_dynamic_blacklist.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3

from __future__ import absolute_import
import sys
diff --git a/tools/lldbmacros/core/syntax_checker.py b/tools/lldbmacros/core/syntax_checker.py
index 3ebc2951..05aba3b4 100755
--- a/tools/lldbmacros/core/syntax_checker.py
+++ b/tools/lldbmacros/core/syntax_checker.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import, print_function


diff --git a/tools/lldbmacros/xnudefines.py b/tools/lldbmacros/xnudefines.py
index 5a489071..2baaf4e6 100755
--- a/tools/lldbmacros/xnudefines.py
+++ b/tools/lldbmacros/xnudefines.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3

""" This file holds all static values that debugging macros need. These are typically object type strings, #defines in C etc.
The objective is to provide a single place to be the bridge between C code in xnu and the python macros used by lldb.
diff --git a/tools/symbolify.py b/tools/symbolify.py
index 6ef18146..2535b86b 100755
--- a/tools/symbolify.py
+++ b/tools/symbolify.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from subprocess import Popen, PIPE, call
import re
import sys
diff --git a/tools/trace/parse_ipc_trace.py b/tools/trace/parse_ipc_trace.py
index 0ffa386c..6e46a0d1 100755
--- a/tools/trace/parse_ipc_trace.py
+++ b/tools/trace/parse_ipc_trace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# machtrace_parse.py
# Parse Mach IPC kmsg data trace from XNU
#
3 changes: 2 additions & 1 deletion x.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def fetch_content(repo : str, tag : str):

# xnu headers patch
sed(f'{WORK_DIR}/xnu/bsd/sys/make_symbol_aliasing.sh', '^AVAILABILITY_PL=.*', r'\$\{.*\}', '${FAKEROOT}')
exec_cmd(["patch", "-p1", "-i", "../patches/xnu.patch"], os.path.join(WORK_DIR, "xnu"))

# libsyscall patch
sed(f'{WORK_DIR}/xnu/libsyscall/Libsyscall.xcconfig', '#include.*BSD.xcconfig.*', '.*', '')
Expand Down Expand Up @@ -185,4 +186,4 @@ def fetch_content(repo : str, tag : str):
shell(f'make SDKROOT=macosx TARGET_CONFIGS="RELEASE ARM64 VMAPPLE" LOGCOLORS=y BUILD_WERROR=0 BUILD_LTO=0 BUILD_JSON_COMPILATION_DATABASE=1 SRCROOT={SRCROOT} OBJROOT={OBJROOT} SYMROOT={SYMROOT} DSTROOT={DSTROOT} FAKEROOT={FAKEROOT_DIR} KDKROOT={KDKROOT}')
JSON_COMPILE_DB = exec_cmd(['find', OBJROOT, '-name', 'compile_commands.json'], WORK_DIR)
print(f'copy json compilation database into {SRCROOT}...')
shell(f'cp -f {JSON_COMPILE_DB} {SRCROOT}')
shell(f'cp -f {JSON_COMPILE_DB} {SRCROOT}')