diff --git a/.ruby-version b/.ruby-version index 1effb003..b5021469 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7 +3.0.2 diff --git a/01_wait_forever/Makefile b/01_wait_forever/Makefile index 679b23b4..c87546fd 100644 --- a/01_wait_forever/Makefile +++ b/01_wait_forever/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/02_runtime_init/Makefile b/02_runtime_init/Makefile index 0abb67cc..807a935e 100644 --- a/02_runtime_init/Makefile +++ b/02_runtime_init/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/02_runtime_init/README.md b/02_runtime_init/README.md index 80fd77a4..7b3fcd82 100644 --- a/02_runtime_init/README.md +++ b/02_runtime_init/README.md @@ -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 \ diff --git a/03_hacky_hello_world/Makefile b/03_hacky_hello_world/Makefile index cfd5dc6e..13dba46c 100644 --- a/03_hacky_hello_world/Makefile +++ b/03_hacky_hello_world/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index 416cab02..b0ad3ff2 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -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 @@ -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 = @@ -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 @@ -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 diff --git a/04_safe_globals/Makefile b/04_safe_globals/Makefile index cfd5dc6e..13dba46c 100644 --- a/04_safe_globals/Makefile +++ b/04_safe_globals/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/05_drivers_gpio_uart/Makefile b/05_drivers_gpio_uart/Makefile index 29d6729f..a8c4821a 100644 --- a/05_drivers_gpio_uart/Makefile +++ b/05_drivers_gpio_uart/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/05_drivers_gpio_uart/README.md b/05_drivers_gpio_uart/README.md index 3fe5e7b2..f53a330b 100644 --- a/05_drivers_gpio_uart/README.md +++ b/05_drivers_gpio_uart/README.md @@ -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 @@ -196,7 +196,7 @@ 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 @@ -204,7 +204,7 @@ diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile ##------------------------------------------------------------------------------ ## 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 @@ -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) diff --git a/06_uart_chainloader/Makefile b/06_uart_chainloader/Makefile index d7b102ae..b619b4ca 100644 --- a/06_uart_chainloader/Makefile +++ b/06_uart_chainloader/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/06_uart_chainloader/README.md b/06_uart_chainloader/README.md index e321e603..95b95149 100644 --- a/06_uart_chainloader/README.md +++ b/06_uart_chainloader/README.md @@ -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) @@ -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) @@ -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) @@ -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 ##-------------------------------------------------------------------------------------------------- @@ -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. @@ -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) @@ -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)") diff --git a/07_timestamps/Makefile b/07_timestamps/Makefile index 76ddb186..23de6557 100644 --- a/07_timestamps/Makefile +++ b/07_timestamps/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/07_timestamps/README.md b/07_timestamps/README.md index 4a5905b4..236def5b 100644 --- a/07_timestamps/README.md +++ b/07_timestamps/README.md @@ -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) @@ -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) @@ -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. @@ -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) @@ -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)") diff --git a/08_hw_debug_JTAG/Makefile b/08_hw_debug_JTAG/Makefile index ce0ebc31..125f75cb 100644 --- a/08_hw_debug_JTAG/Makefile +++ b/08_hw_debug_JTAG/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/08_hw_debug_JTAG/README.md b/08_hw_debug_JTAG/README.md index 69b6b82e..14928253 100644 --- a/08_hw_debug_JTAG/README.md +++ b/08_hw_debug_JTAG/README.md @@ -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 @@ -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 @@ -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 @@ -364,7 +364,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile endif -@@ -214,6 +225,35 @@ +@@ -215,6 +226,35 @@ diff --git a/09_privilege_level/Makefile b/09_privilege_level/Makefile index ce0ebc31..125f75cb 100644 --- a/09_privilege_level/Makefile +++ b/09_privilege_level/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/10_virtual_mem_part1_identity_mapping/Makefile b/10_virtual_mem_part1_identity_mapping/Makefile index ce0ebc31..125f75cb 100644 --- a/10_virtual_mem_part1_identity_mapping/Makefile +++ b/10_virtual_mem_part1_identity_mapping/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/11_exceptions_part1_groundwork/Makefile b/11_exceptions_part1_groundwork/Makefile index ce0ebc31..125f75cb 100644 --- a/11_exceptions_part1_groundwork/Makefile +++ b/11_exceptions_part1_groundwork/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/12_integrated_testing/Makefile b/12_integrated_testing/Makefile index 2d480119..88d106f8 100644 --- a/12_integrated_testing/Makefile +++ b/12_integrated_testing/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -166,7 +167,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 diff --git a/13_exceptions_part2_peripheral_IRQs/Makefile b/13_exceptions_part2_peripheral_IRQs/Makefile index 2d480119..88d106f8 100644 --- a/13_exceptions_part2_peripheral_IRQs/Makefile +++ b/13_exceptions_part2_peripheral_IRQs/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -166,7 +167,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 diff --git a/14_virtual_mem_part2_mmio_remap/Makefile b/14_virtual_mem_part2_mmio_remap/Makefile index 2d480119..88d106f8 100644 --- a/14_virtual_mem_part2_mmio_remap/Makefile +++ b/14_virtual_mem_part2_mmio_remap/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -166,7 +167,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 diff --git a/15_virtual_mem_part3_precomputed_tables/Makefile b/15_virtual_mem_part3_precomputed_tables/Makefile index 4092ec8f..0f5c4870 100644 --- a/15_virtual_mem_part3_precomputed_tables/Makefile +++ b/15_virtual_mem_part3_precomputed_tables/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -185,7 +186,7 @@ $(KERNEL_BIN): $(KERNEL_ELF_TTABLES) $(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 diff --git a/15_virtual_mem_part3_precomputed_tables/README.md b/15_virtual_mem_part3_precomputed_tables/README.md index 00586235..c850992e 100644 --- a/15_virtual_mem_part3_precomputed_tables/README.md +++ b/15_virtual_mem_part3_precomputed_tables/README.md @@ -1848,7 +1848,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/tests/04_exception_irq_sanity.r diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precomputed_tables/Makefile --- 14_virtual_mem_part2_mmio_remap/Makefile +++ 15_virtual_mem_part3_precomputed_tables/Makefile -@@ -71,10 +71,20 @@ +@@ -72,10 +72,20 @@ KERNEL_LINKER_SCRIPT = kernel.ld LAST_BUILD_CONFIG = target/$(BSP).build_config @@ -1871,7 +1871,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precompu -@@ -103,6 +113,7 @@ +@@ -104,6 +114,7 @@ -O binary EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) @@ -1879,7 +1879,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precompu EXEC_TEST_DISPATCH = ruby ../common/tests/dispatch.rb EXEC_MINIPUSH = ruby ../common/serial/minipush.rb -@@ -153,16 +164,24 @@ +@@ -154,16 +165,24 @@ ##------------------------------------------------------------------------------ ## Compile the kernel ELF ##------------------------------------------------------------------------------ @@ -1907,7 +1907,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precompu $(call color_progress_prefix, "Name") @echo $(KERNEL_BIN) $(call color_progress_prefix, "Size") -@@ -300,6 +319,7 @@ +@@ -301,6 +320,7 @@ TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') diff --git a/16_virtual_mem_part4_higher_half_kernel/Makefile b/16_virtual_mem_part4_higher_half_kernel/Makefile index 4092ec8f..0f5c4870 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Makefile +++ b/16_virtual_mem_part4_higher_half_kernel/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -185,7 +186,7 @@ $(KERNEL_BIN): $(KERNEL_ELF_TTABLES) $(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 diff --git a/17_kernel_symbols/Makefile b/17_kernel_symbols/Makefile index 7bed51da..ce1d165b 100644 --- a/17_kernel_symbols/Makefile +++ b/17_kernel_symbols/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -198,8 +199,7 @@ $(KERNEL_ELF_TTABLES): $(KERNEL_ELF_TTABLES_DEPS) ##------------------------------------------------------------------------------ $(KERNEL_ELF_TTABLES_SYMS): $(KERNEL_ELF_TTABLES_SYMS_DEPS) $(call color_header, "Generating kernel symbols and patching kernel ELF") - @time -f "in %es" \ - $(MAKE) --no-print-directory -f kernel_symbols.mk + @$(MAKE) --no-print-directory -f kernel_symbols.mk ##------------------------------------------------------------------------------ ## Generate the stripped kernel binary @@ -210,7 +210,7 @@ $(KERNEL_BIN): $(KERNEL_ELF_TTABLES_SYMS) $(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 diff --git a/17_kernel_symbols/README.md b/17_kernel_symbols/README.md index 87264162..925ed689 100644 --- a/17_kernel_symbols/README.md +++ b/17_kernel_symbols/README.md @@ -516,7 +516,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel_symbols/src/main.rs 17_ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel_symbols.mk 17_kernel_symbols/kernel_symbols.mk --- 16_virtual_mem_part4_higher_half_kernel/kernel_symbols.mk +++ 17_kernel_symbols/kernel_symbols.mk -@@ -0,0 +1,103 @@ +@@ -0,0 +1,117 @@ +## SPDX-License-Identifier: MIT OR Apache-2.0 +## +## Copyright (c) 2018-2022 Andre Richter @@ -598,9 +598,11 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel_symbols.mk 17_kernel_sy +##-------------------------------------------------------------------------------------------------- +## Targets +##-------------------------------------------------------------------------------------------------- -+.PHONY: all ++.PHONY: all symbols measure_time_start measure_time_finish + -+all: ++all: measure_time_start symbols measure_time_finish ++ ++symbols: + @cp $(KERNEL_SYMBOLS_INPUT_ELF) $(KERNEL_SYMBOLS_OUTPUT_ELF) + + @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --gen_symbols $(KERNEL_SYMBOLS_OUTPUT_ELF) \ @@ -619,7 +621,19 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/kernel_symbols.mk 17_kernel_sy + @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --patch_data $(KERNEL_SYMBOLS_OUTPUT_ELF) \ + $(KERNEL_SYMBOLS_STRIPPED) + ++# Note: The following is the only _trivial_ way I could think of that works out of the box on both ++# Linux and macOS. Since macOS does not have the moduloN nanosecond format string option, the ++# resolution is restricted to whole seconds. ++measure_time_start: ++ @date +modulos > /tmp/kernel_symbols_start.date ++ ++measure_time_finish: ++ @date +modulos > /tmp/kernel_symbols_end.date ++ + $(call color_progress_prefix, "Finished") ++ @echo "in $$((`cat /tmp/kernel_symbols_end.date` - `cat /tmp/kernel_symbols_start.date`)).0s" ++ ++ @rm /tmp/kernel_symbols_end.date /tmp/kernel_symbols_start.date diff -uNr 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/Cargo.toml 17_kernel_symbols/libraries/debug-symbol-types/Cargo.toml --- 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/Cargo.toml @@ -683,7 +697,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/libraries/debug-symbol-types/s diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Makefile --- 16_virtual_mem_part4_higher_half_kernel/Makefile +++ 17_kernel_symbols/Makefile -@@ -84,7 +84,24 @@ +@@ -85,7 +85,24 @@ KERNEL_ELF_TTABLES = target/$(TARGET)/release/kernel+ttables KERNEL_ELF_TTABLES_DEPS = $(KERNEL_ELF_RAW) $(wildcard $(TT_TOOL_PATH)/*) @@ -709,7 +723,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak -@@ -177,11 +194,19 @@ +@@ -178,11 +195,18 @@ @$(DOCKER_TOOLS) $(EXEC_TT_TOOL) $(BSP) $(KERNEL_ELF_TTABLES) ##------------------------------------------------------------------------------ @@ -717,8 +731,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak +##------------------------------------------------------------------------------ +$(KERNEL_ELF_TTABLES_SYMS): $(KERNEL_ELF_TTABLES_SYMS_DEPS) + $(call color_header, "Generating kernel symbols and patching kernel ELF") -+ @time -f "in moduloes" \ -+ $(MAKE) --no-print-directory -f kernel_symbols.mk ++ @$(MAKE) --no-print-directory -f kernel_symbols.mk + +##------------------------------------------------------------------------------ ## Generate the stripped kernel binary @@ -731,7 +744,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak $(call color_progress_prefix, "Name") @echo $(KERNEL_BIN) $(call color_progress_prefix, "Size") -@@ -190,7 +215,7 @@ +@@ -191,7 +215,7 @@ ##------------------------------------------------------------------------------ ## Generate the documentation ##------------------------------------------------------------------------------ @@ -740,7 +753,7 @@ diff -uNr 16_virtual_mem_part4_higher_half_kernel/Makefile 17_kernel_symbols/Mak $(call color_header, "Generating docs") @$(DOC_CMD) --document-private-items --open -@@ -317,10 +342,19 @@ +@@ -318,10 +342,19 @@ cd $(shell pwd) TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') diff --git a/17_kernel_symbols/kernel_symbols.mk b/17_kernel_symbols/kernel_symbols.mk index 5b51ccfe..d496ea8a 100644 --- a/17_kernel_symbols/kernel_symbols.mk +++ b/17_kernel_symbols/kernel_symbols.mk @@ -79,9 +79,11 @@ DOCKER_TOOLS = $(DOCKER_CMD) $(DOCKER_IMAGE) ##-------------------------------------------------------------------------------------------------- ## Targets ##-------------------------------------------------------------------------------------------------- -.PHONY: all +.PHONY: all symbols measure_time_start measure_time_finish -all: +all: measure_time_start symbols measure_time_finish + +symbols: @cp $(KERNEL_SYMBOLS_INPUT_ELF) $(KERNEL_SYMBOLS_OUTPUT_ELF) @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --gen_symbols $(KERNEL_SYMBOLS_OUTPUT_ELF) \ @@ -100,4 +102,16 @@ all: @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --patch_data $(KERNEL_SYMBOLS_OUTPUT_ELF) \ $(KERNEL_SYMBOLS_STRIPPED) +# Note: The following is the only _trivial_ way I could think of that works out of the box on both +# Linux and macOS. Since macOS does not have the %N nanosecond format string option, the +# resolution is restricted to whole seconds. +measure_time_start: + @date +%s > /tmp/kernel_symbols_start.date + +measure_time_finish: + @date +%s > /tmp/kernel_symbols_end.date + $(call color_progress_prefix, "Finished") + @echo "in $$((`cat /tmp/kernel_symbols_end.date` - `cat /tmp/kernel_symbols_start.date`)).0s" + + @rm /tmp/kernel_symbols_end.date /tmp/kernel_symbols_start.date diff --git a/18_backtrace/Makefile b/18_backtrace/Makefile index 789ed5cd..fbd96e64 100644 --- a/18_backtrace/Makefile +++ b/18_backtrace/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -200,8 +201,7 @@ $(KERNEL_ELF_TTABLES): $(KERNEL_ELF_TTABLES_DEPS) ##------------------------------------------------------------------------------ $(KERNEL_ELF_TTABLES_SYMS): $(KERNEL_ELF_TTABLES_SYMS_DEPS) $(call color_header, "Generating kernel symbols and patching kernel ELF") - @time -f "in %es" \ - $(MAKE) --no-print-directory -f kernel_symbols.mk + @$(MAKE) --no-print-directory -f kernel_symbols.mk ##------------------------------------------------------------------------------ ## Generate the stripped kernel binary @@ -212,7 +212,7 @@ $(KERNEL_BIN): $(KERNEL_ELF_TTABLES_SYMS) $(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 diff --git a/18_backtrace/README.md b/18_backtrace/README.md index 021b8435..837d0161 100644 --- a/18_backtrace/README.md +++ b/18_backtrace/README.md @@ -1227,7 +1227,7 @@ diff -uNr 17_kernel_symbols/kernel/tests/07_backtrace_invalid_link.rs 18_backtra diff -uNr 17_kernel_symbols/Makefile 18_backtrace/Makefile --- 17_kernel_symbols/Makefile +++ 18_backtrace/Makefile -@@ -42,7 +42,7 @@ +@@ -43,7 +43,7 @@ OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi3.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi3.img LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi @@ -1236,7 +1236,7 @@ diff -uNr 17_kernel_symbols/Makefile 18_backtrace/Makefile else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat KERNEL_BIN = kernel8.img -@@ -56,7 +56,7 @@ +@@ -57,7 +57,7 @@ OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi4.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi4.img LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi @@ -1245,7 +1245,7 @@ diff -uNr 17_kernel_symbols/Makefile 18_backtrace/Makefile endif # Export for build.rs. -@@ -121,10 +121,12 @@ +@@ -122,10 +122,12 @@ $(FEATURES) \ --release diff --git a/18_backtrace/kernel_symbols.mk b/18_backtrace/kernel_symbols.mk index 5b51ccfe..d496ea8a 100644 --- a/18_backtrace/kernel_symbols.mk +++ b/18_backtrace/kernel_symbols.mk @@ -79,9 +79,11 @@ DOCKER_TOOLS = $(DOCKER_CMD) $(DOCKER_IMAGE) ##-------------------------------------------------------------------------------------------------- ## Targets ##-------------------------------------------------------------------------------------------------- -.PHONY: all +.PHONY: all symbols measure_time_start measure_time_finish -all: +all: measure_time_start symbols measure_time_finish + +symbols: @cp $(KERNEL_SYMBOLS_INPUT_ELF) $(KERNEL_SYMBOLS_OUTPUT_ELF) @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --gen_symbols $(KERNEL_SYMBOLS_OUTPUT_ELF) \ @@ -100,4 +102,16 @@ all: @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --patch_data $(KERNEL_SYMBOLS_OUTPUT_ELF) \ $(KERNEL_SYMBOLS_STRIPPED) +# Note: The following is the only _trivial_ way I could think of that works out of the box on both +# Linux and macOS. Since macOS does not have the %N nanosecond format string option, the +# resolution is restricted to whole seconds. +measure_time_start: + @date +%s > /tmp/kernel_symbols_start.date + +measure_time_finish: + @date +%s > /tmp/kernel_symbols_end.date + $(call color_progress_prefix, "Finished") + @echo "in $$((`cat /tmp/kernel_symbols_end.date` - `cat /tmp/kernel_symbols_start.date`)).0s" + + @rm /tmp/kernel_symbols_end.date /tmp/kernel_symbols_start.date diff --git a/19_kernel_heap/Makefile b/19_kernel_heap/Makefile index be41c136..43f5ad1f 100644 --- a/19_kernel_heap/Makefile +++ b/19_kernel_heap/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -205,8 +206,7 @@ $(KERNEL_ELF_TTABLES): $(KERNEL_ELF_TTABLES_DEPS) ##------------------------------------------------------------------------------ $(KERNEL_ELF_TTABLES_SYMS): $(KERNEL_ELF_TTABLES_SYMS_DEPS) $(call color_header, "Generating kernel symbols and patching kernel ELF") - @time -f "in %es" \ - $(MAKE) --no-print-directory -f kernel_symbols.mk + @$(MAKE) --no-print-directory -f kernel_symbols.mk ##------------------------------------------------------------------------------ ## Generate the stripped kernel binary @@ -217,7 +217,7 @@ $(KERNEL_BIN): $(KERNEL_ELF_TTABLES_SYMS) $(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 diff --git a/19_kernel_heap/README.md b/19_kernel_heap/README.md index a40d203d..54bca4ef 100644 --- a/19_kernel_heap/README.md +++ b/19_kernel_heap/README.md @@ -1426,7 +1426,7 @@ diff -uNr 18_backtrace/kernel/src/state.rs 19_kernel_heap/kernel/src/state.rs diff -uNr 18_backtrace/Makefile 19_kernel_heap/Makefile --- 18_backtrace/Makefile +++ 19_kernel_heap/Makefile -@@ -15,6 +15,11 @@ +@@ -16,6 +16,11 @@ # Default to a serial device name that is common in Linux. DEV_SERIAL ?= /dev/ttyUSB0 @@ -1438,7 +1438,7 @@ diff -uNr 18_backtrace/Makefile 19_kernel_heap/Makefile # Optional integration test name. ifdef TEST TEST_ARG = --test $(TEST) -@@ -69,7 +74,7 @@ +@@ -70,7 +75,7 @@ ##-------------------------------------------------------------------------------------------------- KERNEL_MANIFEST = kernel/Cargo.toml KERNEL_LINKER_SCRIPT = kernel.ld @@ -1447,7 +1447,7 @@ diff -uNr 18_backtrace/Makefile 19_kernel_heap/Makefile KERNEL_ELF_RAW = target/$(TARGET)/release/kernel # This parses cargo's dep-info file. -@@ -116,17 +121,17 @@ +@@ -117,17 +122,17 @@ -D warnings \ -D missing_docs diff --git a/19_kernel_heap/kernel_symbols.mk b/19_kernel_heap/kernel_symbols.mk index 5b51ccfe..d496ea8a 100644 --- a/19_kernel_heap/kernel_symbols.mk +++ b/19_kernel_heap/kernel_symbols.mk @@ -79,9 +79,11 @@ DOCKER_TOOLS = $(DOCKER_CMD) $(DOCKER_IMAGE) ##-------------------------------------------------------------------------------------------------- ## Targets ##-------------------------------------------------------------------------------------------------- -.PHONY: all +.PHONY: all symbols measure_time_start measure_time_finish -all: +all: measure_time_start symbols measure_time_finish + +symbols: @cp $(KERNEL_SYMBOLS_INPUT_ELF) $(KERNEL_SYMBOLS_OUTPUT_ELF) @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --gen_symbols $(KERNEL_SYMBOLS_OUTPUT_ELF) \ @@ -100,4 +102,16 @@ all: @$(DOCKER_TOOLS) $(EXEC_SYMBOLS_TOOL) --patch_data $(KERNEL_SYMBOLS_OUTPUT_ELF) \ $(KERNEL_SYMBOLS_STRIPPED) +# Note: The following is the only _trivial_ way I could think of that works out of the box on both +# Linux and macOS. Since macOS does not have the %N nanosecond format string option, the +# resolution is restricted to whole seconds. +measure_time_start: + @date +%s > /tmp/kernel_symbols_start.date + +measure_time_finish: + @date +%s > /tmp/kernel_symbols_end.date + $(call color_progress_prefix, "Finished") + @echo "in $$((`cat /tmp/kernel_symbols_end.date` - `cat /tmp/kernel_symbols_start.date`)).0s" + + @rm /tmp/kernel_symbols_end.date /tmp/kernel_symbols_start.date diff --git a/README.md b/README.md index 745dd3c5..7267f440 100644 --- a/README.md +++ b/README.md @@ -81,10 +81,16 @@ The tutorials are primarily targeted at **Linux**-based distributions. Most stuf 1. In case you use `Visual Studio Code`, I strongly recommend installing the [Rust Analyzer extension]. 1. (**macOS only**) Install a few `Ruby` gems. + This was last tested by the author with Ruby version `3.0.2` on `macOS Monterey`. If you are using + `rbenv`, the respective `.ruby-version` file is already in place. If you never heard of `rbenv`, + try using [this little guide](https://stackoverflow.com/a/68118750). + Run this in the repository root folder: ```bash - bundle install --path .vendor/bundle --without development + bundle config set --local path '.vendor/bundle' + bundle config set --local without 'development' + bundle install ``` [docker group]: https://docs.docker.com/engine/install/linux-postinstall/ diff --git a/X1_JTAG_boot/Makefile b/X1_JTAG_boot/Makefile index 76ddb186..23de6557 100644 --- a/X1_JTAG_boot/Makefile +++ b/X1_JTAG_boot/Makefile @@ -2,8 +2,9 @@ ## ## Copyright (c) 2018-2022 Andre Richter -include ../common/format.mk include ../common/docker.mk +include ../common/format.mk +include ../common/operating_system.mk ##-------------------------------------------------------------------------------------------------- ## Optional, user-provided configuration values @@ -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 diff --git a/common/operating_system.mk b/common/operating_system.mk new file mode 100644 index 00000000..90172f77 --- /dev/null +++ b/common/operating_system.mk @@ -0,0 +1,9 @@ +ifeq ($(shell uname -s),Linux) + DU_ARGUMENTS = --block-size=1024 --apparent-size +else ifeq ($(shell uname -s),Darwin) + DU_ARGUMENTS = -k -A +endif + +define disk_usage_KiB + @printf '%s KiB\n' `du $(DU_ARGUMENTS) $(1) | cut -f1` +endef