aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
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