aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-04 17:46:44 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-04 18:31:36 +0100
commit9a993336835d38600fd740af01af6e68bf9f1af7 (patch)
tree8ba790eb002a0134b37d0a7ca901ba3964a10771 /makefile
parent8742d700e6dd3efd7063c0aa31117bc4bbf7d868 (diff)
linux kernel booting
Diffstat (limited to 'makefile')
-rw-r--r--makefile33
1 files changed, 15 insertions, 18 deletions
diff --git a/makefile b/makefile
index f29ed2a..e7b7356 100644
--- a/makefile
+++ b/makefile
@@ -3,12 +3,7 @@ ifneq ($(shell id -u),0)
AS_ROOT := sudo -n
endif
-MOUNT := $(AS_ROOT) mount
-UMOUNT := $(AS_ROOT) umount
-
CTR := podman
-CP := cp
-GIT := git
CTR_IMG_TAG := avans-linux
@@ -30,9 +25,9 @@ $(eval $(shell state/gen))
include ./env
export
-# shortcuts
.PHONY: all
-all: $(BOOTLOADER_FILES)
+all:
+
.PHONY: sd_format sd_partition
sd_format: state/sdcard_fmt
sd_partition: state/sdcard_part
@@ -42,7 +37,7 @@ state/container_img: Containerfile
touch $@
state/submodules:
- $(GIT) submodule update --init
+ git submodule update --init
touch $@
state/sdcard_part:
@@ -51,8 +46,8 @@ state/sdcard_part:
state/sdcard_fmt: state/sdcard_part
$(eval $(shell state/gen))
- $(AS_ROOT) mkfs.vfat -n BOOT -F 32 $(SDCARD_PART_BOOT)
- $(AS_ROOT) mkfs.ext4 -L ROOTFS -F $(SDCARD_PART_ROOTFS)
+ $(AS_ROOT) mkfs.vfat -a -F 16 -n BOOT $(SDCARD_PART_BOOT)
+ $(AS_ROOT) mkfs.ext4 -F -L ROOTFS $(SDCARD_PART_ROOTFS)
touch $@
bootloader/.config: state/submodules state/container_img
@@ -60,38 +55,40 @@ bootloader/.config: state/submodules state/container_img
.PHONY: build_bootloader
build_bootloader: bootloader/.config state/container_img
$(CTRIZE) $(MAKE) -C bootloader
+# NOTE: MLO MUST be copied first
+BOOTLOADER_FILES += bootloader/MLO
BOOTLOADER_FILES += bootloader/u-boot.img
BOOTLOADER_FILES += bootloader/u-boot.dtb
-BOOTLOADER_FILES += bootloader/MLO
$(BOOTLOADER_FILES): build_bootloader
kernel/.config: state/submodules state/container_img
$(CTRIZE) $(MAKE) -C kernel bb.org_defconfig
.PHONY: build_kernel
build_kernel: kernel/.config state/container_img
- $(CTRIZE) $(MAKE) -C kernel zImage
+ $(CTRIZE) $(MAKE) -C kernel zImage am335x-boneblack.dtb
KERNEL_FILES += kernel/arch/$(ARCH)/boot/dts/am335x-boneblack.dtb
KERNEL_FILES += kernel/arch/$(ARCH)/boot/zImage
$(KERNEL_FILES): build_kernel
+# NOTE: ordering is important!
FILES_PART_BOOT += $(BOOTLOADER_FILES)
FILES_PART_BOOT += $(KERNEL_FILES)
.PHONY: load_boot load_rootfs
load_boot: $(FILES_PART_BOOT) state/sdcard_fmt
mkdir -p mnt/boot
- $(MOUNT) $(SDCARD_PART_BOOT) mnt/boot
- $(AS_ROOT) $(CP) $(FILES_PART_BOOT) mnt/boot
+ $(AS_ROOT) mount $(SDCARD_PART_BOOT) mnt/boot
+ $(AS_ROOT) cp $(FILES_PART_BOOT) mnt/boot
$(AS_ROOT) sync
- $(UMOUNT) mnt/boot
+ $(AS_ROOT) umount mnt/boot
# TODO
# FILES_PART_ROOTFS += ....
load_rootfs: state/sdcard_fmt
mkdir -p mnt/rootfs
- $(MOUNT) $(SDCARD_PART_ROOTFS) mnt/rootfs
- $(AS_ROOT) $(CP) $(FILES_PART_ROOTFS) mnt/boot
+ $(AS_ROOT) mount $(SDCARD_PART_ROOTFS) mnt/rootfs
+ $(AS_ROOT) cp $(FILES_PART_ROOTFS) mnt/boot
$(AS_ROOT) sync
- $(UMOUNT) mnt/rootfs
+ $(AS_ROOT) umount mnt/rootfs
.PHONY: status
status: