aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-02 14:18:39 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-02 14:18:39 +0100
commit6adec226decc4198e0b2caa2d90a36e34e595fd1 (patch)
tree36c53e5c456e74c5aabbfcffe0a11d652fb6773d /makefile
parent4d3f081f061fd9e3de08ed7f2516cff2b5f2a0df (diff)
more cleanup
Diffstat (limited to 'makefile')
-rw-r--r--makefile29
1 files changed, 20 insertions, 9 deletions
diff --git a/makefile b/makefile
index c667590..00a0da5 100644
--- a/makefile
+++ b/makefile
@@ -2,10 +2,16 @@
include ./env
export
-CTR := sudo -n podman
-MOUNT := sudo -n mount
-UMOUNT := sudo -n umount
-CP := sudo -n cp
+# use sudo (non interactively) when running as regular user
+ifneq ($(shell id -u),0)
+AS_ROOT := sudo -n
+endif
+
+CTR := $(AS_ROOT) podman
+MOUNT := $(AS_ROOT) mount
+UMOUNT := $(AS_ROOT) umount
+
+CP := cp
GIT := git
CTR_IMG_TAG := avans-linux
@@ -36,11 +42,16 @@ os_bootloader: container_img $(SUBMODULE_INIT)
$(CTRIZE) $(MAKE) -$(MAKEFLAGS) -C u-boot am335x_evm_config
$(CTRIZE) $(MAKE) -$(MAKEFLAGS) -C u-boot
-# 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)
+# sd card block device prefix (assumed partition numbers, see readme.md)
+# SDCARD_BD_PREFIX := /dev/sdc
+SDCARD_BD_PREFIX := /dev/mmcblk0p
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
+ $(MOUNT) $(SDCARD_BD_PREFIX)1 /tmp/sdcard-boot
+ $(AS_ROOT) $(CP) u-boot/MLO u-boot/u-boot.img u-boot/u-boot.dtb /tmp/sdcard-boot
+ $(UMOUNT) $(SDCARD_BD_PREFIX)1
+
+format_sd:
+ $(AS_ROOT) mkfs.vfat -n BOOT -F 32 $(SDCARD_BD_PREFIX)1
+ $(AS_ROOT) mkfs.ext4 -L ROOTFS -F $(SDCARD_BD_PREFIX)2