# Makefile for GeekOS kernel, userspace, and tools
# Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
-# $Revision: 1.48 $
+# $Revision: 1.49 $
# This is free software. You are permitted to use,
# redistribute, and modify it as specified in the file "COPYING".
#
# and make world will build an empty boot package
#
-XED=0
+XED=1
ifeq ($(DEBUG),1)
JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=10 -DSERIAL_PRINT=1 -DVMM_DEBUG=1 -DVMM_INFO=1 -DVMM_TRACE=1 $(DEBUG_SECTIONS)
NUMSECS := $(PERL) $(PROJECT_ROOT)/scripts/numsecs
-#Round a value up to a certain factor (hex values)
-ROUND_UP_HEX := $(PERL) $(PROJECT_ROOT)/scripts/round_up_hex.pl
+FD_SECTORS_PER_TRACK := $(PERL) $(PROJECT_ROOT)/scripts/numsecs_per_track
+
# ----------------------------------------------------------------------
# Definitions -
-I$(PROJECT_ROOT)/src/geekos/ \
-DNUM_SETUP_SECTORS=`$(NUMSECS) geekos/setup.bin` \
-DNUM_KERN_SECTORS=`$(NUMSECS) geekos/kernel.bin` \
+ -DSECTORS_PER_TRACK=`$(FD_SECTORS_PER_TRACK) geekos/kernel.bin geekos/setup.bin` \
$(PROJECT_ROOT)/src/geekos/fd_boot.asm \
-o $@
--- /dev/null
+#! /usr/bin/perl
+
+# Find the number of 512-byte sectors needed to store
+# given file.
+
+# $Revision: 1.1 $
+
+use strict qw(refs vars);
+
+my $sectors = 0;
+my $filename = "";
+
+foreach $filename (@ARGV) {
+
+ my $size = (-s $filename );
+ die "Couldn't get size of $filename: $!" if ( !defined $size );
+
+ my $result = int($size / 512);
+ my $remainder = $size % 512;
+ $result++ if ( $remainder > 0 );
+
+ $sectors += $result;
+}
+
+if ($sectors <= 2879) {
+ print "18\n";
+} else {
+ print "36\n";
+}
+
; Definitions for use in GeekOS boot code
; Copyright (c) 2001, David H. Hovemeyer <daveho@cs.umd.edu>
-; $Revision: 1.7 $
+; $Revision: 1.8 $
; This is free software. You are permitted to use,
; redistribute, and modify it as specified in the file "COPYING".
; The following information is correct for a 1.44M floppy.
; Yes, I'm hard coding this.
-SECTORS_PER_TRACK equ 18
+;SECTORS_PER_TRACK equ 18
HEADS equ 2
CYLINDERS equ 80