Skip to content

Commit

Permalink
Merge pull request #1 from StevenMattera/master
Browse files Browse the repository at this point in the history
Added 4.x support, Cleaned up code, Added credit from the original about screen, and more.
  • Loading branch information
Shmadul committed May 13, 2018
2 parents 8f70d26 + 4b1a45d commit 0e12de1
Show file tree
Hide file tree
Showing 44 changed files with 44 additions and 982 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,3 +1,5 @@
.vs
.vscode
build_ipl/*
build/*.o
build/*.elf
build/bin/ipl
13 changes: 5 additions & 8 deletions Makefile
Expand Up @@ -7,20 +7,19 @@ LD = $(DEVKITARM)/bin/arm-none-eabi-ld
OBJCOPY = $(DEVKITARM)/bin/arm-none-eabi-objcopy

TARGET := ipl
BUILD := ipl
BUILD := build
BUILD_BINARY := build/bin
SOURCEDIR := ipl
OBJS = $(addprefix $(BUILD)/, \
start.o \
main.o \
btn.o \
clock.o \
cluster.o \
fuse.o \
gpio.o \
heap.o \
hos.o \
i2c.o \
kfuse.o \
lz.o \
max7762x.o \
mc.o \
Expand All @@ -29,7 +28,6 @@ OBJS = $(addprefix $(BUILD)/, \
sdmmc_driver.o \
sdram.o \
sdram_lp0.o \
tui.o \
util.o \
di.o \
gfx.o \
Expand All @@ -39,7 +37,6 @@ OBJS = $(addprefix $(BUILD)/, \
se.o \
tsec.o \
uart.o \
ini.o \
)
OBJS += $(addprefix $(BUILD)/, diskio.o ff.o ffunicode.o)

Expand All @@ -49,14 +46,14 @@ LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections

.PHONY: all clean

all: $(BUILD)/$(TARGET)
all: $(BUILD_BINARY)/$(TARGET)

clean:
@rm -rf $(OBJS)
@rm -rf $(BUILD)/$(TARGET).elf
@rm -rf $(BUILD)/$(TARGET)
@rm -rf $(BUILD_BINARY)/$(TARGET)

$(BUILD)/$(TARGET): $(BUILD)/$(TARGET).elf
$(BUILD_BINARY)/$(TARGET): $(BUILD)/$(TARGET).elf
$(OBJCOPY) -S -O binary $< $@

$(BUILD)/$(TARGET).elf: $(OBJS)
Expand Down
15 changes: 2 additions & 13 deletions README.md
@@ -1,20 +1,9 @@
# hekate for 5.0.x
# hekate for 4.x / 5.0.x

DO NOT UPDATE TO 5.0.2 FOR THIS
DO NOT UPDATE FOR THIS

Original by @nwert

![Image of Hekate](https://upload.wikimedia.org/wikipedia/commons/f/fc/H%C3%A9cate_-_Mallarm%C3%A9.png)

Nintendo Switch bootloader, firmware patcher, and more.

## ipl config

The ipl can be configured via 'hekate_ipl.ini' (if it is present on the SD card). Each ini section represents a boot entry, except for the special section 'config' that controls the global configuration.

Possible key/value combinations:

- warmboot={SD path}
- secmon={SD path}
- kernel={SD path}
- kip1={SD path}
Empty file added build/bin/DELETE_ME
Empty file.
42 changes: 0 additions & 42 deletions ipl/btn.c

This file was deleted.

29 changes: 0 additions & 29 deletions ipl/btn.h

This file was deleted.

Binary file removed ipl/btn.o
Binary file not shown.
Binary file removed ipl/clock.o
Binary file not shown.
Binary file removed ipl/cluster.o
Binary file not shown.
Binary file removed ipl/di.o
Binary file not shown.
Binary file removed ipl/diskio.o
Binary file not shown.
Binary file removed ipl/ff.o
Binary file not shown.
Binary file removed ipl/ffunicode.o
Binary file not shown.
Binary file removed ipl/fuse.o
Binary file not shown.
Binary file removed ipl/gfx.o
Binary file not shown.
Binary file removed ipl/gpio.o
Binary file not shown.
Binary file removed ipl/heap.o
Binary file not shown.
60 changes: 0 additions & 60 deletions ipl/hos.c
Expand Up @@ -265,42 +265,6 @@ out:;
return res;
}

static int _config_warmboot(launch_ctxt_t *ctxt, const char *value)
{
FIL fp;
if (f_open(&fp, value, FA_READ) != FR_OK)
return 0;
ctxt->warmboot_size = f_size(&fp);
ctxt->warmboot = malloc(ctxt->warmboot_size);
f_read(&fp, ctxt->warmboot, ctxt->warmboot_size, NULL);
f_close(&fp);
return 1;
}

static int _config_secmon(launch_ctxt_t *ctxt, const char *value)
{
FIL fp;
if (f_open(&fp, value, FA_READ) != FR_OK)
return 0;
ctxt->secmon_size = f_size(&fp);
ctxt->secmon = malloc(ctxt->secmon_size);
f_read(&fp, ctxt->secmon, ctxt->secmon_size, NULL);
f_close(&fp);
return 1;
}

static int _config_kernel(launch_ctxt_t *ctxt, const char *value)
{
FIL fp;
if (f_open(&fp, value, FA_READ) != FR_OK)
return 0;
ctxt->kernel_size = f_size(&fp);
ctxt->kernel = malloc(ctxt->kernel_size);
f_read(&fp, ctxt->kernel, ctxt->kernel_size, NULL);
f_close(&fp);
return 1;
}

static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
{
FIL fp;
Expand All @@ -315,30 +279,6 @@ DPRINTF("loaded kip from SD (size %08X)\n", f_size(&fp));
return 1;
}

typedef struct _cfg_handler_t
{
const char *key;
int (*handler)(launch_ctxt_t *ctxt, const char *value);
} cfg_handler_t;

static const cfg_handler_t _config_handlers[] = {
{ "warmboot", _config_warmboot },
{ "secmon", _config_secmon },
{ "kernel", _config_kernel },
{ "kip1", _config_kip1 },
{ NULL, NULL },
};

static int _config(launch_ctxt_t *ctxt, ini_sec_t *cfg)
{
LIST_FOREACH_ENTRY(ini_kv_t, kv, &cfg->kvs, link)
for(u32 i = 0; _config_handlers[i].key; i++)
if (!strcmp(_config_handlers[i].key, kv->key) &&
!_config_handlers[i].handler(ctxt, kv->val))
return 0;
return 1;
}

int hos_launch()
{
launch_ctxt_t ctxt;
Expand Down
1 change: 0 additions & 1 deletion ipl/hos.h
Expand Up @@ -18,7 +18,6 @@
#define _HOS_H_

#include "types.h"
#include "ini.h"

int hos_launch();

Expand Down
Binary file removed ipl/hos.o
Binary file not shown.
Binary file removed ipl/i2c.o
Binary file not shown.
93 changes: 0 additions & 93 deletions ipl/ini.c

This file was deleted.

39 changes: 0 additions & 39 deletions ipl/ini.h

This file was deleted.

Binary file removed ipl/ini.o
Binary file not shown.
Binary file removed ipl/ipl.elf
Binary file not shown.

0 comments on commit 0e12de1

Please sign in to comment.