Skip to content

Commit

Permalink
Add boot splash
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfugil committed Dec 21, 2023
1 parent 9ad1eaa commit 5c94653
Show file tree
Hide file tree
Showing 17 changed files with 347 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all: apple-include
$(MAKE) -C $(ROOT)/src

apple-include:
mkdir -p apple-include/{bsm,objc,os/internal,sys,firehose,CoreFoundation,FSEvents,IOKit/kext,libkern,kern,arm,{mach/,}machine,CommonCrypto,Security,CoreSymbolication,Kernel/{kern,IOKit,libkern},rpc,rpcsvc,xpc/private,ktrace,mach-o,dispatch}
mkdir -p apple-include/{bsm,objc,os/internal,sys,firehose,CoreFoundation,FSEvents,IOSurface,IOKit/kext,libkern,kern,arm,{mach/,}machine,CommonCrypto,Security,CoreSymbolication,Kernel/{kern,IOKit,libkern},rpc,rpcsvc,xpc/private,ktrace,mach-o,dispatch}
cp -af $(MACOSX_SYSROOT)/usr/include/{arpa,bsm,hfs,net,xpc,netinet,servers,timeconv.h,launch.h} apple-include
cp -af $(MACOSX_SYSROOT)/usr/include/objc/objc-runtime.h apple-include/objc
cp -af $(MACOSX_SYSROOT)/usr/include/libkern/{OSDebug.h,OSKextLib.h,OSReturn.h,OSThermalNotification.h,OSTypes.h,machine} apple-include/libkern
Expand All @@ -27,6 +27,7 @@ apple-include:
cp -af $(TARGET_SYSROOT)/usr/include/mach/machine/thread_state.h apple-include/mach/machine
cp -af $(TARGET_SYSROOT)/usr/include/mach/arm apple-include/mach
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/IOKit.framework/Headers/* apple-include/IOKit
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/IOSurface.framework/Headers/* apple-include/IOSurface
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/stdlib.h > apple-include/stdlib.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/time.h > apple-include/time.h
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/unistd.h > apple-include/unistd.h
Expand Down
35 changes: 35 additions & 0 deletions include/IOMobileFramebuffer/IOMobileframebuffer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef IOMOBILEFRAMEBUFFER_IOMOBILEFRAMEBUFFER_H
#define IOMOBILEFRAMEBUFFER_IOMOBILEFRAMEBUFFER_H

#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/IOTypes.h>
#include <CoreGraphics/CoreGraphics.h>

typedef IOReturn IOMobileFramebufferReturn;
typedef struct __IOMobileFramebuffer *IOMobileFramebufferRef;
typedef CGSize IOMobileFramebufferDisplaySize;

__BEGIN_DECLS

IOMobileFramebufferReturn
IOMobileFramebufferGetMainDisplay(IOMobileFramebufferRef *pointer);

IOMobileFramebufferReturn
IOMobileFramebufferGetDisplaySize(IOMobileFramebufferRef pointer, IOMobileFramebufferDisplaySize *size);

IOMobileFramebufferReturn
IOMobileFramebufferGetLayerDefaultSurface(IOMobileFramebufferRef pointer, int surface, IOSurfaceRef *buffer);

IOMobileFramebufferReturn
IOMobileFramebufferSwapBegin(IOMobileFramebufferRef pointer, int *token);

IOMobileFramebufferReturn
IOMobileFramebufferSwapEnd(IOMobileFramebufferRef pointer);

IOMobileFramebufferReturn
IOMobileFramebufferSwapSetLayer(IOMobileFramebufferRef pointer, int layerid, IOSurfaceRef buffer, CGRect bounds, CGRect frame, int flags);

__END_DECLS

#endif
1 change: 1 addition & 0 deletions include/fakedyld/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#define MNT_NOBLOCK 0x00020000 /* don't block unmount if not responding */
#define MNT_RELOAD 0x00040000 /* reload filesystem data */
#define MNT_FORCE 0x00080000 /* force unmount or readonly change */
#define MNT_DONTBROWSE 0x00100000

/* sysctl */
#define CTLTYPE 0xf /* Mask for the type */
Expand Down
1 change: 1 addition & 0 deletions include/payload/payload.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ int remove_jailbreak_files(uint64_t pflags);
void obliterate(xpc_object_t xrequest, xpc_object_t xreply, struct paleinfo* pinfo);
int print_jailbreakd_reply(xpc_object_t xreply);
int obliterate_main(int argc, char* argv[]);
int bootscreend_main(void);

