Skip to content

Commit ec84213

Browse files
committed
Improve macOS support
macOS support is still not great, but this patch at least fixes some import Makefile subtargets.
1 parent 2e72a84 commit ec84213

File tree

36 files changed

+185
-98
lines changed

36 files changed

+185
-98
lines changed

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7
1+
3.0.2

01_wait_forever/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -130,7 +131,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
130131
$(call color_progress_prefix, "Name")
131132
@echo $(KERNEL_BIN)
132133
$(call color_progress_prefix, "Size")
133-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
134+
$(call disk_usage_KiB, $(KERNEL_BIN))
134135

135136
##------------------------------------------------------------------------------
136137
## Generate the documentation

02_runtime_init/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -130,7 +131,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
130131
$(call color_progress_prefix, "Name")
131132
@echo $(KERNEL_BIN)
132133
$(call color_progress_prefix, "Size")
133-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
134+
$(call disk_usage_KiB, $(KERNEL_BIN))
134135

135136
##------------------------------------------------------------------------------
136137
## Generate the documentation

02_runtime_init/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml
5252
diff -uNr 01_wait_forever/Makefile 02_runtime_init/Makefile
5353
--- 01_wait_forever/Makefile
5454
+++ 02_runtime_init/Makefile
55-
@@ -180,6 +180,7 @@
55+
@@ -181,6 +181,7 @@
5656
$(call color_header, "Launching objdump")
5757
@$(DOCKER_TOOLS) $(OBJDUMP_BINARY) --disassemble --demangle \
5858
--section .text \

03_hacky_hello_world/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -133,7 +134,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
133134
$(call color_progress_prefix, "Name")
134135
@echo $(KERNEL_BIN)
135136
$(call color_progress_prefix, "Size")
136-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
137+
$(call disk_usage_KiB, $(KERNEL_BIN))
137138

138139
##------------------------------------------------------------------------------
139140
## Generate the documentation

03_hacky_hello_world/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ diff -uNr 02_runtime_init/Cargo.toml 03_hacky_hello_world/Cargo.toml
5353
diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile
5454
--- 02_runtime_init/Makefile
5555
+++ 03_hacky_hello_world/Makefile
56-
@@ -24,7 +24,7 @@
56+
@@ -25,7 +25,7 @@
5757
KERNEL_BIN = kernel8.img
5858
QEMU_BINARY = qemu-system-aarch64
5959
QEMU_MACHINE_TYPE = raspi3
@@ -62,7 +62,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile
6262
OBJDUMP_BINARY = aarch64-none-elf-objdump
6363
NM_BINARY = aarch64-none-elf-nm
6464
READELF_BINARY = aarch64-none-elf-readelf
65-
@@ -35,7 +35,7 @@
65+
@@ -36,7 +36,7 @@
6666
KERNEL_BIN = kernel8.img
6767
QEMU_BINARY = qemu-system-aarch64
6868
QEMU_MACHINE_TYPE =
@@ -71,7 +71,7 @@ diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile
7171
OBJDUMP_BINARY = aarch64-none-elf-objdump
7272
NM_BINARY = aarch64-none-elf-nm
7373
READELF_BINARY = aarch64-none-elf-readelf
74-
@@ -85,17 +85,20 @@
74+
@@ -86,17 +86,20 @@
7575
--strip-all \
7676
-O binary
7777

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

9696

9797

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

04_safe_globals/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -133,7 +134,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
133134
$(call color_progress_prefix, "Name")
134135
@echo $(KERNEL_BIN)
135136
$(call color_progress_prefix, "Size")
136-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
137+
$(call disk_usage_KiB, $(KERNEL_BIN))
137138

138139
##------------------------------------------------------------------------------
139140
## Generate the documentation

05_drivers_gpio_uart/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -145,7 +146,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
145146
$(call color_progress_prefix, "Name")
146147
@echo $(KERNEL_BIN)
147148
$(call color_progress_prefix, "Size")
148-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
149+
$(call disk_usage_KiB, $(KERNEL_BIN))
149150

150151
##------------------------------------------------------------------------------
151152
## Generate the documentation

05_drivers_gpio_uart/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ diff -uNr 04_safe_globals/Cargo.toml 05_drivers_gpio_uart/Cargo.toml
186186
diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile
187187
--- 04_safe_globals/Makefile
188188
+++ 05_drivers_gpio_uart/Makefile
189-
@@ -12,6 +12,9 @@
189+
@@ -13,6 +13,9 @@
190190
# Default to the RPi3.
191191
BSP ?= rpi3
192192

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

197197

198198
##--------------------------------------------------------------------------------------------------
199-
@@ -87,6 +90,7 @@
199+
@@ -88,6 +91,7 @@
200200

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

205205
##------------------------------------------------------------------------------
206206
## Dockerization
207-
@@ -94,18 +98,26 @@
207+
@@ -95,18 +99,26 @@
208208
DOCKER_CMD = docker run -t --rm -v $(shell pwd):/work/tutorial -w /work/tutorial
209209
DOCKER_CMD_INTERACT = $(DOCKER_CMD) -i
210210
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
232232

233233
all: $(KERNEL_BIN)
234234

235-
@@ -155,9 +167,16 @@
235+
@@ -156,9 +168,16 @@
236236
qemu: $(KERNEL_BIN)
237237
$(call color_header, "Launching QEMU")
238238
@$(DOCKER_QEMU) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN)

06_uart_chainloader/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -147,7 +148,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
147148
$(call color_progress_prefix, "Name")
148149
@echo $(KERNEL_BIN)
149150
$(call color_progress_prefix, "Size")
150-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
151+
$(call disk_usage_KiB, $(KERNEL_BIN))
151152

