-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
53 lines (42 loc) · 1.33 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
49
50
51
52
53
# Create a bootable CD ile from our boot code
.DEFAULT_GOAL:=all
IMAGE = uodos
BOOTLOADER = boot/boot.bin boot/boot2.bin
.SUFFIXES: .iso .img .bin .asm .sys .o .lib
.PHONY: bootloader kernel
bootloader:
cd boot && $(MAKE)
kernel:
cd kernel && $(MAKE)
$(IMAGE).img : bootloader kernel
# Get the blank floppy disk image
cp floppy_image/uodos.img $(IMAGE).img
# Copy our new boot sector over to the floppy image
dd status=noxfer conv=notrunc if=boot/boot.bin of=$(IMAGE).img
# Copy our second stage of the boot to the floppy image
dd status=noxfer conv=notrunc seek=1 if=boot/boot2.bin of=$(IMAGE).img
# Mount floppy image file as Z:
imdisk -a -t file -f $(IMAGE).img -o rem -m y:
cp kernel/kernel.sys .
# Now copy files to z: (we do it this way to avoid problems with cygwin and drive specifiers)
cmd /c "copy kernel.sys y:KERNEL.SYS"
# Unmount the floppy disk image
imdisk -D -m y:
# Copy the Test files.
cmd /c "copytestfiles.bat"
# Launch Bocks #TO DO REMOVE.
# cmd /c "bochs -f bochsrc.bxrc -q"
$(IMAGE).iso: $(IMAGE).img
rm -rf cdiso
mkdir cdiso
cp $(IMAGE).img cdiso/$(IMAGE).img
# Make a bootable CD image from the floppy disk image
mkisofs -o $(IMAGE).iso -b $(IMAGE).img cdiso/
all: $(IMAGE).iso
clean:
cd boot && make clean
cd kernel && make clean
rm -f kernel.sys
rm -f $(IMAGE).img
rm -f $(IMAGE).iso
rm -rf cdiso