diff --git a/Makefile b/Makefile index 5a986d9..2263771 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ HOST_OS = $(shell uname -s) # Mount point and boot partition -FLASH_DEFAULT_TARGET = chainloader +FLASH_DEFAULT_TARGET = seed MNT = $(MNT_$(HOST_OS)) MNT_Linux = mnt MNT_Darwin = /Volumes/boot @@ -33,16 +33,16 @@ all: clean buildall # Remove kernel and build directory clean: rm -rf $(BUILD) *.img - $(MAKE) -C chainloader clean + $(MAKE) -C seed clean $(MAKE) -C thorn clean # Build the different OSes build: build-$(BUILD_DEFAULT_TARGET) -buildall: build-chainloader build-thorn +buildall: build-seed build-thorn -build-chainloader: - $(MAKE) -C chainloader build +build-seed: + $(MAKE) -C seed build build-thorn: $(MAKE) -C thorn build @@ -50,8 +50,8 @@ build-thorn: # Mount boot partition of SD card onto set mount point to copy image onto it flash: flash-$(FLASH_DEFAULT_TARGET) -flash-chainloader: - $(MAKE) -C chainloader flash +flash-seed: + $(MAKE) -C seed flash flash-thorn: $(MAKE) -C thorn flash @@ -64,15 +64,22 @@ setup-serial-Darwin: cat -v $(SERIAL_PORT) & stty -f $(SERIAL_PORT) $(BAUD_RATE) raw cs8 -ixoff -cstopb -parenb -resend: reboot build +# reboot and send corresponding image over serial connection +resend: resend-$(SEND_DEFAULT_TARGET) + +resend-seed: setup-serial-$(HOST_OS) reboot + sleep 8 + $(MAKE) -C seed send + +resend-thorn: setup-serial-$(HOST_OS) reboot sleep 8 - $(MAKE) send + $(MAKE) -C thorn send # send corresponding image over serial connection send: send-$(SEND_DEFAULT_TARGET) -send-chainloader: setup-serial-$(HOST_OS) - $(MAKE) -C chainloader send +send-seed: setup-serial-$(HOST_OS) + $(MAKE) -C seed send send-thorn: setup-serial-$(HOST_OS) $(MAKE) -C thorn send @@ -93,8 +100,8 @@ blank: # Emulate the corresponding kernel on qemu emulate: emulate-$(EMULATE_DEFAULT_TARGET) -emulate-chainloader: - $(MAKE) -C chainloader emulate +emulate-seed: + $(MAKE) -C seed emulate emulate-thorn: $(MAKE) -C thorn emulate diff --git a/chainloader/Makefile b/seed/Makefile similarity index 100% rename from chainloader/Makefile rename to seed/Makefile diff --git a/chainloader/include/common/status_led.h b/seed/include/common/status_led.h similarity index 100% rename from chainloader/include/common/status_led.h rename to seed/include/common/status_led.h diff --git a/chainloader/include/common/stdbool.h b/seed/include/common/stdbool.h similarity index 100% rename from chainloader/include/common/stdbool.h rename to seed/include/common/stdbool.h diff --git a/chainloader/include/common/stddef.h b/seed/include/common/stddef.h similarity index 100% rename from chainloader/include/common/stddef.h rename to seed/include/common/stddef.h diff --git a/chainloader/include/common/utils.h b/seed/include/common/utils.h similarity index 100% rename from chainloader/include/common/utils.h rename to seed/include/common/utils.h diff --git a/chainloader/include/kernel/chainload.h b/seed/include/kernel/chainload.h similarity index 100% rename from chainloader/include/kernel/chainload.h rename to seed/include/kernel/chainload.h diff --git a/chainloader/include/kernel/kernel.h b/seed/include/kernel/kernel.h similarity index 100% rename from chainloader/include/kernel/kernel.h rename to seed/include/kernel/kernel.h diff --git a/chainloader/include/kernel/load.h b/seed/include/kernel/load.h similarity index 100% rename from chainloader/include/kernel/load.h rename to seed/include/kernel/load.h diff --git a/chainloader/include/kernel/mailbox.h b/seed/include/kernel/mailbox.h similarity index 100% rename from chainloader/include/kernel/mailbox.h rename to seed/include/kernel/mailbox.h diff --git a/chainloader/include/kernel/mini_uart.h b/seed/include/kernel/mini_uart.h similarity index 100% rename from chainloader/include/kernel/mini_uart.h rename to seed/include/kernel/mini_uart.h diff --git a/chainloader/include/kernel/peripherals/base.h b/seed/include/kernel/peripherals/base.h similarity index 100% rename from chainloader/include/kernel/peripherals/base.h rename to seed/include/kernel/peripherals/base.h diff --git a/chainloader/include/kernel/peripherals/gpio.h b/seed/include/kernel/peripherals/gpio.h similarity index 100% rename from chainloader/include/kernel/peripherals/gpio.h rename to seed/include/kernel/peripherals/gpio.h diff --git a/chainloader/include/kernel/peripherals/mailbox.h b/seed/include/kernel/peripherals/mailbox.h similarity index 100% rename from chainloader/include/kernel/peripherals/mailbox.h rename to seed/include/kernel/peripherals/mailbox.h diff --git a/chainloader/include/kernel/peripherals/mini_uart.h b/seed/include/kernel/peripherals/mini_uart.h similarity index 100% rename from chainloader/include/kernel/peripherals/mini_uart.h rename to seed/include/kernel/peripherals/mini_uart.h diff --git a/chainloader/src/common/status_led.c b/seed/src/common/status_led.c similarity index 100% rename from chainloader/src/common/status_led.c rename to seed/src/common/status_led.c diff --git a/chainloader/src/common/utils.S b/seed/src/common/utils.S similarity index 100% rename from chainloader/src/common/utils.S rename to seed/src/common/utils.S diff --git a/chainloader/src/config.txt b/seed/src/config.txt similarity index 100% rename from chainloader/src/config.txt rename to seed/src/config.txt diff --git a/chainloader/src/kernel/boot.S b/seed/src/kernel/boot.S similarity index 100% rename from chainloader/src/kernel/boot.S rename to seed/src/kernel/boot.S diff --git a/chainloader/src/kernel/kernel.c b/seed/src/kernel/kernel.c similarity index 100% rename from chainloader/src/kernel/kernel.c rename to seed/src/kernel/kernel.c diff --git a/chainloader/src/kernel/load.c b/seed/src/kernel/load.c similarity index 90% rename from chainloader/src/kernel/load.c rename to seed/src/kernel/load.c index 31a9b23..0b71b68 100644 --- a/chainloader/src/kernel/load.c +++ b/seed/src/kernel/load.c @@ -32,7 +32,9 @@ void receive_kernel (void) { toggle_led (POWER_LED); for (int i = sizeof (int); i > 0;) {// 4 is size of int - kernel_size_address[--i] = uart_recv (); + unsigned char c = uart_recv(); + if (i == sizeof (int) && c == 18) continue; // Ignore first char if reboot signal + kernel_size_address[--i] = c; } int length = *(int *) kernel_size_address; diff --git a/chainloader/src/kernel/mailbox.c b/seed/src/kernel/mailbox.c similarity index 100% rename from chainloader/src/kernel/mailbox.c rename to seed/src/kernel/mailbox.c diff --git a/chainloader/src/kernel/mini_uart.c b/seed/src/kernel/mini_uart.c similarity index 100% rename from chainloader/src/kernel/mini_uart.c rename to seed/src/kernel/mini_uart.c diff --git a/chainloader/src/linker.ld b/seed/src/linker.ld similarity index 100% rename from chainloader/src/linker.ld rename to seed/src/linker.ld diff --git a/chainloader/src/mailbox.c b/seed/src/mailbox.c similarity index 100% rename from chainloader/src/mailbox.c rename to seed/src/mailbox.c