aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-01 19:49:49 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-01 19:49:49 +0100
commita9383e658ed69023b3d621dc08f1c073621d1ff1 (patch)
treedc9f15fb531be5d4e02b6c1d3624273347557ddc /makefile
initial commit
Diffstat (limited to 'makefile')
-rw-r--r--makefile42
1 files changed, 42 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..3bfd896
--- /dev/null
+++ b/makefile
@@ -0,0 +1,42 @@
+# read environment variables from ./env
+include ./env
+export
+
+CTR := sudo -n podman
+MOUNT := sudo -n mount
+UMOUNT := sudo -n umount
+CP := sudo -n cp
+GIT := git
+
+CTR_IMG_TAG := avans-linux
+CTRIZE := $(CTR) run --rm --interactive --tty --volume .:/workdir:rw --user $(shell id -u):$(shell id -g) --env-file ./env $(CTR_IMG_TAG)
+
+.PHONY: all
+all: os_bootloader
+
+.PHONY: container_img
+container_img: Containerfile
+ $(CTR) build --tag $(CTR_IMG_TAG) .
+
+# this list holds the .git files in each submodule folder (add
+# $(SUBMODULE_INIT) as prerequisite to require the submodules to exist)
+SUBMODULE_INIT += ./u-boot/.git
+$(SUBMODULE_INIT):
+ $(GIT) submodule init
+ $(GIT) submodule update
+
+MKFLAGS += -j $(shell nproc)
+
+.PHONY: os_bootloader
+os_bootloader: container_img $(SUBMODULE_INIT)
+ $(CTRIZE) make -C u-boot $(MKFLAGS) am335x_evm_config
+ $(CTRIZE) make -C u-boot $(MKFLAGS)
+
+# sd card block device (assumed partition numbers, see readme.md)
+SDCARD_BD := $(shell realpath /dev/disk/by-id/usb-Generic-_Multi-Card_20071114173400000-0:0)
+load_bootloader: $(os_bootloader)
+ mkdir -p /tmp/sdcard-boot
+ $(MOUNT) $(SDCARD_BD)1 /tmp/sdcard-boot
+ $(CP) u-boot/MLO u-boot/u-boot.img u-boot/u-boot.dtb /tmp/sdcard-boot
+ $(UMOUNT) $(SDCARD_BD)1
+