Basic disk detection stuff.
[pintos-anon] / src / Makefile.inc
index 6ed310ea91b24035a12545a6d05456c9edcacaa8..a76c4a9cc3ad429345be1eb9a9451af6da509d37 100644 (file)
@@ -31,6 +31,7 @@ DEVICES_SRC  = timer.c                # Timer device.
 DEVICES_SRC += kbd.c           # Keyboard device.
 DEVICES_SRC += vga.c           # Video device.
 DEVICES_SRC += serial.c                # Serial port device.
+DEVICES_SRC += disk.c          # IDE disk device.
 
 # Library code.
 LIB_SRC  = debug.c             # Debug helpers.
@@ -54,16 +55,15 @@ OBJECTS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCES)))
 all: diskimage.bin
 
 intr-stubs.S: $(TOP_SRCDIR)/threads/intr-stubs.pl
-       $< > $@.tmp && mv $@.tmp $@
+       $< > $@
 
 kernel.o: $(OBJECTS)
        ld -T $(TOP_SRCDIR)/threads/kernel.lds -o $@ $^ \
                `$(CC) -print-libgcc-file-name`
 
 kernel.bin: kernel.o
-       objcopy -O binary -R .note -R .comment -S $< $@.data
-       perl -e 'print "\0" x (4096 - (-s "$@.data") % 4096)' > $@.pad
-       cat $@.data $@.pad > $@.tmp && mv $@.tmp $@
+       objcopy -O binary -R .note -R .comment -S $< $@.tmp
+       $(TOP_SRCDIR)/pad 4096 < $@.tmp > $@
 
 loader.bin: loader.S kernel.bin
        gcc -c $< -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`