rockbox/utils/hwpatcher/Makefile
Amaury Pouly c9a028cc18 Introduce hwpatcher, a tool to patch binaries
This tool is a scriptable (lua) tool to patch binaries, it supports:
- raw binary
- ELF
- SB(v1/v2)
It also contains some basic routines to parse and generate useful arm/thumb code
like jump or register load/store. This is very useful to take a firmware and
patch an interrupt vector or some code to jump to an extra payload added to
the binary. Examples are provided for several STMP based target which the payload
is expected to be hwstub, and also for the Sansa View. A typical patcher usually
requires three elements:
- the lua patcher itself
- the payload (hwstub for example)
- (optional) a small stub either to jump properly to the payload or determine
  under which circumstance to do the jump (hold a key for example)

Change-Id: I6d36020a3bc9e636615ac8221b7591ade5f251e3
2014-06-24 18:07:56 +02:00

27 lines
610 B
Makefile

CC=gcc
CXX=g++
LD=g++
SBTOOLS_DIR=../imxtools/sbtools
CFLAGS=-Wall -O3 -std=c99 -g -I$(SBTOOLS_DIR) `pkg-config --cflags lua5.2`
LDFLAGS=`pkg-config --libs lua5.2` -L$(REGTOOLS_LIB_DIR) `xml2-config --libs` -lreadline
EXEC=hwpatcher
SBTOOLS_SRC=elf.c crypto.c sb.c sb1.c aes128.c crc.c misc.c sha1.c xorcrypt.c
SBTOOLS_OBJ=$(SBTOOLS_SRC:.c=.o)
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
all: $(EXEC)
%.o: $(SBTOOLS_DIR)/%.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o: $%.c
$(CC) $(CFLAGS) -c -o $@ $<
hwpatcher: hwpatcher.o md5.o $(SBTOOLS_OBJ)
$(LD) -o $@ $^ $(LDFLAGS)
clean:
rm -rf $(SBTOOLS_OBJ) $(OBJ) $(EXEC)