2022-01-29 21:48:37 +01:00
|
|
|
ARMGNU ?= aarch64-linux-gnu
|
|
|
|
|
|
|
|
COPS = -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only
|
|
|
|
ASMOPS = -Iinclude
|
|
|
|
|
|
|
|
BUILD_DIR = build
|
|
|
|
SRC_DIR = src
|
|
|
|
|
|
|
|
all: kernel8.img
|
|
|
|
|
|
|
|
install: all
|
|
|
|
udisksctl mount -b /dev/mmcblk0p1
|
|
|
|
cp kernel8.img /run/media/daniil/*/
|
2022-06-20 18:06:49 +02:00
|
|
|
cp /run/media/daniil/*/blobcode.bin /run/media/daniil/*/bootcode.bin
|
2022-01-29 21:48:37 +01:00
|
|
|
umount /run/media/daniil/*
|
|
|
|
sync
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(BUILD_DIR) *.img
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%_c.o: $(SRC_DIR)/%.c
|
|
|
|
mkdir -p $(@D)
|
|
|
|
$(ARMGNU)-gcc $(COPS) -MMD -c $< -o $@
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%_s.o: $(SRC_DIR)/%.S
|
|
|
|
$(ARMGNU)-gcc $(ASMOPS) -MMD -c $< -o $@
|
|
|
|
|
|
|
|
C_FILES = $(wildcard $(SRC_DIR)/*.c)
|
|
|
|
ASM_FILES = $(wildcard $(SRC_DIR)/*.S)
|
|
|
|
OBJ_FILES = $(C_FILES:$(SRC_DIR)/%.c=$(BUILD_DIR)/%_c.o)
|
|
|
|
OBJ_FILES += $(ASM_FILES:$(SRC_DIR)/%.S=$(BUILD_DIR)/%_s.o)
|
|
|
|
|
|
|
|
DEP_FILES = $(OBJ_FILES:%.o=%.d)
|
|
|
|
-include $(DEP_FILES)
|
|
|
|
|
|
|
|
kernel8.img: $(SRC_DIR)/linker.ld $(OBJ_FILES)
|
|
|
|
$(ARMGNU)-ld -T $(SRC_DIR)/linker.ld -o $(BUILD_DIR)/kernel8.elf $(OBJ_FILES)
|
|
|
|
$(ARMGNU)-objcopy $(BUILD_DIR)/kernel8.elf -O binary kernel8.img
|