Use raw2c instead of xxd

This commit is contained in:
Maschell 2021-04-03 20:45:29 +02:00
parent f76b9bd1d7
commit 4c1e0e964b
11 changed files with 85 additions and 20 deletions

6
ios_bsp/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
build/
*.bin
*.bin.h
ios_bsp.c
ios_bsp.h
*.elf

View File

@ -26,6 +26,12 @@ OFILES += $(SFILES:source/%.s=build/%.o)
PROJECTNAME = ${shell basename "$(CURDIR)"} PROJECTNAME = ${shell basename "$(CURDIR)"}
CWD = "$(CURDIR)"" CWD = "$(CURDIR)""
#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
export PATH := $(DEVKITPATH)/tools/bin:$(DEVKITPATH)/devkitPPC/bin:$(PATH)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# canned command sequence for binary data, taken from devkitARM # canned command sequence for binary data, taken from devkitARM
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -49,7 +55,8 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf
@$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@ @$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@
$(PROJECTNAME).bin.h: $(PROJECTNAME).bin $(PROJECTNAME).bin.h: $(PROJECTNAME).bin
@xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@ @raw2c $<
@cp $(PROJECTNAME).c $@
$(PROJECTNAME)_syms.h: $(PROJECTNAME)_syms.h:
@echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@ @echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@
@ -60,7 +67,7 @@ $(PROJECTNAME)_syms.h:
clean: clean:
@rm -f build/*.o build/*.d @rm -f build/*.o build/*.d
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h $(PROJECTNAME).h $(PROJECTNAME).c
@echo "all cleaned up !" @echo "all cleaned up !"
-include $(DFILES) -include $(DFILES)

6
ios_fs/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
build/
*.bin
*.bin.h
ios_fs.c
ios_fs.h
*.elf

View File

@ -28,6 +28,12 @@ OFILES += $(SFILES:source/%.s=build/%.o)
PROJECTNAME = ${shell basename "$(CURDIR)"} PROJECTNAME = ${shell basename "$(CURDIR)"}
CWD = "$(CURDIR)"" CWD = "$(CURDIR)""
#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
export PATH := $(DEVKITPATH)/tools/bin:$(DEVKITPATH)/devkitPPC/bin:$(PATH)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# canned command sequence for binary data, taken from devkitARM # canned command sequence for binary data, taken from devkitARM
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -51,7 +57,8 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf
@$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@ @$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@
$(PROJECTNAME).bin.h: $(PROJECTNAME).bin $(PROJECTNAME).bin.h: $(PROJECTNAME).bin
@xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@ @raw2c $<
@cp $(PROJECTNAME).c $@
$(PROJECTNAME)_syms.h: $(PROJECTNAME)_syms.h:
@echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@ @echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@
@ -63,7 +70,7 @@ $(PROJECTNAME)_syms.h:
clean: clean:
@rm -f build/*.o build/*.d @rm -f build/*.o build/*.d
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h $(PROJECTNAME).h $(PROJECTNAME).c
@echo "all cleaned up !" @echo "all cleaned up !"
-include $(DFILES) -include $(DFILES)

6
ios_kernel/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
build/
*.bin
*.bin.h
ios_kernel.c
ios_kernel.h
*.elf

View File

@ -26,6 +26,12 @@ OFILES += $(SFILES:source/%.s=build/%.o)
PROJECTNAME = ${shell basename "$(CURDIR)"} PROJECTNAME = ${shell basename "$(CURDIR)"}
CWD = "$(CURDIR)"" CWD = "$(CURDIR)""
#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
export PATH := $(DEVKITPATH)/tools/bin:$(DEVKITPATH)/devkitPPC/bin:$(PATH)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# canned command sequence for binary data, taken from devkitARM # canned command sequence for binary data, taken from devkitARM
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -49,7 +55,8 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf
@$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@ @$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@
$(PROJECTNAME).bin.h: $(PROJECTNAME).bin $(PROJECTNAME).bin.h: $(PROJECTNAME).bin
@xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@ @raw2c $<
@cp $(PROJECTNAME).c $@
$(PROJECTNAME)_syms.h: $(PROJECTNAME)_syms.h:
@echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@ @echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@
@ -60,7 +67,7 @@ $(PROJECTNAME)_syms.h:
clean: clean:
@rm -f build/*.o build/*.d @rm -f build/*.o build/*.d
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h $(PROJECTNAME).h $(PROJECTNAME).c
@echo "all cleaned up !" @echo "all cleaned up !"
-include $(DFILES) -include $(DFILES)

6
ios_mcp/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
build/
*.bin
*.bin.h
ios_mcp.c
ios_mcp.h
*.elf

View File

@ -26,6 +26,12 @@ OFILES += $(SFILES:source/%.s=build/%.o)
PROJECTNAME = ${shell basename "$(CURDIR)"} PROJECTNAME = ${shell basename "$(CURDIR)"}
CWD = "$(CURDIR)"" CWD = "$(CURDIR)""
#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
export PATH := $(DEVKITPATH)/tools/bin:$(DEVKITPATH)/devkitPPC/bin:$(PATH)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# canned command sequence for binary data, taken from devkitARM # canned command sequence for binary data, taken from devkitARM
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -49,7 +55,8 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf
@$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@ @$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@
$(PROJECTNAME).bin.h: $(PROJECTNAME).bin $(PROJECTNAME).bin.h: $(PROJECTNAME).bin
@xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@ @raw2c $<
@cp $(PROJECTNAME).c $@
$(PROJECTNAME)_syms.h: $(PROJECTNAME)_syms.h:
@echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@ @echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@
@ -60,7 +67,7 @@ $(PROJECTNAME)_syms.h:
clean: clean:
@rm -f build/*.o build/*.d @rm -f build/*.o build/*.d
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h $(PROJECTNAME).c $(PROJECTNAME).h
@echo "all cleaned up !" @echo "all cleaned up !"
-include $(DFILES) -include $(DFILES)

6
ios_usb/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
build/
*.bin
*.bin.h
ios_usb.c
ios_usb.h
*.elf

View File

@ -26,6 +26,12 @@ OFILES += $(SFILES:source/%.s=build/%.o)
PROJECTNAME = ${shell basename "$(CURDIR)"} PROJECTNAME = ${shell basename "$(CURDIR)"}
CWD = "$(CURDIR)"" CWD = "$(CURDIR)""
#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
export PATH := $(DEVKITPATH)/tools/bin:$(DEVKITPATH)/devkitPPC/bin:$(PATH)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# canned command sequence for binary data, taken from devkitARM # canned command sequence for binary data, taken from devkitARM
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -49,8 +55,9 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf
@$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@ @$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@
$(PROJECTNAME).bin.h: $(PROJECTNAME).bin $(PROJECTNAME).bin.h: $(PROJECTNAME).bin
@xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@ @raw2c $<
@cp $(PROJECTNAME).c $@
$(PROJECTNAME)_syms.h: $(PROJECTNAME)_syms.h:
@echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@ @echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@
@echo "#define $(PROJECTNAME)_SYMS_H" >> $@ @echo "#define $(PROJECTNAME)_SYMS_H" >> $@
@ -60,7 +67,7 @@ $(PROJECTNAME)_syms.h:
clean: clean:
@rm -f build/*.o build/*.d @rm -f build/*.o build/*.d
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h $(PROJECTNAME).h $(PROJECTNAME).c
@echo "all cleaned up !" @echo "all cleaned up !"
-include $(DFILES) -include $(DFILES)

View File

@ -236,7 +236,7 @@ static const int final_chain[] = {
0x0, // 0x1F0 0x0, // 0x1F0
0x101063db, // 0x1F4 POP {R1,R2,R5,PC} 0x101063db, // 0x1F4 POP {R1,R2,R5,PC}
0x0, // 0x1F8 0x0, // 0x1F8
sizeof(ios_kernel_bin), // 0x1FC our code size sizeof(ios_kernel), // 0x1FC our code size
0x0, // 0x200 0x0, // 0x200
0x10123983, // 0x204 POP {R1,R3,R4,R6,PC} 0x10123983, // 0x204 POP {R1,R3,R4,R6,PC}
0x00140000, // 0x208 our code source location 0x00140000, // 0x208 our code source location
@ -309,7 +309,7 @@ static void uhs_exploit_init(int dev_uhs_0_handle, cfw_config_t * config)
memcpy((char*)(0xF4120000), second_chain, sizeof(second_chain)); memcpy((char*)(0xF4120000), second_chain, sizeof(second_chain));
memcpy((char*)(0xF4130000), final_chain, sizeof(final_chain)); memcpy((char*)(0xF4130000), final_chain, sizeof(final_chain));
memcpy((char*)(0xF4140000), ios_kernel_bin, sizeof(ios_kernel_bin)); memcpy((char*)(0xF4140000), ios_kernel, sizeof(ios_kernel));
payload_info_t *payloads = (payload_info_t*)0xF4148000; payload_info_t *payloads = (payload_info_t*)0xF4148000;
@ -317,14 +317,14 @@ static void uhs_exploit_init(int dev_uhs_0_handle, cfw_config_t * config)
memcpy(payloads->data, config, payloads->size); memcpy(payloads->data, config, payloads->size);
payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) ); payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) );
payloads->size = sizeof(ios_usb_bin); payloads->size = sizeof(ios_usb);
memcpy(payloads->data, ios_usb_bin, payloads->size); memcpy(payloads->data, ios_usb, payloads->size);
payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) ); payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) );
//if(config->redNAND) //if(config->redNAND)
//{ //{
payloads->size = sizeof(ios_fs_bin); payloads->size = sizeof(ios_fs);
memcpy(payloads->data, ios_fs_bin, payloads->size); memcpy(payloads->data, ios_fs, payloads->size);
payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) ); payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) );
// if(config->seeprom_red) // if(config->seeprom_red)
@ -335,8 +335,8 @@ static void uhs_exploit_init(int dev_uhs_0_handle, cfw_config_t * config)
// } // }
//} //}
payloads->size = sizeof(ios_mcp_bin); payloads->size = sizeof(ios_mcp);
memcpy(payloads->data, ios_mcp_bin, payloads->size); memcpy(payloads->data, ios_mcp, payloads->size);
payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) ); payloads = (payload_info_t*)( ((char*)payloads) + ALIGN4(sizeof(payload_info_t) + payloads->size) );
/*if(config->launchImage) /*if(config->launchImage)
@ -365,7 +365,7 @@ static void uhs_exploit_init(int dev_uhs_0_handle, cfw_config_t * config)
DCStoreRange(pretend_root_hub + 33, 200); DCStoreRange(pretend_root_hub + 33, 200);
DCStoreRange((void*)0xF4120000, sizeof(second_chain)); DCStoreRange((void*)0xF4120000, sizeof(second_chain));
DCStoreRange((void*)0xF4130000, sizeof(final_chain)); DCStoreRange((void*)0xF4130000, sizeof(final_chain));
DCStoreRange((void*)0xF4140000, sizeof(ios_kernel_bin)); DCStoreRange((void*)0xF4140000, sizeof(ios_kernel));
DCStoreRange((void*)0xF4148000, ((u32)payloads) - 0xF4148000); DCStoreRange((void*)0xF4148000, ((u32)payloads) - 0xF4148000);
} }