152153
##------------------------------------------------------------------------------
153154
## Generate the documentation

06_uart_chainloader/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Binary files 05_drivers_gpio_uart/demo_payload_rpi4.img and 06_uart_chainloader/
140140
diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
141141
--- 05_drivers_gpio_uart/Makefile
142142
+++ 06_uart_chainloader/Makefile
143-
@@ -23,27 +23,29 @@
143+
@@ -24,27 +24,29 @@
144144
QEMU_MISSING_STRING = "This board is not yet supported for QEMU."
145145

146146
ifeq ($(BSP),rpi3)
@@ -190,7 +190,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
190190
endif
191191

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

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

202202
##------------------------------------------------------------------------------
203203
## Dockerization
204-
@@ -109,7 +111,7 @@
204+
@@ -110,7 +112,7 @@
205205
ifeq ($(shell uname -s),Linux)
206206
DOCKER_CMD_DEV = $(DOCKER_CMD_INTERACT) $(DOCKER_ARG_DEV)
207207

@@ -210,7 +210,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
210210
endif
211211

212212

213-
@@ -117,7 +119,7 @@
213+
@@ -118,7 +120,7 @@
214214
##--------------------------------------------------------------------------------------------------
215215
## Targets
216216
##--------------------------------------------------------------------------------------------------
@@ -219,7 +219,7 @@ diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
219219

220220
all: $(KERNEL_BIN)
221221

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

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

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

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

250250
##------------------------------------------------------------------------------
251251
## Run clippy
252-
@@ -231,7 +237,8 @@
252+
@@ -232,7 +238,8 @@
253253
##------------------------------------------------------------------------------
254254
test_boot: $(KERNEL_BIN)
255255
$(call color_header, "Boot test - $(BSP)")

07_timestamps/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -145,7 +146,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
145146
$(call color_progress_prefix, "Name")
146147
@echo $(KERNEL_BIN)
147148
$(call color_progress_prefix, "Size")
148-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
149+
$(call disk_usage_KiB, $(KERNEL_BIN))
149150

150151
##------------------------------------------------------------------------------
151152
## Generate the documentation

07_timestamps/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Binary files 06_uart_chainloader/demo_payload_rpi4.img and 07_timestamps/demo_pa
6363
diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile
6464
--- 06_uart_chainloader/Makefile
6565
+++ 07_timestamps/Makefile
66-
@@ -23,29 +23,27 @@
66+
@@ -24,29 +24,27 @@
6767
QEMU_MISSING_STRING = "This board is not yet supported for QEMU."
6868

6969
ifeq ($(BSP),rpi3)
@@ -113,7 +113,7 @@ diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile
113113
endif
114114

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

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

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

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

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

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

151151
##------------------------------------------------------------------------------
152152
## Run clippy
153-
@@ -237,8 +231,7 @@
153+
@@ -238,8 +232,7 @@
154154
##------------------------------------------------------------------------------
155155
test_boot: $(KERNEL_BIN)
156156
$(call color_header, "Boot test - $(BSP)")

08_hw_debug_JTAG/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
##
33
## Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
44

5-
include ../common/format.mk
65
include ../common/docker.mk
6+
include ../common/format.mk
7+
include ../common/operating_system.mk
78

89
##--------------------------------------------------------------------------------------------------
910
## Optional, user-provided configuration values
@@ -156,7 +157,7 @@ $(KERNEL_BIN): $(KERNEL_ELF)
156157
$(call color_progress_prefix, "Name")
157158
@echo $(KERNEL_BIN)
158159
$(call color_progress_prefix, "Size")
159-
@printf '%s KiB\n' `du -k $(KERNEL_BIN) | cut -f1`
160+
$(call disk_usage_KiB, $(KERNEL_BIN))
160161

161162
##------------------------------------------------------------------------------
162163
## Generate the documentation

08_hw_debug_JTAG/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ diff -uNr 07_timestamps/Cargo.toml 08_hw_debug_JTAG/Cargo.toml
320320
diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
321321
--- 07_timestamps/Makefile
322322
+++ 08_hw_debug_JTAG/Makefile
323-
@@ -31,6 +31,8 @@
323+
@@ -32,6 +32,8 @@
324324
OBJDUMP_BINARY = aarch64-none-elf-objdump
325325
NM_BINARY = aarch64-none-elf-nm
326326
READELF_BINARY = aarch64-none-elf-readelf
@@ -329,7 +329,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
329329
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
330330
RUSTC_MISC_ARGS = -C target-cpu=cortex-a53
331331
else ifeq ($(BSP),rpi4)
332-
@@ -42,6 +44,8 @@
332+
@@ -43,6 +45,8 @@
333333
OBJDUMP_BINARY = aarch64-none-elf-objdump
334334
NM_BINARY = aarch64-none-elf-nm
335335
READELF_BINARY = aarch64-none-elf-readelf
@@ -338,7 +338,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
338338
LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi
339339
RUSTC_MISC_ARGS = -C target-cpu=cortex-a72
340340
endif
341-
@@ -98,18 +102,25 @@
341+
@@ -99,18 +103,25 @@
342342
DOCKER_CMD = docker run -t --rm -v $(shell pwd):/work/tutorial -w /work/tutorial
343343
DOCKER_CMD_INTERACT = $(DOCKER_CMD) -i
344344
DOCKER_ARG_DIR_COMMON = -v $(shell pwd)/../common:/work/common
@@ -364,7 +364,7 @@ diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile
364364
endif
365365

366366

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

369369

370370

0 commit comments

Comments
 (0)