Skip to content

Commit

Permalink
Improve macOS support
Browse files Browse the repository at this point in the history
macOS support is still not great, but this patch at least
fixes some import Makefile subtargets.
  • Loading branch information
andre-richter committed Oct 24, 2022
1 parent 2e72a84 commit ec84213
Show file tree
Hide file tree
Showing 36 changed files with 185 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7
3.0.2
5 changes: 3 additions & 2 deletions 01_wait_forever/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -130,7 +131,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
5 changes: 3 additions & 2 deletions 02_runtime_init/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -130,7 +131,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
2 changes: 1 addition & 1 deletion 02_runtime_init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml
diff -uNr 01_wait_forever/Makefile 02_runtime_init/Makefile
--- 01_wait_forever/Makefile
+++ 02_runtime_init/Makefile
@@ -180,6 +180,7 @@
@@ -181,6 +181,7 @@
$(call color_header, "Launching objdump")
@$(DOCKER_TOOLS) $(OBJDUMP_BINARY) --disassemble --demangle \
--section .text \
Expand Down
5 changes: 3 additions & 2 deletions 03_hacky_hello_world/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -133,7 +134,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
8 changes: 4 additions & 4 deletions 03_hacky_hello_world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ diff -uNr 02_runtime_init/Cargo.toml 03_hacky_hello_world/Cargo.toml
diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile
--- 02_runtime_init/Makefile
+++ 03_hacky_hello_world/Makefile
@@ -24,7 +24,7 @@
@@ -25,7 +25,7 @@
KERNEL_BIN = kernel8.img
QEMU_BINARY = qemu-system-aarch64
QEMU_MACHINE_TYPE = raspi3
Expand All @@ -62,7 +62,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile
OBJDUMP_BINARY = aarch64-none-elf-objdump
NM_BINARY = aarch64-none-elf-nm
READELF_BINARY = aarch64-none-elf-readelf
@@ -35,7 +35,7 @@
@@ -36,7 +36,7 @@
KERNEL_BIN = kernel8.img
QEMU_BINARY = qemu-system-aarch64
QEMU_MACHINE_TYPE =
Expand All @@ -71,7 +71,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile
OBJDUMP_BINARY = aarch64-none-elf-objdump
NM_BINARY = aarch64-none-elf-nm
READELF_BINARY = aarch64-none-elf-readelf
@@ -85,17 +85,20 @@
@@ -86,17 +86,20 @@
--strip-all \
-O binary

Expand All @@ -95,7 +95,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile



@@ -190,3 +193,27 @@
@@ -191,3 +194,27 @@
$(call color_header, "Launching nm")
@$(DOCKER_TOOLS) $(NM_BINARY) --demangle --print-size $(KERNEL_ELF) | sort | rustfilt

Expand Down
5 changes: 3 additions & 2 deletions 04_safe_globals/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -133,7 +134,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
5 changes: 3 additions & 2 deletions 05_drivers_gpio_uart/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -145,7 +146,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
8 changes: 4 additions & 4 deletions 05_drivers_gpio_uart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ diff -uNr 04_safe_globals/Cargo.toml 05_drivers_gpio_uart/Cargo.toml
diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile
--- 04_safe_globals/Makefile
+++ 05_drivers_gpio_uart/Makefile
@@ -12,6 +12,9 @@
@@ -13,6 +13,9 @@
# Default to the RPi3.
BSP ?= rpi3

Expand All @@ -196,15 +196,15 @@ diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile


##--------------------------------------------------------------------------------------------------
@@ -87,6 +90,7 @@
@@ -88,6 +91,7 @@

EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE)
EXEC_TEST_DISPATCH = ruby ../common/tests/dispatch.rb
+EXEC_MINITERM = ruby ../common/serial/miniterm.rb

##------------------------------------------------------------------------------
## Dockerization
@@ -94,18 +98,26 @@
@@ -95,18 +99,26 @@
DOCKER_CMD = docker run -t --rm -v $(shell pwd):/work/tutorial -w /work/tutorial
DOCKER_CMD_INTERACT = $(DOCKER_CMD) -i
DOCKER_ARG_DIR_COMMON = -v $(shell pwd)/../common:/work/common
Expand Down Expand Up @@ -232,7 +232,7 @@ diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile

all: $(KERNEL_BIN)

@@ -155,9 +167,16 @@
@@ -156,9 +168,16 @@
qemu: $(KERNEL_BIN)
$(call color_header, "Launching QEMU")
@$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN)
Expand Down
5 changes: 3 additions & 2 deletions 06_uart_chainloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -147,7 +148,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
14 changes: 7 additions & 7 deletions 06_uart_chainloader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Binary files 05_drivers_gpio_uart/demo_payload_rpi4.img and 06_uart_chainloader/
diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
--- 05_drivers_gpio_uart/Makefile
+++ 06_uart_chainloader/Makefile
@@ -23,27 +23,29 @@
@@ -24,27 +24,29 @@
QEMU_MISSING_STRING = "This board is not yet supported for QEMU."

ifeq ($(BSP),rpi3)
Expand Down Expand Up @@ -190,7 +190,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
endif

# Export for build.rs.
@@ -89,8 +91,8 @@
@@ -90,8 +92,8 @@
-O binary

EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE)
Expand All @@ -201,7 +201,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile

