From 6adec226decc4198e0b2caa2d90a36e34e595fd1 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Fri, 2 Feb 2024 14:18:39 +0100 Subject: more cleanup --- makefile | 29 ++++++++++++++++++++--------- readme.md | 4 ++-- 2 files changed, 22 insertions(+), 11 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 diff --git a/readme.md b/readme.md index d0d6279..aa302a3 100644 --- a/readme.md +++ b/readme.md @@ -9,5 +9,5 @@ - partities: |#|size|fs|bootable| |-|-|-|-| - |1|64M|VFAT (W95 FAT32 / LBA)|\*| - |2|\*|ext4|| + |1|64M|W95 FAT32 (LBA)|ja| + |2|de rest|Linux|| -- cgit v1.2.3