rearranged some stuff to make cross-compilation for iPhone OS less of a pain
This commit is contained in:
Родитель
977c835fbe
Коммит
6ce548978d
|
@ -1,21 +1,21 @@
|
|||
INCLUDE(${PROJECT_SOURCE_DIR}/FindUSB.cmake)
|
||||
|
||||
IF(NOT USB_FOUND)
|
||||
message(FATAL_ERROR "libusb is required for dfu-util!")
|
||||
message(STATUS "libusb is required for dfu-util!")
|
||||
ELSE(NOT USB_FOUND)
|
||||
include_directories(${USB_INCLUDE_DIR})
|
||||
link_directories(${USB_LIBRARIES})
|
||||
|
||||
add_executable(dfu-util dfu.c sam7dfu.c main.c)
|
||||
|
||||
link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs ${PROJECT_BINARY_DIR}/ipsw-patch)
|
||||
|
||||
IF(APPLE)
|
||||
SET_TARGET_PROPERTIES(dfu-util PROPERTIES LINK_FLAGS "-framework CoreFoundation -framework IOKit")
|
||||
ENDIF(APPLE)
|
||||
|
||||
target_link_libraries(dfu-util xpwn)
|
||||
target_link_libraries(dfu-util ${USB_LIBRARIES})
|
||||
|
||||
install(TARGETS dfu-util DESTINATION .)
|
||||
ENDIF(NOT USB_FOUND)
|
||||
|
||||
include_directories(${USB_INCLUDE_DIR})
|
||||
link_directories(${USB_LIBRARIES})
|
||||
|
||||
add_executable(dfu-util dfu.c sam7dfu.c main.c)
|
||||
|
||||
link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs ${PROJECT_BINARY_DIR}/ipsw-patch)
|
||||
|
||||
IF(APPLE)
|
||||
SET_TARGET_PROPERTIES(dfu-util PROPERTIES LINK_FLAGS "-framework CoreFoundation -framework IOKit")
|
||||
ENDIF(APPLE)
|
||||
|
||||
target_link_libraries(dfu-util xpwn)
|
||||
target_link_libraries(dfu-util ${USB_LIBRARIES})
|
||||
|
||||
install(TARGETS dfu-util DESTINATION .)
|
||||
|
|
12
hfs/btree.c
12
hfs/btree.c
|
@ -127,7 +127,7 @@ off_t getRecordOffset(int num, uint32_t nodeNum, BTree* tree) {
|
|||
nodeOffset = nodeNum * tree->headerRec->nodeSize;
|
||||
|
||||
if(!READ(tree->io, nodeOffset + tree->headerRec->nodeSize - (sizeof(uint16_t) * (num + 1)), sizeof(uint16_t), &offset)) {
|
||||
panic("cannot get record offset!");
|
||||
hfs_panic("cannot get record offset!");
|
||||
}
|
||||
|
||||
FLIPENDIAN(offset);
|
||||
|
@ -150,7 +150,7 @@ static off_t getFreeSpace(uint32_t nodeNum, BTNodeDescriptor* descriptor, BTree*
|
|||
freespaceOffsetOffset = nodeOffset + tree->headerRec->nodeSize - (sizeof(uint16_t) * (num + 1));
|
||||
|
||||
if(!READ(tree->io, freespaceOffsetOffset, sizeof(uint16_t), &offset)) {
|
||||
panic("cannot get record offset!");
|
||||
hfs_panic("cannot get record offset!");
|
||||
}
|
||||
|
||||
FLIPENDIAN(offset);
|
||||
|
@ -164,7 +164,7 @@ off_t getNodeNumberFromPointerRecord(off_t offset, io_func* io) {
|
|||
uint32_t nodeNum;
|
||||
|
||||
if(!READ(io, offset, sizeof(uint32_t), &nodeNum)) {
|
||||
panic("cannot get node number from pointer record!");
|
||||
hfs_panic("cannot get node number from pointer record!");
|
||||
}
|
||||
|
||||
FLIPENDIAN(nodeNum);
|
||||
|
@ -223,7 +223,7 @@ static void* searchNode(BTree* tree, uint32_t root, BTKey* searchKey, int *exact
|
|||
}
|
||||
|
||||
if(lastRecordDataOffset == 0) {
|
||||
panic("BTree inconsistent!");
|
||||
hfs_panic("BTree inconsistent!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -841,7 +841,7 @@ static uint32_t removeNode(BTree* tree, uint32_t node) {
|
|||
free(descriptor);
|
||||
|
||||
if(mapNode == 0) {
|
||||
panic("Cannot remove node because I can't map it!");
|
||||
hfs_panic("Cannot remove node because I can't map it!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1167,7 @@ static int addRecord(BTree* tree, uint32_t root, BTKey* searchKey, size_t length
|
|||
} else {
|
||||
if(lastRecordDataOffset == 0) {
|
||||
if(descriptor->numRecords == 0) {
|
||||
panic("empty index node in btree");
|
||||
hfs_panic("empty index node in btree");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ HFSPlusCatalogRecord* getRecordFromPath3(const char* path, Volume* volume, char
|
|||
}
|
||||
|
||||
if(record->recordType != kHFSPlusFolderRecord)
|
||||
panic("inconsistent catalog tree!");
|
||||
hfs_panic("inconsistent catalog tree!");
|
||||
|
||||
realParent = key.parentID;
|
||||
key.parentID = ((HFSPlusCatalogFolder*)record)->folderID;
|
||||
|
|
20
hfs/hfslib.c
20
hfs/hfslib.c
|
@ -19,7 +19,7 @@ void writeToFile(HFSPlusCatalogFile* file, AbstractFile* output, Volume* volume)
|
|||
|
||||
io = openRawFile(file->fileID, &file->dataFork, (HFSPlusCatalogRecord*)file, volume);
|
||||
if(io == NULL) {
|
||||
panic("error opening file");
|
||||
hfs_panic("error opening file");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,19 @@ void writeToFile(HFSPlusCatalogFile* file, AbstractFile* output, Volume* volume)
|
|||
while(bytesLeft > 0) {
|
||||
if(bytesLeft > BUFSIZE) {
|
||||
if(!READ(io, curPosition, BUFSIZE, buffer)) {
|
||||
panic("error reading");
|
||||
hfs_panic("error reading");
|
||||
}
|
||||
if(output->write(output, buffer, BUFSIZE) != BUFSIZE) {
|
||||
panic("error writing");
|
||||
hfs_panic("error writing");
|
||||
}
|
||||
curPosition += BUFSIZE;
|
||||
bytesLeft -= BUFSIZE;
|
||||
} else {
|
||||
if(!READ(io, curPosition, bytesLeft, buffer)) {
|
||||
panic("error reading");
|
||||
hfs_panic("error reading");
|
||||
}
|
||||
if(output->write(output, buffer, bytesLeft) != bytesLeft) {
|
||||
panic("error writing");
|
||||
hfs_panic("error writing");
|
||||
}
|
||||
curPosition += bytesLeft;
|
||||
bytesLeft -= bytesLeft;
|
||||
|
@ -60,7 +60,7 @@ void writeToHFSFile(HFSPlusCatalogFile* file, AbstractFile* input, Volume* volum
|
|||
|
||||
io = openRawFile(file->fileID, &file->dataFork, (HFSPlusCatalogRecord*)file, volume);
|
||||
if(io == NULL) {
|
||||
panic("error opening file");
|
||||
hfs_panic("error opening file");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,19 +71,19 @@ void writeToHFSFile(HFSPlusCatalogFile* file, AbstractFile* input, Volume* volum
|
|||
while(bytesLeft > 0) {
|
||||
if(bytesLeft > BUFSIZE) {
|
||||
if(input->read(input, buffer, BUFSIZE) != BUFSIZE) {
|
||||
panic("error reading");
|
||||
hfs_panic("error reading");
|
||||
}
|
||||
if(!WRITE(io, curPosition, BUFSIZE, buffer)) {
|
||||
panic("error writing");
|
||||
hfs_panic("error writing");
|
||||
}
|
||||
curPosition += BUFSIZE;
|
||||
bytesLeft -= BUFSIZE;
|
||||
} else {
|
||||
if(input->read(input, buffer, (size_t)bytesLeft) != (size_t)bytesLeft) {
|
||||
panic("error reading");
|
||||
hfs_panic("error reading");
|
||||
}
|
||||
if(!WRITE(io, curPosition, (size_t)bytesLeft, buffer)) {
|
||||
panic("error reading");
|
||||
hfs_panic("error reading");
|
||||
}
|
||||
curPosition += bytesLeft;
|
||||
bytesLeft -= bytesLeft;
|
||||
|
|
|
@ -304,7 +304,7 @@ int removeExtents(RawFile* rawFile) {
|
|||
while(blocksLeft > 0) {
|
||||
if(currentExtent == 8) {
|
||||
if(rawFile->volume->extentsTree == NULL) {
|
||||
panic("no extents overflow file loaded yet!");
|
||||
hfs_panic("no extents overflow file loaded yet!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ int removeExtents(RawFile* rawFile) {
|
|||
extentKey.startBlock = currentBlock;
|
||||
descriptor = (HFSPlusExtentDescriptor*) search(rawFile->volume->extentsTree, (BTKey*)(&extentKey), &exact, NULL, NULL);
|
||||
if(descriptor == NULL || exact == FALSE) {
|
||||
panic("inconsistent extents information!");
|
||||
hfs_panic("inconsistent extents information!");
|
||||
return FALSE;
|
||||
} else {
|
||||
removeFromBTree(rawFile->volume->extentsTree, (BTKey*)(&extentKey));
|
||||
|
@ -422,7 +422,7 @@ int readExtents(RawFile* rawFile) {
|
|||
|
||||
if(currentExtent == 8) {
|
||||
if(rawFile->volume->extentsTree == NULL) {
|
||||
panic("no extents overflow file loaded yet!");
|
||||
hfs_panic("no extents overflow file loaded yet!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ int readExtents(RawFile* rawFile) {
|
|||
extentKey.startBlock = currentBlock;
|
||||
descriptor = (HFSPlusExtentDescriptor*) search(rawFile->volume->extentsTree, (BTKey*)(&extentKey), &exact, NULL, NULL);
|
||||
if(descriptor == NULL || exact == FALSE) {
|
||||
panic("inconsistent extents information!");
|
||||
hfs_panic("inconsistent extents information!");
|
||||
return FALSE;
|
||||
} else {
|
||||
currentExtent = 0;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include <stdio.h>
|
||||
#include <hfs/hfsplus.h>
|
||||
|
||||
void panic(const char* panicString) {
|
||||
fprintf(stderr, "%s\n", panicString);
|
||||
void hfs_panic(const char* hfs_panicString) {
|
||||
fprintf(stderr, "%s\n", hfs_panicString);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ typedef struct {
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void panic(const char* panicString);
|
||||
void hfs_panic(const char* panicString);
|
||||
|
||||
void printUnicode(HFSUniStr255* str);
|
||||
char* unicodeToAscii(HFSUniStr255* str);
|
||||
|
|
|
@ -1,27 +1,29 @@
|
|||
INCLUDE(${PROJECT_SOURCE_DIR}/FindUSB.cmake)
|
||||
|
||||
IF(NOT USB_FOUND)
|
||||
message(FATAL_ERROR "libusb is required for xpwn!")
|
||||
message(STATUS "libusb is required for xpwn!")
|
||||
ELSE(NOT USB_FOUND)
|
||||
include_directories(include)
|
||||
|
||||
include_directories(${USB_INCLUDE_DIR})
|
||||
link_directories(${USB_LIBRARIES})
|
||||
|
||||
add_executable(xpwn-bin src/xpwn.cpp src/libibooter.cpp)
|
||||
|
||||
target_link_libraries(xpwn-bin ${USB_LIBRARIES})
|
||||
|
||||
link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs ${PROJECT_BINARY_DIR}/ipsw-patch)
|
||||
|
||||
target_link_libraries(xpwn-bin xpwn)
|
||||
|
||||
set_target_properties(xpwn-bin PROPERTIES OUTPUT_NAME "xpwn")
|
||||
|
||||
IF(APPLE)
|
||||
SET_TARGET_PROPERTIES(xpwn-bin PROPERTIES LINK_FLAGS "-framework CoreFoundation -framework IOKit")
|
||||
ENDIF(APPLE)
|
||||
|
||||
install(FILES ramdisk.dmg DESTINATION .)
|
||||
install(TARGETS xpwn-bin DESTINATION .)
|
||||
|
||||
ENDIF(NOT USB_FOUND)
|
||||
|
||||
include_directories(include)
|
||||
|
||||
include_directories(${USB_INCLUDE_DIR})
|
||||
link_directories(${USB_LIBRARIES})
|
||||
|
||||
add_executable(xpwn-bin src/xpwn.cpp src/libibooter.cpp)
|
||||
|
||||
target_link_libraries(xpwn-bin ${USB_LIBRARIES})
|
||||
|
||||
link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs ${PROJECT_BINARY_DIR}/ipsw-patch)
|
||||
|
||||
target_link_libraries(xpwn-bin xpwn)
|
||||
|
||||
set_target_properties(xpwn-bin PROPERTIES OUTPUT_NAME "xpwn")
|
||||
|
||||
IF(APPLE)
|
||||
SET_TARGET_PROPERTIES(xpwn-bin PROPERTIES LINK_FLAGS "-framework CoreFoundation -framework IOKit")
|
||||
ENDIF(APPLE)
|
||||
|
||||
install(FILES ramdisk.dmg DESTINATION .)
|
||||
install(TARGETS xpwn-bin DESTINATION .)
|
||||
|
|
Загрузка…
Ссылка в новой задаче