diff --git a/Makefile b/Makefile index 145cdf7..f597f56 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ OBJS := $(SRCS:%=%.o) .PHONY: all build clean clean_target run kernel debug gdb -all: +all: $(CPIO) $(MAKE) build TARGET_DIR=./kernel TARGET=kernel8 $(MAKE) build TARGET_DIR=./bootloader TARGET=bootloader diff --git a/bootloader/main.c b/bootloader/main.c index dd7d1de..0db6ea6 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -14,7 +14,7 @@ void main(void *dtb) uart_puts("waiting for kernel to be sent ..." ENDL); union { - int size; + int32_t size; uint8_t buf[4]; } kernel_header; kernel_header.size = 0; diff --git a/kernel/linker.ld b/kernel/linker.ld index c70588a..c32ee2b 100644 --- a/kernel/linker.ld +++ b/kernel/linker.ld @@ -1,10 +1,10 @@ ENTRY(_start) MEMORY { - TEXT (rx) : ORIGIN = 0x80000, LENGTH = 128K - RO (r) : ORIGIN = 0xa0000, LENGTH = 128K - DATA (rw) : ORIGIN = 0x100000, LENGTH = 512K - RAM (rw) : ORIGIN = 0x180000, LENGTH = 64M + TEXT (rx) : ORIGIN = 0x80000, LENGTH = 64K + RO (r) : ORIGIN = 0x90000, LENGTH = 16K + DATA (rw) : ORIGIN = 0x94000, LENGTH = 64K + RAM (rw) : ORIGIN = 0xa4000, LENGTH = 64M } SECTIONS diff --git a/misc/bootcode.bin b/misc/bootcode.bin new file mode 100644 index 0000000..9e831a2 Binary files /dev/null and b/misc/bootcode.bin differ diff --git a/misc/config.txt b/misc/config.txt index a348083..68ad2de 100644 --- a/misc/config.txt +++ b/misc/config.txt @@ -1,3 +1,4 @@ -initramfs initramfs.cpio 0x20000000 +initramfs initramfs.cpio kernel=bootloader.img +enable_uart=1 arm_64bit=1 diff --git a/misc/fixup.dat b/misc/fixup.dat new file mode 100644 index 0000000..2ff9668 Binary files /dev/null and b/misc/fixup.dat differ diff --git a/upload.py b/upload.py index 4a2cd00..bd0e0b2 100755 --- a/upload.py +++ b/upload.py @@ -3,6 +3,8 @@ from pwn import * from struct import pack from tqdm import tqdm +print(sys.argv) + if len(sys.argv) < 2: print("no args for serial device") exit() @@ -26,5 +28,5 @@ while True: r.interactive() - r.send(b"reboot\n") - sleep(1) + r.send(b"\nreboot\n") + sleep(10)