enum {
/* only for sysstatuscheck and prelaunchd stage! */
Expand Down
1 change: 1 addition & 0 deletions include/payload_dylib/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ int (*spawn_hook_common_p)(pid_t *restrict pid, const char *restrict path,
void (*MSHookFunction_p)(void *symbol, void *replace, void **result);
void initSpawnHooks(void);
void InitDaemonHooks(void);
int bootscreend_main(void);

#endif
Binary file added shared/boot.jp2
Binary file not shown.
3 changes: 2 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ binpack.dmg: binpack.tar loader.dmg $(patsubst %, %-all, $(SUBDIRS))
sudo ln -sf /cores/payload binpack/usr/sbin/p1ctl
sudo ln -sf /cores/payload binpack/usr/sbin/palera1nd
sudo mkdir -p binpack/Applications
sudo mkdir -p binpack/usr/lib
sudo mkdir -p binpack/usr/lib binpack/usr/share
sudo mkdir -p binpack/Library/Frameworks/CydiaSubstrate.framework
sudo mkdir -p binpack/Library/LaunchDaemons
sudo cp -a $(ROOT)/shared/*.plist binpack/Library/LaunchDaemons
sudo cp -a $(ROOT)/shared/boot.jp2 binpack/usr/share
sudo chown 0:0 binpack/Library/LaunchDaemons/*.plist
sudo chmod 644 binpack/Library/LaunchDaemons/*.plist
sudo cp rootlesshooks/rootlesshooks.dylib binpack/usr/lib
Expand Down
17 changes: 17 additions & 0 deletions src/fakedyld/main/cores_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ void mount_ramdisk_cores(int platform) {
}

void init_cores(struct systeminfo* sysinfo_p, int platform) {
if (sysinfo_p->osrelease.darwinMajor > 20) {
tmpfs_mount_args_t args = { .case_insensitive = 0, .max_pages = 1, .max_nodes = 1 };
int ret = mount("tmpfs", "/System/Library/PrivateFrameworks/ProgressUI.framework", MNT_DONTBROWSE, &args);
if (ret) {
printf("mount ProgressUI tmpfs error: %d\n", errno);
} else {
printf("Blanked ProgressUI\n");
/* for some reason tmpfs does not support readonly first mounts */
ret = mount("tmpfs", "/System/Library/PrivateFrameworks/ProgressUI.framework", MNT_RDONLY | MNT_DONTBROWSE | MNT_UPDATE , &args);
if (ret) {
printf("remount ProgressUI tmpfs read-only failed with error: %d\n", errno);
} else {
printf("Blank ProgressUI made read-only\n");
}
}
}

