aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / disk / qemu / Makefile
| 1 | # Bare-metal AArch64 payloads: the C NVMe driver (../disk_nvme.c, ../disk.c) |
| 2 | # against QEMU's emulated NVMe, and the C SD host driver (../disk_sdhci.c) |
| 3 | # against QEMU's sdhci-pci + sd-card, on the virt machine. Run them with |
| 4 | # scripts/qemu_native_nvme_test.sh and scripts/qemu_native_sdhci_test.sh. |
| 5 | # QEMU is not hardware. |
| 6 | # |
| 7 | # make build out/nvme_payload.elf and out/sdhci_payload.elf |
| 8 | # STORE_OBJS=... extra freestanding objects (e.g. native/store) to link in |
| 9 | # later; empty by default, nothing here depends on them. |
| 10 | |
| 11 | CC ?= cc |
| 12 | LD ?= ld |
| 13 | NM ?= nm |
| 14 | OUT ?= out |
| 15 | STORE_OBJS ?= |
| 16 | PFLAGS = -std=gnu11 -O2 -Wall -Wextra -Werror -ffreestanding -nostdlib -fno-builtin \ |
| 17 | -fno-stack-protector -fno-tree-loop-distribute-patterns -mstrict-align \ |
| 18 | -mgeneral-regs-only -fno-pic -fno-pie -fno-asynchronous-unwind-tables |
| 19 | |
| 20 | OBJS = $(OUT)/start.o $(OUT)/payload.o $(OUT)/disk.o $(OUT)/disk_nvme.o |
| 21 | ELF = $(OUT)/nvme_payload.elf |
| 22 | SOBJS = $(OUT)/start.o $(OUT)/sdhci_payload.o $(OUT)/disk.o $(OUT)/disk_sdhci.o |
| 23 | SELF = $(OUT)/sdhci_payload.elf |
| 24 | |
| 25 | all: $(ELF) $(SELF) |
| 26 | |
| 27 | $(OUT): |
| 28 | mkdir -p $(OUT) |
| 29 | |
| 30 | $(OUT)/start.o: start.S | $(OUT) |
| 31 | $(CC) -c -o $@ $< |
| 32 | $(OUT)/payload.o: payload.c ../disk.h ../disk_nvme.h | $(OUT) |
| 33 | $(CC) $(PFLAGS) -c -o $@ $< |
| 34 | $(OUT)/sdhci_payload.o: sdhci_payload.c ../disk.h ../disk_sdhci.h | $(OUT) |
| 35 | $(CC) $(PFLAGS) -c -o $@ $< |
| 36 | $(OUT)/disk_sdhci.o: ../disk_sdhci.c ../disk_sdhci.h ../disk.h | $(OUT) |
| 37 | $(CC) $(PFLAGS) -c -o $@ $< |
| 38 | $(OUT)/disk.o: ../disk.c ../disk.h | $(OUT) |
| 39 | $(CC) $(PFLAGS) -c -o $@ $< |
| 40 | $(OUT)/disk_nvme.o: ../disk_nvme.c ../disk_nvme.h ../disk.h | $(OUT) |
| 41 | $(CC) $(PFLAGS) -c -o $@ $< |
| 42 | |
| 43 | $(ELF): $(OBJS) $(STORE_OBJS) payload.ld |
| 44 | $(LD) -nostdlib -static -T payload.ld -o $@ $(OBJS) $(STORE_OBJS) |
| 45 | @u=$$($(NM) -u $@); if [ -n "$$u" ]; then echo "payload has undefined symbols: $$u"; rm -f $@; exit 1; fi |
| 46 | |
| 47 | $(SELF): $(SOBJS) payload.ld |
| 48 | $(LD) -nostdlib -static -T payload.ld -o $@ $(SOBJS) |
| 49 | @u=$$($(NM) -u $@); if [ -n "$$u" ]; then echo "payload has undefined symbols: $$u"; rm -f $@; exit 1; fi |
| 50 | |
| 51 | clean: |
| 52 | rm -rf $(OUT) |
| 53 | |
| 54 | .PHONY: all clean |