4 import KernelCollection
6 # The non-auxKC can still be 1GB.
8 def check(kernel_cache
):
9 # First build a kernel collection
10 kernel_cache
.buildKernelCollection("arm64", "/large-auxkc-no-errors/main.kc", "/large-auxkc-no-errors/main.kernel", "/large-auxkc-no-errors/extensions", [], [])
11 kernel_cache
.analyze("/large-auxkc-no-errors/main.kc", ["-layout", "-arch", "arm64"])
13 # Now build an aux cache using the baseline kernel collection
14 kernel_cache
.buildAuxKernelCollection("arm64", "/large-auxkc-no-errors/aux.kc", "/large-auxkc-no-errors/main.kc", "", "/large-auxkc-no-errors/extensions", ["com.apple.foo", "com.apple.bar"], [])
15 kernel_cache
.analyze("/large-auxkc-no-errors/main.kc", ["-layout", "-arch", "arm64"])
18 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-static -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-rename_section,__TEXT,__text,__TEXT_EXEC,__text -Wl,-e,__start -Wl,-pagezero_size,0x0 -Wl,-pie main.c -o main.kernel
19 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const foo.c -o extensions/foo.kext/foo
20 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const bar.c -o extensions/bar.kext/bar
21 # [~]> rm -r extensions/*.kext/*.ld