##------------------------------------------------------------------------------
## Dockerization
@@ -109,7 +111,7 @@
@@ -110,7 +112,7 @@
ifeq ($(shell uname -s),Linux)
DOCKER_CMD_DEV = $(DOCKER_CMD_INTERACT) $(DOCKER_ARG_DEV)

Expand All @@ -210,7 +210,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
endif


@@ -117,7 +119,7 @@
@@ -118,7 +120,7 @@
##--------------------------------------------------------------------------------------------------
## Targets
##--------------------------------------------------------------------------------------------------
Expand All @@ -219,7 +219,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile

all: $(KERNEL_BIN)

@@ -159,7 +161,7 @@
@@ -160,7 +162,7 @@
##------------------------------------------------------------------------------
ifeq ($(QEMU_MACHINE_TYPE),) # QEMU is not supported for the board.

Expand All @@ -228,7 +228,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
$(call color_header, "$(QEMU_MISSING_STRING)")

else # QEMU is supported.
@@ -168,13 +170,17 @@
@@ -169,13 +171,17 @@
$(call color_header, "Launching QEMU")
@$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN)

Expand All @@ -249,7 +249,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile

##------------------------------------------------------------------------------
## Run clippy
@@ -231,7 +237,8 @@
@@ -232,7 +238,8 @@
##------------------------------------------------------------------------------
test_boot: $(KERNEL_BIN)
$(call color_header, "Boot test - $(BSP)")
Expand Down
5 changes: 3 additions & 2 deletions 07_timestamps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -145,7 +146,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
10 changes: 5 additions & 5 deletions 07_timestamps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Binary files 06_uart_chainloader/demo_payload_rpi4.img and 07_timestamps/demo_pa
diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile
--- 06_uart_chainloader/Makefile
+++ 07_timestamps/Makefile
@@ -23,29 +23,27 @@
@@ -24,29 +24,27 @@
QEMU_MISSING_STRING = "This board is not yet supported for QEMU."

ifeq ($(BSP),rpi3)
Expand Down Expand Up @@ -113,7 +113,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile
endif

# Export for build.rs.
@@ -91,7 +89,7 @@
@@ -92,7 +90,7 @@
-O binary

EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE)
Expand All @@ -122,7 +122,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile
EXEC_MINIPUSH = ruby ../common/serial/minipush.rb

##------------------------------------------------------------------------------
@@ -161,7 +159,7 @@
@@ -162,7 +160,7 @@
##------------------------------------------------------------------------------
ifeq ($(QEMU_MACHINE_TYPE),) # QEMU is not supported for the board.

Expand All @@ -131,7 +131,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile
$(call color_header, "$(QEMU_MISSING_STRING)")

else # QEMU is supported.
@@ -170,17 +168,13 @@
@@ -171,17 +169,13 @@
$(call color_header, "Launching QEMU")
@$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN)

Expand All @@ -150,7 +150,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile

##------------------------------------------------------------------------------
## Run clippy
@@ -237,8 +231,7 @@
@@ -238,8 +232,7 @@
##------------------------------------------------------------------------------
test_boot: $(KERNEL_BIN)
$(call color_header, "Boot test - $(BSP)")
Expand Down
5 changes: 3 additions & 2 deletions 08_hw_debug_JTAG/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
##
## Copyright (c) 2018-2022 Andre Richter <[email protected]>

include ../common/format.mk
include ../common/docker.mk
include ../common/format.mk
include ../common/operating_system.mk

##--------------------------------------------------------------------------------------------------
## Optional, user-provided configuration values
Expand Down Expand Up @@ -156,7 +157,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
$(call color_progress_prefix, "Name")
@echo $(KERNEL_BIN)
$(call color_progress_prefix, "Size")
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
$(call disk_usage_KiB, $(KERNEL_BIN))

##------------------------------------------------------------------------------
## Generate the documentation
Expand Down
8 changes: 4 additions & 4 deletions 08_hw_debug_JTAG/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ diff -uNr 07_timestamps/Cargo.toml 08_hw_debug_JTAG/Cargo.toml
diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
--- 07_timestamps/Makefile
+++ 08_hw_debug_JTAG/Makefile
@@ -31,6 +31,8 @@
@@ -32,6 +32,8 @@
OBJDUMP_BINARY = aarch64-none-elf-objdump
NM_BINARY = aarch64-none-elf-nm
READELF_BINARY = aarch64-none-elf-readelf
Expand All @@ -329,7 +329,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
else ifeq ($(BSP),rpi4)
@@ -42,6 +44,8 @@
@@ -43,6 +45,8 @@
OBJDUMP_BINARY = aarch64-none-elf-objdump
NM_BINARY = aarch64-none-elf-nm
READELF_BINARY = aarch64-none-elf-readelf
Expand All @@ -338,7 +338,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
endif
@@ -98,18 +102,25 @@
@@ -99,18 +103,25 @@
DOCKER_CMD = docker run -t --rm -v $(shell pwd):/work/tutorial -w /work/tutorial
DOCKER_CMD_INTERACT = $(DOCKER_CMD) -i
DOCKER_ARG_DIR_COMMON = -v $(shell pwd)/../common:/work/common
Expand All @@ -364,7 +364,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
endif


@@ -214,6 +225,35 @@
@@ -215,6 +226,35 @@



Expand Down
Loading

0 comments on commit ec84213

Please sign in to comment.