-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (40 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
ifeq ($(TOOLCHAIN_DIR),)
$(warning WARNING: Using default toolchain for Mac OS X, for something else please provide TOOLCHAIN_DIR variable)
endif
TOPDIR = $(PWD)
TOOLCHAIN_DIR ?= $(TOPDIR)/obj/tooldir.Darwin-10.8.0-i386/
CROSSTC ?= $(TOOLCHAIN_DIR)/bin/lm32--netbsd-
HOSTTOOL = $(TOOLCHAIN_DIR)/bin
CC = $(CROSSTC)gcc
LD = $(CROSSTC)ld
AS = $(CROSSTC)as
MDSETIMAGE = $(CROSSTC)mdsetimage
NBMKNOD = $(HOSTTOOL)/nbmknod
DD = dd
NBMAKEFS = $(TOOLCHAIN_DIR)/bin/nbmakefs
RM ?= rm -f
kernel ?= GENERIC_MFS
LDFLAGS ?= -e main -T init.ldscript
ifeq ($(debug),1)
kernel_name = netbsd.gdb
else
kernel_name = netbsd
endif
all: init
init: init.o ident.o
$(LD) $(LDFLAGS) $^ -o $@
init.o: init.c
$(CC) -c $^
install: init
$(DD) if=/dev/zero of=milkymist_disk.ffs bs=1M count=1
$(RM) -r rootfs
mkdir -p rootfs/sbin
cp init rootfs/sbin/
mkdir -p rootfs/dev
sudo $(NBMKNOD) rootfs/dev/console c 0 0
$(NBMAKEFS) -s 1m milkymist_disk.ffs rootfs
$(MDSETIMAGE) $(TOPDIR)/sys/arch/milkymist/compile/obj/$(kernel)/$(kernel_name) milkymist_disk.ffs
clean:
$(RM) -r rootfs
$(RM) ident.o init.o init milkymist_disk.ffs
.PHONY: install clean all