aboutsummaryrefslogblamecommitdiffhomepage
path: root/content/2019-10-27-kernel-debugging-qemu/Makefile
blob: 02ec2c26f25d3924962cdb261ee44b3de52f3c36 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                                  








                               















                                                            
help:
	@echo "[H]: Makefile inteded to be used with podman/docker."
	@echo ""
	@echo "[C]: Build the podman image and drop into a shell in a container instance."
	@echo "(Alternative use the 'docker' target)."
	@echo "> make podman"
	@echo ""
	@echo "[C]: Build the initramfs and kernel (run from the container shell)."
	@echo "> make build"
	@echo ""
	@echo "[C]: Start qemu in the background and attach gdb in the foreground."
	@echo "> make run"
	@echo ""
	@echo "[C]: Attach to the qemu serial console. This is done in a loop to handle restarts."
	@echo "> make con"

build:
	scripts/build_kernel.sh
	scripts/build_initrd.sh

clean:
	$(RM) -r linux-*
	$(RM) -r busybox-*
	$(RM) initramfs.cpio.gz

run:
	scripts/run.sh

con:
	while true; do telnet localhost 12345; sleep 1; done

docker: do-docker
podman: do-podman

do-%:
	$* build -t kernel-dev .
	$* run -it --rm --name kernel-dev \
		-v kernel-dev:/develop \
		-v $(PWD):/develop/scripts \
		-v $(PWD)/Makefile:/develop/Makefile \
		kernel-dev