twoddle
This commit is contained in:
parent
571e200ecf
commit
0a6f2b0a03
24
Makefile
24
Makefile
@ -1,9 +1,23 @@
|
|||||||
DATA = $(word 1,$(wildcard ./data ../data))
|
DATA = $(word 1,$(wildcard ./data ../data))
|
||||||
include $(DATA)/Makefile.common
|
include $(DATA)/Makefile.common
|
||||||
OBJS = check_sanity make_kernel_patchfile apply_patchfile
|
|
||||||
all: .settings $(OBJS)
|
BINS := check_sanity make_kernel_patchfile apply_patchfile sandboxc.c
|
||||||
%: %.c
|
all: .settings .data $(BINS)
|
||||||
|
.data:
|
||||||
make -C $(DATA)
|
make -C $(DATA)
|
||||||
$(GCC) $(CFLAGS) -o $@ $< -I$(DATA) $(DATA)/libdata.a
|
%.o: %.c
|
||||||
|
$(GCC) -c -o $@ $< -I$(DATA)
|
||||||
|
sandbox.o: sandbox.S
|
||||||
|
$(SDK_GCC) -c -o $@ $<
|
||||||
|
sandboxc.c: sandbox.o
|
||||||
|
xxd -i sandbox.o > sandboxc.c
|
||||||
|
|
||||||
|
check_sanity: check_sanity.o
|
||||||
|
$(GCC) -o $@ $^ $(DATA)/libdata.a
|
||||||
|
apply_patchfile: apply_patchfile.o
|
||||||
|
$(GCC) -o $@ $^ $(DATA)/libdata.a
|
||||||
|
make_kernel_patchfile: make_kernel_patchfile.o sandboxc.o
|
||||||
|
$(GCC) -o $@ $^ $(DATA)/libdata.a
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS)
|
rm -f $(BINS) *.o
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
#include <data/link.h>
|
#include <data/link.h>
|
||||||
#include "lambda.h"
|
#include "lambda.h"
|
||||||
|
|
||||||
|
extern unsigned char sandbox_o[];
|
||||||
|
extern unsigned int sandbox_o_len;
|
||||||
|
|
||||||
int patchfd;
|
int patchfd;
|
||||||
|
|
||||||
static inline void patch_with_range(const char *name, addr_t addr, prange_t pr) {
|
static inline void patch_with_range(const char *name, addr_t addr, prange_t pr) {
|
||||||
@ -179,9 +182,9 @@ int main(int argc, char **argv) {
|
|||||||
b_init(&kernel);
|
b_init(&kernel);
|
||||||
b_init(&sandbox);
|
b_init(&sandbox);
|
||||||
b_load_macho(&kernel, argv[1], false);
|
b_load_macho(&kernel, argv[1], false);
|
||||||
b_load_macho(&sandbox, argv[2], true);
|
b_prange_load_macho(&sandbox, (prange_t) {&sandbox_o, sandbox_o_len}, "sandbox.o");
|
||||||
|
|
||||||
patchfd = open(argv[3], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
patchfd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
if(patchfd == -1) {
|
if(patchfd == -1) {
|
||||||
edie("could not open patchfd");
|
edie("could not open patchfd");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user