if (sysinfo_p->osrelease.darwinMajor < 20) {
return;
} else if (sysinfo_p->osrelease.darwinMajor < 21) {
Expand Down
163 changes: 163 additions & 0 deletions src/libs/IOMobileFramebuffer.tbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
--- !tapi-tbd-v3
archs: [ armv7, armv7s, arm64, arm64e ]
platform: ios
flags: [ flat_namespace ]
install-name: /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
current-version: 1
compatibility-version: 1
exports:
- archs: [ armv7, armv7s, arm64, arm64e ]
symbols: [ _IOMFBGainEncoderCreate, _IOMFBGainEncoderDestroy,
_IOMFBGainEncoderEmitEmptyRows,
_IOMFBGainEncoderEmitRun,
_IOMFBGainEncoderFinishEncoding,
_IOMFBGainEncoderStartRow, _IOMFBGainMapRelease,
_IOMFBGainMapRetain, _IOMFBgainencoder_count,
_IOMFBgainencoder_emit_empty_rows,
_IOMFBgainencoder_emit_run, _IOMFBgainencoder_finish,
_IOMFBgainencoder_free, _IOMFBgainencoder_get_origin,
_IOMFBgainencoder_get_size, _IOMFBgainencoder_map,
_IOMFBgainencoder_map_size, _IOMFBgainencoder_new,
_IOMFBgainencoder_row_1_coded,
_IOMFBgainencoder_set_origin,
_IOMFBgainencoder_start_row,
_IOMobileFrameBufferEnableDebugTracing,
_IOMobileFrameBufferEnableVBLTraces,
_IOMobileFrameBufferGetDebugTraces,
_IOMobileFrameBufferGetMirroringCapability,
_IOMobileFrameBufferPrintDebugTraces,
_IOMobileFrameBufferSetLogLevel,
_IOMobileFrameBufferSwapSetContrastEnhancerStrength,
_IOMobileFrameBufferSwapSetUserLuminanceAdjustment,
_IOMobileFrameBufferprintDisplayRegs,
_IOMobileFramebufferChangeFrameInfo,
_IOMobileFramebufferCopyLayerDisplayedSurface,
_IOMobileFramebufferCopyProperty,
_IOMobileFramebufferCreateDisplayList,
_IOMobileFramebufferCreateStatistics,
_IOMobileFramebufferDisableCRCNotifications,
_IOMobileFramebufferDisableHotPlugDetectNotifications,
_IOMobileFramebufferDisablePowerNotifications,
_IOMobileFramebufferDisableVSyncNotifications,
_IOMobileFramebufferEnableCRCNotifications,
_IOMobileFramebufferEnableDisableDithering,
_IOMobileFramebufferEnableDisableVideoPowerSavings,
_IOMobileFramebufferEnableHotPlugDetectNotifications,
_IOMobileFramebufferEnableMirroring,
_IOMobileFramebufferEnablePowerNotifications,
_IOMobileFramebufferEnableStatistics,
_IOMobileFramebufferEnableVSyncNotifications,
_IOMobileFramebufferFactoryPortal,
_IOMobileFramebufferFrameInfo,
_IOMobileFramebufferGetBlock,
_IOMobileFramebufferGetBrightnessControlCapabilities,
_IOMobileFramebufferGetBrightnessControlInfo,
_IOMobileFramebufferGetBufBlock,
_IOMobileFramebufferGetCRCNotifyMessageCount,
_IOMobileFramebufferGetCRCRunLoopSource,
_IOMobileFramebufferGetCanvasSizes,
_IOMobileFramebufferGetColorRemapMode,
_IOMobileFramebufferGetCurrentAbsoluteTime,
_IOMobileFramebufferGetDigitalOutMode,
_IOMobileFramebufferGetDigitalOutState,
_IOMobileFramebufferGetDisplayArea,
_IOMobileFramebufferGetDisplaySize,
_IOMobileFramebufferGetDotPitch,
_IOMobileFramebufferGetFrameworkInfo,
_IOMobileFramebufferGetGammaTable,
_IOMobileFramebufferGetHDCPAuthenticationProtocol,
_IOMobileFramebufferGetHDCPDownstreamState,
_IOMobileFramebufferGetHDCPRunLoopSource,
_IOMobileFramebufferGetHotPlugRunLoopSource,
_IOMobileFramebufferGetID,
_IOMobileFramebufferGetLayerDefaultSurface,
_IOMobileFramebufferGetLinkQuality,
_IOMobileFramebufferGetMainDisplay,
_IOMobileFramebufferGetMatrix,
_IOMobileFramebufferGetMirrorError,
_IOMobileFramebufferGetProtectionOptions,
_IOMobileFramebufferGetRunLoopSource,
_IOMobileFramebufferGetSecondaryDisplay,
_IOMobileFramebufferGetServiceObject,
_IOMobileFramebufferGetSupportedDigitalOutModes,
_IOMobileFramebufferGetTypeID,
_IOMobileFramebufferGetVSyncRunLoopSource,
_IOMobileFramebufferGetWirelessSurface,
_IOMobileFramebufferGetWirelessSurfaceWithOptions,
_IOMobileFramebufferHDCPGetReply,
_IOMobileFramebufferHDCPSendRequest,
_IOMobileFramebufferInstallVirtualDisplay,
_IOMobileFramebufferInstallVirtualDisplays,
_IOMobileFramebufferIsMainDisplay,
_IOMobileFramebufferKernelTests,
_IOMobileFramebufferOpen,
_IOMobileFramebufferOpenByName,
_IOMobileFramebufferReadyForSwap,
_IOMobileFramebufferRequestPowerChange,
_IOMobileFramebufferSPLCGetBrightness,
_IOMobileFramebufferSPLCSetBrightness,
_IOMobileFramebufferScheduleWithDispatchQueue,
_IOMobileFramebufferSetBlock,
_IOMobileFramebufferSetBrightnessControlCallback,
_IOMobileFramebufferSetBrightnessCorrection,
_IOMobileFramebufferSetCanvasSize,
_IOMobileFramebufferSetColorRemapMode,
_IOMobileFramebufferSetContrast,
_IOMobileFramebufferSetDebugFlags,
_IOMobileFramebufferSetDigitalOutMode,
_IOMobileFramebufferSetDisplayDevice,
_IOMobileFramebufferSetDroppable,
_IOMobileFramebufferSetFlags,
_IOMobileFramebufferSetGammaTable,
_IOMobileFramebufferSetIdleBuffer,
_IOMobileFramebufferSetLine21Data,
_IOMobileFramebufferSetMatrix,
_IOMobileFramebufferSetMirrorContentRegion,
_IOMobileFramebufferSetParameter,
_IOMobileFramebufferSetPreset,
_IOMobileFramebufferSetRenderingAngle,
_IOMobileFramebufferSetTVOutMode,
_IOMobileFramebufferSetTVOutSignalType,
_IOMobileFramebufferSetTwilightStrength,
_IOMobileFramebufferSetUnderrunColor,
_IOMobileFramebufferSetVideoDACGain,
_IOMobileFramebufferSetWSSInfo,
_IOMobileFramebufferSetWhiteOnBlackMode,
_IOMobileFramebufferSupportedFrameInfo,
_IOMobileFramebufferSurfaceIsReplaceable,
_IOMobileFramebufferSwapActiveRegion,
_IOMobileFramebufferSwapBegin,
_IOMobileFramebufferSwapCancel,
_IOMobileFramebufferSwapCancelAll,
_IOMobileFramebufferSwapDebugInfo,
_IOMobileFramebufferSwapDirtyRegion,
_IOMobileFramebufferSwapEnd,
_IOMobileFramebufferSwapSetAmbientLux,
_IOMobileFramebufferSwapSetBackgroundColor,
_IOMobileFramebufferSwapSetBlit,
_IOMobileFramebufferSwapSetBrightness,
_IOMobileFramebufferSwapSetBrightnessLimit,
_IOMobileFramebufferSwapSetColorMatrix,
_IOMobileFramebufferSwapSetColorRemapMode,
_IOMobileFramebufferSwapSetDisplayEdr,
_IOMobileFramebufferSwapSetDisplayEdrHeadroom,
_IOMobileFramebufferSwapSetGainMap,
_IOMobileFramebufferSwapSetGammaTable,
_IOMobileFramebufferSwapSetICCCurve,
_IOMobileFramebufferSwapSetICCMatrix,
_IOMobileFramebufferSwapSetLayer,
_IOMobileFramebufferSwapSetParams,
_IOMobileFramebufferSwapSetTimestamp,
_IOMobileFramebufferSwapSetTimestamps,
_IOMobileFramebufferSwapSetUISubRegion,
_IOMobileFramebufferSwapSetVideoDestEdgeAlpha,
_IOMobileFramebufferSwapSignal,
_IOMobileFramebufferSwapSubtitleRegion,
_IOMobileFramebufferSwapUIEdgeBlendMode,
_IOMobileFramebufferSwapWait,
_IOMobileFramebufferSwapWaitWithTimeout,
_IOMobileFramebufferSwapWorkaroundSettings,
_IOMobileFramebufferUnscheduleFromDispatchQueue,
_IOMobileFramebufferWaitSurface, _kIOMFB_TotalSwaps,
_kIOMFB_TotalVBLs ]
...
3 changes: 2 additions & 1 deletion src/payload/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ CFLAGS += -isystem $(ROOT)/apple-include -I$(ROOT)/include -Wno-nullability-comp
LDFLAGS += -Wl,-dead_strip -Wno-unused-command-line-argument
OBJDIR = obj
C_SRC = $(wildcard *.c)
LIBS = -framework CoreFoundation -framework IOKit -framework Foundation ../libs/APFS.tbd ../libjailbreak/libjailbreak.a
LIBS = -framework CoreFoundation -framework IOKit -framework Foundation
LIBS += ../libs/APFS.tbd ../libjailbreak/libjailbreak.a
OBJS = $(patsubst %,$(OBJDIR)/%,$(C_SRC:.c=.c.o))

LAUNCHCTL_OBJ = bootstrap.o xpc_helper.o load.o
Expand Down
1 change: 1 addition & 0 deletions src/payload/entitlements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<key>com.apple.security.iokit-user-client-class</key>
<array>
<string>IOHDIXControllerUserClient</string>
<string>IOUserClient</string>
<string>AppleAPFSUserClient</string>
</array>
<key>com.apple.springboard.CFUserNotification</key>
Expand Down
1 change: 1 addition & 0 deletions src/payload/loader/prelaunchd.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int prelaunchd(uint32_t payload_options, struct paleinfo* pinfo_p) {
printf("mount loader\n");
CHECK_ERROR(mount_dmg("/cores/binpack/loader.dmg", "hfs", "/cores/binpack/Applications", MNT_RDONLY, 0), 1, "mount loader failed");
}

CHECK_ERROR(memorystatus_control(MEMORYSTATUS_CMD_SET_JETSAM_TASK_LIMIT, 1, 4096, NULL, 0), 1, "failed to set launchd memory limit");

char dev_rootdev[32];
Expand Down
3 changes: 2 additions & 1 deletion src/payload_dylib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ LDFLAGS += -install_name /cores/payload.dylib
OBJDIR = obj
C_SRC = $(wildcard *.c)
LIBS = -framework CoreFoundation ../libjailbreak/libjailbreak.a
LIBS += -framework IOKit
LIBS += -framework IOKit -framework Foundation ../libs/IOMobileFramebuffer.tbd
LIBS += -framework CoreGraphics -framework ImageIO -framework IOSurface
OBJS = $(patsubst %,$(OBJDIR)/%,$(C_SRC:.c=.c.o))

ifeq ($(ASAN),1)
Expand Down
Loading

0 comments on commit 5c94653

Please sign in to comment.