Fix the bug where the system doesn't make it past the bootloader. Looks like some...
[newos.git] / boot / i386 / makefile
bloba6f0111ba1b12ce6b293414530fb70552a94493c
2 BOOT_SRCDIR := boot/$(ARCH)
3 BOOT_TARGETDIR := $(call TOBUILDDIR, boot)
5 STAGE2 = $(BOOT_TARGETDIR)/stage2
7 ifeq ($(OSTYPE),cygwin)
8 BOOT_IMAGE_TARGET ?= a:
9 else ifeq ($(OSTYPE),linux)
10 BOOT_IMAGE_TARGET ?= /dev/fd0
11 endif
13 # make a rule for the stage2
14 MY_TARGETDIR := $(BOOT_TARGETDIR)
15 MY_SRCDIR := $(BOOT_SRCDIR)
16 MY_TARGET := $(STAGE2)
17 MY_OBJS := \
18 stage2.o \
19 stage2_asm.o \
20 smp_boot.o \
21 smp_trampoline.o \
22 int86.o
24 MY_INCLUDES := $(STDINCLUDE)
25 MY_CFLAGS := $(KERNEL_CFLAGS)
26 MY_LDFLAGS := -dN
27 MY_LIBS := $(LIBS_BUILD_DIR)/libc.a
28 MY_LIBPATHS :=
29 MY_DEPS :=
30 MY_LINKSCRIPT := $(MY_SRCDIR)/stage2.ld
31 MY_GLUE :=
33 include templates/app.mk
35 STAGE1 = $(BOOT_TARGETDIR)/stage1
37 # rules for stage1
38 MY_TARGETDIR := $(BOOT_TARGETDIR)
39 MY_SRCDIR := $(BOOT_SRCDIR)
40 MY_TARGET := $(STAGE1).elf
41 MY_OBJS := \
42 stage1.o \
43 inflate.o
45 MY_INCLUDES := $(STDINCLUDE)
46 MY_CFLAGS := $(KERNEL_CFLAGS)
47 MY_LDFLAGS := -dN
48 MY_LIBS := $(LIBS_BUILD_DIR)/libc.a
49 MY_LIBPATHS :=
50 MY_DEPS :=
51 MY_LINKSCRIPT := $(MY_SRCDIR)/stage1.ld
52 MY_GLUE :=
54 include templates/app.mk
56 BOOTBLOCK := $(BOOT_SRCDIR)/bootblock.bin
57 BOOTBLOCK_VESA := $(BOOT_SRCDIR)/bootblock.bin.vesa
58 MAKEFLOP := $(BOOT_SRCDIR)/makeflop
59 CONFIG_FILE := $(BOOT_SRCDIR)/config.ini
61 $(FINAL): $(STAGE1) $(STAGE2) $(ALL) $(TOOLS) $(MAKEFLOP) $(CONFIG_FILE) $(BOOTBLOCK)
62 $(BOOTMAKER) --strip-debug --strip-binary $(STRIP) $(CONFIG_FILE) -o $(FINAL).prepre
63 gzip -f -9 $(FINAL).prepre
64 cat $(STAGE1) $(FINAL).prepre.gz > $(FINAL).pre
65 $(MAKEFLOP) -p $(shell expr 18 \* 2 \* 512) $(BOOTBLOCK) $(FINAL).pre $(FINAL)
66 @rm -f $(FINAL).pre $(FINAL).prepre $(FINAL).prepre.gz
68 $(FINAL).v: $(STAGE1) $(STAGE2) $(ALL) $(TOOLS) $(MAKEFLOP) $(CONFIG_FILE) $(BOOTBLOCK_VESA)
69 $(BOOTMAKER) --strip-debug --strip-binary $(STRIP) $(CONFIG_FILE) -o $(FINAL).prepre
70 gzip -f -9 $(FINAL).prepre
71 cat $(STAGE1) $(FINAL).prepre.gz > $(FINAL).pre
72 $(MAKEFLOP) -p $(shell expr 18 \* 2 \* 512) $(BOOTBLOCK_VESA) $(FINAL).pre $(FINAL).v
73 @rm -f $(FINAL).pre $(FINAL).prepre $(FINAL).prepre.gz
75 $(STAGE1): $(STAGE1).elf
76 $(OBJCOPY) -O binary $(STAGE1).elf $(STAGE1)
78 disk: $(FINAL)
79 ifeq ($(OSTYPE),cygwin)
80 fdimage -q $(FINAL) $(BOOT_IMAGE_TARGET)
81 else
82 dd if=$(FINAL) of=$(BOOT_IMAGE_TARGET) bs=18k
83 endif
85 vdisk: $(FINAL).v
86 ifeq ($(OSTYPE),cygwin)
87 fdimage -q $(FINAL).v $(BOOT_IMAGE_TARGET)
88 else
89 dd if=$(FINAL).v of=$(BOOT_IMAGE_TARGET) bs=18k
90 endif
92 $(MAKEFLOP): $(MAKEFLOP).c
93 $(HOST_CC) -O $(MAKEFLOP).c -o $@