From 3853f3876ed8ecb8b47cffc7a724febdd8ff7d84 Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 25 Jun 2020 18:57:41 +0200 Subject: [PATCH] Use bin2s instead of xxd to include the relocator.elf --- Makefile | 10 ++++------ source/kernel.cpp | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 99f39a3..7e17218 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ endif export OFILES_BIN := $(addsuffix .o,$(BINFILES)) export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) -export OFILES := $(OFILES_BIN) $(OFILES_SRC) +export OFILES := $(OFILES_BIN) $(OFILES_SRC) relocator.elf.o export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ @@ -108,7 +108,6 @@ $(BUILD): #------------------------------------------------------------------------------- clean: @echo clean ... - @rm -rf source/relocator.h make clean -C relocator @rm -fr $(BUILD) $(TARGET).rpx $(TARGET).elf @@ -129,10 +128,9 @@ all : $(OUTPUT).rpx $(relocator_elf): make -C ../relocator - $(OUTPUT).rpx : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) -$(OFILES) : relocator.h +$(OFILES) : relocator_elf.h $(OFILES_SRC) : $(HFILES_BIN) @@ -149,8 +147,8 @@ $(OFILES_SRC) : $(HFILES_BIN) @echo $(notdir $<) @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) -relocator.h: $(relocator_elf) - xxd -i $< | sed "s/unsigned/static const unsigned/g;s/loader/loader/g;s/build_//g" > ../source/$@ +relocator_elf.h: $(relocator_elf) + bin2s -a 32 -H `(echo $( #include @@ -14,7 +14,7 @@ void SetupRelocator() { kern_write((void *) (KERN_SYSCALL_TBL_4 + (0x25 * 4)), (unsigned int) SCKernelCopyData); kern_write((void *) (KERN_SYSCALL_TBL_5 + (0x25 * 4)), (unsigned int) SCKernelCopyData); - uint32_t entryPoint = load_loader_elf(0, (char *) ___relocator_relocator_elf, ___relocator_relocator_elf_len); + uint32_t entryPoint = load_loader_elf(0, (char *) relocator_elf, relocator_elf_size); unsigned int repl_addr = ADDRESS_main_entry_hook; KernelWriteU32(repl_addr, 0x48000003 | entryPoint);