mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Docker: Add a Dockerfile and Makefile targets (#373)
* add docker build option * add docker section in makefile * add bash_aliases to get different prompt
This commit is contained in:
committed by
Philipp Oppermann
parent
cf2c5550aa
commit
2e8da22b32
25
Makefile
25
Makefile
@@ -19,6 +19,14 @@ assembly_source_files := $(wildcard src/arch/$(arch)/*.asm)
|
||||
assembly_object_files := $(patsubst src/arch/$(arch)/%.asm, \
|
||||
build/arch/$(arch)/%.o, $(assembly_source_files))
|
||||
|
||||
# used by docker_* targets
|
||||
docker_image ?= blog_os
|
||||
tag ?= 0.1
|
||||
docker_cargo_volume ?= blogos-$(shell id -u)-$(shell id -g)-cargo
|
||||
docker_rustup_volume ?= blogos-$(shell id -u)-$(shell id -g)-rustup
|
||||
docker_args ?= -e LOCAL_UID=$(shell id -u) -e LOCAL_GID=$(shell id -g) -v $(docker_cargo_volume):/usr/local/cargo -v $(docker_rustup_volume):/usr/local/rustup -v $(shell pwd):$(shell pwd) -w $(shell pwd)
|
||||
docker_clean_args ?= $(docker_cargo_volume) $(docker_rustup_volume)
|
||||
|
||||
.PHONY: all clean run debug iso cargo gdb
|
||||
|
||||
all: $(kernel)
|
||||
@@ -33,6 +41,23 @@ run: $(iso)
|
||||
debug: $(iso)
|
||||
@qemu-system-x86_64 -cdrom $(iso) -s -S
|
||||
|
||||
# docker_* targets
|
||||
|
||||
docker_build:
|
||||
@docker build docker/ -t $(docker_image):$(tag)
|
||||
|
||||
docker_iso:
|
||||
@docker run --rm $(docker_args) $(docker_image):$(tag) make iso
|
||||
|
||||
docker_run: docker_iso
|
||||
@qemu-system-x86_64 -cdrom $(iso) -s
|
||||
|
||||
docker_interactive:
|
||||
@docker run -it --rm $(docker_args) $(docker_image):$(tag)
|
||||
|
||||
docker_clean:
|
||||
@docker volume rm $(docker_clean_args)
|
||||
|
||||
gdb:
|
||||
@rust-os-gdb/bin/rust-gdb "build/kernel-x86_64.bin" -ex "target remote :1234"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user